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

libsheepyCSmallJsonCuTest.c (1513741B)


      1 #include <stdlib.h>
      2 #include <stdio.h>
      3 #include <string.h>
      4 
      5 #include "CuTest/CuTest.h"
      6 
      7 #define ck_assert_str_eq(a,b) CuAssertStrEquals(tc, b, a)
      8 #define ck_assert_str_ne(a,b) CuAssertStrNotEquals(tc, b, a)
      9 #define ck_assert_ptr_eq(a,b) CuAssertPtrEquals(tc, b, a)
     10 #define ck_assert_ptr_ne(a,b) CuAssertPtrNotEquals(tc, b, a)
     11 #define ck_assert_uint_eq(a,b) CuAssertUintEquals(tc, b, a)
     12 #define ck_assert_uint_ne(a,b) CuAssertUintNotEquals(tc, b, a)
     13 #define ck_assert_int_eq(a,b)  CuAssertIntEquals(tc, b, a)
     14 #define ck_assert_int_ne(a,b)  CuAssertIntNotEquals(tc, b, a)
     15 #define ck_assert(a)           CuAssertTrue(tc, a)
     16 
     17 
     18 #include "../libsheepy.h"
     19 #include "../libsheepyObject.h"
     20 
     21 #ifdef __GNUC__
     22 #define UNUSED __attribute__ ((unused))
     23 #else
     24 #define UNUSED
     25 #endif
     26 
     27 // TODO redirect stderr
     28 
     29 
     30 void createSJFT(CuTest *tc UNUSED) {
     31 
     32   smallJsont* r;
     33 
     34   r = createSJ("a", "bb");
     35   ck_assert_ptr_ne(r, NULL);
     36   char *s      = toStringO(r);
     37   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
     38   free(s);
     39 
     40   terminateO(r);
     41 
     42 }
     43 
     44 
     45 void getsoSmallJsonT(CuTest *tc UNUSED) {
     46 
     47   smallt* r;
     48   smallJsont *self = allocG(rtSmallJsont);
     49 
     50   // undefined
     51   freeO(self);
     52   createUndefined(u);
     53   setTopO(self, (baset*)&u);
     54   r = getsoO(self);
     55   ck_assert_ptr_eq(r, self->topU);
     56   // bool
     57   freeO(self);
     58   setTopBoolO(self, true);
     59   r = getsoO(self);
     60   ck_assert_ptr_eq(r, self->topB);
     61   // double
     62   freeO(self);
     63   setTopDoubleO(self, 1);
     64   r = getsoO(self);
     65   ck_assert_ptr_eq(r, self->topD);
     66   // int
     67   freeO(self);
     68   setTopIntO(self, 1);
     69   r = getsoO(self);
     70   ck_assert_ptr_eq(r, self->topI);
     71   // string
     72   freeO(self);
     73   setTopSO(self, "qwe");
     74   r = getsoO(self);
     75   ck_assert_ptr_eq(r, self->topS);
     76   // dict
     77   freeO(self);
     78   self->f->setS(self, "qwe", "asd");
     79   r = getsoO(self);
     80   ck_assert_ptr_eq(r, self->top);
     81   // array
     82   freeO(self);
     83   pushG(self, 1);
     84   r = getsoO(self);
     85   ck_assert_ptr_eq(r, self->topA);
     86   terminateO(self);
     87 
     88 }
     89 
     90 
     91 void setsoSmallJsonT(CuTest *tc UNUSED) {
     92 
     93   smallJsont *self = allocG(rtSmallJsont);
     94   smallt *so;
     95 
     96   createSmallJson(src);
     97   // undefined
     98   createUndefined(u);
     99   setTopO(&src, (baset*)&u);
    100   so = getsoO(&src);
    101   resetO(&src);
    102   setsoO(self, so);
    103   ck_assert_ptr_eq(so, self->topU);
    104   freeO(self);
    105   // bool
    106   setTopBoolO(&src, true);
    107   so = getsoO(&src);
    108   resetO(&src);
    109   setsoO(self, so);
    110   ck_assert_ptr_eq(so, self->topB);
    111   freeO(self);
    112   // double
    113   setTopDoubleO(&src, 1);
    114   so = getsoO(&src);
    115   resetO(&src);
    116   setsoO(self, so);
    117   ck_assert_ptr_eq(so, self->topD);
    118   freeO(self);
    119   // int
    120   setTopIntO(&src, 1);
    121   so = getsoO(&src);
    122   resetO(&src);
    123   setsoO(self, so);
    124   ck_assert_ptr_eq(so, self->topI);
    125   freeO(self);
    126   // string
    127   setTopSO(&src, "qwe");
    128   so = getsoO(&src);
    129   resetO(&src);
    130   setsoO(self, so);
    131   ck_assert_ptr_eq(so, self->topS);
    132   freeO(self);
    133   // dict
    134   createSmallDict(d);
    135   (&d)->f->setS(&d, "1", "1");
    136   (&d)->f->setS(&d, "2", "2");
    137   char *as = null;
    138   // reset test: free iterElement in d
    139   iter(&d, E) {
    140     as = toStringO(E);
    141     break;
    142   }
    143   ck_assert_ptr_ne(as, null);
    144   ck_assert_str_eq(as, "1");
    145   free(as);
    146   so = (smallt*)getsoO(&d);
    147   resetO(&d);
    148   setsoO(self, so);
    149   ck_assert_ptr_eq(so, self->top);
    150   freeO(self);
    151   // array
    152   createSmallArray(a);
    153   pushG(&a, 1);
    154   pushG(&a, 2);
    155   as = null;
    156   // reset test: free iterElement in a
    157   iter(&a, E) {
    158     as = toStringO(E);
    159     break;
    160   }
    161   ck_assert_str_eq(as, "1");
    162   free(as);
    163   so = (smallt*)getsoO(&a);
    164   resetO(&a);
    165   setsoO(self, so);
    166   ck_assert_ptr_eq(so, self->topA);
    167   terminateO(self);
    168 
    169 }
    170 
    171 
    172 void mirrorSmallJsonT(CuTest *tc UNUSED) {
    173 
    174   smallJsont* r;
    175   smallJsont *self = allocG(rtSmallJsont);
    176 
    177   // dict
    178   // empty self
    179   r = mirrorO(self);
    180   ck_assert_ptr_eq(r, null);
    181   // non empty with iterator
    182   self->f->setS(self, "1", "1");
    183   self->f->setS(self, "2", "2");
    184   char *as = null;
    185   iter(self, E) {
    186     as = toStringO(E);
    187     break;
    188   }
    189   ck_assert_str_eq(as, "1");
    190   free(as);
    191   r = mirrorO(self);
    192   ck_assert_ptr_eq(r->top, self->top);
    193   finishO(r);
    194   freeO(self);
    195   // array
    196   // empty self
    197   r = mirrorO(self);
    198   ck_assert_ptr_eq(r, null);
    199   // non empty with iterator
    200   pushG(self, 1);
    201   pushG(self, 2);
    202   as = null;
    203   iter(self, E) {
    204     as = toStringO(E);
    205     break;
    206   }
    207   ck_assert_str_eq(as, "1");
    208   free(as);
    209   r = mirrorO(self);
    210   ck_assert_ptr_eq(r->topA, self->topA);
    211   finishO(r);
    212   terminateO(self);
    213 
    214 }
    215 
    216 
    217 void setTopBoolSmallJsonT(CuTest *tc UNUSED) {
    218 
    219   smallJsont* r;
    220   smallJsont *self = allocG(rtSmallJsont);
    221 
    222   r = setTopBoolO(self, true);
    223   ck_assert_ptr_ne(r, null);
    224   char *s = toStringO(r);
    225   ck_assert_str_eq(s, "true");
    226   free(s);
    227   terminateO(self);
    228 
    229 }
    230 
    231 
    232 void setTopDoubleSmallJsonT(CuTest *tc UNUSED) {
    233 
    234   smallJsont* r;
    235   smallJsont *self = allocG(rtSmallJsont);
    236 
    237   r = setTopDoubleO(self, 2);
    238   ck_assert_ptr_ne(r, null);
    239   char *s = toStringO(r);
    240   ck_assert_str_eq(s, "2.000000e+00");
    241   free(s);
    242   terminateO(self);
    243 
    244 }
    245 
    246 
    247 void setTopIntSmallJsonT(CuTest *tc UNUSED) {
    248 
    249   smallJsont* r;
    250   smallJsont *self = allocG(rtSmallJsont);
    251 
    252   r = setTopIntO(self, 2);
    253   ck_assert_ptr_ne(r, null);
    254   char *s = toStringO(r);
    255   ck_assert_str_eq(s, "2");
    256   free(s);
    257   terminateO(self);
    258 
    259 }
    260 
    261 
    262 void setTopStringSmallJsonT(CuTest *tc UNUSED) {
    263 
    264   smallJsont* r;
    265   smallJsont *self = allocG(rtSmallJsont);
    266 
    267   r = setTopStringO(self, "qwe");
    268   ck_assert_ptr_ne(r, null);
    269   char *s = toStringO(r);
    270   ck_assert_str_eq(s, "qwe");
    271   free(s);
    272   // null
    273   ck_assert_ptr_eq(setTopStringO(self, null), null);
    274   terminateO(self);
    275 
    276 }
    277 
    278 
    279 void setTopCharSmallJsonT(CuTest *tc UNUSED) {
    280 
    281   smallJsont* r;
    282   smallJsont *self = allocG(rtSmallJsont);
    283 
    284   r = setTopCharO(self, 'X');
    285   ck_assert_ptr_ne(r, null);
    286   char *s = toStringO(r);
    287   ck_assert_str_eq(s, "X");
    288   free(s);
    289   terminateO(self);
    290 
    291 }
    292 
    293 
    294 void setTopDictSmallJsonT(CuTest *tc UNUSED) {
    295 
    296   smallJsont* r;
    297   smallJsont *self  = allocG(rtSmallJsont);
    298   smallDictt *value = allocSmallDict();
    299 
    300   r = setTopDictO(self, value);
    301   ck_assert_ptr_ne(r, null);
    302   finishG(value);
    303   char *s = toStringO(r);
    304   ck_assert_str_eq(s, "{}");
    305   free(s);
    306   // non smallDict value
    307   value = (smallDictt*) allocSmallInt(1);
    308   ck_assert_ptr_eq(setTopDictO(self, value), null);
    309   terminateO(value);
    310   // null
    311   ck_assert_ptr_eq(setTopDictO(self, null), null);
    312   terminateO(self);
    313 
    314 }
    315 
    316 
    317 void setTopArraySmallJsonT(CuTest *tc UNUSED) {
    318 
    319   smallJsont* r;
    320   smallJsont *self   = allocG(rtSmallJsont);
    321   smallArrayt *value = allocSmallArray();
    322 
    323   r = setTopArrayO(self, value);
    324   ck_assert_ptr_ne(r, null);
    325   finishG(value);
    326   char *s = toStringO(r);
    327   ck_assert_str_eq(s, "[]");
    328   free(s);
    329   // non smallArray value
    330   value = (smallArrayt*) allocSmallInt(1);
    331   ck_assert_ptr_eq(setTopArrayO(self, value), null);
    332   terminateO(value);
    333   // null
    334   ck_assert_ptr_eq(setTopArrayO(self, null), null);
    335   terminateO(self);
    336 
    337 }
    338 
    339 
    340 void setTopArraycSmallJsonT(CuTest *tc UNUSED) {
    341 
    342   smallJsont* r;
    343   smallJsont *self = allocG(rtSmallJsont);
    344   char **value     = listCreateS("a","bb");
    345 
    346   r = setTopArraycO(self, value);
    347   ck_assert_ptr_ne(r, null);
    348   listFreeS(value);
    349   char *s = toStringO(r);
    350   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
    351   free(s);
    352   // null
    353   ck_assert_ptr_eq(setTopArraycO(self, null), null);
    354   terminateO(self);
    355 
    356 }
    357 
    358 
    359 void setTopSmallBoolSmallJsonT(CuTest *tc UNUSED) {
    360 
    361   smallJsont* r;
    362   smallJsont *self  = allocG(rtSmallJsont);
    363   smallBoolt *value = allocSmallBool(true);
    364 
    365   r = setTopSmallBoolO(self, value);
    366   ck_assert_ptr_ne(r, null);
    367   finishG(value);
    368   char *s = toStringO(r);
    369   ck_assert_str_eq(s, "true");
    370   free(s);
    371   // non smallBool value
    372   value = (smallBoolt*) allocSmallInt(1);
    373   ck_assert_ptr_eq(setTopSmallBoolO(self, value), null);
    374   terminateO(value);
    375   // null
    376   ck_assert_ptr_eq(setTopSmallBoolO(self, null), null);
    377   terminateO(self);
    378 
    379 }
    380 
    381 
    382 void setTopSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
    383 
    384   smallJsont* r;
    385   smallJsont *self    = allocG(rtSmallJsont);
    386   smallDoublet *value = allocSmallDouble(2);
    387 
    388   r = setTopSmallDoubleO(self, value);
    389   ck_assert_ptr_ne(r, null);
    390   finishG(value);
    391   char *s = toStringO(r);
    392   ck_assert_str_eq(s, "2.000000e+00");
    393   free(s);
    394   // non smallDouble value
    395   value = (smallDoublet*) allocSmallInt(1);
    396   ck_assert_ptr_eq(setTopSmallDoubleO(self, value), null);
    397   terminateO(value);
    398   // null
    399   ck_assert_ptr_eq(setTopSmallDoubleO(self, null), null);
    400   terminateO(self);
    401 
    402 }
    403 
    404 
    405 void setTopSmallIntSmallJsonT(CuTest *tc UNUSED) {
    406 
    407   smallJsont* r;
    408   smallJsont *self = allocG(rtSmallJsont);
    409   smallIntt *value = allocSmallInt(2);
    410 
    411   r = setTopSmallIntO(self, value);
    412   ck_assert_ptr_ne(r, null);
    413   finishG(value);
    414   char *s = toStringO(r);
    415   ck_assert_str_eq(s, "2");
    416   free(s);
    417   // non smallInt value
    418   value = (smallIntt*) allocSmallBool(true);
    419   ck_assert_ptr_eq(setTopSmallIntO(self, value), null);
    420   terminateO(value);
    421   // null
    422   ck_assert_ptr_eq(setTopSmallIntO(self, null), null);
    423   terminateO(self);
    424 
    425 }
    426 
    427 
    428 void setTopSmallJsonSmallJsonT(CuTest *tc UNUSED) {
    429 
    430   smallJsont* r;
    431   smallJsont *self  = allocG(rtSmallJsont);
    432   smallJsont *value = allocSmallJson();
    433 
    434   r = self->f->setTopSmallJson(self, value);
    435   ck_assert_ptr_ne(r, null);
    436   finishG(value);
    437   char *s = toStringO(r);
    438   ck_assert_str_eq(s, "{}");
    439   free(s);
    440   // non smallJson value
    441   value = (smallJsont*) allocSmallInt(1);
    442   ck_assert_ptr_eq(self->f->setTopSmallJson(self, value), null);
    443   terminateO(value);
    444   // null
    445   ck_assert_ptr_eq(self->f->setTopSmallJson(self, null), null);
    446   terminateO(self);
    447 
    448 }
    449 
    450 
    451 void setTopSmallStringSmallJsonT(CuTest *tc UNUSED) {
    452 
    453   smallJsont* r;
    454   smallJsont *self    = allocG(rtSmallJsont);
    455   smallStringt *value = allocSmallString("qwe");
    456 
    457   r = setTopSmallStringO(self, value);
    458   ck_assert_ptr_ne(r, null);
    459   finishG(value);
    460   char *s = toStringO(r);
    461   ck_assert_str_eq(s, "qwe");
    462   free(s);
    463   // non smallString value
    464   value = (smallStringt*) allocSmallInt(1);
    465   ck_assert_ptr_eq(setTopSmallStringO(self, value), null);
    466   terminateO(value);
    467   // null
    468   ck_assert_ptr_eq(setTopSmallStringO(self, null), null);
    469   terminateO(self);
    470 
    471 }
    472 
    473 
    474 void setTopNFreeSmallJsonT(CuTest *tc UNUSED) {
    475 
    476   smallJsont* r;
    477   smallJsont *self = allocG(rtSmallJsont);
    478   baset *value     = (baset*)allocSmallInt(2);
    479 
    480   r = setTopNFreeO(self, value);
    481   ck_assert_ptr_ne(r, null);
    482   char *s = toStringO(r);
    483   ck_assert_str_eq(s, "2");
    484   free(s);
    485   terminateO(self);
    486 
    487 }
    488 
    489 
    490 void setTopNFreeBoolSmallJsonT(CuTest *tc UNUSED) {
    491 
    492   smallJsont* r;
    493   smallJsont *self = allocG(rtSmallJsont);
    494 
    495   r = setTopNFreeBoolO(self, true);
    496   ck_assert_ptr_ne(r, null);
    497   char *s = toStringO(r);
    498   ck_assert_str_eq(s, "true");
    499   free(s);
    500   terminateO(self);
    501 
    502 }
    503 
    504 
    505 void setTopNFreeDoubleSmallJsonT(CuTest *tc UNUSED) {
    506 
    507   smallJsont* r;
    508   smallJsont *self = allocG(rtSmallJsont);
    509 
    510   r = setTopNFreeDoubleO(self, 2);
    511   ck_assert_ptr_ne(r, null);
    512   char *s = toStringO(r);
    513   ck_assert_str_eq(s, "2.000000e+00");
    514   free(s);
    515   terminateO(self);
    516 
    517 }
    518 
    519 
    520 void setTopNFreeIntSmallJsonT(CuTest *tc UNUSED) {
    521 
    522   smallJsont* r;
    523   smallJsont *self = allocG(rtSmallJsont);
    524 
    525   r = setTopNFreeIntO(self, 2);
    526   ck_assert_ptr_ne(r, null);
    527   char *s = toStringO(r);
    528   ck_assert_str_eq(s, "2");
    529   free(s);
    530   terminateO(self);
    531 
    532 }
    533 
    534 
    535 void setTopNFreeStringSmallJsonT(CuTest *tc UNUSED) {
    536 
    537   smallJsont* r;
    538   smallJsont *self = allocG(rtSmallJsont);
    539   char *value      = strdup("qwe");
    540 
    541   r = setTopNFreeStringO(self, value);
    542   ck_assert_ptr_ne(r, null);
    543   char *s = toStringO(r);
    544   ck_assert_str_eq(s, "qwe");
    545   free(s);
    546   // null
    547   ck_assert_ptr_eq(setTopNFreeStringO(self, null), null);
    548   terminateO(self);
    549 
    550 }
    551 
    552 
    553 void setTopNFreeDictSmallJsonT(CuTest *tc UNUSED) {
    554 
    555   smallJsont* r;
    556   smallJsont *self  = allocG(rtSmallJsont);
    557   smallDictt *value = allocSmallDict();
    558 
    559   r = setTopNFreeDictO(self, value);
    560   ck_assert_ptr_ne(r, null);
    561   char *s = toStringO(r);
    562   ck_assert_str_eq(s, "{}");
    563   free(s);
    564   // non smallDict value
    565   value = (smallDictt*) allocSmallInt(1);
    566   ck_assert_ptr_eq(setTopNFreeDictO(self, value), null);
    567   terminateO(value);
    568   // null
    569   ck_assert_ptr_eq(setTopNFreeDictO(self, null), null);
    570   terminateO(self);
    571 
    572 }
    573 
    574 
    575 void setTopNFreeArraySmallJsonT(CuTest *tc UNUSED) {
    576 
    577   smallJsont* r;
    578   smallJsont *self   = allocG(rtSmallJsont);
    579   smallArrayt *value = allocSmallArray();
    580 
    581   r = setTopNFreeArrayO(self, value);
    582   ck_assert_ptr_ne(r, null);
    583   char *s = toStringO(r);
    584   ck_assert_str_eq(s, "[]");
    585   free(s);
    586   // non smallArray value
    587   value = (smallArrayt*) allocSmallInt(1);
    588   ck_assert_ptr_eq(setTopNFreeArrayO(self, value), null);
    589   terminateO(value);
    590   // null
    591   ck_assert_ptr_eq(setTopNFreeArrayO(self, null), null);
    592   terminateO(self);
    593 
    594 }
    595 
    596 
    597 void setTopNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
    598 
    599   smallJsont* r;
    600   smallJsont *self = allocG(rtSmallJsont);
    601   char **value     = listCreateS("a","bb");
    602 
    603   r = setTopNFreeArraycO(self, value);
    604   ck_assert_ptr_ne(r, null);
    605   char *s = toStringO(r);
    606   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
    607   free(s);
    608   // null
    609   ck_assert_ptr_eq(setTopNFreeArraycO(self, null), null);
    610   terminateO(self);
    611 
    612 }
    613 
    614 
    615 void setTopNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
    616 
    617   smallJsont* r;
    618   smallJsont *self  = allocG(rtSmallJsont);
    619   smallBoolt *value = allocSmallBool(true);
    620 
    621   r = setTopNFreeSmallBoolO(self, value);
    622   ck_assert_ptr_ne(r, null);
    623   char *s = toStringO(r);
    624   ck_assert_str_eq(s, "true");
    625   free(s);
    626   // non smallBool value
    627   value = (smallBoolt*) allocSmallInt(1);
    628   ck_assert_ptr_eq(setTopNFreeSmallBoolO(self, value), null);
    629   terminateO(value);
    630   // null
    631   ck_assert_ptr_eq(setTopNFreeSmallBoolO(self, null), null);
    632   terminateO(self);
    633 
    634 }
    635 
    636 
    637 void setTopNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
    638 
    639   smallJsont* r;
    640   smallJsont *self    = allocG(rtSmallJsont);
    641   smallDoublet *value = allocSmallDouble(2);
    642 
    643   r = setTopNFreeSmallDoubleO(self, value);
    644   ck_assert_ptr_ne(r, null);
    645   char *s = toStringO(r);
    646   ck_assert_str_eq(s, "2.000000e+00");
    647   free(s);
    648   // non smallDouble value
    649   value = (smallDoublet*) allocSmallInt(1);
    650   ck_assert_ptr_eq(setTopNFreeSmallDoubleO(self, value), null);
    651   terminateO(value);
    652   // null
    653   ck_assert_ptr_eq(setTopNFreeSmallDoubleO(self, null), null);
    654   terminateO(self);
    655 
    656 }
    657 
    658 
    659 void setTopNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
    660 
    661   smallJsont* r;
    662   smallJsont *self = allocG(rtSmallJsont);
    663   smallIntt *value = allocSmallInt(2);
    664 
    665   r = setTopNFreeSmallIntO(self, value);
    666   ck_assert_ptr_ne(r, null);
    667   char *s = toStringO(r);
    668   ck_assert_str_eq(s, "2");
    669   free(s);
    670   // non smallInt value
    671   value = (smallIntt*) allocSmallBool(true);
    672   ck_assert_ptr_eq(setTopNFreeSmallIntO(self, value), null);
    673   terminateO(value);
    674   // null
    675   ck_assert_ptr_eq(setTopNFreeSmallIntO(self, null), null);
    676   terminateO(self);
    677 
    678 }
    679 
    680 
    681 void setTopNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
    682 
    683   smallJsont* r;
    684   smallJsont *self  = allocG(rtSmallJsont);
    685   smallJsont *value = allocSmallJson();
    686 
    687   r = self->f->setTopNFreeSmallJson(self, value);
    688   ck_assert_ptr_ne(r, null);
    689   char *s = toStringO(r);
    690   ck_assert_str_eq(s, "{}");
    691   free(s);
    692   // non smallJson value
    693   value = (smallJsont*) allocSmallInt(1);
    694   ck_assert_ptr_eq(self->f->setTopNFreeSmallJson(self, value), null);
    695   terminateO(value);
    696   // null
    697   ck_assert_ptr_eq(self->f->setTopNFreeSmallJson(self, null), null);
    698   terminateO(self);
    699 
    700 }
    701 
    702 
    703 void setTopNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
    704 
    705   smallJsont* r;
    706   smallJsont *self    = allocG(rtSmallJsont);
    707   smallStringt *value = allocSmallString("qwe");
    708 
    709   r = setTopNFreeSmallStringO(self, value);
    710   ck_assert_ptr_ne(r, null);
    711   char *s = toStringO(r);
    712   ck_assert_str_eq(s, "qwe");
    713   free(s);
    714   // non smallString value
    715   value = (smallStringt*) allocSmallInt(1);
    716   ck_assert_ptr_eq(setTopNFreeSmallStringO(self, value), null);
    717   terminateO(value);
    718   // null
    719   ck_assert_ptr_eq(setTopNFreeSmallStringO(self, null), null);
    720   terminateO(self);
    721 
    722 }
    723 
    724 
    725 void fromArraySmallJsonT(CuTest *tc UNUSED) {
    726 
    727   smallJsont* r;
    728   smallJsont *self = allocG(rtSmallJsont);
    729   char **array;
    730   size_t size = 3;
    731 
    732   // libsheepy list
    733   array = listCreateS("a", "bb", "ccc");
    734   r = fromArrayO(self, array, 0);
    735   ck_assert_ptr_eq(self, r);
    736   char *s = toStringO(r);
    737   ck_assert_str_eq(s, "[\"a\",\"bb\",\"ccc\"]");
    738   free(s);
    739   listFreeS(array);
    740   // array with strings
    741   freeO(self);
    742   array = allocArray(array, size+1);
    743   array[0] = strdup("a1");
    744   array[1] = strdup("bb1");
    745   array[2] = strdup("ccc1");
    746   array[3] = array[2];
    747   r = fromArrayO(self, array, size);
    748   ck_assert_ptr_eq(self, r);
    749   s = toStringO(r);
    750   ck_assert_str_eq(s, "[\"a1\",\"bb1\",\"ccc1\"]");
    751   free(s);
    752   // null in array
    753   freeO(self);
    754   char *elem = array[0];
    755   array[0]   = null;
    756   r = fromArrayO(self, array, size);
    757   ck_assert_ptr_eq(self, r);
    758   s = toStringO(r);
    759   ck_assert_str_eq(s, "[\"bb1\",\"ccc1\"]");
    760   ck_assert_uint_eq(lenO(self), 3);
    761   free(s);
    762   array[0] = elem;
    763   // json dict
    764   freeO(self);
    765   setTypeIntO(self);
    766   r = fromArrayO(self, array, 1);
    767   ck_assert_ptr_eq(r, null);
    768   array[3] = null;
    769   listFreeS(array);
    770   // NULL array
    771   r = fromArrayO(self, null, 1);
    772   ck_assert_ptr_eq(r, null);
    773   terminateO(self);
    774 
    775 }
    776 
    777 
    778 void fromArrayNFreeSmallJsonT(CuTest *tc UNUSED) {
    779 
    780   smallJsont* r;
    781   smallJsont *self = allocSmallJson();
    782   char **array;
    783   size_t size = 3;
    784 
    785   // libsheepy list
    786   array = listCreateS("a", "bb", "ccc");
    787   r = fromArrayNFreeO(self, array, 0);
    788   ck_assert_ptr_eq(self, r);
    789   char *s = toStringO(r);
    790   ck_assert_str_eq(s, "[\"a\",\"bb\",\"ccc\"]");
    791   free(s);
    792   // array with strings
    793   array = allocArray(array, size);
    794   array[0] = strdup("a1");
    795   array[1] = strdup("bb1");
    796   array[2] = strdup("ccc1");
    797   r = fromArrayNFreeO(self, array, size);
    798   ck_assert_ptr_eq(self, r);
    799   s = toStringO(r);
    800   ck_assert_str_eq(s, "[\"a1\",\"bb1\",\"ccc1\"]");
    801   free(s);
    802   // NULL array
    803   r = fromArrayNFreeO(self, null, 1);
    804   ck_assert_ptr_eq(r, null);
    805   terminateO(self);
    806 
    807 }
    808 
    809 
    810 void fromArrayDictSmallJsonT(CuTest *tc UNUSED) {
    811 
    812   smallJsont* r;
    813   smallJsont *self   = allocG(rtSmallJsont);
    814   smallArrayt *items = allocSmallArray();
    815 
    816   self->f->setInt(self, "", 1);
    817   // ignored item
    818   items->f->pushS(items, "ignored");
    819   createAllocateSmallArray(a);
    820   a->f->pushS(a, "a");
    821   a->f->pushInt(a, 1);
    822   items->f->pushNFreeArray(items, a);
    823   a = allocSmallArray();
    824   items->f->pushNFreeArray(items, a);
    825   a = allocSmallArray();
    826   a->f->pushInt(a, 1);
    827   a->f->pushInt(a, 2);
    828   items->f->pushNFreeArray(items, a);
    829   r = fromArrayDictO(self, items);
    830   ck_assert_ptr_ne(r, NULL);
    831   char *s = toStringO(r);
    832   ck_assert_str_eq(s, "{\"\":1,\"a\":1}");
    833   free(s);
    834   // empty json
    835   freeO(self);
    836   r = fromArrayDictO(self, items);
    837   ck_assert_ptr_ne(r, NULL);
    838   s = toStringO(r);
    839   ck_assert_str_eq(s, "{\"a\":1}");
    840   free(s);
    841   // non json dict
    842   freeO(self);
    843   setTypeIntO(self);
    844   r = fromArrayDictO(self, items);
    845   ck_assert_ptr_eq(r, NULL);
    846   terminateO(items);
    847   // non smallArray items
    848   freeO(self);
    849   items = (smallArrayt*) allocSmallInt(2);
    850   r = fromArrayDictO(self, items);
    851   ck_assert_ptr_eq(r, NULL);
    852   // null items
    853   r = fromArrayDictO(self, null);
    854   ck_assert_ptr_eq(r, NULL);
    855   terminateO(items);
    856   terminateO(self);
    857 
    858 }
    859 
    860 
    861 void toArrayDictSmallJsonT(CuTest *tc UNUSED) {
    862 
    863   smallArrayt* r;
    864   smallJsont *self = allocG(rtSmallJsont);
    865 
    866   parseO(self, "{\"a\":2,\"bb\":4}");
    867 
    868   r = toArrayDictO(self);
    869   ck_assert_ptr_ne(r, null);
    870   char *s = toStringO(r);
    871   terminateO(r);
    872   ck_assert_str_eq(s, "[[\"a\",2],[\"bb\",4]]");
    873   free(s);
    874   // empty self
    875   freeO(self);
    876   setTypeDictO(self);
    877   ck_assert_ptr_eq(toArrayDictO(self), null);
    878   // non json dict
    879   freeO(self);
    880   ck_assert_ptr_eq(toArrayDictO(self), null);
    881   terminateO(self);
    882 
    883 }
    884 
    885 
    886 void getTopUndefinedSmallJsonT(CuTest *tc UNUSED) {
    887 
    888   undefinedt*   r  = allocUndefined();
    889   smallJsont *self = allocG(rtSmallJsont);
    890 
    891   setTopO(self, (baset*) r);
    892   finishO(r);
    893   r = getTopUndefinedO(self);
    894   ck_assert_ptr_ne(r, null);
    895   char *s = toStringO(r);
    896   finishO(r);
    897   ck_assert_str_eq(s, "null");
    898   free(s);
    899   // non json undefined
    900   freeO(self);
    901   ck_assert_ptr_eq(getTopUndefinedO(self), null);
    902   terminateO(self);
    903 
    904 }
    905 
    906 
    907 void getTopBoolSmallJsonT(CuTest *tc UNUSED) {
    908 
    909   bool          r;
    910   smallJsont *self = allocG(rtSmallJsont);
    911 
    912   setTopBoolO(self, true);
    913   r = getTopBoolO(self);
    914   ck_assert(r);
    915   terminateO(self);
    916 
    917 }
    918 
    919 
    920 void getTopBoolPSmallJsonT(CuTest *tc UNUSED) {
    921 
    922   bool*         r;
    923   smallJsont *self = allocG(rtSmallJsont);
    924 
    925   setTopBoolO(self, true);
    926   r = getTopBoolPO(self);
    927   ck_assert_ptr_ne(r, null);
    928   ck_assert(*r);
    929   terminateO(self);
    930 
    931 }
    932 
    933 
    934 void getTopDoubleSmallJsonT(CuTest *tc UNUSED) {
    935 
    936   double        r;
    937   smallJsont *self = allocG(rtSmallJsont);
    938 
    939   setTopDoubleO(self, 2);
    940   r = getTopDoubleO(self);
    941   ck_assert(r==2);
    942   terminateO(self);
    943 
    944 }
    945 
    946 
    947 void getTopDoublePSmallJsonT(CuTest *tc UNUSED) {
    948 
    949   double*       r;
    950   smallJsont *self = allocG(rtSmallJsont);
    951 
    952   setTopDoubleO(self, 2);
    953   r = getTopDoublePO(self);
    954   ck_assert_ptr_ne(r, null);
    955   ck_assert(*r==2);
    956   terminateO(self);
    957 
    958 }
    959 
    960 
    961 void getTopIntSmallJsonT(CuTest *tc UNUSED) {
    962 
    963   int64_t       r;
    964   smallJsont *self = allocG(rtSmallJsont);
    965 
    966   setTopIntO(self, 3);
    967   r = getTopIntO(self);
    968   ck_assert_int_eq(r, 3);
    969   terminateO(self);
    970 
    971 }
    972 
    973 
    974 void getTopIntPSmallJsonT(CuTest *tc UNUSED) {
    975 
    976   int64_t*      r;
    977   smallJsont *self = allocG(rtSmallJsont);
    978 
    979   setTopIntO(self, 3);
    980   r = getTopIntPO(self);
    981   ck_assert_ptr_ne(r, null);
    982   ck_assert_int_eq(*r, 3);
    983   terminateO(self);
    984 
    985 }
    986 
    987 
    988 void getTopInt32SmallJsonT(CuTest *tc UNUSED) {
    989 
    990   int32_t       r;
    991   smallJsont *self = allocG(rtSmallJsont);
    992 
    993   setTopIntO(self, 3);
    994   r = getTopInt32O(self);
    995   ck_assert_int_eq(r, 3);
    996   terminateO(self);
    997 
    998 }
    999 
   1000 
   1001 void getTopInt32PSmallJsonT(CuTest *tc UNUSED) {
   1002 
   1003   int32_t*      r;
   1004   smallJsont *self = allocG(rtSmallJsont);
   1005 
   1006   setTopIntO(self, 3);
   1007   r = getTopInt32PO(self);
   1008   ck_assert_ptr_ne(r, null);
   1009   ck_assert_int_eq(*r, 3);
   1010   terminateO(self);
   1011 
   1012 }
   1013 
   1014 
   1015 void getTopUintSmallJsonT(CuTest *tc UNUSED) {
   1016 
   1017   uint64_t      r;
   1018   smallJsont *self = allocG(rtSmallJsont);
   1019 
   1020   setTopIntO(self, 3);
   1021   r = getTopUintO(self);
   1022   ck_assert_int_eq(r, 3);
   1023   terminateO(self);
   1024 
   1025 }
   1026 
   1027 
   1028 void getTopUintPSmallJsonT(CuTest *tc UNUSED) {
   1029 
   1030   uint64_t*     r;
   1031   smallJsont *self = allocG(rtSmallJsont);
   1032 
   1033   setTopIntO(self, 3);
   1034   r = getTopUintPO(self);
   1035   ck_assert_ptr_ne(r, null);
   1036   ck_assert_int_eq(*r, 3);
   1037   terminateO(self);
   1038 
   1039 }
   1040 
   1041 
   1042 void getTopUint32SmallJsonT(CuTest *tc UNUSED) {
   1043 
   1044   uint32_t      r;
   1045   smallJsont *self = allocG(rtSmallJsont);
   1046 
   1047   setTopIntO(self, 3);
   1048   r = getTopUint32O(self);
   1049   ck_assert_int_eq(r, 3);
   1050   terminateO(self);
   1051 
   1052 }
   1053 
   1054 
   1055 void getTopUint32PSmallJsonT(CuTest *tc UNUSED) {
   1056 
   1057   uint32_t*     r;
   1058   smallJsont *self = allocG(rtSmallJsont);
   1059 
   1060   setTopIntO(self, 3);
   1061   r = getTopUint32PO(self);
   1062   ck_assert_ptr_ne(r, null);
   1063   ck_assert_int_eq(*r, 3);
   1064   terminateO(self);
   1065 
   1066 }
   1067 
   1068 
   1069 void getTopSSmallJsonT(CuTest *tc UNUSED) {
   1070 
   1071   char*         r;
   1072   smallJsont *self = allocG(rtSmallJsont);
   1073 
   1074   setTopStringO(self, "qwe");
   1075   r = getTopSO(self);
   1076   ck_assert_ptr_ne(r, null);
   1077   ck_assert_str_eq(r, "qwe");
   1078   terminateO(self);
   1079 
   1080 }
   1081 
   1082 
   1083 void getTopDictSmallJsonT(CuTest *tc UNUSED) {
   1084 
   1085   smallDictt*   r  = allocSmallDict();
   1086   smallJsont *self = allocG(rtSmallJsont);
   1087 
   1088   setTopNFreeDictO(self, r);
   1089   r = getTopDictO(self);
   1090   ck_assert_ptr_ne(r, null);
   1091   char *s = toStringO(r);
   1092   finishO(r);
   1093   ck_assert_str_eq(s, "{}");
   1094   free(s);
   1095   // non json dict
   1096   freeO(self);
   1097   ck_assert_ptr_eq(getTopDictO(self), null);
   1098   terminateO(self);
   1099 
   1100 }
   1101 
   1102 
   1103 void getTopArraySmallJsonT(CuTest *tc UNUSED) {
   1104 
   1105   smallArrayt*  r  = allocSmallArray();
   1106   smallJsont *self = allocG(rtSmallJsont);
   1107 
   1108   setTopNFreeArrayO(self, r);
   1109   r = getTopArrayO(self);
   1110   ck_assert_ptr_ne(r, null);
   1111   char *s = toStringO(r);
   1112   finishO(r);
   1113   ck_assert_str_eq(s, "[]");
   1114   free(s);
   1115   // non json array
   1116   freeO(self);
   1117   ck_assert_ptr_eq(getTopArrayO(self), null);
   1118   terminateO(self);
   1119 
   1120 }
   1121 
   1122 
   1123 void getTopSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   1124 
   1125   smallBoolt*   r  = allocSmallBool(true);
   1126   smallJsont *self = allocG(rtSmallJsont);
   1127 
   1128   setTopNFreeSmallBoolO(self, r);
   1129   r = getTopSmallBoolO(self);
   1130   ck_assert_ptr_ne(r, null);
   1131   char *s = toStringO(r);
   1132   finishO(r);
   1133   ck_assert_str_eq(s, "true");
   1134   free(s);
   1135   // non json bool
   1136   freeO(self);
   1137   ck_assert_ptr_eq(getTopSmallBoolO(self), null);
   1138   terminateO(self);
   1139 
   1140 }
   1141 
   1142 
   1143 void getTopSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   1144 
   1145   smallDoublet* r  = allocSmallDouble(2);
   1146   smallJsont *self = allocG(rtSmallJsont);
   1147 
   1148   setTopNFreeSmallDoubleO(self, r);
   1149   r = getTopSmallDoubleO(self);
   1150   ck_assert_ptr_ne(r, null);
   1151   char *s = toStringO(r);
   1152   finishO(r);
   1153   ck_assert_str_eq(s, "2.000000e+00");
   1154   free(s);
   1155   // non json double
   1156   freeO(self);
   1157   ck_assert_ptr_eq(getTopSmallDoubleO(self), null);
   1158   terminateO(self);
   1159 
   1160 }
   1161 
   1162 
   1163 void getTopSmallIntSmallJsonT(CuTest *tc UNUSED) {
   1164 
   1165   smallIntt* r     = allocSmallInt(2);
   1166   smallJsont *self = allocG(rtSmallJsont);
   1167 
   1168   setTopNFreeSmallIntO(self, r);
   1169   r = getTopSmallIntO(self);
   1170   ck_assert_ptr_ne(r, null);
   1171   char *s = toStringO(r);
   1172   finishO(r);
   1173   ck_assert_str_eq(s, "2");
   1174   free(s);
   1175   // non json int
   1176   freeO(self);
   1177   ck_assert_ptr_eq(getTopSmallIntO(self), null);
   1178   terminateO(self);
   1179 
   1180 }
   1181 
   1182 
   1183 void getTopSmallStringSmallJsonT(CuTest *tc UNUSED) {
   1184 
   1185   smallStringt* r  = allocSmallString("qwe");
   1186   smallJsont *self = allocG(rtSmallJsont);
   1187 
   1188   setTopNFreeSmallStringO(self, r);
   1189   r = getTopSmallStringO(self);
   1190   ck_assert_ptr_ne(r, null);
   1191   char *s = toStringO(r);
   1192   finishO(r);
   1193   ck_assert_str_eq(s, "qwe");
   1194   free(s);
   1195   // non json string
   1196   freeO(self);
   1197   ck_assert_ptr_eq(getTopSmallStringO(self), null);
   1198   terminateO(self);
   1199 
   1200 }
   1201 
   1202 
   1203 void keyIsSmallJsonT(CuTest *tc UNUSED) {
   1204 
   1205   jsonPathRest r;
   1206   smallJsont *self = allocG(rtSmallJsont);
   1207 
   1208   // array path
   1209   r = keyIsO(self, "[123].\"wef\"");
   1210   ck_assert_int_eq(r, ARRAY_PATH);
   1211   // dict path
   1212   r = keyIsO(self, "\"wef\"[-123]");
   1213   ck_assert_int_eq(r, DICT_PATH);
   1214   // not a path
   1215   r = keyIsO(self, "[\"");
   1216   ck_assert_int_eq(r, NOT_A_PATH);
   1217   r = keyIsO(self, "[[123]");
   1218   ck_assert_int_eq(r, NOT_A_PATH);
   1219   r = keyIsO(self, "[123]]");
   1220   ck_assert_int_eq(r, NOT_A_PATH);
   1221   r = keyIsO(self, "[123]qwe");
   1222   ck_assert_int_eq(r, NOT_A_PATH);
   1223   r = keyIsO(self, "['123]");
   1224   ck_assert_int_eq(r, NOT_A_PATH);
   1225   r = keyIsO(self, "[1-]");
   1226   ck_assert_int_eq(r, NOT_A_PATH);
   1227   // null key
   1228   r = keyIsO(self, null);
   1229   ck_assert_int_eq(r, KEY_IS_NULL);
   1230   terminateO(self);
   1231 
   1232 }
   1233 
   1234 
   1235 void keyIsSSmallJsonT(CuTest *tc UNUSED) {
   1236 
   1237   const char* r;
   1238   smallJsont *self = allocG(rtSmallJsont);
   1239 
   1240   // array path
   1241   r = keyIsSO(self, "[123].\"wef\"");
   1242   ck_assert_ptr_ne(r, null);
   1243   ck_assert_str_eq(r, "ARRAY_PATH");
   1244   // dict path
   1245   r = keyIsSO(self, "\"wef\"[-123]");
   1246   ck_assert_ptr_ne(r, null);
   1247   ck_assert_str_eq(r, "DICT_PATH");
   1248   // not a path
   1249   r = keyIsSO(self, "key");
   1250   ck_assert_ptr_ne(r, null);
   1251   ck_assert_str_eq(r, "NOT_A_PATH");
   1252   // null key
   1253   r = keyIsSO(self, null);
   1254   ck_assert_ptr_eq(r, null);
   1255   terminateO(self);
   1256 
   1257 }
   1258 
   1259 
   1260 void makeKeySmallJsonT(CuTest *tc UNUSED) {
   1261 
   1262   char*  r;
   1263   smallJsont *self = allocG(rtSmallJsont);
   1264 
   1265 
   1266   r = makeKeyO(self, "\"\\asd");
   1267   ck_assert_ptr_ne(r, null);
   1268   ck_assert_str_eq(r, "\"\\\"\\\\asd\"");
   1269   free(r);
   1270   // null key
   1271   r = makeKeyO(self, null);
   1272   ck_assert_ptr_eq(r, null);
   1273   terminateO(self);
   1274 
   1275 }
   1276 
   1277 
   1278 void iMakeKeySmallJsonT(CuTest *tc UNUSED) {
   1279 
   1280   char*  r;
   1281   smallJsont *self = allocG(rtSmallJsont);
   1282   char *key = strdup("qwe");
   1283 
   1284   r = iMakeKeyO(self, &key);
   1285   ck_assert_ptr_ne(r, null);
   1286   ck_assert_ptr_eq(r, key);
   1287   ck_assert_str_eq(r, "\"qwe\"");
   1288   // null key
   1289   freen(key);
   1290   r = iMakeKeyO(self, &key);
   1291   ck_assert_ptr_eq(r, null);
   1292   r = iMakeKeyO(self, null);
   1293   ck_assert_ptr_eq(r, null);
   1294   terminateO(self);
   1295 
   1296 }
   1297 
   1298 
   1299 void bMakeKeySmallJsonT(CuTest *tc UNUSED) {
   1300 
   1301   char*  r;
   1302   smallJsont *self = allocG(rtSmallJsont);
   1303   char dest[20];
   1304 
   1305   r = bMakeKeyO(self, dest, "\"\\123");
   1306   ck_assert_ptr_ne(r, null);
   1307   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1308   // null
   1309   r = bMakeKeyO(self, dest, null);
   1310   ck_assert_ptr_eq(r, null);
   1311   r = bMakeKeyO(self, null, "\"\\123");
   1312   ck_assert_ptr_eq(r, null);
   1313   terminateO(self);
   1314 
   1315 }
   1316 
   1317 
   1318 void bLMakeKeySmallJsonT(CuTest *tc UNUSED) {
   1319 
   1320   char*  r;
   1321   smallJsont *self = allocG(rtSmallJsont);
   1322   char dest[20];
   1323 
   1324   r = bLMakeKeyO(self, dest, sizeof(dest), "\"\\123");
   1325   ck_assert_ptr_ne(r, null);
   1326   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1327   // just enough space
   1328   r = bLMakeKeyO(self, dest, 10, "\"\\123");
   1329   ck_assert_ptr_ne(r, null);
   1330   ck_assert_str_eq(r, "\"\\\"\\\\123\"");
   1331   // dest too short
   1332   r = bLMakeKeyO(self, dest, 9, "\"\\123");
   1333   ck_assert_ptr_eq(r, null);
   1334   // null
   1335   r = bLMakeKeyO(self, dest, 45, null);
   1336   ck_assert_ptr_eq(r, null);
   1337   r = bLMakeKeyO(self, null, 4, "\"\\123");
   1338   ck_assert_ptr_eq(r, null);
   1339   r = bLMakeKeyO(self, dest, 0, "\"\\123");
   1340   ck_assert_ptr_eq(r, null);
   1341   terminateO(self);
   1342 
   1343 }
   1344 
   1345 
   1346 void makeKeyLenSmallJsonT(CuTest *tc UNUSED) {
   1347 
   1348   size_t r;
   1349   smallJsont *self = allocG(rtSmallJsont);
   1350 
   1351   r = makeKeyLenO(self, "\"\\asd");
   1352   ck_assert_int_eq(r, 9);
   1353   r = makeKeyLenO(self, "");
   1354   ck_assert_int_eq(r, 2);
   1355   // null
   1356   ck_assert_int_eq(makeKeyLenO(self, null), 0);
   1357   terminateO(self);
   1358 
   1359 }
   1360 
   1361 
   1362 void setSmallJsonT(CuTest *tc UNUSED) {
   1363 
   1364   smallJsont* r;
   1365   smallJsont *self = allocSmallJson();
   1366   baset *value     = (baset*) allocSmallInt(1);
   1367 
   1368   r = self->f->set(self, "1", value);
   1369   ck_assert_ptr_ne(r, null);
   1370   finishO(value);
   1371   char *s = toStringO(r);
   1372   ck_assert_str_eq(s, "{\"1\":1}");
   1373   free(s);
   1374   // path
   1375   value = (baset*) allocSmallInt(2);
   1376   createSmallArray(a);
   1377   createSmallDict(d);
   1378   a.f->pushDict(&a, &d);
   1379   self->f->setArray(self, "array", &a);
   1380   r = self->f->set(self, "\"array\"[0].\"key\"", value);
   1381   ck_assert_ptr_ne(r, null);
   1382   finishO(value);
   1383   s = toStringO(r);
   1384   ck_assert_str_eq(s, "{\"1\":1,\"array\":[{\"key\":2}]}");
   1385   free(s);
   1386   // json bool
   1387   freeO(self);
   1388   value = (baset*) allocSmallInt(2);
   1389   setTypeBoolO(self);
   1390   r = self->f->set(self, "1", value);
   1391   ck_assert_ptr_eq(r, null);
   1392   // json array
   1393   freeO(self);
   1394   setTypeArrayO(self);
   1395   r = self->f->set(self, "1", value);
   1396   ck_assert_ptr_eq(r, null);
   1397   // non existing dict path
   1398   freeO(self);
   1399   r = self->f->set(self, "\"1\"[1]", value);
   1400   ck_assert_ptr_eq(r, null);
   1401   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   1402   createSmallInt(i);
   1403   r = self->f->set(self, "\"1\".[1]", (baset*)&i);
   1404   ck_assert_ptr_eq(r, null);
   1405   freeO(&i);
   1406   //    wrong path and user class
   1407   i.type = "myclass";
   1408   r = self->f->set(self, "\"1\".[1]", (baset*)&i);
   1409   ck_assert_ptr_eq(r, null);
   1410   //   dict path but the object is an array
   1411   resetO(&a);
   1412   self->f->setArray(self, "1", &a);
   1413   r = self->f->set(self, "\"1\".\"1\"", value);
   1414   ck_assert_ptr_eq(r, null);
   1415   //   dict object in path but the key doesn't exists
   1416   resetO(&d);
   1417   self->f->setDict(self, "2", &d);
   1418   r = self->f->set(self, "\"2\".\"1\".[12]", value);
   1419   ck_assert_ptr_eq(r, null);
   1420   // null key
   1421   r = self->f->set(self, null, value);
   1422   ck_assert_ptr_eq(r, null);
   1423   terminateO(value);
   1424   terminateO(self);
   1425 
   1426 }
   1427 
   1428 
   1429 void setUndefinedSmallJsonT(CuTest *tc UNUSED) {
   1430 
   1431   smallJsont* r;
   1432   smallJsont *self = allocSmallJson();
   1433 
   1434   r = self->f->setUndefined(self, "1");
   1435   ck_assert_ptr_ne(r, null);
   1436   char *s = toStringO(r);
   1437   ck_assert_str_eq(s, "{\"1\":null}");
   1438   free(s);
   1439   // path
   1440   createSmallArray(a);
   1441   createSmallDict(d);
   1442   a.f->pushDict(&a, &d);
   1443   self->f->setArray(self, "array", &a);
   1444   r = self->f->setUndefined(self, "\"array\"[0].\"key\"");
   1445   ck_assert_ptr_ne(r, null);
   1446   s = toStringO(r);
   1447   ck_assert_str_eq(s, "{\"1\":null,\"array\":[{\"key\":null}]}");
   1448   free(s);
   1449   // json bool
   1450   freeO(self);
   1451   setTypeBoolO(self);
   1452   r = self->f->setUndefined(self, "1");
   1453   ck_assert_ptr_eq(r, null);
   1454   // json array
   1455   freeO(self);
   1456   setTypeArrayO(self);
   1457   r = self->f->setUndefined(self, "1");
   1458   ck_assert_ptr_eq(r, null);
   1459   // non existing dict path
   1460   freeO(self);
   1461   r = self->f->setUndefined(self, "\"1\"[1]");
   1462   ck_assert_ptr_eq(r, null);
   1463   //   dict path but the object is an array
   1464   resetO(&a);
   1465   self->f->setArray(self, "1", &a);
   1466   r = self->f->setUndefined(self, "\"1\".\"1\"");
   1467   ck_assert_ptr_eq(r, null);
   1468   //   dict object in path but the key doesn't exists
   1469   resetO(&d);
   1470   self->f->setDict(self, "2", &d);
   1471   r = self->f->setUndefined(self, "\"2\".\"1\".[12]");
   1472   ck_assert_ptr_eq(r, null);
   1473   // null key
   1474   r = self->f->setUndefined(self, null);
   1475   ck_assert_ptr_eq(r, null);
   1476   terminateO(self);
   1477 
   1478 }
   1479 
   1480 
   1481 void setBoolSmallJsonT(CuTest *tc UNUSED) {
   1482 
   1483   smallJsont* r;
   1484   smallJsont *self = allocSmallJson();
   1485 
   1486   r = self->f->setBool(self, "1", true);
   1487   ck_assert_ptr_ne(r, null);
   1488   char *s = toStringO(r);
   1489   ck_assert_str_eq(s, "{\"1\":true}");
   1490   free(s);
   1491   // path
   1492   createSmallArray(a);
   1493   createSmallDict(d);
   1494   a.f->pushDict(&a, &d);
   1495   self->f->setArray(self, "array", &a);
   1496   r = self->f->setBool(self, "\"array\"[0].\"key\"", false);
   1497   ck_assert_ptr_ne(r, null);
   1498   s = toStringO(r);
   1499   ck_assert_str_eq(s, "{\"1\":true,\"array\":[{\"key\":false}]}");
   1500   free(s);
   1501   // json bool
   1502   freeO(self);
   1503   setTypeBoolO(self);
   1504   r = self->f->setBool(self, "1", true);
   1505   ck_assert_ptr_eq(r, null);
   1506   // json array
   1507   freeO(self);
   1508   setTypeArrayO(self);
   1509   r = self->f->setBool(self, "1", true);
   1510   ck_assert_ptr_eq(r, null);
   1511   // non existing dict path
   1512   freeO(self);
   1513   r = self->f->setBool(self, "\"1\"[1]", true);
   1514   ck_assert_ptr_eq(r, null);
   1515   //   dict path but the object is an array
   1516   resetO(&a);
   1517   self->f->setArray(self, "1", &a);
   1518   r = self->f->setBool(self, "\"1\".\"1\"", true);
   1519   ck_assert_ptr_eq(r, null);
   1520   //   dict object in path but the key doesn't exists
   1521   resetO(&d);
   1522   self->f->setDict(self, "2", &d);
   1523   r = self->f->setBool(self, "\"2\".\"1\".[12]", true);
   1524   ck_assert_ptr_eq(r, null);
   1525   // null key
   1526   r = self->f->setBool(self, null, false);
   1527   ck_assert_ptr_eq(r, null);
   1528   terminateO(self);
   1529 
   1530 }
   1531 
   1532 
   1533 void setDoubleSmallJsonT(CuTest *tc UNUSED) {
   1534 
   1535   smallJsont* r;
   1536   smallJsont *self = allocSmallJson();
   1537 
   1538   r = self->f->setDouble(self, "1", 2.2);
   1539   ck_assert_ptr_ne(r, null);
   1540   char *s = toStringO(r);
   1541   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   1542   free(s);
   1543   // path
   1544   createSmallArray(a);
   1545   createSmallDict(d);
   1546   a.f->pushDict(&a, &d);
   1547   self->f->setArray(self, "array", &a);
   1548   r = self->f->setDouble(self, "\"array\"[0].\"key\"", 1.2);
   1549   ck_assert_ptr_ne(r, null);
   1550   s = toStringO(r);
   1551   ck_assert_str_eq(s, "{\"1\":2.200000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   1552   free(s);
   1553   // json bool
   1554   freeO(self);
   1555   setTypeBoolO(self);
   1556   r = self->f->setDouble(self, "1", 2.2);
   1557   ck_assert_ptr_eq(r, null);
   1558   // json array
   1559   freeO(self);
   1560   setTypeArrayO(self);
   1561   r = self->f->setDouble(self, "1", 2.2);
   1562   ck_assert_ptr_eq(r, null);
   1563   // non existing dict path
   1564   freeO(self);
   1565   r = self->f->setDouble(self, "\"1\"[1]", 2.2);
   1566   ck_assert_ptr_eq(r, null);
   1567   //   dict path but the object is an array
   1568   resetO(&a);
   1569   self->f->setArray(self, "1", &a);
   1570   r = self->f->setDouble(self, "\"1\".\"1\"", 2.2);
   1571   ck_assert_ptr_eq(r, null);
   1572   //   dict object in path but the key doesn't exists
   1573   resetO(&d);
   1574   self->f->setDict(self, "2", &d);
   1575   r = self->f->setDouble(self, "\"2\".\"1\".[12]", 2.2);
   1576   ck_assert_ptr_eq(r, null);
   1577   // null key
   1578   r = self->f->setDouble(self, null, 1);
   1579   ck_assert_ptr_eq(r, null);
   1580   terminateO(self);
   1581 
   1582 }
   1583 
   1584 
   1585 void setIntSmallJsonT(CuTest *tc UNUSED) {
   1586 
   1587   smallJsont* r;
   1588   smallJsont *self = allocSmallJson();
   1589 
   1590   r = self->f->setInt(self, "1", 2);
   1591   ck_assert_ptr_ne(r, null);
   1592   char *s = toStringO(r);
   1593   ck_assert_str_eq(s, "{\"1\":2}");
   1594   free(s);
   1595   // path
   1596   createSmallArray(a);
   1597   createSmallDict(d);
   1598   a.f->pushDict(&a, &d);
   1599   self->f->setArray(self, "array", &a);
   1600   r = self->f->setInt(self, "\"array\"[0].\"key\"", 4);
   1601   ck_assert_ptr_ne(r, null);
   1602   s = toStringO(r);
   1603   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":4}]}");
   1604   free(s);
   1605   // json bool
   1606   freeO(self);
   1607   setTypeBoolO(self);
   1608   r = self->f->setInt(self, "1", 1);
   1609   ck_assert_ptr_eq(r, null);
   1610   // json array
   1611   freeO(self);
   1612   setTypeArrayO(self);
   1613   r = self->f->setInt(self, "1", 1);
   1614   ck_assert_ptr_eq(r, null);
   1615   // non existing dict path
   1616   freeO(self);
   1617   r = self->f->setInt(self, "\"1\"[1]", 1);
   1618   ck_assert_ptr_eq(r, null);
   1619   //   dict path but the object is an array
   1620   resetO(&a);
   1621   self->f->setArray(self, "1", &a);
   1622   r = self->f->setInt(self, "\"1\".\"1\"", 1);
   1623   ck_assert_ptr_eq(r, null);
   1624   //   dict object in path but the key doesn't exists
   1625   resetO(&d);
   1626   self->f->setDict(self, "2", &d);
   1627   r = self->f->setInt(self, "\"2\".\"1\".[12]", 1);
   1628   ck_assert_ptr_eq(r, null);
   1629   // null key
   1630   r = self->f->setInt(self, null, 1);
   1631   ck_assert_ptr_eq(r, null);
   1632   terminateO(self);
   1633 
   1634 }
   1635 
   1636 
   1637 void setSSmallJsonT(CuTest *tc UNUSED) {
   1638 
   1639   smallJsont* r;
   1640   smallJsont *self = allocSmallJson();
   1641 
   1642   r = self->f->setS(self, "1", "qwe");
   1643   ck_assert_ptr_ne(r, null);
   1644   char *s = toStringO(r);
   1645   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   1646   free(s);
   1647   // path
   1648   createSmallArray(a);
   1649   createSmallDict(d);
   1650   a.f->pushDict(&a, &d);
   1651   self->f->setArray(self, "array", &a);
   1652   r = self->f->setS(self, "\"array\"[0].\"key\"", "a");
   1653   ck_assert_ptr_ne(r, null);
   1654   s = toStringO(r);
   1655   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"a\"}]}");
   1656   free(s);
   1657   // json bool
   1658   freeO(self);
   1659   setTypeBoolO(self);
   1660   r = self->f->setS(self, "1", "");
   1661   ck_assert_ptr_eq(r, null);
   1662   // json array
   1663   freeO(self);
   1664   setTypeArrayO(self);
   1665   r = self->f->setS(self, "1", "");
   1666   ck_assert_ptr_eq(r, null);
   1667   // non existing dict path
   1668   freeO(self);
   1669   r = self->f->setS(self, "\"1\"[1]", "");
   1670   ck_assert_ptr_eq(r, null);
   1671   //   dict path but the object is an array
   1672   resetO(&a);
   1673   self->f->setArray(self, "1", &a);
   1674   r = self->f->setS(self, "\"1\".\"1\"", "");
   1675   ck_assert_ptr_eq(r, null);
   1676   //   dict object in path but the key doesn't exists
   1677   resetO(&d);
   1678   self->f->setDict(self, "2", &d);
   1679   r = self->f->setS(self, "\"2\".\"1\".[12]", "");
   1680   ck_assert_ptr_eq(r, null);
   1681   // null value
   1682   r = self->f->setS(self, "1", null);
   1683   ck_assert_ptr_eq(r, null);
   1684   // null key
   1685   r = self->f->setS(self, null, "");
   1686   ck_assert_ptr_eq(r, null);
   1687   terminateO(self);
   1688 
   1689 }
   1690 
   1691 
   1692 void setCharSmallJsonT(CuTest *tc UNUSED) {
   1693 
   1694   smallJsont* r;
   1695   smallJsont *self = allocSmallJson();
   1696 
   1697   r = self->f->setChar(self, "1", 'x');
   1698   ck_assert_ptr_ne(r, null);
   1699   char *s = toStringO(r);
   1700   ck_assert_str_eq(s, "{\"1\":\"x\"}");
   1701   free(s);
   1702   // path
   1703   createSmallArray(a);
   1704   createSmallDict(d);
   1705   a.f->pushDict(&a, &d);
   1706   self->f->setArray(self, "array", &a);
   1707   r = self->f->setChar(self, "\"array\"[0].\"key\"", 'q');
   1708   ck_assert_ptr_ne(r, null);
   1709   s = toStringO(r);
   1710   ck_assert_str_eq(s, "{\"1\":\"x\",\"array\":[{\"key\":\"q\"}]}");
   1711   free(s);
   1712   // json bool
   1713   freeO(self);
   1714   setTypeBoolO(self);
   1715   r = self->f->setChar(self, "1", 'c');
   1716   ck_assert_ptr_eq(r, null);
   1717   // json array
   1718   freeO(self);
   1719   setTypeArrayO(self);
   1720   r = self->f->setChar(self, "1", 'x');
   1721   ck_assert_ptr_eq(r, null);
   1722   // non existing dict path
   1723   freeO(self);
   1724   r = self->f->setChar(self, "\"1\"[1]", 'x');
   1725   ck_assert_ptr_eq(r, null);
   1726   //   dict path but the object is an array
   1727   resetO(&a);
   1728   self->f->setArray(self, "1", &a);
   1729   r = self->f->setChar(self, "\"1\".\"1\"", 'q');
   1730   ck_assert_ptr_eq(r, null);
   1731   //   dict object in path but the key doesn't exists
   1732   resetO(&d);
   1733   self->f->setDict(self, "2", &d);
   1734   r = self->f->setChar(self, "\"2\".\"1\".[12]", 'q');
   1735   ck_assert_ptr_eq(r, null);
   1736   // null key
   1737   r = self->f->setChar(self, null, '1');
   1738   ck_assert_ptr_eq(r, null);
   1739   terminateO(self);
   1740 
   1741 }
   1742 
   1743 
   1744 void setDictSmallJsonT(CuTest *tc UNUSED) {
   1745 
   1746   smallJsont* r;
   1747   smallJsont *self = allocSmallJson();
   1748   smallDictt *dict = allocSmallDict();
   1749 
   1750   // empty dict
   1751   r = self->f->setDict(self, "1", dict);
   1752   ck_assert_ptr_ne(r, null);
   1753   finishO(dict);
   1754   char *s = toStringO(r);
   1755   ck_assert_str_eq(s, "{\"1\":{}}");
   1756   free(s);
   1757   // set dict
   1758   dict = allocSmallDict();
   1759   dict->f->setS(dict, "a", "zxc");
   1760   r = self->f->setDict(self, "1", dict);
   1761   ck_assert_ptr_ne(r, null);
   1762   finishO(dict);
   1763   s = toStringO(r);
   1764   ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"}}");
   1765   free(s);
   1766   // non smallDict object
   1767   dict = (smallDictt*) allocSmallInt(2);
   1768   r = self->f->setDict(self, "1", dict);
   1769   ck_assert_ptr_eq(r, null);
   1770   terminateO(dict);
   1771   // path
   1772   dict = allocSmallDict();
   1773   createSmallArray(a);
   1774   createSmallDict(d);
   1775   a.f->pushDict(&a, &d);
   1776   self->f->setArray(self, "array", &a);
   1777   r = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
   1778   ck_assert_ptr_ne(r, null);
   1779   finishO(dict);
   1780   s = toStringO(r);
   1781   ck_assert_str_eq(s, "{\"1\":{\"a\":\"zxc\"},\"array\":[{\"key\":{}}]}");
   1782   free(s);
   1783   // json bool
   1784   freeO(self);
   1785   setTypeBoolO(self);
   1786   dict = allocSmallDict();
   1787   r = self->f->setDict(self, "1", dict);
   1788   ck_assert_ptr_eq(r, null);
   1789   // json array
   1790   freeO(self);
   1791   setTypeArrayO(self);
   1792   r = self->f->setDict(self, "1", dict);
   1793   ck_assert_ptr_eq(r, null);
   1794   // non existing dict path
   1795   freeO(self);
   1796   r = self->f->setDict(self, "\"1\"[1]", dict);
   1797   ck_assert_ptr_eq(r, null);
   1798   //   dict path but the object is an array
   1799   resetO(&a);
   1800   self->f->setArray(self, "1", &a);
   1801   r = self->f->setDict(self, "\"1\".\"1\"", dict);
   1802   ck_assert_ptr_eq(r, null);
   1803   //   dict object in path but the key doesn't exists
   1804   resetO(&d);
   1805   self->f->setDict(self, "2", &d);
   1806   r = self->f->setDict(self, "\"2\".\"1\".[12]", dict);
   1807   ck_assert_ptr_eq(r, null);
   1808   // null value
   1809   r = self->f->setDict(self, "1", null);
   1810   ck_assert_ptr_eq(r, null);
   1811   // null key
   1812   r = self->f->setDict(self, null, dict);
   1813   ck_assert_ptr_eq(r, null);
   1814   terminateO(dict);
   1815   terminateO(self);
   1816 
   1817 }
   1818 
   1819 
   1820 void setArraySmallJsonT(CuTest *tc UNUSED) {
   1821 
   1822   smallJsont* r;
   1823   smallJsont *self   = allocSmallJson();
   1824   smallArrayt *array = allocSmallArray();
   1825 
   1826   // empty array
   1827   r = self->f->setArray(self, "1", array);
   1828   ck_assert_ptr_ne(r, null);
   1829   finishO(array);
   1830   char *s = toStringO(r);
   1831   ck_assert_str_eq(s, "{\"1\":[]}");
   1832   free(s);
   1833   // set array
   1834   array = allocSmallArray();
   1835   array->f->pushS(array, "zxc");
   1836   r = self->f->setArray(self, "1", array);
   1837   ck_assert_ptr_ne(r, null);
   1838   finishO(array);
   1839   s = toStringO(r);
   1840   ck_assert_str_eq(s, "{\"1\":[\"zxc\"]}");
   1841   free(s);
   1842   // non smallArray object
   1843   array = (smallArrayt*) allocSmallInt(2);
   1844   r = self->f->setArray(self, "1", array);
   1845   ck_assert_ptr_eq(r, null);
   1846   terminateO(array);
   1847   // path
   1848   array = allocSmallArray();
   1849   createSmallArray(a);
   1850   createSmallDict(d);
   1851   a.f->pushDict(&a, &d);
   1852   self->f->setArray(self, "array", &a);
   1853   r = self->f->setArray(self, "\"array\"[0].\"key\"", array);
   1854   ck_assert_ptr_ne(r, null);
   1855   s = toStringO(r);
   1856   ck_assert_str_eq(s, "{\"1\":[\"zxc\"],\"array\":[{\"key\":[]}]}");
   1857   free(s);
   1858   // json bool
   1859   freeO(self);
   1860   setTypeBoolO(self);
   1861   r = self->f->setArray(self, "1", array);
   1862   ck_assert_ptr_eq(r, null);
   1863   // json array
   1864   freeO(self);
   1865   setTypeArrayO(self);
   1866   r = self->f->setArray(self, "1", array);
   1867   ck_assert_ptr_eq(r, null);
   1868   // non existing dict path
   1869   freeO(self);
   1870   r = self->f->setArray(self, "\"1\"[1]", array);
   1871   ck_assert_ptr_eq(r, null);
   1872   //   dict path but the object is an array
   1873   resetO(&a);
   1874   self->f->setArray(self, "1", &a);
   1875   r = self->f->setArray(self, "\"1\".\"1\"", array);
   1876   ck_assert_ptr_eq(r, null);
   1877   //   dict object in path but the key doesn't exists
   1878   resetO(&d);
   1879   self->f->setDict(self, "2", &d);
   1880   r = self->f->setArray(self, "\"2\".\"1\".[12]", array);
   1881   ck_assert_ptr_eq(r, null);
   1882   // null value
   1883   r = self->f->setArray(self, "1", null);
   1884   ck_assert_ptr_eq(r, null);
   1885   // null key
   1886   r = self->f->setArray(self, null, array);
   1887   ck_assert_ptr_eq(r, null);
   1888   finishO(array);
   1889   terminateO(self);
   1890 
   1891 }
   1892 
   1893 
   1894 void setArraycSmallJsonT(CuTest *tc UNUSED) {
   1895 
   1896   smallJsont* r;
   1897   smallJsont *self = allocSmallJson();
   1898   char **array     = listCreateS("a", "b");
   1899 
   1900   r = self->f->setArrayc(self, "1", array);
   1901   ck_assert_ptr_ne(r, null);
   1902   char *s = toStringO(r);
   1903   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
   1904   free(s);
   1905   // zero element list
   1906   char *e0 = array[0];
   1907   array[0] = null;
   1908   r = self->f->setArrayc(self, "1", array);
   1909   ck_assert_ptr_ne(r, null);
   1910   array[0] = e0;
   1911   listFreeS(array);
   1912   s = toStringO(r);
   1913   ck_assert_str_eq(s, "{\"1\":[]}");
   1914   free(s);
   1915   // path
   1916   array = listCreateS("1", "2");
   1917   createSmallArray(a);
   1918   createSmallDict(d);
   1919   a.f->pushDict(&a, &d);
   1920   self->f->setArray(self, "array", &a);
   1921   r = self->f->setArrayc(self, "\"array\"[0].\"key\"", array);
   1922   ck_assert_ptr_ne(r, null);
   1923   s = toStringO(r);
   1924   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[\"1\",\"2\"]}]}");
   1925   free(s);
   1926   // json bool
   1927   freeO(self);
   1928   setTypeBoolO(self);
   1929   r = self->f->setArrayc(self, "1", array);
   1930   ck_assert_ptr_eq(r, null);
   1931   // json array
   1932   freeO(self);
   1933   setTypeArrayO(self);
   1934   r = self->f->setArrayc(self, "1", array);
   1935   ck_assert_ptr_eq(r, null);
   1936   // non existing dict path
   1937   freeO(self);
   1938   r = self->f->setArrayc(self, "\"1\"[1]", array);
   1939   ck_assert_ptr_eq(r, null);
   1940   //   dict path but the object is an array
   1941   resetO(&a);
   1942   self->f->setArray(self, "1", &a);
   1943   r = self->f->setArrayc(self, "\"1\".\"1\"", array);
   1944   ck_assert_ptr_eq(r, null);
   1945   //   dict object in path but the key doesn't exists
   1946   resetO(&d);
   1947   self->f->setDict(self, "2", &d);
   1948   r = self->f->setArrayc(self, "\"2\".\"1\".[12]", array);
   1949   ck_assert_ptr_eq(r, null);
   1950   // null value
   1951   r = self->f->setArrayc(self, "1", null);
   1952   ck_assert_ptr_eq(r, null);
   1953   // null key
   1954   r = self->f->setArrayc(self, null, array);
   1955   ck_assert_ptr_eq(r, null);
   1956   listFreeS(array);
   1957   terminateO(self);
   1958 
   1959 }
   1960 
   1961 
   1962 void setSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   1963 
   1964   smallJsont* r;
   1965   smallJsont *self  = allocSmallJson();
   1966   smallBoolt *value = allocSmallBool(true);
   1967 
   1968   r = self->f->setSmallBool(self, "1", value);
   1969   ck_assert_ptr_ne(r, null);
   1970   char *s = toStringO(r);
   1971   ck_assert_str_eq(s, "{\"1\":true}");
   1972   free(s);
   1973   // empty smallBool
   1974   value->value = null;
   1975   r = self->f->setSmallBool(self, "1", value);
   1976   ck_assert_ptr_ne(r, null);
   1977   finishO(value);
   1978   s = toStringO(r);
   1979   ck_assert_str_eq(s, "{\"1\":false}");
   1980   free(s);
   1981   // non smallBool object
   1982   value = (smallBoolt*) allocSmallInt(2);
   1983   r = self->f->setSmallBool(self, "1", value);
   1984   ck_assert_ptr_eq(r, null);
   1985   terminateO(value);
   1986   // path
   1987   value = allocSmallBool(true);
   1988   createSmallArray(a);
   1989   createSmallDict(d);
   1990   a.f->pushDict(&a, &d);
   1991   self->f->setArray(self, "array", &a);
   1992   r = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
   1993   ck_assert_ptr_ne(r, null);
   1994   s = toStringO(r);
   1995   ck_assert_str_eq(s, "{\"1\":false,\"array\":[{\"key\":true}]}");
   1996   free(s);
   1997   // json bool
   1998   freeO(self);
   1999   setTypeBoolO(self);
   2000   r = self->f->setSmallBool(self, "1", value);
   2001   ck_assert_ptr_eq(r, null);
   2002   // json array
   2003   freeO(self);
   2004   setTypeArrayO(self);
   2005   r = self->f->setSmallBool(self, "1", value);
   2006   ck_assert_ptr_eq(r, null);
   2007   // non existing dict path
   2008   freeO(self);
   2009   r = self->f->setSmallBool(self, "\"1\"[1]", value);
   2010   ck_assert_ptr_eq(r, null);
   2011   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2012   createSmallBool(i);
   2013   r = self->f->setSmallBool(self, "\"1\".[1]", &i);
   2014   ck_assert_ptr_eq(r, null);
   2015   freeO(&i);
   2016   //   dict path but the object is an array
   2017   resetO(&a);
   2018   self->f->setArray(self, "1", &a);
   2019   r = self->f->setSmallBool(self, "\"1\".\"1\"", value);
   2020   ck_assert_ptr_eq(r, null);
   2021   //   dict object in path but the key doesn't exists
   2022   resetO(&d);
   2023   self->f->setDict(self, "2", &d);
   2024   r = self->f->setSmallBool(self, "\"2\".\"1\".[12]", value);
   2025   ck_assert_ptr_eq(r, null);
   2026   // null value
   2027   r = self->f->setSmallBool(self, "1", null);
   2028   ck_assert_ptr_eq(r, null);
   2029   // null key
   2030   r = self->f->setSmallBool(self, null, value);
   2031   ck_assert_ptr_eq(r, null);
   2032   finishO(value);
   2033   terminateO(self);
   2034 
   2035 }
   2036 
   2037 
   2038 void setSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   2039 
   2040   smallJsont* r;
   2041   smallJsont *self   = allocSmallJson();
   2042   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
   2043 
   2044   r = self->f->setSmallBytes(self, "1", value);
   2045   ck_assert_ptr_ne(r, null);
   2046   char *s = toStringO(r);
   2047   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
   2048   free(s);
   2049   // empty smallBytes
   2050   value->B = null;
   2051   r = self->f->setSmallBytes(self, "1", value);
   2052   ck_assert_ptr_ne(r, null);
   2053   finishO(value);
   2054   s = toStringO(r);
   2055   ck_assert_str_eq(s, "{\"1\":[]}");
   2056   free(s);
   2057   // non smallBytes object
   2058   value = (smallBytest*) allocSmallInt(2);
   2059   r = self->f->setSmallBytes(self, "1", value);
   2060   ck_assert_ptr_eq(r, null);
   2061   terminateO(value);
   2062   // path
   2063   value = allocSmallBytes("qwf", sizeof("qwf"));
   2064   createSmallArray(a);
   2065   createSmallDict(d);
   2066   a.f->pushDict(&a, &d);
   2067   self->f->setArray(self, "array", &a);
   2068   r = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
   2069   ck_assert_ptr_ne(r, null);
   2070   s = toStringO(r);
   2071   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[0x71,0x77,0x66,0x00]}]}");
   2072   free(s);
   2073   // json bool
   2074   freeO(self);
   2075   setTypeBoolO(self);
   2076   r = self->f->setSmallBytes(self, "1", value);
   2077   ck_assert_ptr_eq(r, null);
   2078   // json array
   2079   freeO(self);
   2080   setTypeArrayO(self);
   2081   r = self->f->setSmallBytes(self, "1", value);
   2082   ck_assert_ptr_eq(r, null);
   2083   // non existing dict path
   2084   freeO(self);
   2085   r = self->f->setSmallBytes(self, "\"1\"[1]", value);
   2086   ck_assert_ptr_eq(r, null);
   2087   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2088   createSmallBytes(i);
   2089   r = self->f->setSmallBytes(self, "\"1\".[1]", &i);
   2090   ck_assert_ptr_eq(r, null);
   2091   freeO(&i);
   2092   //   dict path but the object is an array
   2093   resetO(&a);
   2094   self->f->setArray(self, "1", &a);
   2095   r = self->f->setSmallBytes(self, "\"1\".\"1\"", value);
   2096   ck_assert_ptr_eq(r, null);
   2097   //   dict object in path but the key doesn't exists
   2098   resetO(&d);
   2099   self->f->setDict(self, "2", &d);
   2100   r = self->f->setSmallBytes(self, "\"2\".\"1\".[12]", value);
   2101   ck_assert_ptr_eq(r, null);
   2102   // null value
   2103   r = self->f->setSmallBytes(self, "1", null);
   2104   ck_assert_ptr_eq(r, null);
   2105   // null key
   2106   r = self->f->setSmallBytes(self, null, value);
   2107   ck_assert_ptr_eq(r, null);
   2108   finishO(value);
   2109   terminateO(self);
   2110 
   2111 }
   2112 
   2113 
   2114 void setSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   2115 
   2116   smallJsont* r;
   2117   smallJsont *self    = allocSmallJson();
   2118   smallDoublet *value = allocSmallDouble(2.2);
   2119 
   2120   r = self->f->setSmallDouble(self, "1", value);
   2121   ck_assert_ptr_ne(r, null);
   2122   char *s = toStringO(r);
   2123   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   2124   free(s);
   2125   // empty smallDouble
   2126   value->value = null;
   2127   r = self->f->setSmallDouble(self, "1", value);
   2128   ck_assert_ptr_ne(r, null);
   2129   finishO(value);
   2130   s = toStringO(r);
   2131   ck_assert_str_eq(s, "{\"1\":0.000000e+00}");
   2132   free(s);
   2133   // non smallDouble object
   2134   value = (smallDoublet*) allocSmallInt(2);
   2135   r = self->f->setSmallDouble(self, "1", value);
   2136   ck_assert_ptr_eq(r, null);
   2137   terminateO(value);
   2138   // path
   2139   value = allocSmallDouble(1.2);
   2140   createSmallArray(a);
   2141   createSmallDict(d);
   2142   a.f->pushDict(&a, &d);
   2143   self->f->setArray(self, "array", &a);
   2144   r = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
   2145   ck_assert_ptr_ne(r, null);
   2146   s = toStringO(r);
   2147   ck_assert_str_eq(s, "{\"1\":0.000000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   2148   free(s);
   2149   // json bool
   2150   freeO(self);
   2151   setTypeBoolO(self);
   2152   r = self->f->setSmallDouble(self, "1", value);
   2153   ck_assert_ptr_eq(r, null);
   2154   // json array
   2155   freeO(self);
   2156   setTypeArrayO(self);
   2157   r = self->f->setSmallDouble(self, "1", value);
   2158   ck_assert_ptr_eq(r, null);
   2159   // non existing dict path
   2160   freeO(self);
   2161   r = self->f->setSmallDouble(self, "\"1\"[1]", value);
   2162   ck_assert_ptr_eq(r, null);
   2163   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2164   createSmallDouble(i);
   2165   r = self->f->setSmallDouble(self, "\"1\".[1]", &i);
   2166   ck_assert_ptr_eq(r, null);
   2167   freeO(&i);
   2168   //   dict path but the object is an array
   2169   resetO(&a);
   2170   self->f->setArray(self, "1", &a);
   2171   r = self->f->setSmallDouble(self, "\"1\".\"1\"", value);
   2172   ck_assert_ptr_eq(r, null);
   2173   //   dict object in path but the key doesn't exists
   2174   resetO(&d);
   2175   self->f->setDict(self, "2", &d);
   2176   r = self->f->setSmallDouble(self, "\"2\".\"1\".[12]", value);
   2177   ck_assert_ptr_eq(r, null);
   2178   // null value
   2179   r = self->f->setSmallDouble(self, "1", null);
   2180   ck_assert_ptr_eq(r, null);
   2181   // null key
   2182   r = self->f->setSmallDouble(self, null, value);
   2183   ck_assert_ptr_eq(r, null);
   2184   finishO(value);
   2185   terminateO(self);
   2186 
   2187 }
   2188 
   2189 
   2190 void setSmallIntSmallJsonT(CuTest *tc UNUSED) {
   2191 
   2192   smallJsont* r;
   2193   smallJsont *self = allocSmallJson();
   2194   smallIntt *value = allocSmallInt(2);
   2195 
   2196   r = self->f->setSmallInt(self, "1", value);
   2197   ck_assert_ptr_ne(r, null);
   2198   char *s = toStringO(r);
   2199   ck_assert_str_eq(s, "{\"1\":2}");
   2200   free(s);
   2201   // empty smallInt
   2202   value->value = null;
   2203   r = self->f->setSmallInt(self, "1", value);
   2204   ck_assert_ptr_ne(r, null);
   2205   finishO(value);
   2206   s = toStringO(r);
   2207   ck_assert_str_eq(s, "{\"1\":0}");
   2208   free(s);
   2209   // non smallInt object
   2210   value = (smallIntt*) allocSmallBool(true);
   2211   r = self->f->setSmallInt(self, "1", value);
   2212   ck_assert_ptr_eq(r, null);
   2213   terminateO(value);
   2214   // path
   2215   value = allocSmallInt(1);
   2216   createSmallArray(a);
   2217   createSmallDict(d);
   2218   a.f->pushDict(&a, &d);
   2219   self->f->setArray(self, "array", &a);
   2220   r = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
   2221   ck_assert_ptr_ne(r, null);
   2222   s = toStringO(r);
   2223   ck_assert_str_eq(s, "{\"1\":0,\"array\":[{\"key\":1}]}");
   2224   free(s);
   2225   // json bool
   2226   freeO(self);
   2227   setTypeBoolO(self);
   2228   r = self->f->setSmallInt(self, "1", value);
   2229   ck_assert_ptr_eq(r, null);
   2230   // json array
   2231   freeO(self);
   2232   setTypeArrayO(self);
   2233   r = self->f->setSmallInt(self, "1", value);
   2234   ck_assert_ptr_eq(r, null);
   2235   // non existing dict path
   2236   freeO(self);
   2237   r = self->f->setSmallInt(self, "\"1\"[1]", value);
   2238   ck_assert_ptr_eq(r, null);
   2239   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2240   createSmallInt(i);
   2241   r = self->f->setSmallInt(self, "\"1\".[1]", &i);
   2242   freeO(&i);
   2243   ck_assert_ptr_eq(r, null);
   2244   //   dict path but the object is an array
   2245   resetO(&a);
   2246   self->f->setArray(self, "1", &a);
   2247   r = self->f->setSmallInt(self, "\"1\".\"1\"", value);
   2248   ck_assert_ptr_eq(r, null);
   2249   //   dict object in path but the key doesn't exists
   2250   resetO(&d);
   2251   self->f->setDict(self, "2", &d);
   2252   r = self->f->setSmallInt(self, "\"2\".\"1\".[12]", value);
   2253   ck_assert_ptr_eq(r, null);
   2254   // null value
   2255   r = self->f->setSmallInt(self, "1", null);
   2256   ck_assert_ptr_eq(r, null);
   2257   // null key
   2258   r = self->f->setSmallInt(self, null, value);
   2259   ck_assert_ptr_eq(r, null);
   2260   finishO(value);
   2261   terminateO(self);
   2262 
   2263 }
   2264 
   2265 
   2266 void setSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   2267 
   2268   smallJsont* r;
   2269   smallJsont *self = allocSmallJson();
   2270   smallJsont *value = allocSmallJson();
   2271 
   2272   setTopIntO(value, 2);
   2273   r = self->f->setSmallJson(self, "1", value);
   2274   ck_assert_ptr_ne(r, null);
   2275   char *s = toStringO(r);
   2276   ck_assert_str_eq(s, "{\"1\":2}");
   2277   free(s);
   2278   // empty smallJson
   2279   resetO(value);
   2280   r = self->f->setSmallJson(self, "1", value);
   2281   ck_assert_ptr_ne(r, null);
   2282   finishO(value);
   2283   s = toStringO(r);
   2284   ck_assert_str_eq(s, "{\"1\":{}}");
   2285   free(s);
   2286   // non smallJson object
   2287   value = (smallJsont*) allocSmallInt(2);
   2288   r = self->f->setSmallJson(self, "1", value);
   2289   ck_assert_ptr_eq(r, null);
   2290   terminateO(value);
   2291   // path
   2292   value = allocSmallJson();
   2293   createSmallArray(a);
   2294   createSmallDict(d);
   2295   a.f->pushDict(&a, &d);
   2296   self->f->setArray(self, "array", &a);
   2297   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
   2298   ck_assert_ptr_ne(r, null);
   2299   s = toStringO(r);
   2300   ck_assert_str_eq(s, "{\"1\":{},\"array\":[{\"key\":{}}]}");
   2301   free(s);
   2302   // json bool
   2303   freeO(self);
   2304   setTypeBoolO(self);
   2305   r = self->f->setSmallJson(self, "1", value);
   2306   ck_assert_ptr_eq(r, null);
   2307   // json array
   2308   freeO(self);
   2309   setTypeArrayO(self);
   2310   r = self->f->setSmallJson(self, "1", value);
   2311   ck_assert_ptr_eq(r, null);
   2312   // non existing dict path
   2313   freeO(self);
   2314   r = self->f->setSmallJson(self, "\"1\"[1]", value);
   2315   ck_assert_ptr_eq(r, null);
   2316   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2317   createSmallJson(i);
   2318   r = self->f->setSmallJson(self, "\"1\".[1]", &i);
   2319   ck_assert_ptr_eq(r, null);
   2320   freeO(&i);
   2321   //   dict path but the object is an array
   2322   resetO(&a);
   2323   self->f->setArray(self, "1", &a);
   2324   r = self->f->setSmallJson(self, "\"1\".\"1\"", value);
   2325   ck_assert_ptr_eq(r, null);
   2326   //   dict object in path but the key doesn't exists
   2327   resetO(&d);
   2328   self->f->setDict(self, "2", &d);
   2329   r = self->f->setSmallJson(self, "\"2\".\"1\".[12]", value);
   2330   ck_assert_ptr_eq(r, null);
   2331   // null value
   2332   r = self->f->setSmallJson(self, "1", null);
   2333   ck_assert_ptr_eq(r, null);
   2334   // null key
   2335   r = self->f->setSmallJson(self, null, value);
   2336   ck_assert_ptr_eq(r, null);
   2337   finishO(value);
   2338   terminateO(self);
   2339 
   2340 }
   2341 
   2342 
   2343 void setSmallStringSmallJsonT(CuTest *tc UNUSED) {
   2344 
   2345   smallJsont* r;
   2346   smallJsont *self     = allocSmallJson();
   2347   smallStringt *string = allocSmallString("qwe");
   2348 
   2349   r = self->f->setSmallString(self, "1", string);
   2350   ck_assert_ptr_ne(r, null);
   2351   char *s = toStringO(r);
   2352   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   2353   free(s);
   2354   // empty smallString
   2355   string->data = null;
   2356   r = self->f->setSmallString(self, "1", string);
   2357   ck_assert_ptr_ne(r, null);
   2358   finishO(string);
   2359   s = toStringO(r);
   2360   ck_assert_str_eq(s, "{\"1\":\"\"}");
   2361   free(s);
   2362   // non smallString object
   2363   string = (smallStringt*) allocSmallInt(2);
   2364   r = self->f->setSmallString(self, "1", string);
   2365   ck_assert_ptr_eq(r, null);
   2366   terminateO(string);
   2367   // path
   2368   smallStringt *value = allocSmallString("asd");
   2369   createSmallArray(a);
   2370   createSmallDict(d);
   2371   a.f->pushDict(&a, &d);
   2372   self->f->setArray(self, "array", &a);
   2373   r = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
   2374   ck_assert_ptr_ne(r, null);
   2375   s = toStringO(r);
   2376   ck_assert_str_eq(s, "{\"1\":\"\",\"array\":[{\"key\":\"asd\"}]}");
   2377   free(s);
   2378   // json bool
   2379   freeO(self);
   2380   setTypeBoolO(self);
   2381   r = self->f->setSmallString(self, "1", value);
   2382   ck_assert_ptr_eq(r, null);
   2383   // json array
   2384   freeO(self);
   2385   setTypeArrayO(self);
   2386   r = self->f->setSmallString(self, "1", value);
   2387   ck_assert_ptr_eq(r, null);
   2388   // non existing dict path
   2389   freeO(self);
   2390   r = self->f->setSmallString(self, "\"1\"[1]", value);
   2391   ck_assert_ptr_eq(r, null);
   2392   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2393   createSmallString(i);
   2394   r = self->f->setSmallString(self, "\"1\".[1]", &i);
   2395   ck_assert_ptr_eq(r, null);
   2396   freeO(&i);
   2397   //   dict path but the object is an array
   2398   resetO(&a);
   2399   self->f->setArray(self, "1", &a);
   2400   r = self->f->setSmallString(self, "\"1\".\"1\"", value);
   2401   ck_assert_ptr_eq(r, null);
   2402   //   dict object in path but the key doesn't exists
   2403   resetO(&d);
   2404   self->f->setDict(self, "2", &d);
   2405   r = self->f->setSmallString(self, "\"2\".\"1\".[12]", value);
   2406   ck_assert_ptr_eq(r, null);
   2407   // null value
   2408   r = self->f->setSmallString(self, "1", null);
   2409   ck_assert_ptr_eq(r, null);
   2410   // null key
   2411   r = self->f->setSmallString(self, null, string);
   2412   ck_assert_ptr_eq(r, null);
   2413   finishO(value);
   2414   terminateO(self);
   2415 
   2416 }
   2417 
   2418 
   2419 void setSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   2420 
   2421   smallJsont* r;
   2422   smallJsont *self           = allocSmallJson();
   2423   smallContainert *container = allocSmallContainer(null);
   2424 
   2425   r = self->f->setSmallContainer(self, "1", container);
   2426   ck_assert_ptr_ne(r, null);
   2427   char *s = toStringO(r);
   2428   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2429   free(s);
   2430   // empty smallContainer
   2431   container->data = null;
   2432   r = self->f->setSmallContainer(self, "1", container);
   2433   ck_assert_ptr_ne(r, null);
   2434   finishO(container);
   2435   s = toStringO(r);
   2436   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2437   free(s);
   2438   // non smallContainer object
   2439   container = (smallContainert*) allocSmallInt(2);
   2440   r = self->f->setSmallContainer(self, "1", container);
   2441   ck_assert_ptr_eq(r, null);
   2442   terminateO(container);
   2443   // path
   2444   smallContainert *value = allocSmallContainer(null);
   2445   createSmallArray(a);
   2446   createSmallDict(d);
   2447   a.f->pushDict(&a, &d);
   2448   self->f->setArray(self, "array", &a);
   2449   r = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
   2450   ck_assert_ptr_ne(r, null);
   2451   s = toStringO(r);
   2452   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":\"<data container>\"}]}");
   2453   free(s);
   2454   // json bool
   2455   freeO(self);
   2456   setTypeBoolO(self);
   2457   r = self->f->setSmallContainer(self, "1", value);
   2458   ck_assert_ptr_eq(r, null);
   2459   // json array
   2460   freeO(self);
   2461   setTypeArrayO(self);
   2462   r = self->f->setSmallContainer(self, "1", value);
   2463   ck_assert_ptr_eq(r, null);
   2464   // non existing dict path
   2465   freeO(self);
   2466   r = self->f->setSmallContainer(self, "\"1\"[1]", value);
   2467   ck_assert_ptr_eq(r, null);
   2468   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2469   createSmallContainer(i);
   2470   r = self->f->setSmallContainer(self, "\"1\".[1]", &i);
   2471   ck_assert_ptr_eq(r, null);
   2472   freeO(&i);
   2473   //   dict path but the object is an array
   2474   resetO(&a);
   2475   self->f->setArray(self, "1", &a);
   2476   r = self->f->setSmallContainer(self, "\"1\".\"1\"", value);
   2477   ck_assert_ptr_eq(r, null);
   2478   //   dict object in path but the key doesn't exists
   2479   resetO(&d);
   2480   self->f->setDict(self, "2", &d);
   2481   r = self->f->setSmallContainer(self, "\"2\".\"1\".[12]", value);
   2482   ck_assert_ptr_eq(r, null);
   2483   // null value
   2484   r = self->f->setSmallContainer(self, "1", null);
   2485   ck_assert_ptr_eq(r, null);
   2486   // null key
   2487   r = self->f->setSmallContainer(self, null, container);
   2488   ck_assert_ptr_eq(r, null);
   2489   finishO(value);
   2490   terminateO(self);
   2491 
   2492 }
   2493 
   2494 
   2495 void setNFreeSmallJsonT(CuTest *tc UNUSED) {
   2496 
   2497   smallJsont* r;
   2498   smallJsont *self = allocSmallJson();
   2499   baset *value;
   2500 
   2501   // undefined object
   2502   value   = (baset*)allocUndefined();
   2503   r = self->f->setNFree(self, "1", value);
   2504   ck_assert_ptr_ne(r, null);
   2505   char *s = toStringO(r);
   2506   ck_assert_str_eq(s, "{\"1\":null}");
   2507   free(s);
   2508   // container
   2509   createAllocateSmallContainer(c);
   2510   r = self->f->setNFree(self, "1", (baset*)c);
   2511   ck_assert_ptr_ne(r, null);
   2512   s = toStringO(r);
   2513   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2514   free(s);
   2515   // base object in container
   2516   createAllocateSmallInt(I);
   2517   setValG(I, 11);
   2518   I->type = "anothertype";
   2519   r = self->f->setNFree(self, "1", (baset*)I);
   2520   ck_assert_ptr_ne(r, null);
   2521   s = toStringO(r);
   2522   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   2523   free(s);
   2524   // path
   2525   value = (baset*) allocSmallInt(2);
   2526   createSmallArray(a);
   2527   createSmallDict(d);
   2528   a.f->pushDict(&a, &d);
   2529   self->f->setArray(self, "array", &a);
   2530   r = self->f->setNFree(self, "\"array\"[0].\"key\"", value);
   2531   ck_assert_ptr_ne(r, null);
   2532   s = toStringO(r);
   2533   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":2}]}");
   2534   free(s);
   2535   // json bool
   2536   freeO(self);
   2537   setTypeBoolO(self);
   2538   value = (baset*) allocSmallInt(2);
   2539   r = self->f->setNFree(self, "1", value);
   2540   ck_assert_ptr_eq(r, null);
   2541   // json array
   2542   freeO(self);
   2543   setTypeArrayO(self);
   2544   r = self->f->setNFree(self, "1", value);
   2545   ck_assert_ptr_eq(r, null);
   2546   // non existing dict path
   2547   freeO(self);
   2548   r = self->f->setNFree(self, "\"1\"[1]", value);
   2549   ck_assert_ptr_eq(r, null);
   2550   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   2551   createSmallInt(i);
   2552   r = self->f->setNFree(self, "\"1\".[1]", (baset*)&i);
   2553   ck_assert_ptr_eq(r, null);
   2554   freeO(&i);
   2555   //    wrong path and user class
   2556   i.type = "myclass";
   2557   r = self->f->setNFree(self, "\"1\".[1]", (baset*)&i);
   2558   ck_assert_ptr_eq(r, null);
   2559   //   dict path but the object is an array
   2560   resetO(&a);
   2561   self->f->setArray(self, "1", &a);
   2562   r = self->f->setNFree(self, "\"1\".\"1\"", value);
   2563   ck_assert_ptr_eq(r, null);
   2564   //   dict object in path but the key doesn't exists
   2565   resetO(&d);
   2566   self->f->setDict(self, "2", &d);
   2567   r = self->f->setNFree(self, "\"2\".\"1\".[12]", value);
   2568   ck_assert_ptr_eq(r, null);
   2569   terminateO(value);
   2570   // null value
   2571   r = self->f->setNFree(self, "1", null);
   2572   ck_assert_ptr_eq(r, null);
   2573   // null key
   2574   r = self->f->setNFree(self, null, value);
   2575   ck_assert_ptr_eq(r, null);
   2576   terminateO(self);
   2577 
   2578 }
   2579 
   2580 
   2581 void setNFreeUndefinedSmallJsonT(CuTest *tc UNUSED) {
   2582 
   2583   smallJsont* r;
   2584   smallJsont *self      = allocSmallJson();
   2585   undefinedt *undefined = allocUndefined();
   2586 
   2587   r = self->f->setNFreeUndefined(self, "1", undefined);
   2588   ck_assert_ptr_ne(r, null);
   2589   char *s = toStringO(r);
   2590   ck_assert_str_eq(s, "{\"1\":null}");
   2591   free(s);
   2592   // path
   2593   undefined = allocUndefined();
   2594   createSmallArray(a);
   2595   createSmallDict(d);
   2596   a.f->pushDict(&a, &d);
   2597   self->f->setArray(self, "array", &a);
   2598   r = self->f->setNFreeUndefined(self, "\"array\"[0].\"key\"", undefined);
   2599   ck_assert_ptr_ne(r, null);
   2600   s = toStringO(r);
   2601   ck_assert_str_eq(s, "{\"1\":null,\"array\":[{\"key\":null}]}");
   2602   free(s);
   2603   // json bool
   2604   freeO(self);
   2605   setTypeBoolO(self);
   2606   undefined = allocUndefined();
   2607   r = self->f->setNFreeUndefined(self, "1", undefined);
   2608   ck_assert_ptr_eq(r, null);
   2609   // json array
   2610   freeO(self);
   2611   setTypeArrayO(self);
   2612   r = self->f->setNFreeUndefined(self, "1", undefined);
   2613   ck_assert_ptr_eq(r, null);
   2614   // non existing dict path
   2615   freeO(self);
   2616   r = self->f->setNFreeUndefined(self, "\"1\"[1]", undefined);
   2617   ck_assert_ptr_eq(r, null);
   2618   //   dict path but the object is an array
   2619   resetO(&a);
   2620   self->f->setArray(self, "1", &a);
   2621   r = self->f->setNFreeUndefined(self, "\"1\".\"1\"", undefined);
   2622   ck_assert_ptr_eq(r, null);
   2623   //   dict object in path but the key doesn't exists
   2624   resetO(&d);
   2625   self->f->setDict(self, "2", &d);
   2626   r = self->f->setNFreeUndefined(self, "\"2\".\"1\".[12]", undefined);
   2627   ck_assert_ptr_eq(r, null);
   2628   terminateO(undefined);
   2629   // null value
   2630   r = self->f->setNFreeUndefined(self, "1", null);
   2631   ck_assert_ptr_eq(r, null);
   2632   // null key
   2633   undefined = allocUndefined();
   2634   r = self->f->setNFreeUndefined(self, null, undefined);
   2635   ck_assert_ptr_eq(r, null);
   2636   terminateO(self);
   2637   terminateO(undefined);
   2638 
   2639 }
   2640 
   2641 
   2642 void setNFreeSSmallJsonT(CuTest *tc UNUSED) {
   2643 
   2644   smallJsont* r;
   2645   smallJsont *self = allocSmallJson();
   2646   char *string     = strdup("qwe");
   2647 
   2648   r = self->f->setNFreeS(self, "1", string);
   2649   ck_assert_ptr_ne(r, null);
   2650   char *s = toStringO(r);
   2651   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   2652   free(s);
   2653   // path
   2654   string = strdup("asd");
   2655   createSmallArray(a);
   2656   createSmallDict(d);
   2657   a.f->pushDict(&a, &d);
   2658   self->f->setArray(self, "array", &a);
   2659   r = self->f->setNFreeS(self, "\"array\"[0].\"key\"", string);
   2660   ck_assert_ptr_ne(r, null);
   2661   s = toStringO(r);
   2662   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"asd\"}]}");
   2663   free(s);
   2664   // json bool
   2665   freeO(self);
   2666   setTypeBoolO(self);
   2667   string = strdup("asd");
   2668   r = self->f->setNFreeS(self, "1", string);
   2669   ck_assert_ptr_eq(r, null);
   2670   // json array
   2671   freeO(self);
   2672   setTypeArrayO(self);
   2673   r = self->f->setNFreeS(self, "1", string);
   2674   ck_assert_ptr_eq(r, null);
   2675   // non existing dict path
   2676   freeO(self);
   2677   r = self->f->setNFreeS(self, "\"1\"[1]", string);
   2678   ck_assert_ptr_eq(r, null);
   2679   //   dict path but the object is an array
   2680   resetO(&a);
   2681   self->f->setArray(self, "1", &a);
   2682   r = self->f->setNFreeS(self, "\"1\".\"1\"", string);
   2683   ck_assert_ptr_eq(r, null);
   2684   //   dict object in path but the key doesn't exists
   2685   resetO(&d);
   2686   self->f->setDict(self, "2", &d);
   2687   r = self->f->setNFreeS(self, "\"2\".\"1\".[12]", string);
   2688   ck_assert_ptr_eq(r, null);
   2689   free(string);
   2690   // null value
   2691   r = self->f->setNFreeS(self, "1", null);
   2692   ck_assert_ptr_eq(r, null);
   2693   // null key
   2694   string = strdup("qwe");
   2695   r = self->f->setNFreeS(self, null, string);
   2696   ck_assert_ptr_eq(r, null);
   2697   terminateO(self);
   2698   free(string);
   2699 
   2700 }
   2701 
   2702 
   2703 void setNFreeDictSmallJsonT(CuTest *tc UNUSED) {
   2704 
   2705   smallJsont* r;
   2706   smallJsont *self = allocSmallJson();
   2707   smallDictt *dict = allocSmallDict();
   2708 
   2709   r = self->f->setNFreeDict(self, "1", dict);
   2710   ck_assert_ptr_ne(r, null);
   2711   char *s = toStringO(r);
   2712   ck_assert_str_eq(s, "{\"1\":{}}");
   2713   free(s);
   2714   // null value
   2715   r = self->f->setNFreeDict(self, "1", null);
   2716   ck_assert_ptr_eq(r, null);
   2717   // path
   2718   smallDictt *value = allocSmallDict();
   2719   createSmallArray(a);
   2720   createSmallDict(d);
   2721   a.f->pushDict(&a, &d);
   2722   self->f->setArray(self, "array", &a);
   2723   r = self->f->setNFreeDict(self, "\"array\"[0].\"key\"", value);
   2724   ck_assert_ptr_ne(r, null);
   2725   s = toStringO(r);
   2726   ck_assert_str_eq(s, "{\"1\":{},\"array\":[{\"key\":{}}]}");
   2727   free(s);
   2728   // json bool
   2729   freeO(self);
   2730   setTypeBoolO(self);
   2731   value = allocSmallDict();
   2732   r = self->f->setNFreeDict(self, "1", value);
   2733   ck_assert_ptr_eq(r, null);
   2734   // json array
   2735   freeO(self);
   2736   setTypeArrayO(self);
   2737   r = self->f->setNFreeDict(self, "1", value);
   2738   ck_assert_ptr_eq(r, null);
   2739   // non existing dict path
   2740   freeO(self);
   2741   r = self->f->setNFreeDict(self, "\"1\"[1]", value);
   2742   ck_assert_ptr_eq(r, null);
   2743   //   dict path but the object is an array
   2744   resetO(&a);
   2745   self->f->setArray(self, "1", &a);
   2746   r = self->f->setNFreeDict(self, "\"1\".\"1\"", value);
   2747   ck_assert_ptr_eq(r, null);
   2748   //   dict object in path but the key doesn't exists
   2749   resetO(&d);
   2750   self->f->setDict(self, "2", &d);
   2751   r = self->f->setNFreeDict(self, "\"2\".\"1\".[12]", value);
   2752   ck_assert_ptr_eq(r, null);
   2753   terminateO(value);
   2754   // null key
   2755   dict = allocSmallDict();
   2756   r = self->f->setNFreeDict(self, null, dict);
   2757   ck_assert_ptr_eq(r, null);
   2758   terminateO(self);
   2759   terminateO(dict);
   2760 
   2761 }
   2762 
   2763 
   2764 void setNFreeArraySmallJsonT(CuTest *tc UNUSED) {
   2765 
   2766   smallJsont* r;
   2767   smallJsont *self   = allocSmallJson();
   2768   smallArrayt *array = allocSmallArray();
   2769 
   2770   // empty array
   2771   r = self->f->setNFreeArray(self, "1", array);
   2772   ck_assert_ptr_ne(r, null);
   2773   char *s = toStringO(r);
   2774   ck_assert_str_eq(s, "{\"1\":[]}");
   2775   free(s);
   2776   // path
   2777   smallArrayt *value = allocSmallArray();
   2778   createSmallArray(a);
   2779   createSmallDict(d);
   2780   a.f->pushDict(&a, &d);
   2781   self->f->setArray(self, "array", &a);
   2782   r = self->f->setNFreeArray(self, "\"array\"[0].\"key\"", value);
   2783   ck_assert_ptr_ne(r, null);
   2784   s = toStringO(r);
   2785   ck_assert_str_eq(s, "{\"1\":[],\"array\":[{\"key\":[]}]}");
   2786   free(s);
   2787   // json bool
   2788   freeO(self);
   2789   setTypeBoolO(self);
   2790   value = allocSmallArray();
   2791   r = self->f->setNFreeArray(self, "1", value);
   2792   ck_assert_ptr_eq(r, null);
   2793   // json array
   2794   freeO(self);
   2795   setTypeArrayO(self);
   2796   r = self->f->setNFreeArray(self, "1", value);
   2797   ck_assert_ptr_eq(r, null);
   2798   // non existing dict path
   2799   freeO(self);
   2800   r = self->f->setNFreeArray(self, "\"1\"[1]", value);
   2801   ck_assert_ptr_eq(r, null);
   2802   //   dict path but the object is an array
   2803   resetO(&a);
   2804   self->f->setArray(self, "1", &a);
   2805   r = self->f->setNFreeArray(self, "\"1\".\"1\"", value);
   2806   ck_assert_ptr_eq(r, null);
   2807   //   dict object in path but the key doesn't exists
   2808   resetO(&d);
   2809   self->f->setDict(self, "2", &d);
   2810   r = self->f->setNFreeArray(self, "\"2\".\"1\".[12]", value);
   2811   ck_assert_ptr_eq(r, null);
   2812   terminateO(value);
   2813   // null value
   2814   r = self->f->setNFreeArray(self, "1", null);
   2815   ck_assert_ptr_eq(r, null);
   2816   // null key
   2817   r = self->f->setNFreeArray(self, null, array);
   2818   ck_assert_ptr_eq(r, null);
   2819   terminateO(self);
   2820 
   2821 }
   2822 
   2823 
   2824 void setNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
   2825 
   2826   smallJsont* r;
   2827   smallJsont *self = allocSmallJson();
   2828   char **array     = listCreateS("a", "b");
   2829 
   2830   r = self->f->setNFreeArrayc(self, "1", array);
   2831   ck_assert_ptr_ne(r, null);
   2832   char *s = toStringO(r);
   2833   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
   2834   free(s);
   2835   // path
   2836   char **value = listCreateS("1", "2");
   2837   createSmallArray(a);
   2838   createSmallDict(d);
   2839   a.f->pushDict(&a, &d);
   2840   self->f->setArray(self, "array", &a);
   2841   r = self->f->setNFreeArrayc(self, "\"array\"[0].\"key\"", value);
   2842   ck_assert_ptr_ne(r, null);
   2843   s = toStringO(r);
   2844   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"],\"array\":[{\"key\":[\"1\",\"2\"]}]}");
   2845   free(s);
   2846   // json bool
   2847   freeO(self);
   2848   setTypeBoolO(self);
   2849   value = listCreateS("1", "2");
   2850   r = self->f->setNFreeArrayc(self, "1", value);
   2851   ck_assert_ptr_eq(r, null);
   2852   // json array
   2853   freeO(self);
   2854   setTypeArrayO(self);
   2855   r = self->f->setNFreeArrayc(self, "1", value);
   2856   ck_assert_ptr_eq(r, null);
   2857   // non existing dict path
   2858   freeO(self);
   2859   r = self->f->setNFreeArrayc(self, "\"1\"[1]", value);
   2860   ck_assert_ptr_eq(r, null);
   2861   //   dict path but the object is an array
   2862   resetO(&a);
   2863   self->f->setArray(self, "1", &a);
   2864   r = self->f->setNFreeArrayc(self, "\"1\".\"1\"", value);
   2865   ck_assert_ptr_eq(r, null);
   2866   //   dict object in path but the key doesn't exists
   2867   resetO(&d);
   2868   self->f->setDict(self, "2", &d);
   2869   r = self->f->setNFreeArrayc(self, "\"2\".\"1\".[12]", value);
   2870   ck_assert_ptr_eq(r, null);
   2871   listFreeS(value);
   2872   // null value
   2873   r = self->f->setNFreeArrayc(self, "1", null);
   2874   ck_assert_ptr_eq(r, null);
   2875   // null key
   2876   r = self->f->setNFreeArrayc(self, null, array);
   2877   ck_assert_ptr_eq(r, null);
   2878   terminateO(self);
   2879 
   2880 }
   2881 
   2882 
   2883 void setNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   2884 
   2885   smallJsont* r;
   2886   smallJsont *self  = allocSmallJson();
   2887   smallBoolt *value = allocSmallBool(true);
   2888 
   2889   r = self->f->setNFreeSmallBool(self, "1", value);
   2890   ck_assert_ptr_ne(r, null);
   2891   char *s = toStringO(r);
   2892   ck_assert_str_eq(s, "{\"1\":true}");
   2893   free(s);
   2894   // path
   2895   value = allocSmallBool(false);
   2896   createSmallArray(a);
   2897   createSmallDict(d);
   2898   a.f->pushDict(&a, &d);
   2899   self->f->setArray(self, "array", &a);
   2900   r = self->f->setNFreeSmallBool(self, "\"array\"[0].\"key\"", value);
   2901   ck_assert_ptr_ne(r, null);
   2902   s = toStringO(r);
   2903   ck_assert_str_eq(s, "{\"1\":true,\"array\":[{\"key\":false}]}");
   2904   free(s);
   2905   // json bool
   2906   freeO(self);
   2907   setTypeBoolO(self);
   2908   value = allocSmallBool(true);
   2909   r = self->f->setNFreeSmallBool(self, "1", value);
   2910   ck_assert_ptr_eq(r, null);
   2911   // json array
   2912   freeO(self);
   2913   setTypeArrayO(self);
   2914   r = self->f->setNFreeSmallBool(self, "1", value);
   2915   ck_assert_ptr_eq(r, null);
   2916   // non existing dict path
   2917   freeO(self);
   2918   r = self->f->setNFreeSmallBool(self, "\"1\"[1]", value);
   2919   ck_assert_ptr_eq(r, null);
   2920   //   dict path but the object is an array
   2921   resetO(&a);
   2922   self->f->setArray(self, "1", &a);
   2923   r = self->f->setNFreeSmallBool(self, "\"1\".\"1\"", value);
   2924   ck_assert_ptr_eq(r, null);
   2925   //   dict object in path but the key doesn't exists
   2926   resetO(&d);
   2927   self->f->setDict(self, "2", &d);
   2928   r = self->f->setNFreeSmallBool(self, "\"2\".\"1\".[12]", value);
   2929   ck_assert_ptr_eq(r, null);
   2930   // null value
   2931   r = self->f->setNFreeSmallBool(self, "1", null);
   2932   ck_assert_ptr_eq(r, null);
   2933   // null key
   2934   r = self->f->setNFreeSmallBool(self, null, value);
   2935   ck_assert_ptr_eq(r, null);
   2936   terminateO(value);
   2937   terminateO(self);
   2938 
   2939 }
   2940 
   2941 
   2942 void setNFreeSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   2943 
   2944   smallJsont* r;
   2945   smallJsont *self   = allocSmallJson();
   2946   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
   2947 
   2948   r = self->f->setNFreeSmallBytes(self, "1", value);
   2949   ck_assert_ptr_ne(r, null);
   2950   char *s = toStringO(r);
   2951   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
   2952   free(s);
   2953   // path
   2954   value = allocSmallBytes("qwf", sizeof("qwf"));
   2955   createSmallArray(a);
   2956   createSmallDict(d);
   2957   a.f->pushDict(&a, &d);
   2958   self->f->setArray(self, "array", &a);
   2959   r = self->f->setNFreeSmallBytes(self, "\"array\"[0].\"key\"", value);
   2960   ck_assert_ptr_ne(r, null);
   2961   s = toStringO(r);
   2962   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00],\"array\":[{\"key\":[0x71,0x77,0x66,0x00]}]}");
   2963   free(s);
   2964   // json bool
   2965   freeO(self);
   2966   setTypeBoolO(self);
   2967   value = allocSmallBytes("qwf", sizeof("qwf"));
   2968   r = self->f->setNFreeSmallBytes(self, "1", value);
   2969   ck_assert_ptr_eq(r, null);
   2970   // json array
   2971   freeO(self);
   2972   setTypeArrayO(self);
   2973   r = self->f->setNFreeSmallBytes(self, "1", value);
   2974   ck_assert_ptr_eq(r, null);
   2975   // non existing dict path
   2976   freeO(self);
   2977   r = self->f->setNFreeSmallBytes(self, "\"1\"[1]", value);
   2978   ck_assert_ptr_eq(r, null);
   2979   //   dict path but the object is an array
   2980   resetO(&a);
   2981   self->f->setArray(self, "1", &a);
   2982   r = self->f->setNFreeSmallBytes(self, "\"1\".\"1\"", value);
   2983   ck_assert_ptr_eq(r, null);
   2984   //   dict object in path but the key doesn't exists
   2985   resetO(&d);
   2986   self->f->setDict(self, "2", &d);
   2987   r = self->f->setNFreeSmallBytes(self, "\"2\".\"1\".[12]", value);
   2988   ck_assert_ptr_eq(r, null);
   2989   // null value
   2990   r = self->f->setNFreeSmallBytes(self, "1", null);
   2991   ck_assert_ptr_eq(r, null);
   2992   // null key
   2993   r = self->f->setNFreeSmallBytes(self, null, value);
   2994   ck_assert_ptr_eq(r, null);
   2995   terminateO(value);
   2996   terminateO(self);
   2997 
   2998 }
   2999 
   3000 
   3001 void setNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   3002 
   3003   smallJsont* r;
   3004   smallJsont *self    = allocSmallJson();
   3005   smallDoublet *value = allocSmallDouble(2.2);
   3006 
   3007   r = self->f->setNFreeSmallDouble(self, "1", value);
   3008   ck_assert_ptr_ne(r, null);
   3009   char *s = toStringO(r);
   3010   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
   3011   free(s);
   3012   // path
   3013   value = allocSmallDouble(1.2);
   3014   createSmallArray(a);
   3015   createSmallDict(d);
   3016   a.f->pushDict(&a, &d);
   3017   self->f->setArray(self, "array", &a);
   3018   r = self->f->setNFreeSmallDouble(self, "\"array\"[0].\"key\"", value);
   3019   ck_assert_ptr_ne(r, null);
   3020   s = toStringO(r);
   3021   ck_assert_str_eq(s, "{\"1\":2.200000e+00,\"array\":[{\"key\":1.200000e+00}]}");
   3022   free(s);
   3023   // json bool
   3024   freeO(self);
   3025   setTypeBoolO(self);
   3026   value = allocSmallDouble(3.2);
   3027   r = self->f->setNFreeSmallDouble(self, "1", value);
   3028   ck_assert_ptr_eq(r, null);
   3029   // json array
   3030   freeO(self);
   3031   setTypeArrayO(self);
   3032   r = self->f->setNFreeSmallDouble(self, "1", value);
   3033   ck_assert_ptr_eq(r, null);
   3034   // non existing dict path
   3035   freeO(self);
   3036   r = self->f->setNFreeSmallDouble(self, "\"1\"[1]", value);
   3037   ck_assert_ptr_eq(r, null);
   3038   //   dict path but the object is an array
   3039   resetO(&a);
   3040   self->f->setArray(self, "1", &a);
   3041   r = self->f->setNFreeSmallDouble(self, "\"1\".\"1\"", value);
   3042   ck_assert_ptr_eq(r, null);
   3043   //   dict object in path but the key doesn't exists
   3044   resetO(&d);
   3045   self->f->setDict(self, "2", &d);
   3046   r = self->f->setNFreeSmallDouble(self, "\"2\".\"1\".[12]", value);
   3047   ck_assert_ptr_eq(r, null);
   3048   // null value
   3049   r = self->f->setNFreeSmallDouble(self, "1", null);
   3050   ck_assert_ptr_eq(r, null);
   3051   // null key
   3052   r = self->f->setNFreeSmallDouble(self, null, value);
   3053   ck_assert_ptr_eq(r, null);
   3054   terminateO(value);
   3055   terminateO(self);
   3056 
   3057 }
   3058 
   3059 
   3060 void setNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
   3061 
   3062   smallJsont* r;
   3063   smallJsont *self = allocSmallJson();
   3064   smallIntt *value = allocSmallInt(2);
   3065 
   3066   r = self->f->setNFreeSmallInt(self, "1", value);
   3067   ck_assert_ptr_ne(r, null);
   3068   char *s = toStringO(r);
   3069   ck_assert_str_eq(s, "{\"1\":2}");
   3070   free(s);
   3071   // path
   3072   value = allocSmallInt(3);
   3073   createSmallArray(a);
   3074   createSmallDict(d);
   3075   a.f->pushDict(&a, &d);
   3076   self->f->setArray(self, "array", &a);
   3077   r = self->f->setNFreeSmallInt(self, "\"array\"[0].\"key\"", value);
   3078   ck_assert_ptr_ne(r, null);
   3079   s = toStringO(r);
   3080   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":3}]}");
   3081   free(s);
   3082   // json bool
   3083   freeO(self);
   3084   setTypeBoolO(self);
   3085   value = allocSmallInt(1);
   3086   r = self->f->setNFreeSmallInt(self, "1", value);
   3087   ck_assert_ptr_eq(r, null);
   3088   // json array
   3089   freeO(self);
   3090   setTypeArrayO(self);
   3091   r = self->f->setNFreeSmallInt(self, "1", value);
   3092   ck_assert_ptr_eq(r, null);
   3093   // non existing dict path
   3094   freeO(self);
   3095   r = self->f->setNFreeSmallInt(self, "\"1\"[1]", value);
   3096   ck_assert_ptr_eq(r, null);
   3097   //   dict path but the object is an array
   3098   resetO(&a);
   3099   self->f->setArray(self, "1", &a);
   3100   r = self->f->setNFreeSmallInt(self, "\"1\".\"1\"", value);
   3101   ck_assert_ptr_eq(r, null);
   3102   //   dict object in path but the key doesn't exists
   3103   resetO(&d);
   3104   self->f->setDict(self, "2", &d);
   3105   r = self->f->setNFreeSmallInt(self, "\"2\".\"1\".[12]", value);
   3106   ck_assert_ptr_eq(r, null);
   3107   // null value
   3108   r = self->f->setNFreeSmallInt(self, "1", null);
   3109   ck_assert_ptr_eq(r, null);
   3110   // null key
   3111   r = self->f->setNFreeSmallInt(self, null, value);
   3112   ck_assert_ptr_eq(r, null);
   3113   terminateO(value);
   3114   terminateO(self);
   3115 
   3116 }
   3117 
   3118 
   3119 void setNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   3120 
   3121   smallJsont* r;
   3122   smallJsont *self  = allocSmallJson();
   3123   smallJsont *value = allocSmallJson();
   3124 
   3125   setTopIntO(value, 2);
   3126   r = self->f->setNFreeSmallJson(self, "1", value);
   3127   ck_assert_ptr_ne(r, null);
   3128   char *s = toStringO(r);
   3129   ck_assert_str_eq(s, "{\"1\":2}");
   3130   free(s);
   3131   // path
   3132   value = allocSmallJson();
   3133   createSmallArray(a);
   3134   createSmallDict(d);
   3135   a.f->pushDict(&a, &d);
   3136   self->f->setArray(self, "array", &a);
   3137   r = self->f->setNFreeSmallJson(self, "\"array\"[0].\"key\"", value);
   3138   ck_assert_ptr_ne(r, null);
   3139   s = toStringO(r);
   3140   ck_assert_str_eq(s, "{\"1\":2,\"array\":[{\"key\":{}}]}");
   3141   free(s);
   3142   // json bool
   3143   freeO(self);
   3144   setTypeBoolO(self);
   3145   value = allocSmallJson();
   3146   r = self->f->setNFreeSmallJson(self, "1", value);
   3147   ck_assert_ptr_eq(r, null);
   3148   // json array
   3149   freeO(self);
   3150   setTypeArrayO(self);
   3151   r = self->f->setNFreeSmallJson(self, "1", value);
   3152   ck_assert_ptr_eq(r, null);
   3153   // non existing dict path
   3154   freeO(self);
   3155   r = self->f->setNFreeSmallJson(self, "\"1\"[1]", value);
   3156   ck_assert_ptr_eq(r, null);
   3157   //   dict path but the object is an array
   3158   resetO(&a);
   3159   self->f->setArray(self, "1", &a);
   3160   r = self->f->setNFreeSmallJson(self, "\"1\".\"1\"", value);
   3161   ck_assert_ptr_eq(r, null);
   3162   //   dict object in path but the key doesn't exists
   3163   resetO(&d);
   3164   self->f->setDict(self, "2", &d);
   3165   r = self->f->setNFreeSmallJson(self, "\"2\".\"1\".[12]", value);
   3166   ck_assert_ptr_eq(r, null);
   3167   // null value
   3168   r = self->f->setNFreeSmallJson(self, "1", null);
   3169   ck_assert_ptr_eq(r, null);
   3170   // null key
   3171   r = self->f->setNFreeSmallJson(self, null, value);
   3172   ck_assert_ptr_eq(r, null);
   3173   terminateO(value);
   3174   terminateO(self);
   3175 
   3176 }
   3177 
   3178 
   3179 void setNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
   3180 
   3181   smallJsont* r;
   3182   smallJsont *self     = allocSmallJson();
   3183   smallStringt *string = allocSmallString("qwe");
   3184 
   3185   r = self->f->setNFreeSmallString(self, "1", string);
   3186   ck_assert_ptr_ne(r, null);
   3187   char *s = toStringO(r);
   3188   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
   3189   free(s);
   3190   // path
   3191   smallStringt *value = allocSmallString("asd");
   3192   createSmallArray(a);
   3193   createSmallDict(d);
   3194   a.f->pushDict(&a, &d);
   3195   self->f->setArray(self, "array", &a);
   3196   r = self->f->setNFreeSmallString(self, "\"array\"[0].\"key\"", value);
   3197   ck_assert_ptr_ne(r, null);
   3198   s = toStringO(r);
   3199   ck_assert_str_eq(s, "{\"1\":\"qwe\",\"array\":[{\"key\":\"asd\"}]}");
   3200   free(s);
   3201   // json bool
   3202   freeO(self);
   3203   setTypeBoolO(self);
   3204   value = allocSmallString("123");
   3205   r = self->f->setNFreeSmallString(self, "1", value);
   3206   ck_assert_ptr_eq(r, null);
   3207   // json array
   3208   freeO(self);
   3209   setTypeArrayO(self);
   3210   r = self->f->setNFreeSmallString(self, "1", value);
   3211   ck_assert_ptr_eq(r, null);
   3212   // non existing dict path
   3213   freeO(self);
   3214   r = self->f->setNFreeSmallString(self, "\"1\"[1]", value);
   3215   ck_assert_ptr_eq(r, null);
   3216   //   dict path but the object is an array
   3217   resetO(&a);
   3218   self->f->setArray(self, "1", &a);
   3219   r = self->f->setNFreeSmallString(self, "\"1\".\"1\"", value);
   3220   ck_assert_ptr_eq(r, null);
   3221   //   dict object in path but the key doesn't exists
   3222   resetO(&d);
   3223   self->f->setDict(self, "2", &d);
   3224   r = self->f->setNFreeSmallString(self, "\"2\".\"1\".[12]", value);
   3225   ck_assert_ptr_eq(r, null);
   3226   // null value
   3227   r = self->f->setNFreeSmallString(self, "1", null);
   3228   ck_assert_ptr_eq(r, null);
   3229   // null key
   3230   r = self->f->setNFreeSmallString(self, null, string);
   3231   ck_assert_ptr_eq(r, null);
   3232   terminateO(value);
   3233   terminateO(self);
   3234 
   3235 }
   3236 
   3237 
   3238 void setNFreeSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   3239 
   3240   smallJsont* r;
   3241   smallJsont *self           = allocSmallJson();
   3242   smallContainert *container = allocSmallContainer(null);
   3243 
   3244   r = self->f->setNFreeSmallContainer(self, "1", container);
   3245   ck_assert_ptr_ne(r, null);
   3246   char *s = toStringO(r);
   3247   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
   3248   free(s);
   3249   // path
   3250   smallContainert *value = allocSmallContainer(null);
   3251   createSmallArray(a);
   3252   createSmallDict(d);
   3253   a.f->pushDict(&a, &d);
   3254   self->f->setArray(self, "array", &a);
   3255   r = self->f->setNFreeSmallContainer(self, "\"array\"[0].\"key\"", value);
   3256   ck_assert_ptr_ne(r, null);
   3257   s = toStringO(r);
   3258   ck_assert_str_eq(s, "{\"1\":\"<data container>\",\"array\":[{\"key\":\"<data container>\"}]}");
   3259   free(s);
   3260   // json bool
   3261   freeO(self);
   3262   setTypeBoolO(self);
   3263   value = allocSmallContainer(null);
   3264   r = self->f->setNFreeSmallContainer(self, "1", value);
   3265   ck_assert_ptr_eq(r, null);
   3266   // json array
   3267   freeO(self);
   3268   setTypeArrayO(self);
   3269   r = self->f->setNFreeSmallContainer(self, "1", value);
   3270   ck_assert_ptr_eq(r, null);
   3271   // non existing dict path
   3272   freeO(self);
   3273   r = self->f->setNFreeSmallContainer(self, "\"1\"[1]", value);
   3274   ck_assert_ptr_eq(r, null);
   3275   //   dict path but the object is an array
   3276   resetO(&a);
   3277   self->f->setArray(self, "1", &a);
   3278   r = self->f->setNFreeSmallContainer(self, "\"1\".\"1\"", value);
   3279   ck_assert_ptr_eq(r, null);
   3280   //   dict object in path but the key doesn't exists
   3281   resetO(&d);
   3282   self->f->setDict(self, "2", &d);
   3283   r = self->f->setNFreeSmallContainer(self, "\"2\".\"1\".[12]", value);
   3284   ck_assert_ptr_eq(r, null);
   3285   // null value
   3286   r = self->f->setNFreeSmallContainer(self, "1", null);
   3287   ck_assert_ptr_eq(r, null);
   3288   // null key
   3289   r = self->f->setNFreeSmallContainer(self, null, container);
   3290   ck_assert_ptr_eq(r, null);
   3291   terminateO(value);
   3292   terminateO(self);
   3293 
   3294 }
   3295 
   3296 
   3297 void setPDictSmallJsonT(CuTest *tc UNUSED) {
   3298 
   3299   smallJsont* r;
   3300   smallJsont *self = allocSmallJson();
   3301   smallDictt *dict;
   3302 
   3303   dict = allocSmallDict();
   3304   r    = self->f->setDict(self, "1", dict);
   3305   ck_assert_ptr_ne(r, null);
   3306   dict->f->setInt(dict, "a", 1);
   3307   r    = self->f->setPDict(self, "1", dict);
   3308   ck_assert_ptr_ne(r, null);
   3309   char *s = toStringO(r);
   3310   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3311   free(s);
   3312   // empty dict
   3313 	finishO(dict);
   3314   dict = allocSmallDict();
   3315   r    = self->f->setPDict(self, "1", dict);
   3316   ck_assert_ptr_eq(r, null);
   3317   finishO(dict);
   3318   s = toStringO(self);
   3319   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3320   free(s);
   3321   // non smallDict object
   3322   dict = (smallDictt*) allocSmallInt(2);
   3323   r = self->f->setPDict(self, "1", dict);
   3324   ck_assert_ptr_eq(r, null);
   3325   terminateO(dict);
   3326   // path
   3327   dict = allocSmallDict();
   3328   dict->f->setInt(dict, "b", 2);
   3329   createSmallArray(a);
   3330   createSmallDict(d);
   3331   a.f->pushDict(&a, &d);
   3332   self->f->setArray(self, "array", &a);
   3333   r = self->f->setPDict(self, "\"array\"[0].\"key\"", dict);
   3334   ck_assert_ptr_ne(r, null);
   3335   finishO(dict);
   3336   s = toStringO(r);
   3337   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3338   free(s);
   3339   // json bool
   3340   freeO(self);
   3341   setTypeBoolO(self);
   3342   dict = allocSmallDict();
   3343   dict->f->setInt(dict, "b", 2);
   3344   r = self->f->setPDict(self, "1", dict);
   3345   ck_assert_ptr_eq(r, null);
   3346   // json array
   3347   freeO(self);
   3348   setTypeArrayO(self);
   3349   r = self->f->setPDict(self, "1", dict);
   3350   ck_assert_ptr_eq(r, null);
   3351   // non existing dict path
   3352   freeO(self);
   3353   r = self->f->setPDict(self, "\"1\"[1]", dict);
   3354   ck_assert_ptr_eq(r, null);
   3355   //   dict path but the object is an array
   3356   resetO(&a);
   3357   self->f->setArray(self, "1", &a);
   3358   r = self->f->setPDict(self, "\"1\".\"1\"", dict);
   3359   ck_assert_ptr_eq(r, null);
   3360   //   dict object in path but the key doesn't exists
   3361   resetO(&d);
   3362   self->f->setDict(self, "2", &d);
   3363   r = self->f->setPDict(self, "\"2\".\"1\".[12]", dict);
   3364   ck_assert_ptr_eq(r, null);
   3365   // null value
   3366   r = self->f->setPDict(self, "1", null);
   3367   ck_assert_ptr_eq(r, null);
   3368   // null key
   3369   r = self->f->setPDict(self, null, dict);
   3370   ck_assert_ptr_eq(r, null);
   3371   terminateO(dict);
   3372   terminateO(self);
   3373 
   3374 }
   3375 
   3376 
   3377 void setPArraySmallJsonT(CuTest *tc UNUSED) {
   3378 
   3379   smallJsont* r;
   3380   smallJsont *self = allocSmallJson();
   3381   smallArrayt *array;
   3382 
   3383   array   = allocSmallArray();
   3384   r       = self->f->setArray(self, "1", array);
   3385   ck_assert_ptr_ne(r, null);
   3386   array->f->pushInt(array, 1);
   3387   r       = self->f->setPArray(self, "1", array);
   3388   ck_assert_ptr_ne(r, null);
   3389   char *s = toStringO(r);
   3390   ck_assert_str_eq(s, "{\"1\":[1]}");
   3391   free(s);
   3392   // empty array
   3393 	finishO(array);
   3394   array = allocSmallArray();
   3395   r    = self->f->setPArray(self, "1", array);
   3396   ck_assert_ptr_eq(r, null);
   3397   finishO(array);
   3398   s = toStringO(self);
   3399   ck_assert_str_eq(s, "{\"1\":[1]}");
   3400   free(s);
   3401   // non smallDict object
   3402   array = (smallArrayt*) allocSmallInt(2);
   3403   r = self->f->setPArray(self, "1", array);
   3404   ck_assert_ptr_eq(r, null);
   3405   terminateO(array);
   3406   // path
   3407   array = allocSmallArray();
   3408   array->f->pushInt(array, 2);
   3409   createSmallArray(a);
   3410   createSmallDict(d);
   3411   a.f->pushDict(&a, &d);
   3412   self->f->setArray(self, "array", &a);
   3413   r = self->f->setPArray(self, "\"array\"[0].\"key\"", array);
   3414   ck_assert_ptr_ne(r, null);
   3415   finishO(array);
   3416   s = toStringO(r);
   3417   ck_assert_str_eq(s, "{\"1\":[1],\"array\":[{\"key\":[2]}]}");
   3418   free(s);
   3419   // json bool
   3420   array = allocSmallArray();
   3421   array->f->pushInt(array, 2);
   3422   freeO(self);
   3423   setTypeBoolO(self);
   3424   r = self->f->setPArray(self, "1", array);
   3425   ck_assert_ptr_eq(r, null);
   3426   // json array
   3427   freeO(self);
   3428   setTypeArrayO(self);
   3429   r = self->f->setPArray(self, "1", array);
   3430   ck_assert_ptr_eq(r, null);
   3431   // non existing dict path
   3432   freeO(self);
   3433   r = self->f->setPArray(self, "\"1\"[1]", array);
   3434   ck_assert_ptr_eq(r, null);
   3435   //   dict path but the object is an array
   3436   resetO(&a);
   3437   self->f->setArray(self, "1", &a);
   3438   r = self->f->setPArray(self, "\"1\".\"1\"", array);
   3439   ck_assert_ptr_eq(r, null);
   3440   //   dict object in path but the key doesn't exists
   3441   resetO(&d);
   3442   self->f->setDict(self, "2", &d);
   3443   r = self->f->setPArray(self, "\"2\".\"1\".[12]", array);
   3444   ck_assert_ptr_eq(r, null);
   3445   // null value
   3446   r = self->f->setPArray(self, "1", null);
   3447   ck_assert_ptr_eq(r, null);
   3448   // null key
   3449   r = self->f->setPArray(self, null, array);
   3450   ck_assert_ptr_eq(r, null);
   3451   terminateO(array);
   3452   terminateO(self);
   3453 
   3454 }
   3455 
   3456 
   3457 void setPSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   3458 
   3459   smallJsont* r;
   3460   smallJsont *self = allocSmallJson();
   3461   smallJsont *json;
   3462 
   3463   json    = allocSmallJson();
   3464   r       = self->f->setSmallJson(self, "1", json);
   3465   ck_assert_ptr_ne(r, null);
   3466   json->f->setInt(json, "a", 1);
   3467   r       = self->f->setPSmallJson(self, "1", json);
   3468   ck_assert_ptr_ne(r, null);
   3469   finishO(json);
   3470   char *s = toStringO(r);
   3471   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3472   free(s);
   3473   // empty smallJson
   3474   json   = allocSmallJson();
   3475   r = self->f->setPSmallJson(self, "1", json);
   3476   ck_assert_ptr_eq(r, null);
   3477   terminateO(json);
   3478   // non smallJson object
   3479   json = (smallJsont*) allocSmallInt(2);
   3480   r = self->f->setPSmallJson(self, "1", json);
   3481   ck_assert_ptr_eq(r, null);
   3482   // path
   3483   smallJsont *value = allocSmallJson();
   3484   value->f->setInt(value, "b", 2);
   3485   createSmallArray(a);
   3486   createSmallDict(d);
   3487   a.f->pushDict(&a, &d);
   3488   self->f->setArray(self, "array", &a);
   3489   r = self->f->setPSmallJson(self, "\"array\"[0].\"key\"", value);
   3490   ck_assert_ptr_ne(r, null);
   3491   finishO(value);
   3492   s = toStringO(r);
   3493   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3494   free(s);
   3495   // json bool
   3496   value = allocSmallJson();
   3497   value->f->setInt(value, "b", 2);
   3498   freeO(self);
   3499   setTypeBoolO(self);
   3500   r = self->f->setPSmallJson(self, "1", value);
   3501   ck_assert_ptr_eq(r, null);
   3502   // json array
   3503   freeO(self);
   3504   setTypeArrayO(self);
   3505   r = self->f->setPSmallJson(self, "1", value);
   3506   ck_assert_ptr_eq(r, null);
   3507   // non existing dict path
   3508   freeO(self);
   3509   r = self->f->setPSmallJson(self, "\"1\"[1]", value);
   3510   ck_assert_ptr_eq(r, null);
   3511   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3512   createSmallJson(i);
   3513   r = self->f->setPSmallJson(self, "\"1\".[1]", &i);
   3514   ck_assert_ptr_eq(r, null);
   3515   freeO(&i);
   3516   //   dict path but the object is an array
   3517   resetO(&a);
   3518   self->f->setArray(self, "1", &a);
   3519   r = self->f->setPSmallJson(self, "\"1\".\"1\"", value);
   3520   ck_assert_ptr_eq(r, null);
   3521   //   dict object in path but the key doesn't exists
   3522   resetO(&d);
   3523   self->f->setDict(self, "2", &d);
   3524   r = self->f->setPSmallJson(self, "\"2\".\"1\".[12]", value);
   3525   ck_assert_ptr_eq(r, null);
   3526   terminateO(value);
   3527   // null value
   3528   r = self->f->setPSmallJson(self, "1", null);
   3529   ck_assert_ptr_eq(r, null);
   3530   // null key
   3531   r = self->f->setPSmallJson(self, null, json);
   3532   ck_assert_ptr_eq(r, null);
   3533   terminateO(self);
   3534   terminateO(json);
   3535 
   3536 }
   3537 
   3538 
   3539 void setPSmallStringSmallJsonT(CuTest *tc UNUSED) {
   3540 
   3541   smallJsont* r;
   3542   smallJsont *self = allocSmallJson();
   3543   smallStringt *string;
   3544 
   3545   string = allocSmallString("");
   3546   r      = self->f->setSmallString(self, "1", string);
   3547   ck_assert_ptr_ne(r, null);
   3548   string->f->appendS(string, "s");
   3549   r      = self->f->setPSmallString(self, "1", string);
   3550   ck_assert_ptr_ne(r, null);
   3551   finishO(string);
   3552   char *s = toStringO(r);
   3553   ck_assert_str_eq(s, "{\"1\":\"s\"}");
   3554   free(s);
   3555   // empty SmallString
   3556   string = allocSmallString("");
   3557   freeO(string);
   3558   r = self->f->setPSmallString(self, "1", string);
   3559   ck_assert_ptr_eq(r, null);
   3560   terminateO(string);
   3561   // non smallString object
   3562   string = (smallStringt*) allocSmallInt(2);
   3563   r = self->f->setPSmallString(self, "1", string);
   3564   ck_assert_ptr_eq(r, null);
   3565   terminateO(string);
   3566   // path
   3567   smallStringt *value = allocSmallString("asd");
   3568   createSmallArray(a);
   3569   createSmallDict(d);
   3570   a.f->pushDict(&a, &d);
   3571   self->f->setArray(self, "array", &a);
   3572   r = self->f->setPSmallString(self, "\"array\"[0].\"key\"", value);
   3573   ck_assert_ptr_ne(r, null);
   3574   finishO(value);
   3575   s = toStringO(r);
   3576   ck_assert_str_eq(s, "{\"1\":\"s\",\"array\":[{\"key\":\"asd\"}]}");
   3577   free(s);
   3578   // json bool
   3579   value = allocSmallString("ASD");
   3580   freeO(self);
   3581   setTypeBoolO(self);
   3582   r = self->f->setPSmallString(self, "1", value);
   3583   ck_assert_ptr_eq(r, null);
   3584   // json array
   3585   freeO(self);
   3586   setTypeArrayO(self);
   3587   r = self->f->setPSmallString(self, "1", value);
   3588   ck_assert_ptr_eq(r, null);
   3589   // non existing dict path
   3590   freeO(self);
   3591   r = self->f->setPSmallString(self, "\"1\"[1]", value);
   3592   ck_assert_ptr_eq(r, null);
   3593   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3594   createSmallString(i);
   3595   r = self->f->setPSmallString(self, "\"1\".[1]", &i);
   3596   ck_assert_ptr_eq(r, null);
   3597   freeO(&i);
   3598   //   dict path but the object is an array
   3599   resetO(&a);
   3600   self->f->setArray(self, "1", &a);
   3601   r = self->f->setPSmallString(self, "\"1\".\"1\"", value);
   3602   ck_assert_ptr_eq(r, null);
   3603   //   dict object in path but the key doesn't exists
   3604   resetO(&d);
   3605   self->f->setDict(self, "2", &d);
   3606   r = self->f->setPSmallString(self, "\"2\".\"1\".[12]", value);
   3607   ck_assert_ptr_eq(r, null);
   3608   terminateO(value);
   3609   // null value
   3610   r = self->f->setPSmallString(self, "1", null);
   3611   ck_assert_ptr_eq(r, null);
   3612   // null key
   3613   string = allocSmallString("");
   3614   r = self->f->setPSmallString(self, null, string);
   3615   ck_assert_ptr_eq(r, null);
   3616   terminateO(self);
   3617   terminateO(string);
   3618 
   3619 }
   3620 
   3621 
   3622 void setNFreePDictSmallJsonT(CuTest *tc UNUSED) {
   3623 
   3624   smallJsont* r;
   3625   smallJsont *self = allocSmallJson();
   3626   smallDictt *value;
   3627 
   3628   value   = allocSmallDict();
   3629   r       = self->f->setDict(self, "1", value);
   3630   ck_assert_ptr_ne(r, null);
   3631   value->f->setInt(value, "a", 1);
   3632   r       = self->f->setNFreePDict(self, "1", value);
   3633   ck_assert_ptr_ne(r, null);
   3634   char *s = toStringO(r);
   3635   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3636   free(s);
   3637   // empty smallDict
   3638   value   = allocSmallDict();
   3639   r       = self->f->setNFreePDict(self, "1", value);
   3640   ck_assert_ptr_eq(r, null);
   3641   terminateO(value);
   3642   // non smallDict object
   3643   value = (smallDictt*) allocSmallInt(2);
   3644   r = self->f->setNFreePDict(self, "1", value);
   3645   ck_assert_ptr_eq(r, null);
   3646   terminateO(value);
   3647   // path
   3648   value = allocSmallDict();
   3649   value->f->setInt(value, "b", 2);
   3650   createSmallArray(a);
   3651   createSmallDict(d);
   3652   a.f->pushDict(&a, &d);
   3653   self->f->setArray(self, "array", &a);
   3654   r = self->f->setNFreePDict(self, "\"array\"[0].\"key\"", value);
   3655   ck_assert_ptr_ne(r, null);
   3656   s = toStringO(r);
   3657   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3658   free(s);
   3659   // json bool
   3660   freeO(self);
   3661   setTypeBoolO(self);
   3662   value = allocSmallDict();
   3663   value->f->setInt(value, "b", 2);
   3664   r = self->f->setNFreePDict(self, "1", value);
   3665   ck_assert_ptr_eq(r, null);
   3666   // json array
   3667   freeO(self);
   3668   setTypeArrayO(self);
   3669   r = self->f->setNFreePDict(self, "1", value);
   3670   ck_assert_ptr_eq(r, null);
   3671   // non existing dict path
   3672   freeO(self);
   3673   r = self->f->setNFreePDict(self, "\"1\"[1]", value);
   3674   ck_assert_ptr_eq(r, null);
   3675   //   dict path but the object is an array
   3676   resetO(&a);
   3677   self->f->setArray(self, "1", &a);
   3678   r = self->f->setNFreePDict(self, "\"1\".\"1\"", value);
   3679   ck_assert_ptr_eq(r, null);
   3680   //   dict object in path but the key doesn't exists
   3681   resetO(&d);
   3682   self->f->setDict(self, "2", &d);
   3683   r = self->f->setNFreePDict(self, "\"2\".\"1\".[12]", value);
   3684   ck_assert_ptr_eq(r, null);
   3685   // null value
   3686   r = self->f->setNFreePDict(self, "1", null);
   3687   ck_assert_ptr_eq(r, null);
   3688   // null key
   3689   r = self->f->setNFreePDict(self, null, value);
   3690   ck_assert_ptr_eq(r, null);
   3691   terminateO(self);
   3692   terminateO(value);
   3693 
   3694 }
   3695 
   3696 
   3697 void setNFreePArraySmallJsonT(CuTest *tc UNUSED) {
   3698 
   3699   smallJsont* r;
   3700   smallJsont *self = allocSmallJson();
   3701   smallArrayt *value;
   3702 
   3703   value   = allocSmallArray();
   3704   r       = self->f->setArray(self, "1", value);
   3705   ck_assert_ptr_ne(r, null);
   3706   value->f->pushInt(value, 2);
   3707   r       = self->f->setNFreePArray(self, "1", value);
   3708   ck_assert_ptr_ne(r, null);
   3709   char *s = toStringO(r);
   3710   ck_assert_str_eq(s, "{\"1\":[2]}");
   3711   free(s);
   3712   // empty smallArray
   3713   value   = allocSmallArray();
   3714   r       = self->f->setNFreePArray(self, "1", value);
   3715   ck_assert_ptr_eq(r, null);
   3716   terminateO(value);
   3717   // non smallArray object
   3718   value   = (smallArrayt*) allocSmallInt(2);
   3719   r       = self->f->setNFreePArray(self, "1", value);
   3720   ck_assert_ptr_eq(r, null);
   3721   terminateO(value);
   3722   // path
   3723   value = allocSmallArray();
   3724   value->f->pushInt(value, 3);
   3725   createSmallArray(a);
   3726   createSmallDict(d);
   3727   a.f->pushDict(&a, &d);
   3728   self->f->setArray(self, "array", &a);
   3729   r = self->f->setNFreePArray(self, "\"array\"[0].\"key\"", value);
   3730   ck_assert_ptr_ne(r, null);
   3731   s = toStringO(r);
   3732   ck_assert_str_eq(s, "{\"1\":[2],\"array\":[{\"key\":[3]}]}");
   3733   free(s);
   3734   // json bool
   3735   value = allocSmallArray();
   3736   value->f->pushInt(value, 2);
   3737   freeO(self);
   3738   setTypeBoolO(self);
   3739   r = self->f->setNFreePArray(self, "1", value);
   3740   ck_assert_ptr_eq(r, null);
   3741   // json array
   3742   freeO(self);
   3743   setTypeArrayO(self);
   3744   r = self->f->setNFreePArray(self, "1", value);
   3745   ck_assert_ptr_eq(r, null);
   3746   // non existing dict path
   3747   freeO(self);
   3748   r = self->f->setNFreePArray(self, "\"1\"[1]", value);
   3749   ck_assert_ptr_eq(r, null);
   3750   //   dict path but the object is an array
   3751   resetO(&a);
   3752   self->f->setArray(self, "1", &a);
   3753   r = self->f->setNFreePArray(self, "\"1\".\"1\"", value);
   3754   ck_assert_ptr_eq(r, null);
   3755   //   dict object in path but the key doesn't exists
   3756   resetO(&d);
   3757   self->f->setDict(self, "2", &d);
   3758   r = self->f->setNFreePArray(self, "\"2\".\"1\".[12]", value);
   3759   ck_assert_ptr_eq(r, null);
   3760   // null value
   3761   r = self->f->setNFreePArray(self, "1", null);
   3762   ck_assert_ptr_eq(r, null);
   3763   // null key
   3764   r = self->f->setNFreePArray(self, null, value);
   3765   ck_assert_ptr_eq(r, null);
   3766   terminateO(self);
   3767   terminateO(value);
   3768 
   3769 }
   3770 
   3771 
   3772 void setNFreePSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   3773 
   3774   smallJsont* r;
   3775   smallJsont *self = allocSmallJson();
   3776   smallJsont *value;
   3777 
   3778   value   = allocSmallJson();
   3779   r       = self->f->setSmallJson(self, "1", value);
   3780   ck_assert_ptr_ne(r, null);
   3781   value->f->setInt(value, "a", 1);
   3782   r       = self->f->setNFreePSmallJson(self, "1", value);
   3783   ck_assert_ptr_ne(r, null);
   3784   char *s = toStringO(r);
   3785   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
   3786   free(s);
   3787   // empty smallJson
   3788   value   = allocSmallJson();
   3789   r = self->f->setNFreePSmallJson(self, "1", value);
   3790   ck_assert_ptr_eq(r, null);
   3791   terminateO(value);
   3792   // non smallJson object
   3793   value = (smallJsont*) allocSmallInt(2);
   3794   r = self->f->setNFreePSmallJson(self, "1", value);
   3795   ck_assert_ptr_eq(r, null);
   3796   terminateO(value);
   3797   // path
   3798   value = allocSmallJson();
   3799   value->f->setInt(value, "b", 2);
   3800   createSmallArray(a);
   3801   createSmallDict(d);
   3802   a.f->pushDict(&a, &d);
   3803   self->f->setArray(self, "array", &a);
   3804   r = self->f->setNFreePSmallJson(self, "\"array\"[0].\"key\"", value);
   3805   ck_assert_ptr_ne(r, null);
   3806   s = toStringO(r);
   3807   ck_assert_str_eq(s, "{\"1\":{\"a\":1},\"array\":[{\"key\":{\"b\":2}}]}");
   3808   free(s);
   3809   // json bool
   3810   value = allocSmallJson();
   3811   value->f->setInt(value, "b", 2);
   3812   freeO(self);
   3813   setTypeBoolO(self);
   3814   r = self->f->setNFreePSmallJson(self, "1", value);
   3815   ck_assert_ptr_eq(r, null);
   3816   // json array
   3817   freeO(self);
   3818   setTypeArrayO(self);
   3819   r = self->f->setNFreePSmallJson(self, "1", value);
   3820   ck_assert_ptr_eq(r, null);
   3821   // non existing dict path
   3822   freeO(self);
   3823   r = self->f->setNFreePSmallJson(self, "\"1\"[1]", value);
   3824   ck_assert_ptr_eq(r, null);
   3825   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3826   createSmallJson(i);
   3827   r = self->f->setNFreePSmallJson(self, "\"1\".[1]", &i);
   3828   ck_assert_ptr_eq(r, null);
   3829   freeO(&i);
   3830   //   dict path but the object is an array
   3831   resetO(&a);
   3832   self->f->setArray(self, "1", &a);
   3833   r = self->f->setNFreePSmallJson(self, "\"1\".\"1\"", value);
   3834   ck_assert_ptr_eq(r, null);
   3835   //   dict object in path but the key doesn't exists
   3836   resetO(&d);
   3837   self->f->setDict(self, "2", &d);
   3838   r = self->f->setNFreePSmallJson(self, "\"2\".\"1\".[12]", value);
   3839   ck_assert_ptr_eq(r, null);
   3840   // null value
   3841   r = self->f->setNFreePSmallJson(self, "1", null);
   3842   ck_assert_ptr_eq(r, null);
   3843   // null key
   3844   r = self->f->setNFreePSmallJson(self, null, value);
   3845   ck_assert_ptr_eq(r, null);
   3846   terminateO(self);
   3847   terminateO(value);
   3848 
   3849 }
   3850 
   3851 
   3852 void setNFreePSmallStringSmallJsonT(CuTest *tc UNUSED) {
   3853 
   3854   smallJsont* r;
   3855   smallJsont *self = allocSmallJson();
   3856   smallStringt *value;
   3857 
   3858   value = allocSmallString("");
   3859   r       = self->f->setSmallString(self, "1", value);
   3860   ck_assert_ptr_ne(r, null);
   3861   value->f->appendS(value, "2");
   3862   r       = self->f->setNFreePSmallString(self, "1", value);
   3863   ck_assert_ptr_ne(r, null);
   3864   char *s = toStringO(r);
   3865   ck_assert_str_eq(s, "{\"1\":\"2\"}");
   3866   free(s);
   3867   // empty SmallString
   3868   value   = allocSmallString("");
   3869   freeO(value);
   3870   r = self->f->setNFreePSmallString(self, "1", value);
   3871   ck_assert_ptr_eq(r, null);
   3872   terminateO(value);
   3873   // non smallString object
   3874   value = (smallStringt*) allocSmallInt(2);
   3875   r = self->f->setNFreePSmallString(self, "1", value);
   3876   ck_assert_ptr_eq(r, null);
   3877   terminateO(value);
   3878   // path
   3879   value = allocSmallString("asd");
   3880   createSmallArray(a);
   3881   createSmallDict(d);
   3882   a.f->pushDict(&a, &d);
   3883   self->f->setArray(self, "array", &a);
   3884   r = self->f->setNFreePSmallString(self, "\"array\"[0].\"key\"", value);
   3885   ck_assert_ptr_ne(r, null);
   3886   s = toStringO(r);
   3887   ck_assert_str_eq(s, "{\"1\":\"2\",\"array\":[{\"key\":\"asd\"}]}");
   3888   free(s);
   3889   // json bool
   3890   value = allocSmallString("ASD");
   3891   freeO(self);
   3892   setTypeBoolO(self);
   3893   r = self->f->setNFreePSmallString(self, "1", value);
   3894   ck_assert_ptr_eq(r, null);
   3895   // json array
   3896   freeO(self);
   3897   setTypeArrayO(self);
   3898   r = self->f->setNFreePSmallString(self, "1", value);
   3899   ck_assert_ptr_eq(r, null);
   3900   // non existing dict path
   3901   freeO(self);
   3902   r = self->f->setNFreePSmallString(self, "\"1\"[1]", value);
   3903   ck_assert_ptr_eq(r, null);
   3904   //    wrong path and empty smallInt container (sInt is allocated in toSmallt)
   3905   createSmallString(i);
   3906   r = self->f->setNFreePSmallString(self, "\"1\".[1]", &i);
   3907   ck_assert_ptr_eq(r, null);
   3908   freeO(&i);
   3909   //   dict path but the object is an array
   3910   resetO(&a);
   3911   self->f->setArray(self, "1", &a);
   3912   r = self->f->setNFreePSmallString(self, "\"1\".\"1\"", value);
   3913   ck_assert_ptr_eq(r, null);
   3914   //   dict object in path but the key doesn't exists
   3915   resetO(&d);
   3916   self->f->setDict(self, "2", &d);
   3917   r = self->f->setNFreePSmallString(self, "\"2\".\"1\".[12]", value);
   3918   ck_assert_ptr_eq(r, null);
   3919   // null value
   3920   r = self->f->setNFreePSmallString(self, "1", null);
   3921   ck_assert_ptr_eq(r, null);
   3922   // null key
   3923   r = self->f->setNFreePSmallString(self, null, value);
   3924   ck_assert_ptr_eq(r, null);
   3925   terminateO(self);
   3926   terminateO(value);
   3927 
   3928 }
   3929 
   3930 
   3931 void setAtSmallJsonT(CuTest *tc UNUSED) {
   3932 
   3933   smallJsont* r;
   3934   smallJsont *self = allocSmallJson();
   3935   baset *value;
   3936 
   3937   // add elements to self
   3938   r = self->f->pushInt(self, 1);
   3939   ck_assert_ptr_ne(r, null);
   3940   r = self->f->pushInt(self, 2);
   3941   ck_assert_ptr_ne(r, null);
   3942   r = self->f->pushInt(self, 3);
   3943   ck_assert_ptr_ne(r, null);
   3944   r = self->f->pushInt(self, 4);
   3945   ck_assert_ptr_ne(r, null);
   3946 
   3947   // positive index
   3948   value   = (baset*)allocSmallInt(123);
   3949   r       = self->f->setAt(self, 1, value);
   3950   ck_assert_ptr_ne(r, null);
   3951   finishO(value);
   3952   char *s = toStringO(r);
   3953   ck_assert_str_eq(s, "[1,123,3,4]");
   3954   free(s);
   3955   // negative index
   3956   value   = (baset*)allocSmallInt(234);
   3957   r = self->f->setAt(self, -1, value);
   3958   ck_assert_ptr_ne(r, null);
   3959   finishO(value);
   3960   s = toStringO(r);
   3961   ck_assert_str_eq(s, "[1,123,3,234]");
   3962   free(s);
   3963   // undefined object
   3964   value   = (baset*)allocUndefined();
   3965   r = self->f->setAt(self, -1, value);
   3966   ck_assert_ptr_ne(r, null);
   3967   finishO(value);
   3968   s = toStringO(r);
   3969   ck_assert_str_eq(s, "[1,123,3,null]");
   3970   free(s);
   3971   // container
   3972   createAllocateSmallContainer(c);
   3973   r = self->f->setAt(self, -1, (baset*)c);
   3974   ck_assert_ptr_ne(r, null);
   3975   finishO(c);
   3976   s = toStringO(r);
   3977   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   3978   free(s);
   3979   // base object in container
   3980   createAllocateSmallInt(I);
   3981   setValG(I, 11);
   3982   I->type = "anothertype";
   3983   r = self->f->setAt(self, -1, (baset*)I);
   3984   ck_assert_ptr_ne(r, null);
   3985   s = toStringO(r);
   3986   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   3987   free(s);
   3988   // index outside
   3989   value = (baset*)allocSmallInt(123);
   3990   ck_assert_ptr_eq(self->f->setAt(self, 20, value), NULL);
   3991   ck_assert_ptr_eq(self->f->setAt(self, -8, value), NULL);
   3992   // empty list
   3993   emptyO(self);
   3994   ck_assert_ptr_eq(self->f->setAt(self, 0, value), NULL);
   3995   ck_assert_ptr_eq(self->f->setAt(self, -1, value), NULL);
   3996   terminateO(value);
   3997   // NULL value
   3998   ck_assert_ptr_eq(self->f->setAt(self, 0, NULL), NULL);
   3999   terminateO(self);
   4000 
   4001 }
   4002 
   4003 
   4004 void setAtUndefinedSmallJsonT(CuTest *tc UNUSED) {
   4005 
   4006   smallJsont* r;
   4007   smallJsont *self = allocSmallJson();
   4008 
   4009   // add elements to self
   4010   r = self->f->pushInt(self, 1);
   4011   ck_assert_ptr_ne(r, null);
   4012   r = self->f->pushInt(self, 2);
   4013   ck_assert_ptr_ne(r, null);
   4014   r = self->f->pushInt(self, 3);
   4015   ck_assert_ptr_ne(r, null);
   4016   r = self->f->pushInt(self, 4);
   4017   ck_assert_ptr_ne(r, null);
   4018 
   4019   // positive index
   4020   r       = self->f->setAtUndefined(self, 1);
   4021   ck_assert_ptr_ne(r, null);
   4022   char *s = toStringO(r);
   4023   ck_assert_str_eq(s, "[1,null,3,4]");
   4024   free(s);
   4025   // negative index
   4026   r = self->f->setAtUndefined(self, -1);
   4027   ck_assert_ptr_ne(r, null);
   4028   s = toStringO(r);
   4029   ck_assert_str_eq(s, "[1,null,3,null]");
   4030   free(s);
   4031   // index outside
   4032   ck_assert_ptr_eq(self->f->setAtUndefined(self, 20), NULL);
   4033   ck_assert_ptr_eq(self->f->setAtUndefined(self, -8), NULL);
   4034   // empty list
   4035   emptyO(self);
   4036   ck_assert_ptr_eq(self->f->setAtUndefined(self, 0), NULL);
   4037   ck_assert_ptr_eq(self->f->setAtUndefined(self, -1), NULL);
   4038   // non json array
   4039   freeO(self);
   4040   setTypeBoolO(self);
   4041   ck_assert_ptr_eq(self->f->setAtUndefined(self, 0), NULL);
   4042   terminateO(self);
   4043 
   4044 }
   4045 
   4046 
   4047 void setAtBoolSmallJsonT(CuTest *tc UNUSED) {
   4048 
   4049   smallJsont* r;
   4050   smallJsont *self = allocSmallJson();
   4051 
   4052   // add elements to self
   4053   r = self->f->pushInt(self, 1);
   4054   ck_assert_ptr_ne(r, null);
   4055   r = self->f->pushInt(self, 2);
   4056   ck_assert_ptr_ne(r, null);
   4057   r = self->f->pushInt(self, 3);
   4058   ck_assert_ptr_ne(r, null);
   4059   r = self->f->pushInt(self, 4);
   4060   ck_assert_ptr_ne(r, null);
   4061 
   4062   // positive index
   4063   r       = self->f->setAtBool(self, 1, true);
   4064   ck_assert_ptr_ne(r, null);
   4065   char *s = toStringO(r);
   4066   ck_assert_str_eq(s, "[1,true,3,4]");
   4067   free(s);
   4068   // negative index
   4069   r = self->f->setAtBool(self, -1, true);
   4070   ck_assert_ptr_ne(r, null);
   4071   s = toStringO(r);
   4072   ck_assert_str_eq(s, "[1,true,3,true]");
   4073   free(s);
   4074   // index outside
   4075   ck_assert_ptr_eq(self->f->setAtBool(self, 20, true), NULL);
   4076   ck_assert_ptr_eq(self->f->setAtBool(self, -8, true), NULL);
   4077   // empty list
   4078   emptyO(self);
   4079   ck_assert_ptr_eq(self->f->setAtBool(self, 0, true), NULL);
   4080   ck_assert_ptr_eq(self->f->setAtBool(self, -1, true), NULL);
   4081   // non json array
   4082   freeO(self);
   4083   setTypeBoolO(self);
   4084   ck_assert_ptr_eq(self->f->setAtBool(self, 0, true), NULL);
   4085   terminateO(self);
   4086 
   4087 }
   4088 
   4089 
   4090 void setAtDoubleSmallJsonT(CuTest *tc UNUSED) {
   4091 
   4092   smallJsont* r;
   4093   smallJsont *self = allocSmallJson();
   4094 
   4095   // add elements to self
   4096   r = self->f->pushInt(self, 1);
   4097   ck_assert_ptr_ne(r, null);
   4098   r = self->f->pushInt(self, 2);
   4099   ck_assert_ptr_ne(r, null);
   4100   r = self->f->pushInt(self, 3);
   4101   ck_assert_ptr_ne(r, null);
   4102   r = self->f->pushInt(self, 4);
   4103   ck_assert_ptr_ne(r, null);
   4104 
   4105   // positive index
   4106   r       = self->f->setAtDouble(self, 1, 12);
   4107   ck_assert_ptr_ne(r, null);
   4108   char *s = toStringO(r);
   4109   ck_assert_str_eq(s, "[1,1.200000e+01,3,4]");
   4110   free(s);
   4111   // negative index
   4112   r = self->f->setAtDouble(self, -1, 14);
   4113   ck_assert_ptr_ne(r, null);
   4114   s = toStringO(r);
   4115   ck_assert_str_eq(s, "[1,1.200000e+01,3,1.400000e+01]");
   4116   free(s);
   4117   // index outside
   4118   ck_assert_ptr_eq(self->f->setAtDouble(self, 20, 1), NULL);
   4119   ck_assert_ptr_eq(self->f->setAtDouble(self, -8, 1), NULL);
   4120   // empty list
   4121   emptyO(self);
   4122   ck_assert_ptr_eq(self->f->setAtDouble(self, 0, 1), NULL);
   4123   ck_assert_ptr_eq(self->f->setAtDouble(self, -1, 1), NULL);
   4124   // non json array
   4125   freeO(self);
   4126   setTypeBoolO(self);
   4127   ck_assert_ptr_eq(self->f->setAtDouble(self, 0, 1), NULL);
   4128   terminateO(self);
   4129 
   4130 }
   4131 
   4132 
   4133 void setAtIntSmallJsonT(CuTest *tc UNUSED) {
   4134 
   4135   smallJsont* r;
   4136   smallJsont *self = allocSmallJson();
   4137 
   4138   // add elements to self
   4139   r = self->f->pushInt(self, 1);
   4140   ck_assert_ptr_ne(r, null);
   4141   r = self->f->pushInt(self, 2);
   4142   ck_assert_ptr_ne(r, null);
   4143   r = self->f->pushInt(self, 3);
   4144   ck_assert_ptr_ne(r, null);
   4145   r = self->f->pushInt(self, 4);
   4146   ck_assert_ptr_ne(r, null);
   4147 
   4148   // positive index
   4149   r       = self->f->setAtInt(self, 1, 12);
   4150   ck_assert_ptr_ne(r, null);
   4151   char *s = toStringO(r);
   4152   ck_assert_str_eq(s, "[1,12,3,4]");
   4153   free(s);
   4154   // negative index
   4155   r = self->f->setAtInt(self, -1, 14);
   4156   ck_assert_ptr_ne(r, null);
   4157   s = toStringO(r);
   4158   ck_assert_str_eq(s, "[1,12,3,14]");
   4159   free(s);
   4160   // index outside
   4161   ck_assert_ptr_eq(self->f->setAtInt(self, 20, 1), NULL);
   4162   ck_assert_ptr_eq(self->f->setAtInt(self, -8, 1), NULL);
   4163   // empty list
   4164   emptyO(self);
   4165   ck_assert_ptr_eq(self->f->setAtInt(self, 0, 1), NULL);
   4166   ck_assert_ptr_eq(self->f->setAtInt(self, -1, 1), NULL);
   4167   // non json array
   4168   freeO(self);
   4169   setTypeBoolO(self);
   4170   ck_assert_ptr_eq(self->f->setAtInt(self, 0, 1), NULL);
   4171   terminateO(self);
   4172 
   4173 }
   4174 
   4175 
   4176 void setAtSSmallJsonT(CuTest *tc UNUSED) {
   4177 
   4178   smallJsont* r;
   4179   smallJsont *self = allocSmallJson();
   4180 
   4181   // add elements to self
   4182   r = self->f->pushInt(self, 1);
   4183   ck_assert_ptr_ne(r, null);
   4184   r = self->f->pushInt(self, 2);
   4185   ck_assert_ptr_ne(r, null);
   4186   r = self->f->pushInt(self, 3);
   4187   ck_assert_ptr_ne(r, null);
   4188   r = self->f->pushInt(self, 4);
   4189   ck_assert_ptr_ne(r, null);
   4190 
   4191   // positive index
   4192   r       = self->f->setAtS(self, 1, "a");
   4193   ck_assert_ptr_ne(r, null);
   4194   char *s = toStringO(r);
   4195   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4196   free(s);
   4197   // negative index
   4198   r = self->f->setAtS(self, -1, "b");
   4199   ck_assert_ptr_ne(r, null);
   4200   s = toStringO(r);
   4201   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4202   free(s);
   4203   // NULL string
   4204   r = self->f->setAtS(self, -1, NULL);
   4205   ck_assert_ptr_eq(r, null);
   4206   // index outside
   4207   ck_assert_ptr_eq(self->f->setAtS(self, 20, ""), NULL);
   4208   ck_assert_ptr_eq(self->f->setAtS(self, -8, ""), NULL);
   4209   // empty list
   4210   emptyO(self);
   4211   ck_assert_ptr_eq(self->f->setAtS(self, 0, ""), NULL);
   4212   ck_assert_ptr_eq(self->f->setAtS(self, -1, ""), NULL);
   4213   terminateO(self);
   4214 
   4215 }
   4216 
   4217 
   4218 void setAtCharSmallJsonT(CuTest *tc UNUSED) {
   4219 
   4220   smallJsont* r;
   4221   smallJsont *self = allocSmallJson();
   4222 
   4223   // add elements to self
   4224   r = self->f->pushInt(self, 1);
   4225   ck_assert_ptr_ne(r, null);
   4226   r = self->f->pushInt(self, 2);
   4227   ck_assert_ptr_ne(r, null);
   4228   r = self->f->pushInt(self, 3);
   4229   ck_assert_ptr_ne(r, null);
   4230   r = self->f->pushInt(self, 4);
   4231   ck_assert_ptr_ne(r, null);
   4232 
   4233   // positive index
   4234   r       = self->f->setAtChar(self, 1, 'a');
   4235   ck_assert_ptr_ne(r, null);
   4236   char *s = toStringO(r);
   4237   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4238   free(s);
   4239   // negative index
   4240   r = self->f->setAtChar(self, -1, 'b');
   4241   ck_assert_ptr_ne(r, null);
   4242   s = toStringO(r);
   4243   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4244   free(s);
   4245   // index outside
   4246   ck_assert_ptr_eq(self->f->setAtChar(self, 20, 'a'), NULL);
   4247   ck_assert_ptr_eq(self->f->setAtChar(self, -8, 's'), NULL);
   4248   // empty list
   4249   emptyO(self);
   4250   ck_assert_ptr_eq(self->f->setAtChar(self, 0, 'a'), NULL);
   4251   ck_assert_ptr_eq(self->f->setAtChar(self, -1, 's'), NULL);
   4252   terminateO(self);
   4253 
   4254 }
   4255 
   4256 
   4257 void setAtDictSmallJsonT(CuTest *tc UNUSED) {
   4258 
   4259   smallJsont* r;
   4260   smallJsont *self = allocSmallJson();
   4261   smallDictt *value;
   4262 
   4263   // add elements to self
   4264   r = self->f->pushInt(self, 1);
   4265   ck_assert_ptr_ne(r, null);
   4266   r = self->f->pushInt(self, 2);
   4267   ck_assert_ptr_ne(r, null);
   4268   r = self->f->pushInt(self, 3);
   4269   ck_assert_ptr_ne(r, null);
   4270   r = self->f->pushInt(self, 4);
   4271   ck_assert_ptr_ne(r, null);
   4272 
   4273   // positive index
   4274   value   = allocSmallDict();
   4275   r       = self->f->setAtDict(self, 1, value);
   4276   ck_assert_ptr_ne(r, null);
   4277   finishO(value);
   4278   char *s = toStringO(r);
   4279   ck_assert_str_eq(s, "[1,{},3,4]");
   4280   free(s);
   4281   // negative index
   4282   value   = allocSmallDict();
   4283   r = self->f->setAtDict(self, -1, value);
   4284   ck_assert_ptr_ne(r, null);
   4285   finishO(value);
   4286   s = toStringO(r);
   4287   ck_assert_str_eq(s, "[1,{},3,{}]");
   4288   free(s);
   4289   // index outside
   4290   value = allocSmallDict();
   4291   ck_assert_ptr_eq(self->f->setAtDict(self, 20, value), NULL);
   4292   ck_assert_ptr_eq(self->f->setAtDict(self, -8, value), NULL);
   4293   // empty list
   4294   emptyO(self);
   4295   ck_assert_ptr_eq(self->f->setAtDict(self, 0, value), NULL);
   4296   ck_assert_ptr_eq(self->f->setAtDict(self, -1, value), NULL);
   4297   terminateO(value);
   4298   // non smallDict object
   4299   value = (smallDictt*) allocSmallInt(2);
   4300   r = self->f->setAtDict(self, 0, value);
   4301   ck_assert_ptr_eq(r, null);
   4302   terminateO(value);
   4303   // NULL value
   4304   ck_assert_ptr_eq(self->f->setAtDict(self, 0, NULL), NULL);
   4305   terminateO(self);
   4306 
   4307 }
   4308 
   4309 
   4310 void setAtArraySmallJsonT(CuTest *tc UNUSED) {
   4311 
   4312   smallJsont* r;
   4313   smallJsont *self = allocSmallJson();
   4314   smallArrayt *value;
   4315 
   4316   // add elements to self
   4317   r = self->f->pushInt(self, 1);
   4318   ck_assert_ptr_ne(r, null);
   4319   r = self->f->pushInt(self, 2);
   4320   ck_assert_ptr_ne(r, null);
   4321   r = self->f->pushInt(self, 3);
   4322   ck_assert_ptr_ne(r, null);
   4323   r = self->f->pushInt(self, 4);
   4324   ck_assert_ptr_ne(r, null);
   4325 
   4326   // positive index
   4327   value   = allocSmallArray();
   4328   r       = self->f->setAtArray(self, 1, value);
   4329   ck_assert_ptr_ne(r, null);
   4330   finishO(value);
   4331   char *s = toStringO(r);
   4332   ck_assert_str_eq(s, "[1,[],3,4]");
   4333   free(s);
   4334   // negative index
   4335   value   = allocSmallArray();
   4336   r = self->f->setAtArray(self, -1, value);
   4337   ck_assert_ptr_ne(r, null);
   4338   finishO(value);
   4339   s = toStringO(r);
   4340   ck_assert_str_eq(s, "[1,[],3,[]]");
   4341   free(s);
   4342   // index outside
   4343   value = allocSmallArray();
   4344   ck_assert_ptr_eq(self->f->setAtArray(self, 20, value), NULL);
   4345   ck_assert_ptr_eq(self->f->setAtArray(self, -8, value), NULL);
   4346   // empty list
   4347   emptyO(self);
   4348   ck_assert_ptr_eq(self->f->setAtArray(self, 0, value), NULL);
   4349   ck_assert_ptr_eq(self->f->setAtArray(self, -1, value), NULL);
   4350   terminateO(value);
   4351   // non smallArray object
   4352   value = (smallArrayt*) allocSmallInt(2);
   4353   r = self->f->setAtArray(self, 0, value);
   4354   ck_assert_ptr_eq(r, null);
   4355   terminateO(value);
   4356   // NULL value
   4357   ck_assert_ptr_eq(self->f->setAtArray(self, 0, NULL), NULL);
   4358   terminateO(self);
   4359 
   4360 }
   4361 
   4362 
   4363 void setAtArraycSmallJsonT(CuTest *tc UNUSED) {
   4364 
   4365   smallJsont* r;
   4366   smallJsont *self = allocSmallJson();
   4367   char **value;
   4368 
   4369   // add elements to self
   4370   r = self->f->pushInt(self, 1);
   4371   ck_assert_ptr_ne(r, null);
   4372   r = self->f->pushInt(self, 2);
   4373   ck_assert_ptr_ne(r, null);
   4374   r = self->f->pushInt(self, 3);
   4375   ck_assert_ptr_ne(r, null);
   4376   r = self->f->pushInt(self, 4);
   4377   ck_assert_ptr_ne(r, null);
   4378 
   4379   // positive index
   4380   value   = listCreateS("a");
   4381   r       = self->f->setAtArrayc(self, 1, value);
   4382   ck_assert_ptr_ne(r, null);
   4383   listFreeS(value);
   4384   char *s = toStringO(r);
   4385   ck_assert_str_eq(s, "[1,[\"a\"],3,4]");
   4386   free(s);
   4387   // negative index
   4388   value   = listCreateS("b");
   4389   r = self->f->setAtArrayc(self, -1, value);
   4390   ck_assert_ptr_ne(r, null);
   4391   listFreeS(value);
   4392   s = toStringO(r);
   4393   ck_assert_str_eq(s, "[1,[\"a\"],3,[\"b\"]]");
   4394   free(s);
   4395   // index outside
   4396   value = (char**)r;
   4397   ck_assert_ptr_eq(self->f->setAtArrayc(self, 20, value), NULL);
   4398   ck_assert_ptr_eq(self->f->setAtArrayc(self, -8, value), NULL);
   4399   // empty list
   4400   emptyO(self);
   4401   ck_assert_ptr_eq(self->f->setAtArrayc(self, 0, value), NULL);
   4402   ck_assert_ptr_eq(self->f->setAtArrayc(self, -1, value), NULL);
   4403   // NULL value
   4404   ck_assert_ptr_eq(self->f->setAtArrayc(self, 0, NULL), NULL);
   4405   terminateO(self);
   4406 
   4407 }
   4408 
   4409 
   4410 void setAtSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   4411 
   4412   smallJsont* r;
   4413   smallJsont *self = allocSmallJson();
   4414   smallBoolt *value;
   4415 
   4416   // add elements to self
   4417   r = self->f->pushInt(self, 1);
   4418   ck_assert_ptr_ne(r, null);
   4419   r = self->f->pushInt(self, 2);
   4420   ck_assert_ptr_ne(r, null);
   4421   r = self->f->pushInt(self, 3);
   4422   ck_assert_ptr_ne(r, null);
   4423   r = self->f->pushInt(self, 4);
   4424   ck_assert_ptr_ne(r, null);
   4425 
   4426   // positive index
   4427   value   = allocSmallBool(true);
   4428   r       = self->f->setAtSmallBool(self, 1, value);
   4429   ck_assert_ptr_ne(r, null);
   4430   finishO(value);
   4431   char *s = toStringO(r);
   4432   ck_assert_str_eq(s, "[1,true,3,4]");
   4433   free(s);
   4434   // negative index
   4435   value   = allocSmallBool(true);
   4436   r = self->f->setAtSmallBool(self, -1, value);
   4437   ck_assert_ptr_ne(r, null);
   4438   finishO(value);
   4439   s = toStringO(r);
   4440   ck_assert_str_eq(s, "[1,true,3,true]");
   4441   free(s);
   4442   // empty smallBool
   4443   value = allocSmallBool(true);
   4444   freeO(value);
   4445   r = self->f->setAtSmallBool(self, -1, value);
   4446   ck_assert_ptr_ne(r, null);
   4447   finishO(value);
   4448   s = toStringO(r);
   4449   ck_assert_str_eq(s, "[1,true,3,false]");
   4450   free(s);
   4451   // index outside
   4452   value = allocSmallBool(true);
   4453   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 20, value), NULL);
   4454   ck_assert_ptr_eq(self->f->setAtSmallBool(self, -8, value), NULL);
   4455   // empty list
   4456   emptyO(self);
   4457   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 0, value), NULL);
   4458   ck_assert_ptr_eq(self->f->setAtSmallBool(self, -1, value), NULL);
   4459   terminateO(value);
   4460   // non smallBool object
   4461   value = (smallBoolt*) allocSmallInt(2);
   4462   r = self->f->setAtSmallBool(self, 0, value);
   4463   ck_assert_ptr_eq(r, null);
   4464   terminateO(value);
   4465   // NULL value
   4466   ck_assert_ptr_eq(self->f->setAtSmallBool(self, 0, NULL), NULL);
   4467   terminateO(self);
   4468 
   4469 }
   4470 
   4471 
   4472 void setAtSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   4473 
   4474   smallJsont* r;
   4475   smallJsont *self = allocSmallJson();
   4476   smallBytest *value;
   4477 
   4478   // add elements to self
   4479   r = self->f->pushInt(self, 1);
   4480   ck_assert_ptr_ne(r, null);
   4481   r = self->f->pushInt(self, 2);
   4482   ck_assert_ptr_ne(r, null);
   4483   r = self->f->pushInt(self, 3);
   4484   ck_assert_ptr_ne(r, null);
   4485   r = self->f->pushInt(self, 4);
   4486   ck_assert_ptr_ne(r, null);
   4487 
   4488   // positive index
   4489   value   = allocSmallBytes(NULL, 0);
   4490   r       = self->f->setAtSmallBytes(self, 1, value);
   4491   ck_assert_ptr_ne(r, null);
   4492   finishO(value);
   4493   char *s = toStringO(r);
   4494   ck_assert_str_eq(s, "[1,[],3,4]");
   4495   free(s);
   4496   // empty smallBytes
   4497   value   = allocSmallBytes(NULL, 0);
   4498   freeO(value);
   4499   r       = self->f->setAtSmallBytes(self, 1, value);
   4500   ck_assert_ptr_ne(r, null);
   4501   finishO(value);
   4502   s = toStringO(r);
   4503   ck_assert_str_eq(s, "[1,[],3,4]");
   4504   free(s);
   4505   // negative index
   4506   value   = allocSmallBytes(NULL, 0);
   4507   r = self->f->setAtSmallBytes(self, -1, value);
   4508   ck_assert_ptr_ne(r, null);
   4509   finishO(value);
   4510   s = toStringO(r);
   4511   ck_assert_str_eq(s, "[1,[],3,[]]");
   4512   free(s);
   4513   // index outside
   4514   value = allocSmallBytes(NULL, 0);
   4515   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 20, value), NULL);
   4516   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, -5, value), NULL);
   4517   // empty list
   4518   emptyO(self);
   4519   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 0, value), NULL);
   4520   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, -1, value), NULL);
   4521   terminateO(value);
   4522   // non smallBytes object
   4523   value = (smallBytest*) allocSmallInt(2);
   4524   r = self->f->setAtSmallBytes(self, 0, value);
   4525   ck_assert_ptr_eq(r, null);
   4526   terminateO(value);
   4527   // NULL value
   4528   ck_assert_ptr_eq(self->f->setAtSmallBytes(self, 0, NULL), NULL);
   4529   terminateO(self);
   4530 
   4531 }
   4532 
   4533 
   4534 void setAtSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   4535 
   4536   smallJsont* r;
   4537   smallJsont *self = allocSmallJson();
   4538   smallDoublet *value;
   4539 
   4540   // add elements to self
   4541   r = self->f->pushInt(self, 1);
   4542   ck_assert_ptr_ne(r, null);
   4543   r = self->f->pushInt(self, 2);
   4544   ck_assert_ptr_ne(r, null);
   4545   r = self->f->pushInt(self, 3);
   4546   ck_assert_ptr_ne(r, null);
   4547   r = self->f->pushInt(self, 4);
   4548   ck_assert_ptr_ne(r, null);
   4549 
   4550   // positive index
   4551   value   = allocSmallDouble(5);
   4552   r       = self->f->setAtSmallDouble(self, 1, value);
   4553   ck_assert_ptr_ne(r, null);
   4554   finishO(value);
   4555   char *s = toStringO(r);
   4556   ck_assert_str_eq(s, "[1,5.000000e+00,3,4]");
   4557   free(s);
   4558   // negative index
   4559   value   = allocSmallDouble(6);
   4560   r = self->f->setAtSmallDouble(self, -1, value);
   4561   ck_assert_ptr_ne(r, null);
   4562   finishO(value);
   4563   s = toStringO(r);
   4564   ck_assert_str_eq(s, "[1,5.000000e+00,3,6.000000e+00]");
   4565   free(s);
   4566   // empty smallDouble
   4567   value   = allocSmallDouble(0);
   4568   freeO(value);
   4569   r = self->f->setAtSmallDouble(self, -1, value);
   4570   ck_assert_ptr_ne(r, null);
   4571   finishO(value);
   4572   s = toStringO(r);
   4573   ck_assert_str_eq(s, "[1,5.000000e+00,3,0.000000e+00]");
   4574   free(s);
   4575   // index outside
   4576   value = allocSmallDouble(1);
   4577   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 20, value), NULL);
   4578   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, -8, value), NULL);
   4579   // empty list
   4580   emptyO(self);
   4581   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 0, value), NULL);
   4582   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, -1, value), NULL);
   4583   terminateO(value);
   4584   // non smallDouble object
   4585   value = (smallDoublet*) allocSmallInt(2);
   4586   r = self->f->setAtSmallDouble(self, 0, value);
   4587   ck_assert_ptr_eq(r, null);
   4588   terminateO(value);
   4589   // NULL value
   4590   ck_assert_ptr_eq(self->f->setAtSmallDouble(self, 0, NULL), NULL);
   4591   terminateO(self);
   4592 
   4593 }
   4594 
   4595 
   4596 void setAtSmallIntSmallJsonT(CuTest *tc UNUSED) {
   4597 
   4598   smallJsont* r;
   4599   smallJsont *self = allocSmallJson();
   4600   smallIntt *value;
   4601 
   4602   // add elements to self
   4603   r = self->f->pushInt(self, 1);
   4604   ck_assert_ptr_ne(r, null);
   4605   r = self->f->pushInt(self, 2);
   4606   ck_assert_ptr_ne(r, null);
   4607   r = self->f->pushInt(self, 3);
   4608   ck_assert_ptr_ne(r, null);
   4609   r = self->f->pushInt(self, 4);
   4610   ck_assert_ptr_ne(r, null);
   4611 
   4612   // positive index
   4613   value   = allocSmallInt(5);
   4614   r       = self->f->setAtSmallInt(self, 1, value);
   4615   ck_assert_ptr_ne(r, null);
   4616   finishO(value);
   4617   char *s = toStringO(r);
   4618   ck_assert_str_eq(s, "[1,5,3,4]");
   4619   free(s);
   4620   // negative index
   4621   value   = allocSmallInt(6);
   4622   r = self->f->setAtSmallInt(self, -1, value);
   4623   ck_assert_ptr_ne(r, null);
   4624   finishO(value);
   4625   s = toStringO(r);
   4626   ck_assert_str_eq(s, "[1,5,3,6]");
   4627   free(s);
   4628   // empty SmallInt
   4629   value   = allocSmallInt(0);
   4630   freeO(value);
   4631   r = self->f->setAtSmallInt(self, -1, value);
   4632   ck_assert_ptr_ne(r, null);
   4633   finishO(value);
   4634   s = toStringO(r);
   4635   ck_assert_str_eq(s, "[1,5,3,0]");
   4636   free(s);
   4637   // index outside
   4638   value = allocSmallInt(1);
   4639   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 20, value), NULL);
   4640   ck_assert_ptr_eq(self->f->setAtSmallInt(self, -8, value), NULL);
   4641   // empty list
   4642   emptyO(self);
   4643   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 0, value), NULL);
   4644   ck_assert_ptr_eq(self->f->setAtSmallInt(self, -1, value), NULL);
   4645   terminateO(value);
   4646   // non smallInt object
   4647   value = (smallIntt*) allocSmallBool(true);
   4648   r = self->f->setAtSmallInt(self, 0, value);
   4649   ck_assert_ptr_eq(r, null);
   4650   terminateO(value);
   4651   // NULL value
   4652   ck_assert_ptr_eq(self->f->setAtSmallInt(self, 0, NULL), NULL);
   4653   terminateO(self);
   4654 
   4655 }
   4656 
   4657 
   4658 void setAtSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   4659 
   4660   smallJsont* r;
   4661   smallJsont *self = allocSmallJson();
   4662   smallJsont *value;
   4663 
   4664   // add elements to self
   4665   r = self->f->pushInt(self, 1);
   4666   ck_assert_ptr_ne(r, null);
   4667   r = self->f->pushInt(self, 2);
   4668   ck_assert_ptr_ne(r, null);
   4669   r = self->f->pushInt(self, 3);
   4670   ck_assert_ptr_ne(r, null);
   4671   r = self->f->pushInt(self, 4);
   4672   ck_assert_ptr_ne(r, null);
   4673 
   4674   // positive index
   4675   value   = allocSmallJson();
   4676   r       = self->f->setAtSmallJson(self, 1, value);
   4677   ck_assert_ptr_ne(r, null);
   4678   finishO(value);
   4679   char *s = toStringO(r);
   4680   ck_assert_str_eq(s, "[1,{},3,4]");
   4681   free(s);
   4682   // negative index
   4683   value   = allocSmallJson();
   4684   r = self->f->setAtSmallJson(self, -1, value);
   4685   ck_assert_ptr_ne(r, null);
   4686   finishO(value);
   4687   s = toStringO(r);
   4688   ck_assert_str_eq(s, "[1,{},3,{}]");
   4689   free(s);
   4690   // index outside
   4691   value = allocSmallJson();
   4692   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 20, value), NULL);
   4693   ck_assert_ptr_eq(self->f->setAtSmallJson(self, -8, value), NULL);
   4694   // empty list
   4695   emptyO(self);
   4696   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 0, value), NULL);
   4697   ck_assert_ptr_eq(self->f->setAtSmallJson(self, -1, value), NULL);
   4698   terminateO(value);
   4699   // non smallJson object
   4700   value = (smallJsont*) allocSmallInt(2);
   4701   r = self->f->setAtSmallJson(self, 0, value);
   4702   ck_assert_ptr_eq(r, null);
   4703   terminateO(value);
   4704   // NULL value
   4705   ck_assert_ptr_eq(self->f->setAtSmallJson(self, 0, NULL), NULL);
   4706   terminateO(self);
   4707 
   4708 }
   4709 
   4710 
   4711 void setAtSmallStringSmallJsonT(CuTest *tc UNUSED) {
   4712 
   4713   smallJsont* r;
   4714   smallJsont *self = allocSmallJson();
   4715   smallStringt *value;
   4716 
   4717   // add elements to self
   4718   r = self->f->pushInt(self, 1);
   4719   ck_assert_ptr_ne(r, null);
   4720   r = self->f->pushInt(self, 2);
   4721   ck_assert_ptr_ne(r, null);
   4722   r = self->f->pushInt(self, 3);
   4723   ck_assert_ptr_ne(r, null);
   4724   r = self->f->pushInt(self, 4);
   4725   ck_assert_ptr_ne(r, null);
   4726 
   4727   // positive index
   4728   initiateAllocateSmallString(&value);
   4729   r       = self->f->setAtSmallString(self, 1, value);
   4730   ck_assert_ptr_ne(r, null);
   4731   finishO(value);
   4732   char *s = toStringO(r);
   4733   ck_assert_str_eq(s, "[1,\"\",3,4]");
   4734   free(s);
   4735   // negative index
   4736   value   = allocSmallString("a");
   4737   r = self->f->setAtSmallString(self, -1, value);
   4738   ck_assert_ptr_ne(r, null);
   4739   finishO(value);
   4740   s = toStringO(r);
   4741   ck_assert_str_eq(s, "[1,\"\",3,\"a\"]");
   4742   free(s);
   4743   // index outside
   4744   value = allocSmallString("asd");
   4745   ck_assert_ptr_eq(self->f->setAtSmallString(self, 20, value), NULL);
   4746   ck_assert_ptr_eq(self->f->setAtSmallString(self, -8, value), NULL);
   4747   // empty list
   4748   emptyO(self);
   4749   ck_assert_ptr_eq(self->f->setAtSmallString(self, 0, value), NULL);
   4750   ck_assert_ptr_eq(self->f->setAtSmallString(self, -1, value), NULL);
   4751   terminateO(value);
   4752   // non smallString object
   4753   value = (smallStringt*) allocSmallInt(2);
   4754   r = self->f->setAtSmallString(self, 0, value);
   4755   ck_assert_ptr_eq(r, null);
   4756   terminateO(value);
   4757   // NULL value
   4758   ck_assert_ptr_eq(self->f->setAtSmallString(self, 0, NULL), NULL);
   4759   terminateO(self);
   4760 
   4761 }
   4762 
   4763 
   4764 void setAtSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   4765 
   4766   smallJsont* r;
   4767   smallJsont *self = allocSmallJson();
   4768   smallContainert *value;
   4769 
   4770   // add elements to self
   4771   r = self->f->pushInt(self, 1);
   4772   ck_assert_ptr_ne(r, null);
   4773   r = self->f->pushInt(self, 2);
   4774   ck_assert_ptr_ne(r, null);
   4775   r = self->f->pushInt(self, 3);
   4776   ck_assert_ptr_ne(r, null);
   4777   r = self->f->pushInt(self, 4);
   4778   ck_assert_ptr_ne(r, null);
   4779 
   4780   // positive index
   4781   initiateAllocateSmallContainer(&value);
   4782   r       = self->f->setAtSmallContainer(self, 1, value);
   4783   ck_assert_ptr_ne(r, null);
   4784   finishO(value);
   4785   char *s = toStringO(r);
   4786   ck_assert_str_eq(s, "[1,\"<data container>\",3,4]");
   4787   free(s);
   4788   // negative index
   4789   initiateAllocateSmallContainer(&value);
   4790   r = self->f->setAtSmallContainer(self, -1, value);
   4791   ck_assert_ptr_ne(r, null);
   4792   finishO(value);
   4793   s = toStringO(r);
   4794   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
   4795   free(s);
   4796   // index outside
   4797   initiateAllocateSmallContainer(&value);
   4798   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 20, value), NULL);
   4799   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, -8, value), NULL);
   4800   // empty list
   4801   emptyO(self);
   4802   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 0, value), NULL);
   4803   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, -1, value), NULL);
   4804   terminateO(value);
   4805   // non smallContainer object
   4806   value = (smallContainert*) allocSmallInt(2);
   4807   r = self->f->setAtSmallContainer(self, 0, value);
   4808   ck_assert_ptr_eq(r, null);
   4809   terminateO(value);
   4810   // NULL value
   4811   ck_assert_ptr_eq(self->f->setAtSmallContainer(self, 0, NULL), NULL);
   4812   terminateO(self);
   4813 
   4814 }
   4815 
   4816 
   4817 void setAtNFreeSmallJsonT(CuTest *tc UNUSED) {
   4818 
   4819   smallJsont* r;
   4820   smallJsont *self = allocSmallJson();
   4821   baset *value;
   4822 
   4823   // add elements to self
   4824   r = self->f->pushInt(self, 1);
   4825   ck_assert_ptr_ne(r, null);
   4826   r = self->f->pushInt(self, 2);
   4827   ck_assert_ptr_ne(r, null);
   4828   r = self->f->pushInt(self, 3);
   4829   ck_assert_ptr_ne(r, null);
   4830   r = self->f->pushInt(self, 4);
   4831   ck_assert_ptr_ne(r, null);
   4832 
   4833   // positive index
   4834   value   = (baset*)allocSmallInt(123);
   4835   r       = self->f->setAtNFree(self, 1, value);
   4836   ck_assert_ptr_ne(r, null);
   4837   char *s = toStringO(r);
   4838   ck_assert_str_eq(s, "[1,123,3,4]");
   4839   free(s);
   4840   // negative index
   4841   value   = (baset*)allocSmallInt(234);
   4842   r = self->f->setAtNFree(self, -1, value);
   4843   ck_assert_ptr_ne(r, null);
   4844   s = toStringO(r);
   4845   ck_assert_str_eq(s, "[1,123,3,234]");
   4846   free(s);
   4847   // undefined object
   4848   value   = (baset*)allocUndefined();
   4849   r = self->f->setAtNFree(self, -1, value);
   4850   ck_assert_ptr_ne(r, null);
   4851   s = toStringO(r);
   4852   ck_assert_str_eq(s, "[1,123,3,null]");
   4853   free(s);
   4854   // container
   4855   createAllocateSmallContainer(c);
   4856   r = self->f->setAtNFree(self, -1, (baset*)c);
   4857   ck_assert_ptr_ne(r, null);
   4858   s = toStringO(r);
   4859   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   4860   free(s);
   4861   // base object in container
   4862   createAllocateSmallInt(I);
   4863   setValG(I, 11);
   4864   I->type = "anothertype";
   4865   r = self->f->setAtNFree(self, -1, (baset*)I);
   4866   ck_assert_ptr_ne(r, null);
   4867   s = toStringO(r);
   4868   ck_assert_str_eq(s, "[1,123,3,\"<data container>\"]");
   4869   free(s);
   4870   // index outside
   4871   value = (baset*)allocSmallInt(123);
   4872   ck_assert_ptr_eq(self->f->setAtNFree(self, 20, value), NULL);
   4873   ck_assert_ptr_eq(self->f->setAtNFree(self, -8, value), NULL);
   4874   // empty list
   4875   emptyO(self);
   4876   ck_assert_ptr_eq(self->f->setAtNFree(self, 0, value), NULL);
   4877   ck_assert_ptr_eq(self->f->setAtNFree(self, -1, value), NULL);
   4878   // NULL value
   4879   ck_assert_ptr_eq(self->f->setAtNFree(self, 0, NULL), NULL);
   4880   terminateO(value);
   4881   terminateO(self);
   4882 
   4883 }
   4884 
   4885 
   4886 void setAtNFreeUndefinedSmallJsonT(CuTest *tc UNUSED) {
   4887 
   4888   smallJsont* r;
   4889   smallJsont *self = allocSmallJson();
   4890   undefinedt *value = NULL;
   4891 
   4892 
   4893   // add elements to self
   4894   r = self->f->pushInt(self, 1);
   4895   ck_assert_ptr_ne(r, null);
   4896   r = self->f->pushInt(self, 2);
   4897   ck_assert_ptr_ne(r, null);
   4898   r = self->f->pushInt(self, 3);
   4899   ck_assert_ptr_ne(r, null);
   4900   r = self->f->pushInt(self, 4);
   4901   ck_assert_ptr_ne(r, null);
   4902 
   4903   // positive index
   4904   value = allocUndefined();
   4905   r       = self->f->setAtNFreeUndefined(self, 1, value);
   4906   ck_assert_ptr_ne(r, null);
   4907   char *s = toStringO(r);
   4908   ck_assert_str_eq(s, "[1,null,3,4]");
   4909   free(s);
   4910   // negative index
   4911   value = allocUndefined();
   4912   r = self->f->setAtNFreeUndefined(self, -1, value);
   4913   ck_assert_ptr_ne(r, null);
   4914   s = toStringO(r);
   4915   ck_assert_str_eq(s, "[1,null,3,null]");
   4916   free(s);
   4917   // index outside
   4918   value = allocUndefined();
   4919   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 20, value), NULL);
   4920   terminateO(value);
   4921   value = allocUndefined();
   4922   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, -8, value), NULL);
   4923   terminateO(value);
   4924   // empty list
   4925   emptyO(self);
   4926   value = allocUndefined();
   4927   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 0, value), NULL);
   4928   terminateO(value);
   4929   value = allocUndefined();
   4930   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, -1, value), NULL);
   4931   terminateO(value);
   4932   // non json array
   4933   freeO(self);
   4934   setTypeBoolO(self);
   4935   value = allocUndefined();
   4936   ck_assert_ptr_eq(self->f->setAtNFreeUndefined(self, 0, value), NULL);
   4937   terminateO(value);
   4938   terminateO(self);
   4939 
   4940 }
   4941 
   4942 
   4943 void setAtNFreeSSmallJsonT(CuTest *tc UNUSED) {
   4944 
   4945   smallJsont* r;
   4946   smallJsont *self = allocSmallJson();
   4947 
   4948   // add elements to self
   4949   r = self->f->pushInt(self, 1);
   4950   ck_assert_ptr_ne(r, null);
   4951   r = self->f->pushInt(self, 2);
   4952   ck_assert_ptr_ne(r, null);
   4953   r = self->f->pushInt(self, 3);
   4954   ck_assert_ptr_ne(r, null);
   4955   r = self->f->pushInt(self, 4);
   4956   ck_assert_ptr_ne(r, null);
   4957 
   4958   // positive index
   4959   r       = self->f->setAtNFreeS(self, 1, strdup("a"));
   4960   ck_assert_ptr_ne(r, null);
   4961   char *s = toStringO(r);
   4962   ck_assert_str_eq(s, "[1,\"a\",3,4]");
   4963   free(s);
   4964   // negative index
   4965   r = self->f->setAtNFreeS(self, -1, strdup("b"));
   4966   ck_assert_ptr_ne(r, null);
   4967   s = toStringO(r);
   4968   ck_assert_str_eq(s, "[1,\"a\",3,\"b\"]");
   4969   free(s);
   4970   // NULL string
   4971   r = self->f->setAtNFreeS(self, -1, NULL);
   4972   ck_assert_ptr_eq(r, null);
   4973   // index outside
   4974   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 20, ""), NULL);
   4975   ck_assert_ptr_eq(self->f->setAtNFreeS(self, -8, ""), NULL);
   4976   // empty list
   4977   emptyO(self);
   4978   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 0, ""), NULL);
   4979   ck_assert_ptr_eq(self->f->setAtNFreeS(self, -1, ""), NULL);
   4980   // non json array
   4981   freeO(self);
   4982   setTypeBoolO(self);
   4983   ck_assert_ptr_eq(self->f->setAtNFreeS(self, 0, ""), NULL);
   4984   terminateO(self);
   4985 
   4986 }
   4987 
   4988 
   4989 void setAtNFreeDictSmallJsonT(CuTest *tc UNUSED) {
   4990 
   4991   smallJsont* r;
   4992   smallJsont *self = allocSmallJson();
   4993   smallDictt *value;
   4994 
   4995   // add elements to self
   4996   r = self->f->pushInt(self, 1);
   4997   ck_assert_ptr_ne(r, null);
   4998   r = self->f->pushInt(self, 2);
   4999   ck_assert_ptr_ne(r, null);
   5000   r = self->f->pushInt(self, 3);
   5001   ck_assert_ptr_ne(r, null);
   5002   r = self->f->pushInt(self, 4);
   5003   ck_assert_ptr_ne(r, null);
   5004 
   5005   // positive index
   5006   value   = allocSmallDict();
   5007   r       = self->f->setAtNFreeDict(self, 1, value);
   5008   ck_assert_ptr_ne(r, null);
   5009   char *s = toStringO(r);
   5010   ck_assert_str_eq(s, "[1,{},3,4]");
   5011   free(s);
   5012   // negative index
   5013   value   = allocSmallDict();
   5014   r = self->f->setAtNFreeDict(self, -1, value);
   5015   ck_assert_ptr_ne(r, null);
   5016   s = toStringO(r);
   5017   ck_assert_str_eq(s, "[1,{},3,{}]");
   5018   free(s);
   5019   // index outside
   5020   value = allocSmallDict();
   5021   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 20, value), NULL);
   5022   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, -8, value), NULL);
   5023   // empty list
   5024   emptyO(self);
   5025   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, value), NULL);
   5026   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, -1, value), NULL);
   5027   terminateO(value);
   5028   // NULL value
   5029   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, NULL), NULL);
   5030   // non json array
   5031   freeO(self);
   5032   setTypeBoolO(self);
   5033   value = allocSmallDict();
   5034   ck_assert_ptr_eq(self->f->setAtNFreeDict(self, 0, value), NULL);
   5035   terminateO(value);
   5036   terminateO(self);
   5037 
   5038 }
   5039 
   5040 
   5041 void setAtNFreeArraySmallJsonT(CuTest *tc UNUSED) {
   5042 
   5043   smallJsont* r;
   5044   smallJsont *self = allocSmallJson();
   5045   smallArrayt *value;
   5046 
   5047   // add elements to self
   5048   r = self->f->pushInt(self, 1);
   5049   ck_assert_ptr_ne(r, null);
   5050   r = self->f->pushInt(self, 2);
   5051   ck_assert_ptr_ne(r, null);
   5052   r = self->f->pushInt(self, 3);
   5053   ck_assert_ptr_ne(r, null);
   5054   r = self->f->pushInt(self, 4);
   5055   ck_assert_ptr_ne(r, null);
   5056 
   5057   // positive index
   5058   value   = allocSmallArray();
   5059   r       = self->f->setAtNFreeArray(self, 1, value);
   5060   ck_assert_ptr_ne(r, null);
   5061   char *s = toStringO(r);
   5062   ck_assert_str_eq(s, "[1,[],3,4]");
   5063   free(s);
   5064   // negative index
   5065   value   = allocSmallArray();
   5066   r = self->f->setAtNFreeArray(self, -1, value);
   5067   ck_assert_ptr_ne(r, null);
   5068   s = toStringO(r);
   5069   ck_assert_str_eq(s, "[1,[],3,[]]");
   5070   free(s);
   5071   // index outside
   5072   value = allocSmallArray();
   5073   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 20, value), NULL);
   5074   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, -8, value), NULL);
   5075   // empty list
   5076   emptyO(self);
   5077   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, value), NULL);
   5078   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, -1, value), NULL);
   5079   terminateO(value);
   5080   // NULL value
   5081   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, NULL), NULL);
   5082   // non json array
   5083   freeO(self);
   5084   setTypeBoolO(self);
   5085   value = allocSmallArray();
   5086   ck_assert_ptr_eq(self->f->setAtNFreeArray(self, 0, value), NULL);
   5087   terminateO(value);
   5088   terminateO(self);
   5089 
   5090 }
   5091 
   5092 
   5093 void setAtNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
   5094 
   5095   smallJsont* r;
   5096   smallJsont *self = allocSmallJson();
   5097   char **value;
   5098 
   5099   // add elements to self
   5100   r = self->f->pushInt(self, 1);
   5101   ck_assert_ptr_ne(r, null);
   5102   r = self->f->pushInt(self, 2);
   5103   ck_assert_ptr_ne(r, null);
   5104   r = self->f->pushInt(self, 3);
   5105   ck_assert_ptr_ne(r, null);
   5106   r = self->f->pushInt(self, 4);
   5107   ck_assert_ptr_ne(r, null);
   5108 
   5109   // positive index
   5110   value   = listCreateS("a");
   5111   r       = self->f->setAtNFreeArrayc(self, 1, value);
   5112   ck_assert_ptr_ne(r, null);
   5113   char *s = toStringO(r);
   5114   ck_assert_str_eq(s, "[1,[\"a\"],3,4]");
   5115   free(s);
   5116   // negative index
   5117   value   = listCreateS("b");
   5118   r = self->f->setAtNFreeArrayc(self, -1, value);
   5119   ck_assert_ptr_ne(r, null);
   5120   s = toStringO(r);
   5121   ck_assert_str_eq(s, "[1,[\"a\"],3,[\"b\"]]");
   5122   free(s);
   5123   // index outside
   5124   value = (char**)r;
   5125   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 20, value), NULL);
   5126   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, -8, value), NULL);
   5127   // empty list
   5128   emptyO(self);
   5129   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, value), NULL);
   5130   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, -1, value), NULL);
   5131   // NULL value
   5132   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, NULL), NULL);
   5133   // non json array
   5134   freeO(self);
   5135   setTypeBoolO(self);
   5136   value = listCreateS("b");
   5137   ck_assert_ptr_eq(self->f->setAtNFreeArrayc(self, 0, value), NULL);
   5138   listFreeS(value);
   5139   terminateO(self);
   5140 
   5141 }
   5142 
   5143 
   5144 void setAtNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   5145 
   5146   smallJsont* r;
   5147   smallJsont *self = allocSmallJson();
   5148   smallBoolt *value;
   5149 
   5150   // add elements to self
   5151   r = self->f->pushInt(self, 1);
   5152   ck_assert_ptr_ne(r, null);
   5153   r = self->f->pushInt(self, 2);
   5154   ck_assert_ptr_ne(r, null);
   5155   r = self->f->pushInt(self, 3);
   5156   ck_assert_ptr_ne(r, null);
   5157   r = self->f->pushInt(self, 4);
   5158   ck_assert_ptr_ne(r, null);
   5159 
   5160   // positive index
   5161   value   = allocSmallBool(true);
   5162   r       = self->f->setAtNFreeSmallBool(self, 1, value);
   5163   ck_assert_ptr_ne(r, null);
   5164   char *s = toStringO(r);
   5165   ck_assert_str_eq(s, "[1,true,3,4]");
   5166   free(s);
   5167   // negative index
   5168   value   = allocSmallBool(true);
   5169   r = self->f->setAtNFreeSmallBool(self, -1, value);
   5170   ck_assert_ptr_ne(r, null);
   5171   s = toStringO(r);
   5172   ck_assert_str_eq(s, "[1,true,3,true]");
   5173   free(s);
   5174   // index outside
   5175   value = allocSmallBool(true);
   5176   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 20, value), NULL);
   5177   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, -8, value), NULL);
   5178   // empty list
   5179   emptyO(self);
   5180   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, value), NULL);
   5181   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, -1, value), NULL);
   5182   terminateO(value);
   5183   // NULL value
   5184   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, NULL), NULL);
   5185   // non json array
   5186   freeO(self);
   5187   setTypeBoolO(self);
   5188   value = allocSmallBool(true);
   5189   ck_assert_ptr_eq(self->f->setAtNFreeSmallBool(self, 0, value), NULL);
   5190   terminateO(value);
   5191   terminateO(self);
   5192 
   5193 }
   5194 
   5195 
   5196 void setAtNFreeSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   5197 
   5198   smallJsont* r;
   5199   smallJsont *self = allocSmallJson();
   5200   smallBytest *value;
   5201 
   5202   // add elements to self
   5203   r = self->f->pushInt(self, 1);
   5204   ck_assert_ptr_ne(r, null);
   5205   r = self->f->pushInt(self, 2);
   5206   ck_assert_ptr_ne(r, null);
   5207   r = self->f->pushInt(self, 3);
   5208   ck_assert_ptr_ne(r, null);
   5209   r = self->f->pushInt(self, 4);
   5210   ck_assert_ptr_ne(r, null);
   5211 
   5212   // positive index
   5213   value   = allocSmallBytes(NULL, 0);
   5214   r       = self->f->setAtNFreeSmallBytes(self, 1, value);
   5215   ck_assert_ptr_ne(r, null);
   5216   char *s = toStringO(r);
   5217   ck_assert_str_eq(s, "[1,[],3,4]");
   5218   free(s);
   5219   // negative index
   5220   value   = allocSmallBytes(NULL, 0);
   5221   r = self->f->setAtNFreeSmallBytes(self, -1, value);
   5222   ck_assert_ptr_ne(r, null);
   5223   s = toStringO(r);
   5224   ck_assert_str_eq(s, "[1,[],3,[]]");
   5225   free(s);
   5226   // index outside
   5227   value = allocSmallBytes(NULL, 0);
   5228   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 20, value), NULL);
   5229   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, -5, value), NULL);
   5230   // empty list
   5231   emptyO(self);
   5232   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, value), NULL);
   5233   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, -1, value), NULL);
   5234   terminateO(value);
   5235   // NULL value
   5236   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, NULL), NULL);
   5237   // non json array
   5238   freeO(self);
   5239   setTypeBoolO(self);
   5240   value = allocSmallBytes("", sizeof(""));
   5241   ck_assert_ptr_eq(self->f->setAtNFreeSmallBytes(self, 0, value), NULL);
   5242   terminateO(value);
   5243   terminateO(self);
   5244 
   5245 }
   5246 
   5247 
   5248 void setAtNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   5249 
   5250   smallJsont* r;
   5251   smallJsont *self = allocSmallJson();
   5252   smallDoublet *value;
   5253 
   5254   // add elements to self
   5255   r = self->f->pushInt(self, 1);
   5256   ck_assert_ptr_ne(r, null);
   5257   r = self->f->pushInt(self, 2);
   5258   ck_assert_ptr_ne(r, null);
   5259   r = self->f->pushInt(self, 3);
   5260   ck_assert_ptr_ne(r, null);
   5261   r = self->f->pushInt(self, 4);
   5262   ck_assert_ptr_ne(r, null);
   5263 
   5264   // positive index
   5265   value   = allocSmallDouble(5);
   5266   r       = self->f->setAtNFreeSmallDouble(self, 1, value);
   5267   ck_assert_ptr_ne(r, null);
   5268   char *s = toStringO(r);
   5269   ck_assert_str_eq(s, "[1,5.000000e+00,3,4]");
   5270   free(s);
   5271   // negative index
   5272   value   = allocSmallDouble(6);
   5273   r = self->f->setAtNFreeSmallDouble(self, -1, value);
   5274   ck_assert_ptr_ne(r, null);
   5275   s = toStringO(r);
   5276   ck_assert_str_eq(s, "[1,5.000000e+00,3,6.000000e+00]");
   5277   free(s);
   5278   // index outside
   5279   value = allocSmallDouble(1);
   5280   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 20, value), NULL);
   5281   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, -8, value), NULL);
   5282   // empty list
   5283   emptyO(self);
   5284   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, value), NULL);
   5285   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, -1, value), NULL);
   5286   terminateO(value);
   5287   // NULL value
   5288   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, NULL), NULL);
   5289   // non json array
   5290   freeO(self);
   5291   setTypeBoolO(self);
   5292   value = allocSmallDouble(1);
   5293   ck_assert_ptr_eq(self->f->setAtNFreeSmallDouble(self, 0, value), NULL);
   5294   terminateO(value);
   5295   terminateO(self);
   5296 
   5297 }
   5298 
   5299 
   5300 void setAtNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
   5301 
   5302   smallJsont* r;
   5303   smallJsont *self = allocSmallJson();
   5304   smallIntt *value;
   5305 
   5306   // add elements to self
   5307   r = self->f->pushInt(self, 1);
   5308   ck_assert_ptr_ne(r, null);
   5309   r = self->f->pushInt(self, 2);
   5310   ck_assert_ptr_ne(r, null);
   5311   r = self->f->pushInt(self, 3);
   5312   ck_assert_ptr_ne(r, null);
   5313   r = self->f->pushInt(self, 4);
   5314   ck_assert_ptr_ne(r, null);
   5315 
   5316   // positive index
   5317   value   = allocSmallInt(5);
   5318   r       = self->f->setAtNFreeSmallInt(self, 1, value);
   5319   ck_assert_ptr_ne(r, null);
   5320   char *s = toStringO(r);
   5321   ck_assert_str_eq(s, "[1,5,3,4]");
   5322   free(s);
   5323   // negative index
   5324   value   = allocSmallInt(6);
   5325   r = self->f->setAtNFreeSmallInt(self, -1, value);
   5326   ck_assert_ptr_ne(r, null);
   5327   s = toStringO(r);
   5328   ck_assert_str_eq(s, "[1,5,3,6]");
   5329   free(s);
   5330   // index outside
   5331   value = allocSmallInt(1);
   5332   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 20, value), NULL);
   5333   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, -8, value), NULL);
   5334   // empty list
   5335   emptyO(self);
   5336   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, value), NULL);
   5337   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, -1, value), NULL);
   5338   terminateO(value);
   5339   // NULL value
   5340   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, NULL), NULL);
   5341   // non json array
   5342   freeO(self);
   5343   setTypeBoolO(self);
   5344   value = allocSmallInt(2);
   5345   ck_assert_ptr_eq(self->f->setAtNFreeSmallInt(self, 0, value), NULL);
   5346   terminateO(value);
   5347   terminateO(self);
   5348 
   5349 }
   5350 
   5351 
   5352 void setAtNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   5353 
   5354   smallJsont* r;
   5355   smallJsont *self = allocSmallJson();
   5356   smallJsont *value;
   5357 
   5358   // add elements to self
   5359   r = self->f->pushInt(self, 1);
   5360   ck_assert_ptr_ne(r, null);
   5361   r = self->f->pushInt(self, 2);
   5362   ck_assert_ptr_ne(r, null);
   5363   r = self->f->pushInt(self, 3);
   5364   ck_assert_ptr_ne(r, null);
   5365   r = self->f->pushInt(self, 4);
   5366   ck_assert_ptr_ne(r, null);
   5367 
   5368   // positive index
   5369   value   = allocSmallJson();
   5370   r       = self->f->setAtNFreeSmallJson(self, 1, value);
   5371   ck_assert_ptr_ne(r, null);
   5372   char *s = toStringO(r);
   5373   ck_assert_str_eq(s, "[1,{},3,4]");
   5374   free(s);
   5375   // negative index
   5376   value   = allocSmallJson();
   5377   r = self->f->setAtNFreeSmallJson(self, -1, value);
   5378   ck_assert_ptr_ne(r, null);
   5379   s = toStringO(r);
   5380   ck_assert_str_eq(s, "[1,{},3,{}]");
   5381   free(s);
   5382   // index outside
   5383   value = allocSmallJson();
   5384   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 20, value), NULL);
   5385   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, -8, value), NULL);
   5386   // empty list
   5387   emptyO(self);
   5388   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, value), NULL);
   5389   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, -1, value), NULL);
   5390   terminateO(value);
   5391   // NULL value
   5392   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, NULL), NULL);
   5393   // non json array
   5394   freeO(self);
   5395   setTypeBoolO(self);
   5396   value = allocSmallJson();
   5397   ck_assert_ptr_eq(self->f->setAtNFreeSmallJson(self, 0, value), NULL);
   5398   terminateO(value);
   5399   terminateO(self);
   5400 
   5401 }
   5402 
   5403 
   5404 void setAtNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
   5405 
   5406   smallJsont* r;
   5407   smallJsont *self = allocSmallJson();
   5408   smallStringt *value;
   5409 
   5410   // add elements to self
   5411   r = self->f->pushInt(self, 1);
   5412   ck_assert_ptr_ne(r, null);
   5413   r = self->f->pushInt(self, 2);
   5414   ck_assert_ptr_ne(r, null);
   5415   r = self->f->pushInt(self, 3);
   5416   ck_assert_ptr_ne(r, null);
   5417   r = self->f->pushInt(self, 4);
   5418   ck_assert_ptr_ne(r, null);
   5419 
   5420   // positive index
   5421   initiateAllocateSmallString(&value);
   5422   r       = self->f->setAtNFreeSmallString(self, 1, value);
   5423   ck_assert_ptr_ne(r, null);
   5424   char *s = toStringO(r);
   5425   ck_assert_str_eq(s, "[1,\"\",3,4]");
   5426   free(s);
   5427   // negative index
   5428   value   = allocSmallString("a");
   5429   r = self->f->setAtNFreeSmallString(self, -1, value);
   5430   ck_assert_ptr_ne(r, null);
   5431   s = toStringO(r);
   5432   ck_assert_str_eq(s, "[1,\"\",3,\"a\"]");
   5433   free(s);
   5434   // index outside
   5435   value = allocSmallString("asd");
   5436   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 20, value), NULL);
   5437   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, -8, value), NULL);
   5438   // empty list
   5439   emptyO(self);
   5440   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, value), NULL);
   5441   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, -1, value), NULL);
   5442   terminateO(value);
   5443   // NULL value
   5444   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, NULL), NULL);
   5445   // non json array
   5446   freeO(self);
   5447   setTypeBoolO(self);
   5448   value = allocSmallString("qwe");
   5449   ck_assert_ptr_eq(self->f->setAtNFreeSmallString(self, 0, value), NULL);
   5450   terminateO(value);
   5451   terminateO(self);
   5452 
   5453 }
   5454 
   5455 
   5456 void setAtNFreeSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   5457 
   5458   smallJsont* r;
   5459   smallJsont *self = allocSmallJson();
   5460   smallContainert *value;
   5461 
   5462   // add elements to self
   5463   r = self->f->pushInt(self, 1);
   5464   ck_assert_ptr_ne(r, null);
   5465   r = self->f->pushInt(self, 2);
   5466   ck_assert_ptr_ne(r, null);
   5467   r = self->f->pushInt(self, 3);
   5468   ck_assert_ptr_ne(r, null);
   5469   r = self->f->pushInt(self, 4);
   5470   ck_assert_ptr_ne(r, null);
   5471 
   5472   // positive index
   5473   initiateAllocateSmallContainer(&value);
   5474   r       = self->f->setAtNFreeSmallContainer(self, 1, value);
   5475   ck_assert_ptr_ne(r, null);
   5476   char *s = toStringO(r);
   5477   ck_assert_str_eq(s, "[1,\"<data container>\",3,4]");
   5478   free(s);
   5479   // negative index
   5480   initiateAllocateSmallContainer(&value);
   5481   r = self->f->setAtNFreeSmallContainer(self, -1, value);
   5482   ck_assert_ptr_ne(r, null);
   5483   s = toStringO(r);
   5484   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
   5485   free(s);
   5486   // index outside
   5487   initiateAllocateSmallContainer(&value);
   5488   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 20, value), NULL);
   5489   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, -8, value), NULL);
   5490   // empty list
   5491   emptyO(self);
   5492   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, value), NULL);
   5493   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, -1, value), NULL);
   5494   terminateO(value);
   5495   // NULL value
   5496   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, NULL), NULL);
   5497   // non json array
   5498   freeO(self);
   5499   setTypeBoolO(self);
   5500   initiateAllocateSmallContainer(&value);
   5501   ck_assert_ptr_eq(self->f->setAtNFreeSmallContainer(self, 0, value), NULL);
   5502   terminateO(value);
   5503   terminateO(self);
   5504 
   5505 }
   5506 
   5507 
   5508 void setPAtDictSmallJsonT(CuTest *tc UNUSED) {
   5509 
   5510   smallJsont* r;
   5511   smallJsont *self = allocSmallJson();
   5512   smallDictt *value;
   5513 
   5514   // add elements to self
   5515   r = self->f->pushInt(self, 1);
   5516   ck_assert_ptr_ne(r, null);
   5517   r = self->f->pushInt(self, 2);
   5518   ck_assert_ptr_ne(r, null);
   5519   r = self->f->pushInt(self, 3);
   5520   ck_assert_ptr_ne(r, null);
   5521   r = self->f->pushInt(self, 4);
   5522   ck_assert_ptr_ne(r, null);
   5523 
   5524   // positive 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", 1);
   5529   r       = self->f->setPAtDict(self, 1, value);
   5530   ck_assert_ptr_ne(r, null);
   5531   finishO(value);
   5532   char *s = toStringO(r);
   5533   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5534   free(s);
   5535   // negative index
   5536   value   = allocSmallDict();
   5537   r       = self->f->setAtDict(self, -1, value);
   5538   ck_assert_ptr_ne(r, null);
   5539   value->f->setInt(value, "a", 2);
   5540   r       = self->f->setPAtDict(self, -1, value);
   5541   ck_assert_ptr_ne(r, null);
   5542   finishO(value);
   5543   s = toStringO(r);
   5544   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5545   free(s);
   5546   // empty smallDict
   5547   value   = allocSmallDict();
   5548   r       = self->f->setPAtDict(self, -1, value);
   5549   ck_assert_ptr_eq(r, null);
   5550   terminateO(value);
   5551   // non smallDict object
   5552   value   = (smallDictt*) allocSmallInt(2);
   5553   r       = self->f->setPAtDict(self, 0, value);
   5554   ck_assert_ptr_eq(r, null);
   5555   terminateO(value);
   5556   // index outside
   5557   value = allocSmallDict();
   5558   ck_assert_ptr_eq(self->f->setPAtDict(self, 20, value), NULL);
   5559   ck_assert_ptr_eq(self->f->setPAtDict(self, -8, value), NULL);
   5560   // empty list
   5561   emptyO(self);
   5562   ck_assert_ptr_eq(self->f->setPAtDict(self, 0, value), NULL);
   5563   ck_assert_ptr_eq(self->f->setPAtDict(self, -1, value), NULL);
   5564   terminateO(value);
   5565   // NULL value
   5566   ck_assert_ptr_eq(self->f->setPAtDict(self, 0, NULL), NULL);
   5567   terminateO(self);
   5568 
   5569 }
   5570 
   5571 
   5572 void setPAtArraySmallJsonT(CuTest *tc UNUSED) {
   5573 
   5574   smallJsont* r;
   5575   smallJsont *self = allocSmallJson();
   5576   smallArrayt *value;
   5577 
   5578   // add elements to self
   5579   r = self->f->pushInt(self, 1);
   5580   ck_assert_ptr_ne(r, null);
   5581   r = self->f->pushInt(self, 2);
   5582   ck_assert_ptr_ne(r, null);
   5583   r = self->f->pushInt(self, 3);
   5584   ck_assert_ptr_ne(r, null);
   5585   r = self->f->pushInt(self, 4);
   5586   ck_assert_ptr_ne(r, null);
   5587 
   5588   // positive index
   5589   value   = allocSmallArray();
   5590   r       = self->f->setAtArray(self, 1, value);
   5591   ck_assert_ptr_ne(r, null);
   5592   value->f->pushInt(value, 1);
   5593   r       = self->f->setPAtArray(self, 1, value);
   5594   ck_assert_ptr_ne(r, null);
   5595   finishO(value);
   5596   char *s = toStringO(r);
   5597   ck_assert_str_eq(s, "[1,[1],3,4]");
   5598   free(s);
   5599   // negative index
   5600   value   = allocSmallArray();
   5601   r = self->f->setAtArray(self, -1, value);
   5602   ck_assert_ptr_ne(r, null);
   5603   value->f->pushInt(value, 2);
   5604   r       = self->f->setPAtArray(self, -1, value);
   5605   ck_assert_ptr_ne(r, null);
   5606   finishO(value);
   5607   s = toStringO(r);
   5608   ck_assert_str_eq(s, "[1,[1],3,[2]]");
   5609   free(s);
   5610   // empty smallArray
   5611   value   = allocSmallArray();
   5612   r       = self->f->setPAtArray(self, -1, value);
   5613   ck_assert_ptr_eq(r, null);
   5614   terminateO(value);
   5615   // non smallArray object
   5616   value   = (smallArrayt*) allocSmallInt(2);
   5617   r       = self->f->setPAtArray(self, 0, value);
   5618   ck_assert_ptr_eq(r, null);
   5619   terminateO(value);
   5620   // index outside
   5621   value = allocSmallArray();
   5622   ck_assert_ptr_eq(self->f->setPAtArray(self, 20, value), NULL);
   5623   ck_assert_ptr_eq(self->f->setPAtArray(self, -8, value), NULL);
   5624   // empty list
   5625   emptyO(self);
   5626   ck_assert_ptr_eq(self->f->setPAtArray(self, 0, value), NULL);
   5627   ck_assert_ptr_eq(self->f->setPAtArray(self, -1, value), NULL);
   5628   terminateO(value);
   5629   // NULL value
   5630   ck_assert_ptr_eq(self->f->setPAtArray(self, 0, NULL), NULL);
   5631   terminateO(self);
   5632 
   5633 }
   5634 
   5635 
   5636 void setPAtSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   5637 
   5638   smallJsont* r;
   5639   smallJsont *self = allocSmallJson();
   5640   smallJsont *value;
   5641 
   5642   // add elements to self
   5643   r = self->f->pushInt(self, 1);
   5644   ck_assert_ptr_ne(r, null);
   5645   r = self->f->pushInt(self, 2);
   5646   ck_assert_ptr_ne(r, null);
   5647   r = self->f->pushInt(self, 3);
   5648   ck_assert_ptr_ne(r, null);
   5649   r = self->f->pushInt(self, 4);
   5650   ck_assert_ptr_ne(r, null);
   5651 
   5652   // positive 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", 1);
   5657   r       = self->f->setPAtSmallJson(self, 1, value);
   5658   ck_assert_ptr_ne(r, null);
   5659   finishO(value);
   5660   char *s = toStringO(r);
   5661   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5662   free(s);
   5663   // negative index
   5664   value   = allocSmallJson();
   5665   r = self->f->setAtSmallJson(self, -1, value);
   5666   ck_assert_ptr_ne(r, null);
   5667   value->f->setInt(value, "a", 2);
   5668   r       = self->f->setPAtSmallJson(self, -1, value);
   5669   ck_assert_ptr_ne(r, null);
   5670   finishO(value);
   5671   s = toStringO(r);
   5672   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5673   free(s);
   5674   // empty smallJson
   5675   value   = allocSmallJson();
   5676   r = self->f->setPAtSmallJson(self, -1, value);
   5677   ck_assert_ptr_eq(r, null);
   5678   terminateO(value);
   5679   // non smallJson object
   5680   value = (smallJsont*) allocSmallInt(2);
   5681   r = self->f->setPAtSmallJson(self, 0, value);
   5682   ck_assert_ptr_eq(r, null);
   5683   terminateO(value);
   5684   // index outside
   5685   value = allocSmallJson();
   5686   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 20, value), NULL);
   5687   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, -8, value), NULL);
   5688   // empty list
   5689   emptyO(self);
   5690   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 0, value), NULL);
   5691   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, -1, value), NULL);
   5692   terminateO(value);
   5693   // NULL value
   5694   ck_assert_ptr_eq(self->f->setPAtSmallJson(self, 0, NULL), NULL);
   5695   terminateO(self);
   5696 
   5697 }
   5698 
   5699 
   5700 void setPAtSmallStringSmallJsonT(CuTest *tc UNUSED) {
   5701 
   5702   smallJsont* r;
   5703   smallJsont *self = allocSmallJson();
   5704   smallStringt *value;
   5705 
   5706   // add elements to self
   5707   r = self->f->pushInt(self, 1);
   5708   ck_assert_ptr_ne(r, null);
   5709   r = self->f->pushInt(self, 2);
   5710   ck_assert_ptr_ne(r, null);
   5711   r = self->f->pushInt(self, 3);
   5712   ck_assert_ptr_ne(r, null);
   5713   r = self->f->pushInt(self, 4);
   5714   ck_assert_ptr_ne(r, null);
   5715 
   5716   // positive index
   5717   initiateAllocateSmallString(&value);
   5718   r       = self->f->setAtSmallString(self, 1, value);
   5719   ck_assert_ptr_ne(r, null);
   5720   value->f->appendS(value, "1");
   5721   r       = self->f->setPAtSmallString(self, 1, value);
   5722   ck_assert_ptr_ne(r, null);
   5723   finishO(value);
   5724   char *s = toStringO(r);
   5725   ck_assert_str_eq(s, "[1,\"1\",3,4]");
   5726   free(s);
   5727   // negative index
   5728   value   = allocSmallString("a");
   5729   r = self->f->setAtSmallString(self, -1, value);
   5730   ck_assert_ptr_ne(r, null);
   5731   value->f->appendS(value, "2");
   5732   r       = self->f->setPAtSmallString(self, -1, value);
   5733   ck_assert_ptr_ne(r, null);
   5734   finishO(value);
   5735   s = toStringO(r);
   5736   ck_assert_str_eq(s, "[1,\"1\",3,\"a2\"]");
   5737   free(s);
   5738   // empty SmallString
   5739   value   = allocSmallString("");
   5740   freeO(value);
   5741   r = self->f->setPAtSmallString(self, -1, value);
   5742   ck_assert_ptr_eq(r, null);
   5743   terminateO(value);
   5744   // non smallString object
   5745   value = (smallStringt*) allocSmallInt(2);
   5746   r = self->f->setPAtSmallString(self, 0, value);
   5747   ck_assert_ptr_eq(r, null);
   5748   terminateO(value);
   5749   // index outside
   5750   value = allocSmallString("asd");
   5751   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 20, value), NULL);
   5752   ck_assert_ptr_eq(self->f->setPAtSmallString(self, -8, value), NULL);
   5753   // empty list
   5754   emptyO(self);
   5755   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 0, value), NULL);
   5756   ck_assert_ptr_eq(self->f->setPAtSmallString(self, -1, value), NULL);
   5757   terminateO(value);
   5758   // NULL value
   5759   ck_assert_ptr_eq(self->f->setPAtSmallString(self, 0, NULL), NULL);
   5760   terminateO(self);
   5761 
   5762 }
   5763 
   5764 
   5765 void setPAtNFreeDictSmallJsonT(CuTest *tc UNUSED) {
   5766 
   5767   smallJsont* r;
   5768   smallJsont *self = allocSmallJson();
   5769   smallDictt *value;
   5770 
   5771   // add elements to self
   5772   r = self->f->pushInt(self, 1);
   5773   ck_assert_ptr_ne(r, null);
   5774   r = self->f->pushInt(self, 2);
   5775   ck_assert_ptr_ne(r, null);
   5776   r = self->f->pushInt(self, 3);
   5777   ck_assert_ptr_ne(r, null);
   5778   r = self->f->pushInt(self, 4);
   5779   ck_assert_ptr_ne(r, null);
   5780 
   5781   // positive index
   5782   value   = allocSmallDict();
   5783   r       = self->f->setAtDict(self, 1, value);
   5784   ck_assert_ptr_ne(r, null);
   5785   value->f->setInt(value, "a", 1);
   5786   r       = self->f->setPAtNFreeDict(self, 1, value);
   5787   ck_assert_ptr_ne(r, null);
   5788   char *s = toStringO(r);
   5789   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5790   free(s);
   5791   // negative index
   5792   value   = allocSmallDict();
   5793   r       = self->f->setAtDict(self, -1, value);
   5794   ck_assert_ptr_ne(r, null);
   5795   value->f->setInt(value, "a", 2);
   5796   r       = self->f->setPAtNFreeDict(self, -1, value);
   5797   ck_assert_ptr_ne(r, null);
   5798   s = toStringO(r);
   5799   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5800   free(s);
   5801   // empty smallDict
   5802   value   = allocSmallDict();
   5803   r       = self->f->setPAtNFreeDict(self, -1, value);
   5804   ck_assert_ptr_eq(r, null);
   5805   terminateO(value);
   5806   // non smallDict object
   5807   value = (smallDictt*) allocSmallInt(2);
   5808   r = self->f->setPAtNFreeDict(self, 0, value);
   5809   ck_assert_ptr_eq(r, null);
   5810   terminateO(value);
   5811   // index outside
   5812   value = allocSmallDict();
   5813   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 20, value), NULL);
   5814   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, -8, value), NULL);
   5815   // empty list
   5816   emptyO(self);
   5817   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 0, value), NULL);
   5818   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, -1, value), NULL);
   5819   terminateO(value);
   5820   // NULL value
   5821   ck_assert_ptr_eq(self->f->setPAtNFreeDict(self, 0, NULL), NULL);
   5822   terminateO(self);
   5823 
   5824 }
   5825 
   5826 
   5827 void setPAtNFreeArraySmallJsonT(CuTest *tc UNUSED) {
   5828 
   5829   smallJsont* r;
   5830   smallJsont *self = allocSmallJson();
   5831   smallArrayt *value;
   5832 
   5833   // add elements to self
   5834   r = self->f->pushInt(self, 1);
   5835   ck_assert_ptr_ne(r, null);
   5836   r = self->f->pushInt(self, 2);
   5837   ck_assert_ptr_ne(r, null);
   5838   r = self->f->pushInt(self, 3);
   5839   ck_assert_ptr_ne(r, null);
   5840   r = self->f->pushInt(self, 4);
   5841   ck_assert_ptr_ne(r, null);
   5842 
   5843   // positive index
   5844   value   = allocSmallArray();
   5845   r       = self->f->setAtArray(self, 1, value);
   5846   ck_assert_ptr_ne(r, null);
   5847   value->f->pushInt(value, 1);
   5848   r       = self->f->setPAtNFreeArray(self, 1, value);
   5849   ck_assert_ptr_ne(r, null);
   5850   char *s = toStringO(r);
   5851   ck_assert_str_eq(s, "[1,[1],3,4]");
   5852   free(s);
   5853   // negative index
   5854   value   = allocSmallArray();
   5855   r = self->f->setAtArray(self, -1, value);
   5856   ck_assert_ptr_ne(r, null);
   5857   value->f->pushInt(value, 2);
   5858   r       = self->f->setPAtNFreeArray(self, -1, value);
   5859   ck_assert_ptr_ne(r, null);
   5860   s = toStringO(r);
   5861   ck_assert_str_eq(s, "[1,[1],3,[2]]");
   5862   free(s);
   5863   // empty smallArray
   5864   value   = allocSmallArray();
   5865   r       = self->f->setPAtNFreeArray(self, -1, value);
   5866   ck_assert_ptr_eq(r, null);
   5867   terminateO(value);
   5868   // non smallArray object
   5869   value   = (smallArrayt*) allocSmallInt(2);
   5870   r       = self->f->setPAtNFreeArray(self, 0, value);
   5871   ck_assert_ptr_eq(r, null);
   5872   terminateO(value);
   5873   // index outside
   5874   value = allocSmallArray();
   5875   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 20, value), NULL);
   5876   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, -8, value), NULL);
   5877   // empty list
   5878   emptyO(self);
   5879   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 0, value), NULL);
   5880   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, -1, value), NULL);
   5881   terminateO(value);
   5882   // NULL value
   5883   ck_assert_ptr_eq(self->f->setPAtNFreeArray(self, 0, NULL), NULL);
   5884   terminateO(self);
   5885 
   5886 }
   5887 
   5888 
   5889 void setPAtNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   5890 
   5891   smallJsont* r;
   5892   smallJsont *self = allocSmallJson();
   5893   smallJsont *value;
   5894 
   5895   // add elements to self
   5896   r = self->f->pushInt(self, 1);
   5897   ck_assert_ptr_ne(r, null);
   5898   r = self->f->pushInt(self, 2);
   5899   ck_assert_ptr_ne(r, null);
   5900   r = self->f->pushInt(self, 3);
   5901   ck_assert_ptr_ne(r, null);
   5902   r = self->f->pushInt(self, 4);
   5903   ck_assert_ptr_ne(r, null);
   5904 
   5905   // positive index
   5906   value   = allocSmallJson();
   5907   r       = self->f->setAtSmallJson(self, 1, value);
   5908   ck_assert_ptr_ne(r, null);
   5909   value->f->setInt(value, "a", 1);
   5910   r       = self->f->setPAtNFreeSmallJson(self, 1, value);
   5911   ck_assert_ptr_ne(r, null);
   5912   char *s = toStringO(r);
   5913   ck_assert_str_eq(s, "[1,{\"a\":1},3,4]");
   5914   free(s);
   5915   // negative index
   5916   value   = allocSmallJson();
   5917   r = self->f->setAtSmallJson(self, -1, value);
   5918   ck_assert_ptr_ne(r, null);
   5919   value->f->setInt(value, "a", 2);
   5920   r       = self->f->setPAtNFreeSmallJson(self, -1, value);
   5921   ck_assert_ptr_ne(r, null);
   5922   s = toStringO(r);
   5923   ck_assert_str_eq(s, "[1,{\"a\":1},3,{\"a\":2}]");
   5924   free(s);
   5925   // empty smallJson
   5926   value   = allocSmallJson();
   5927   r = self->f->setPAtNFreeSmallJson(self, -1, value);
   5928   ck_assert_ptr_eq(r, null);
   5929   terminateO(value);
   5930   // non smallJson object
   5931   value = (smallJsont*) allocSmallInt(2);
   5932   r = self->f->setPAtNFreeSmallJson(self, 0, value);
   5933   ck_assert_ptr_eq(r, null);
   5934   terminateO(value);
   5935   // index outside
   5936   value = allocSmallJson();
   5937   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 20, value), NULL);
   5938   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, -8, value), NULL);
   5939   // empty list
   5940   emptyO(self);
   5941   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 0, value), NULL);
   5942   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, -1, value), NULL);
   5943   terminateO(value);
   5944   // NULL value
   5945   ck_assert_ptr_eq(self->f->setPAtNFreeSmallJson(self, 0, NULL), NULL);
   5946   terminateO(self);
   5947 
   5948 }
   5949 
   5950 
   5951 void setPAtNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
   5952 
   5953   smallJsont* r;
   5954   smallJsont *self = allocSmallJson();
   5955   smallStringt *value;
   5956 
   5957   // add elements to self
   5958   r = self->f->pushInt(self, 1);
   5959   ck_assert_ptr_ne(r, null);
   5960   r = self->f->pushInt(self, 2);
   5961   ck_assert_ptr_ne(r, null);
   5962   r = self->f->pushInt(self, 3);
   5963   ck_assert_ptr_ne(r, null);
   5964   r = self->f->pushInt(self, 4);
   5965   ck_assert_ptr_ne(r, null);
   5966 
   5967   // positive index
   5968   initiateAllocateSmallString(&value);
   5969   r       = self->f->setAtSmallString(self, 1, value);
   5970   ck_assert_ptr_ne(r, null);
   5971   value->f->appendS(value, "1");
   5972   r       = self->f->setPAtNFreeSmallString(self, 1, value);
   5973   ck_assert_ptr_ne(r, null);
   5974   char *s = toStringO(r);
   5975   ck_assert_str_eq(s, "[1,\"1\",3,4]");
   5976   free(s);
   5977   // negative index
   5978   value   = allocSmallString("a");
   5979   r = self->f->setAtSmallString(self, -1, value);
   5980   ck_assert_ptr_ne(r, null);
   5981   value->f->appendS(value, "2");
   5982   r       = self->f->setPAtNFreeSmallString(self, -1, value);
   5983   ck_assert_ptr_ne(r, null);
   5984   s = toStringO(r);
   5985   ck_assert_str_eq(s, "[1,\"1\",3,\"a2\"]");
   5986   free(s);
   5987   // empty SmallString
   5988   value   = allocSmallString("");
   5989   freeO(value);
   5990   r = self->f->setPAtNFreeSmallString(self, -1, value);
   5991   ck_assert_ptr_eq(r, null);
   5992   terminateO(value);
   5993   // non smallString object
   5994   value = (smallStringt*) allocSmallInt(2);
   5995   r = self->f->setPAtNFreeSmallString(self, 0, value);
   5996   ck_assert_ptr_eq(r, null);
   5997   terminateO(value);
   5998   // index outside
   5999   value = allocSmallString("asd");
   6000   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 20, value), NULL);
   6001   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, -8, value), NULL);
   6002   // empty list
   6003   emptyO(self);
   6004   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 0, value), NULL);
   6005   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, -1, value), NULL);
   6006   terminateO(value);
   6007   // NULL value
   6008   ck_assert_ptr_eq(self->f->setPAtNFreeSmallString(self, 0, NULL), NULL);
   6009   terminateO(self);
   6010 
   6011 }
   6012 
   6013 
   6014 void pushUndefinedSmallJsonT(CuTest *tc UNUSED) {
   6015 
   6016   smallJsont* r;
   6017   smallJsont *self = allocSmallJson();
   6018 
   6019   // add an element to check that push adds the second element
   6020   // at the end
   6021   r = self->f->pushInt(self, 1);
   6022   ck_assert_ptr_ne(r, null);
   6023   r = self->f->pushUndefined(self);
   6024   ck_assert_ptr_ne(r, null);
   6025   ck_assert_int_eq(lenO(r), 2);
   6026   char *s = toStringO(r);
   6027   ck_assert_str_eq(s, "[1,null]");
   6028   free(s);
   6029   // non json array
   6030   freeO(self);
   6031   setTypeBoolO(self);
   6032   ck_assert_ptr_eq(self->f->pushUndefined(self), NULL);
   6033   terminateO(self);
   6034 
   6035 }
   6036 
   6037 
   6038 void pushBoolSmallJsonT(CuTest *tc UNUSED) {
   6039 
   6040   smallJsont* r;
   6041   smallJsont *self = allocSmallJson();
   6042 
   6043   // add an element to check that push adds the second element
   6044   // at the end
   6045   r = self->f->pushInt(self, 1);
   6046   ck_assert_ptr_ne(r, null);
   6047   r = self->f->pushBool(self, TRUE);
   6048   ck_assert_ptr_ne(r, null);
   6049   ck_assert_int_eq(lenO(r), 2);
   6050   char *s = toStringO(r);
   6051   ck_assert_str_eq(s, "[1,true]");
   6052   free(s);
   6053   // non json array
   6054   freeO(self);
   6055   setTypeBoolO(self);
   6056   ck_assert_ptr_eq(self->f->pushBool(self, true), NULL);
   6057   terminateO(self);
   6058 
   6059 }
   6060 
   6061 
   6062 void pushDoubleSmallJsonT(CuTest *tc UNUSED) {
   6063 
   6064   smallJsont* r;
   6065   smallJsont *self = allocSmallJson();
   6066 
   6067   // add an element to check that push adds the second element
   6068   // at the end
   6069   r = self->f->pushInt(self, 1);
   6070   ck_assert_ptr_ne(r, null);
   6071   r = self->f->pushDouble(self, 1.0);
   6072   ck_assert_ptr_ne(r, null);
   6073   ck_assert_int_eq(lenO(r), 2);
   6074   char *s = toStringO(r);
   6075   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6076   free(s);
   6077   // non json array
   6078   freeO(self);
   6079   setTypeBoolO(self);
   6080   ck_assert_ptr_eq(self->f->pushDouble(self, 2.2), NULL);
   6081   terminateO(self);
   6082 
   6083 }
   6084 
   6085 
   6086 void pushIntSmallJsonT(CuTest *tc UNUSED) {
   6087 
   6088   smallJsont* r;
   6089   smallJsont *self = allocSmallJson();
   6090 
   6091   // add an element to check that push adds the second element
   6092   // at the end
   6093   r = self->f->pushInt(self, 1);
   6094   ck_assert_ptr_ne(r, null);
   6095   r = self->f->pushInt(self, 1);
   6096   ck_assert_ptr_ne(r, null);
   6097   ck_assert_int_eq(lenO(r), 2);
   6098   char *s = toStringO(r);
   6099   ck_assert_str_eq(s, "[1,1]");
   6100   free(s);
   6101   // non json array
   6102   freeO(self);
   6103   setTypeBoolO(self);
   6104   ck_assert_ptr_eq(self->f->pushInt(self, 3), NULL);
   6105   terminateO(self);
   6106 
   6107 }
   6108 
   6109 
   6110 void pushSSmallJsonT(CuTest *tc UNUSED) {
   6111 
   6112   smallJsont* r;
   6113   smallJsont *self = allocSmallJson();
   6114 
   6115   // add an element to check that push adds the second element
   6116   // at the end
   6117   r = self->f->pushInt(self, 1);
   6118   ck_assert_ptr_ne(r, null);
   6119   r = self->f->pushS(self, null);
   6120   ck_assert_ptr_eq(r, null);
   6121   ck_assert_int_eq(lenO(self), 1);
   6122   char *s = toStringO(self);
   6123   ck_assert_str_eq(s, "[1]");
   6124   free(s);
   6125   char *str = "poi";
   6126   r = self->f->pushS(self, str);
   6127   ck_assert_ptr_ne(r, null);
   6128   ck_assert_int_eq(lenO(self), 2);
   6129   s = toStringO(r);
   6130   ck_assert_str_eq(s, "[1,\"poi\"]");
   6131   free(s);
   6132   // non json array
   6133   freeO(self);
   6134   setTypeBoolO(self);
   6135   ck_assert_ptr_eq(self->f->pushS(self, "qwe"), NULL);
   6136   terminateO(self);
   6137   // json string
   6138   self = allocSmallJson();
   6139   setTopSO(self, "qwe");
   6140   r = self->f->pushS(self, "!@#");
   6141   ck_assert_ptr_ne(r, null);
   6142   s = toStringO(r);
   6143   ck_assert_str_eq(s, "qwe!@#");
   6144   free(s);
   6145   // empty string
   6146   r = self->f->pushS(self, "");
   6147   ck_assert_ptr_ne(r, null);
   6148   s = toStringO(r);
   6149   ck_assert_str_eq(s, "qwe!@#");
   6150   free(s);
   6151   // empty self
   6152   freeO(self);
   6153   setTypeStringO(self);
   6154   r = self->f->pushS(self, "asd");
   6155   ck_assert_ptr_ne(r, null);
   6156   s = toStringO(r);
   6157   ck_assert_str_eq(s, "asd");
   6158   free(s);
   6159   terminateO(self);
   6160 
   6161 }
   6162 
   6163 
   6164 void pushCharSmallJsonT(CuTest *tc UNUSED) {
   6165 
   6166   smallJsont* r;
   6167   smallJsont *self = allocSmallJson();
   6168 
   6169   // add an element to check that push adds the second element
   6170   // at the end
   6171   r = self->f->pushInt(self, 1);
   6172   ck_assert_ptr_ne(r, null);
   6173   r = self->f->pushChar(self, 'a');
   6174   ck_assert_ptr_ne(r, null);
   6175   ck_assert_int_eq(lenO(r), 2);
   6176   char *s = toStringO(r);
   6177   ck_assert_str_eq(s, "[1,\"a\"]");
   6178   free(s);
   6179   // non json array
   6180   freeO(self);
   6181   setTypeBoolO(self);
   6182   ck_assert_ptr_eq(self->f->pushChar(self, 'a'), NULL);
   6183   terminateO(self);
   6184 
   6185 }
   6186 
   6187 
   6188 void pushDictSmallJsonT(CuTest *tc UNUSED) {
   6189 
   6190   smallJsont* r;
   6191   smallJsont *self = allocSmallJson();
   6192   smallDictt *dict  = allocG(rtSmallDictt);
   6193 
   6194   // add an element to check that push adds the second element
   6195   // at the end
   6196   r = self->f->pushInt(self, 1);
   6197   ck_assert_ptr_ne(r, null);
   6198   // push dict
   6199   r = self->f->pushDict(self, dict);
   6200   ck_assert_ptr_ne(r, null);
   6201   ck_assert_int_eq(lenO(r), 2);
   6202   ck_assert_ptr_ne(r, null);
   6203   char *s = toStringO(r);
   6204   ck_assert_str_eq(s, "[1,{}]");
   6205   free(s);
   6206   // non json array
   6207   freeO(self);
   6208   setTypeBoolO(self);
   6209   ck_assert_ptr_eq(self->f->pushDict(self, dict), NULL);
   6210   finishO(dict);
   6211   setTypeArrayO(self);
   6212   // non smallDict object
   6213   dict = (smallDictt*) allocSmallInt(2);
   6214   r = self->f->pushDict(self, dict);
   6215   ck_assert_ptr_eq(r, null);
   6216   terminateO(dict);
   6217   // null
   6218   r = self->f->pushDict(self, null);
   6219   ck_assert_ptr_eq(r, null);
   6220   ck_assert_int_eq(lenO(self), 0);
   6221   s = toStringO(self);
   6222   ck_assert_str_eq(s, "[]");
   6223   free(s);
   6224   terminateO(self);
   6225 
   6226 }
   6227 
   6228 
   6229 void pushArraySmallJsonT(CuTest *tc UNUSED) {
   6230 
   6231   smallJsont* r;
   6232   smallJsont *self  = allocSmallJson();
   6233   smallArrayt *array = allocG(rtSmallArrayt);
   6234 
   6235   // add an element to check that push adds the second element
   6236   // at the end
   6237   r = self->f->pushInt(self, 1);
   6238   ck_assert_ptr_ne(r, null);
   6239   r = self->f->pushArray(self, array);
   6240   ck_assert_ptr_ne(r, null);
   6241   ck_assert_int_eq(lenO(r), 2);
   6242   char *s = toStringO(r);
   6243   ck_assert_str_eq(s, "[1,[]]");
   6244   free(s);
   6245   // non json array
   6246   freeO(self);
   6247   setTypeBoolO(self);
   6248   ck_assert_ptr_eq(self->f->pushArray(self, array), NULL);
   6249   finishO(array);
   6250   setTypeArrayO(self);
   6251   // non smallArray object
   6252   array = (smallArrayt*) allocSmallInt(2);
   6253   r = self->f->pushArray(self, array);
   6254   ck_assert_ptr_eq(r, null);
   6255   terminateO(array);
   6256   // null
   6257   r = self->f->pushArray(self, null);
   6258   ck_assert_ptr_eq(r, null);
   6259   ck_assert_int_eq(lenO(self), 0);
   6260   s = toStringO(self);
   6261   ck_assert_str_eq(s, "[]");
   6262   free(s);
   6263   terminateO(self);
   6264 
   6265 }
   6266 
   6267 
   6268 void pushArraycSmallJsonT(CuTest *tc UNUSED) {
   6269 
   6270   smallJsont* r;
   6271   smallJsont *self = allocSmallJson();
   6272   char **array      = listCreateS("a","bb");
   6273 
   6274   // add an element to check that push adds the second element
   6275   // at the end
   6276   r = self->f->pushInt(self, 1);
   6277   ck_assert_ptr_ne(r, null);
   6278 
   6279   r = self->f->pushArrayc(self, array);
   6280   ck_assert_ptr_ne(r, null);
   6281   ck_assert_int_eq(lenO(r), 2);
   6282   char *s = toStringO(r);
   6283   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6284   free(s);
   6285   // non json array
   6286   freeO(self);
   6287   setTypeBoolO(self);
   6288   ck_assert_ptr_eq(self->f->pushArrayc(self, array), NULL);
   6289   listFreeS(array);
   6290   setTypeArrayO(self);
   6291   // null
   6292   r = self->f->pushArrayc(self, null);
   6293   ck_assert_ptr_eq(r, null);
   6294   ck_assert_int_eq(lenO(self), 0);
   6295   s = toStringO(self);
   6296   ck_assert_str_eq(s, "[]");
   6297   free(s);
   6298   terminateO(self);
   6299 
   6300 }
   6301 
   6302 
   6303 void pushSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   6304 
   6305   smallJsont* r;
   6306   smallJsont *self = allocSmallJson();
   6307   smallBoolt *value = allocG(TRUE);
   6308 
   6309   // add an element to check that push adds the second element
   6310   // at the end
   6311   r = self->f->pushInt(self, 1);
   6312   ck_assert_ptr_ne(r, null);
   6313   r = self->f->pushSmallBool(self, value);
   6314   ck_assert_ptr_ne(r, null);
   6315   ck_assert_int_eq(lenO(r), 2);
   6316   char *s = toStringO(r);
   6317   ck_assert_str_eq(s, "[1,true]");
   6318   free(s);
   6319   // non json array
   6320   freeO(self);
   6321   setTypeBoolO(self);
   6322   ck_assert_ptr_eq(self->f->pushSmallBool(self, value), NULL);
   6323   finishO(value);
   6324   setTypeArrayO(self);
   6325   // non smallBool object
   6326   value = (smallBoolt*) allocSmallInt(2);
   6327   r = self->f->pushSmallBool(self, value);
   6328   ck_assert_ptr_eq(r, null);
   6329   terminateO(value);
   6330   // bool object with no data
   6331   createAllocateSmallBool(b);
   6332   r = self->f->pushSmallBool(self, b);
   6333   ck_assert_ptr_ne(r, null);
   6334   ck_assert_int_eq(lenO(r), 1);
   6335   finishO(b);
   6336   s = toStringO(r);
   6337   ck_assert_str_eq(s, "[false]");
   6338   free(s);
   6339   // null
   6340   r = self->f->pushSmallBool(self, null);
   6341   ck_assert_ptr_eq(r, null);
   6342   ck_assert_int_eq(lenO(self), 1);
   6343   s = toStringO(self);
   6344   ck_assert_str_eq(s, "[false]");
   6345   free(s);
   6346   terminateO(self);
   6347 
   6348 }
   6349 
   6350 
   6351 void pushSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   6352 
   6353   smallJsont* r;
   6354   smallJsont *self = allocSmallJson();
   6355   createAllocateSmallBytes(value);
   6356 
   6357   // add an element to check that push adds the second element
   6358   // at the end
   6359   r = self->f->pushInt(self, 1);
   6360   ck_assert_ptr_ne(r, null);
   6361   // the smallBytes container is empty
   6362   r = self->f->pushSmallBytes(self, value);
   6363   ck_assert_ptr_ne(r, null);
   6364   ck_assert_int_eq(lenO(r), 2);
   6365   char *s = toStringO(r);
   6366   ck_assert_str_eq(s, "[1,[]]");
   6367   free(s);
   6368   // non json array
   6369   freeO(self);
   6370   setTypeBoolO(self);
   6371   ck_assert_ptr_eq(self->f->pushSmallBytes(self, value), NULL);
   6372   setTypeArrayO(self);
   6373   // reuse value
   6374   value->B = null;
   6375   char *buffer = "poi";
   6376   pushBufferO(value, buffer, strlen(buffer));
   6377   r = self->f->pushSmallBytes(self, value);
   6378   finishO(value);
   6379   ck_assert_ptr_ne(r, null);
   6380   ck_assert_int_eq(lenO(r), 1);
   6381   s = toStringO(r);
   6382   ck_assert_str_eq(s, "[[0x70,0x6f,0x69]]");
   6383   free(s);
   6384   // non smallBytes object
   6385   value = (smallBytest*) allocSmallInt(2);
   6386   r = self->f->pushSmallBytes(self, value);
   6387   ck_assert_ptr_eq(r, null);
   6388   terminateO(value);
   6389   // null
   6390   r = self->f->pushSmallBytes(self, null);
   6391   ck_assert_ptr_eq(r, null);
   6392   ck_assert_int_eq(lenO(self), 1);
   6393   s = toStringO(self);
   6394   ck_assert_str_eq(s, "[[0x70,0x6f,0x69]]");
   6395   free(s);
   6396   terminateO(self);
   6397 
   6398 }
   6399 
   6400 
   6401 void pushSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   6402 
   6403   smallJsont* r;
   6404   smallJsont *self   = allocSmallJson();
   6405   smallDoublet *value = allocG(1.0);
   6406 
   6407   // add an element to check that push adds the second element
   6408   // at the end
   6409   r = self->f->pushInt(self, 1);
   6410   ck_assert_ptr_ne(r, null);
   6411   r = self->f->pushSmallDouble(self, value);
   6412   ck_assert_ptr_ne(r, null);
   6413   ck_assert_int_eq(lenO(r), 2);
   6414   char *s = toStringO(r);
   6415   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6416   free(s);
   6417   // non json array
   6418   freeO(self);
   6419   setTypeBoolO(self);
   6420   ck_assert_ptr_eq(self->f->pushSmallDouble(self, value), NULL);
   6421   finishO(value);
   6422   setTypeArrayO(self);
   6423   // object with no data
   6424   createAllocateSmallDouble(b);
   6425   r = self->f->pushSmallDouble(self, b);
   6426   ck_assert_ptr_ne(r, null);
   6427   ck_assert_int_eq(lenO(r), 1);
   6428   finishO(b);
   6429   s = toStringO(r);
   6430   ck_assert_str_eq(s, "[0.000000e+00]");
   6431   free(s);
   6432   // non smallDouble object
   6433   value = (smallDoublet*) allocSmallInt(2);
   6434   r = self->f->pushSmallDouble(self, value);
   6435   ck_assert_ptr_eq(r, null);
   6436   terminateO(value);
   6437   // null
   6438   r = self->f->pushSmallDouble(self, null);
   6439   ck_assert_ptr_eq(r, null);
   6440   ck_assert_int_eq(lenO(self), 1);
   6441   s = toStringO(self);
   6442   ck_assert_str_eq(s, "[0.000000e+00]");
   6443   free(s);
   6444   terminateO(self);
   6445 
   6446 }
   6447 
   6448 
   6449 void pushSmallIntSmallJsonT(CuTest *tc UNUSED) {
   6450 
   6451   smallJsont* r;
   6452   smallJsont *self = allocSmallJson();
   6453   smallIntt *value  = allocG(1);
   6454 
   6455   // add an element to check that push adds the second element
   6456   // at the end
   6457   r = self->f->pushInt(self, 1);
   6458   ck_assert_ptr_ne(r, null);
   6459   r = self->f->pushSmallInt(self, value);
   6460   ck_assert_ptr_ne(r, null);
   6461   ck_assert_int_eq(lenO(r), 2);
   6462   char *s = toStringO(r);
   6463   ck_assert_str_eq(s, "[1,1]");
   6464   free(s);
   6465   // non json array
   6466   freeO(self);
   6467   setTypeBoolO(self);
   6468   ck_assert_ptr_eq(self->f->pushSmallInt(self, value), NULL);
   6469   finishO(value);
   6470   setTypeArrayO(self);
   6471   // int object with no data
   6472   createAllocateSmallInt(b);
   6473   r = self->f->pushSmallInt(self, b);
   6474   ck_assert_ptr_ne(r, null);
   6475   ck_assert_int_eq(lenO(r), 1);
   6476   finishO(b);
   6477   s = toStringO(r);
   6478   ck_assert_str_eq(s, "[0]");
   6479   free(s);
   6480   // non smallInt object
   6481   value = (smallIntt*) allocSmallBool(true);
   6482   r = self->f->pushSmallInt(self, value);
   6483   ck_assert_ptr_eq(r, null);
   6484   terminateO(value);
   6485   // null
   6486   r = self->f->pushSmallInt(self, null);
   6487   ck_assert_ptr_eq(r, null);
   6488   ck_assert_int_eq(lenO(self), 1);
   6489   s = toStringO(self);
   6490   ck_assert_str_eq(s, "[0]");
   6491   free(s);
   6492   terminateO(self);
   6493 
   6494 }
   6495 
   6496 
   6497 void pushSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   6498 
   6499   smallJsont* r;
   6500   smallJsont *self = allocSmallJson();
   6501   smallJsont *value = allocG(rtSmallJsont);
   6502 
   6503   // add an element to check that push adds the second element
   6504   // at the end
   6505   r = self->f->pushInt(self, 1);
   6506   ck_assert_ptr_ne(r, null);
   6507   // the smallJson container is empty
   6508   r = self->f->pushSmallJson(self, value);
   6509   ck_assert_ptr_ne(r, null);
   6510   ck_assert_int_eq(lenO(r), 2);
   6511   char *s = toStringO(r);
   6512   ck_assert_str_eq(s, "[1,{}]");
   6513   free(s);
   6514   // non json array
   6515   freeO(self);
   6516   setTypeBoolO(self);
   6517   ck_assert_ptr_eq(self->f->pushSmallJson(self, value), NULL);
   6518   setTypeArrayO(self);
   6519   resetO(value);
   6520   parseO(value, "{}");
   6521   r = self->f->pushSmallJson(self, value);
   6522   finishO(value);
   6523   ck_assert_ptr_ne(r, null);
   6524   ck_assert_int_eq(lenO(r), 1);
   6525   s = toStringO(r);
   6526   ck_assert_str_eq(s, "[{}]");
   6527   free(s);
   6528   // non smallJson object
   6529   value = (smallJsont*) allocSmallInt(2);
   6530   r = self->f->pushSmallJson(self, value);
   6531   ck_assert_ptr_eq(r, null);
   6532   terminateO(value);
   6533   // null
   6534   r = self->f->pushSmallJson(self, null);
   6535   ck_assert_ptr_eq(r, null);
   6536   ck_assert_int_eq(lenO(self), 1);
   6537   s = toStringO(self);
   6538   ck_assert_str_eq(s, "[{}]");
   6539   free(s);
   6540   terminateO(self);
   6541 
   6542 }
   6543 
   6544 
   6545 void pushSmallStringSmallJsonT(CuTest *tc UNUSED) {
   6546 
   6547   smallJsont* r;
   6548   smallJsont *self    = allocSmallJson();
   6549   createAllocateSmallString(string);
   6550 
   6551   // add an element to check that push adds the second element
   6552   // at the end
   6553   r = self->f->pushInt(self, 1);
   6554   ck_assert_ptr_ne(r, null);
   6555   r = self->f->pushSmallString(self, string);
   6556   ck_assert_ptr_ne(r, null);
   6557   ck_assert_int_eq(lenO(r), 2);
   6558   char *s = toStringO(r);
   6559   ck_assert_str_eq(s, "[1,\"\"]");
   6560   free(s);
   6561   // non json array
   6562   freeO(self);
   6563   setTypeBoolO(self);
   6564   ck_assert_ptr_eq(self->f->pushSmallString(self, string), NULL);
   6565   finishO(string);
   6566   setTypeArrayO(self);
   6567   // non smallString object
   6568   string = (smallStringt*) allocSmallInt(2);
   6569   r = self->f->pushSmallString(self, string);
   6570   ck_assert_ptr_eq(r, null);
   6571   terminateO(string);
   6572   // null
   6573   r = self->f->pushSmallString(self, null);
   6574   ck_assert_ptr_eq(r, null);
   6575   ck_assert_int_eq(lenO(self), 0);
   6576   s = toStringO(self);
   6577   ck_assert_str_eq(s, "[]");
   6578   free(s);
   6579   terminateO(self);
   6580   // json string
   6581   self   = allocSmallJson();
   6582   setTopSO(self, "qwe");
   6583   string = allocSmallString("!@#");
   6584   r = self->f->pushSmallString(self, string);
   6585   ck_assert_ptr_ne(r, null);
   6586   s = toStringO(r);
   6587   ck_assert_str_eq(s, "qwe!@#");
   6588   free(s);
   6589   // empty string
   6590   setValO(string, "");
   6591   r = self->f->pushSmallString(self, string);
   6592   ck_assert_ptr_ne(r, null);
   6593   s = toStringO(r);
   6594   ck_assert_str_eq(s, "qwe!@#");
   6595   free(s);
   6596   freeO(string);
   6597   r = self->f->pushSmallString(self, string);
   6598   ck_assert_ptr_ne(r, null);
   6599   s = toStringO(r);
   6600   ck_assert_str_eq(s, "qwe!@#");
   6601   free(s);
   6602   // empty self
   6603   freeO(self);
   6604   setTypeStringO(self);
   6605   setValO(string, "asd");
   6606   r = self->f->pushSmallString(self, string);
   6607   ck_assert_ptr_ne(r, null);
   6608   s = toStringO(r);
   6609   ck_assert_str_eq(s, "asd");
   6610   free(s);
   6611   terminateO(string);
   6612   // not smallString object
   6613   string = (smallStringt*) allocSmallInt(1);
   6614   r = self->f->pushSmallString(self, string);
   6615   ck_assert_ptr_eq(r, null);
   6616   terminateO(string);
   6617   terminateO(self);
   6618 
   6619 }
   6620 
   6621 
   6622 void pushSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   6623 
   6624   smallJsont* r;
   6625   smallJsont *self          = allocSmallJson();
   6626   createAllocateSmallContainer(container);
   6627 
   6628   // add an element to check that push adds the second element
   6629   // at the end
   6630   r = self->f->pushInt(self, 1);
   6631   ck_assert_ptr_ne(r, null);
   6632   r = self->f->pushSmallContainer(self, container);
   6633   ck_assert_ptr_ne(r, null);
   6634   ck_assert_int_eq(lenO(r), 2);
   6635   char *s = toStringO(r);
   6636   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   6637   free(s);
   6638   // non json array
   6639   freeO(self);
   6640   setTypeBoolO(self);
   6641   ck_assert_ptr_eq(self->f->pushSmallContainer(self, container), NULL);
   6642   finishO(container);
   6643   setTypeArrayO(self);
   6644   // non smallContainer object
   6645   container = (smallContainert*) allocSmallInt(2);
   6646   r = self->f->pushSmallContainer(self, container);
   6647   ck_assert_ptr_eq(r, null);
   6648   terminateO(container);
   6649   // null
   6650   r = self->f->pushSmallContainer(self, null);
   6651   ck_assert_ptr_eq(r, null);
   6652   ck_assert_int_eq(lenO(self), 0);
   6653   s = toStringO(self);
   6654   ck_assert_str_eq(s, "[]");
   6655   free(s);
   6656   terminateO(self);
   6657 
   6658 }
   6659 
   6660 
   6661 void pushNFreeSmallJsonT(CuTest *tc UNUSED) {
   6662 
   6663   smallJsont* r;
   6664   smallJsont *self = allocSmallJson();
   6665   baset *value = (baset*) allocG(2);
   6666 
   6667   // add an element to check that push adds the second element
   6668   // at the end
   6669   r = self->f->pushInt(self, 1);
   6670   ck_assert_ptr_ne(r, null);
   6671   r = self->f->pushNFree(self, value);
   6672   ck_assert_ptr_ne(r, null);
   6673   ck_assert_int_eq(lenO(r), 2);
   6674   char *s = toStringO(r);
   6675   ck_assert_str_eq(s, "[1,2]");
   6676   free(s);
   6677   // null
   6678   r = self->f->pushNFree(self, null);
   6679   ck_assert_ptr_eq(r, null);
   6680   ck_assert_int_eq(lenO(self), 2);
   6681   s = toStringO(self);
   6682   ck_assert_str_eq(s, "[1,2]");
   6683   free(s);
   6684   // non json array
   6685   freeO(self);
   6686   value = (baset*) allocSmallInt(2);
   6687   setTypeBoolO(self);
   6688   ck_assert_ptr_eq(self->f->pushNFree(self, value), NULL);
   6689   terminateO(value);
   6690   terminateO(self);
   6691 
   6692 }
   6693 
   6694 
   6695 void pushNFreeUndefinedSmallJsonT(CuTest *tc UNUSED) {
   6696 
   6697   smallJsont* r;
   6698   smallJsont *self = allocSmallJson();
   6699 
   6700   // add an element to check that push adds the second element
   6701   // at the end
   6702   r = self->f->pushInt(self, 1);
   6703   ck_assert_ptr_ne(r, null);
   6704 
   6705   createAllocateUndefined(value);
   6706   r = self->f->pushNFreeUndefined(self, value);
   6707   ck_assert_ptr_ne(r, null);
   6708   ck_assert_int_eq(lenO(r), 2);
   6709   char *s = toStringO(r);
   6710   ck_assert_str_eq(s, "[1,null]");
   6711   free(s);
   6712   terminateO(self);
   6713 
   6714 }
   6715 
   6716 
   6717 void pushNFreeSSmallJsonT(CuTest *tc UNUSED) {
   6718 
   6719   smallJsont* r;
   6720   smallJsont *self = allocSmallJson();
   6721 
   6722   // add an element to check that push adds the second element
   6723   // at the end
   6724   r = self->f->pushInt(self, 1);
   6725   ck_assert_ptr_ne(r, null);
   6726 
   6727   r = self->f->pushNFreeS(self, null);
   6728   ck_assert_ptr_eq(r, null);
   6729   ck_assert_int_eq(lenO(self), 1);
   6730   char *s = toStringO(self);
   6731   ck_assert_str_eq(s, "[1]");
   6732   free(s);
   6733 
   6734   char *str = strdup("poi");
   6735   r = self->f->pushNFreeS(self, str);
   6736   ck_assert_ptr_ne(r, null);
   6737   ck_assert_int_eq(lenO(self), 2);
   6738   s = toStringO(r);
   6739   ck_assert_str_eq(s, "[1,\"poi\"]");
   6740   free(s);
   6741 
   6742   terminateO(self);
   6743 
   6744 }
   6745 
   6746 
   6747 void pushNFreeDictSmallJsonT(CuTest *tc UNUSED) {
   6748 
   6749   smallJsont* r;
   6750   smallJsont *self = allocSmallJson();
   6751   smallDictt *dict  = allocG(rtSmallDictt);
   6752 
   6753   // add an element to check that push adds the second element
   6754   // at the end
   6755   r = self->f->pushInt(self, 1);
   6756   ck_assert_ptr_ne(r, null);
   6757 
   6758   // push dict
   6759   r = self->f->pushNFreeDict(self, dict);
   6760   ck_assert_ptr_ne(r, null);
   6761   ck_assert_int_eq(lenO(r), 2);
   6762   ck_assert_ptr_ne(r, null);
   6763   char *s = toStringO(r);
   6764   ck_assert_str_eq(s, "[1,{}]");
   6765   free(s);
   6766   // null
   6767   r = self->f->pushNFreeDict(self, null);
   6768   ck_assert_ptr_eq(r, null);
   6769   ck_assert_int_eq(lenO(self), 2);
   6770   s = toStringO(self);
   6771   ck_assert_str_eq(s, "[1,{}]");
   6772   free(s);
   6773   terminateO(self);
   6774 
   6775 }
   6776 
   6777 
   6778 void pushNFreeArraySmallJsonT(CuTest *tc UNUSED) {
   6779 
   6780   smallJsont* r;
   6781   smallJsont *self  = allocSmallJson();
   6782   smallArrayt *array = allocG(rtSmallArrayt);
   6783 
   6784   // add an element to check that push adds the second element
   6785   // at the end
   6786   r = self->f->pushInt(self, 1);
   6787   ck_assert_ptr_ne(r, null);
   6788 
   6789   r = self->f->pushNFreeArray(self, array);
   6790   ck_assert_ptr_ne(r, null);
   6791   ck_assert_int_eq(lenO(r), 2);
   6792   char *s = toStringO(r);
   6793   ck_assert_str_eq(s, "[1,[]]");
   6794   free(s);
   6795   // null
   6796   r = self->f->pushNFreeArray(self, null);
   6797   ck_assert_ptr_eq(r, null);
   6798   ck_assert_int_eq(lenO(self), 2);
   6799   s = toStringO(self);
   6800   ck_assert_str_eq(s, "[1,[]]");
   6801   free(s);
   6802   terminateO(self);
   6803 
   6804 }
   6805 
   6806 
   6807 void pushNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
   6808 
   6809   smallJsont* r;
   6810   smallJsont *self = allocSmallJson();
   6811   char **array      = listCreateS("a","bb");
   6812 
   6813   // add an element to check that push adds the second element
   6814   // at the end
   6815   r = self->f->pushInt(self, 1);
   6816   ck_assert_ptr_ne(r, null);
   6817 
   6818   r = self->f->pushNFreeArrayc(self, array);
   6819   ck_assert_ptr_ne(r, null);
   6820   ck_assert_int_eq(lenO(r), 2);
   6821   char *s = toStringO(r);
   6822   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6823   free(s);
   6824   // null
   6825   r = self->f->pushNFreeArrayc(self, null);
   6826   ck_assert_ptr_eq(r, null);
   6827   ck_assert_int_eq(lenO(self), 2);
   6828   s = toStringO(self);
   6829   ck_assert_str_eq(s, "[1,[\"a\",\"bb\"]]");
   6830   free(s);
   6831   terminateO(self);
   6832 
   6833 }
   6834 
   6835 
   6836 void pushNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   6837 
   6838   smallJsont* r;
   6839   smallJsont *self = allocSmallJson();
   6840   smallBoolt *value = allocG(TRUE);
   6841 
   6842   // add an element to check that push adds the second element
   6843   // at the end
   6844   r = self->f->pushInt(self, 1);
   6845   ck_assert_ptr_ne(r, null);
   6846 
   6847   r = self->f->pushNFreeSmallBool(self, value);
   6848   ck_assert_ptr_ne(r, null);
   6849   ck_assert_int_eq(lenO(r), 2);
   6850   char *s = toStringO(r);
   6851   ck_assert_str_eq(s, "[1,true]");
   6852   free(s);
   6853   // bool object with no data
   6854   createAllocateSmallBool(b);
   6855   r = self->f->pushNFreeSmallBool(self, b);
   6856   ck_assert_ptr_ne(r, null);
   6857   ck_assert_int_eq(lenO(r), 3);
   6858   s = toStringO(r);
   6859   ck_assert_str_eq(s, "[1,true,false]");
   6860   free(s);
   6861   // null
   6862   r = self->f->pushNFreeSmallBool(self, null);
   6863   ck_assert_ptr_eq(r, null);
   6864   ck_assert_int_eq(lenO(self), 3);
   6865   s = toStringO(self);
   6866   ck_assert_str_eq(s, "[1,true,false]");
   6867   free(s);
   6868   terminateO(self);
   6869 
   6870 }
   6871 
   6872 
   6873 void pushNFreeSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   6874 
   6875   smallJsont* r;
   6876   smallJsont *self = allocSmallJson();
   6877   createAllocateSmallBytes(value);
   6878 
   6879   // add an element to check that push adds the second element
   6880   // at the end
   6881   r = self->f->pushInt(self, 1);
   6882   ck_assert_ptr_ne(r, null);
   6883 
   6884   // the smallBytes container is empty
   6885   r = self->f->pushNFreeSmallBytes(self, value);
   6886   ck_assert_ptr_ne(r, null);
   6887   ck_assert_int_eq(lenO(r), 2);
   6888   char *s = toStringO(r);
   6889   ck_assert_str_eq(s, "[1,[]]");
   6890   free(s);
   6891 
   6892   char *buffer = "poi";
   6893   value        = allocSmallBytes(buffer, strlen(buffer));
   6894   r = self->f->pushNFreeSmallBytes(self, value);
   6895   ck_assert_ptr_ne(r, null);
   6896   ck_assert_int_eq(lenO(r), 3);
   6897   s = toStringO(r);
   6898   ck_assert_str_eq(s, "[1,[],[0x70,0x6f,0x69]]");
   6899   free(s);
   6900   // null
   6901   r = self->f->pushNFreeSmallBytes(self, null);
   6902   ck_assert_ptr_eq(r, null);
   6903   ck_assert_int_eq(lenO(self), 3);
   6904   s = toStringO(self);
   6905   ck_assert_str_eq(s, "[1,[],[0x70,0x6f,0x69]]");
   6906   free(s);
   6907   terminateO(self);
   6908 
   6909 }
   6910 
   6911 
   6912 void pushNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   6913 
   6914   smallJsont* r;
   6915   smallJsont *self   = allocSmallJson();
   6916   smallDoublet *value = allocG(1.0);
   6917 
   6918   // add an element to check that push adds the second element
   6919   // at the end
   6920   r = self->f->pushInt(self, 1);
   6921   ck_assert_ptr_ne(r, null);
   6922 
   6923   r = self->f->pushNFreeSmallDouble(self, value);
   6924   ck_assert_ptr_ne(r, null);
   6925   ck_assert_int_eq(lenO(r), 2);
   6926   char *s = toStringO(r);
   6927   ck_assert_str_eq(s, "[1,1.000000e+00]");
   6928   free(s);
   6929   // object with no data
   6930   createAllocateSmallDouble(b);
   6931   r = self->f->pushNFreeSmallDouble(self, b);
   6932   ck_assert_ptr_ne(r, null);
   6933   ck_assert_int_eq(lenO(r), 3);
   6934   s = toStringO(r);
   6935   ck_assert_str_eq(s, "[1,1.000000e+00,0.000000e+00]");
   6936   free(s);
   6937   // null
   6938   r = self->f->pushNFreeSmallDouble(self, null);
   6939   ck_assert_ptr_eq(r, null);
   6940   ck_assert_int_eq(lenO(self), 3);
   6941   s = toStringO(self);
   6942   ck_assert_str_eq(s, "[1,1.000000e+00,0.000000e+00]");
   6943   free(s);
   6944   terminateO(self);
   6945 
   6946 }
   6947 
   6948 
   6949 void pushNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
   6950 
   6951   smallJsont* r;
   6952   smallJsont *self = allocSmallJson();
   6953   smallIntt *value  = allocG(1);
   6954 
   6955   // add an element to check that push adds the second element
   6956   // at the end
   6957   r = self->f->pushInt(self, 1);
   6958   ck_assert_ptr_ne(r, null);
   6959 
   6960   r = self->f->pushNFreeSmallInt(self, value);
   6961   ck_assert_ptr_ne(r, null);
   6962   ck_assert_int_eq(lenO(r), 2);
   6963   char *s = toStringO(r);
   6964   ck_assert_str_eq(s, "[1,1]");
   6965   free(s);
   6966   // bool object with no data
   6967   createAllocateSmallInt(b);
   6968   r = self->f->pushNFreeSmallInt(self, b);
   6969   ck_assert_ptr_ne(r, null);
   6970   ck_assert_int_eq(lenO(r), 3);
   6971   s = toStringO(r);
   6972   ck_assert_str_eq(s, "[1,1,0]");
   6973   free(s);
   6974   // null
   6975   r = self->f->pushNFreeSmallInt(self, null);
   6976   ck_assert_ptr_eq(r, null);
   6977   ck_assert_int_eq(lenO(self), 3);
   6978   s = toStringO(self);
   6979   ck_assert_str_eq(s, "[1,1,0]");
   6980   free(s);
   6981   terminateO(self);
   6982 
   6983 }
   6984 
   6985 
   6986 void pushNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   6987 
   6988   smallJsont* r;
   6989   smallJsont *self = allocSmallJson();
   6990   smallJsont *value = allocG(rtSmallJsont);
   6991 
   6992   // add an element to check that push adds the second element
   6993   // at the end
   6994   r = self->f->pushInt(self, 1);
   6995   ck_assert_ptr_ne(r, null);
   6996 
   6997   // the smallJson container is empty
   6998   r = self->f->pushNFreeSmallJson(self, value);
   6999   ck_assert_ptr_ne(r, null);
   7000   ck_assert_int_eq(lenO(r), 2);
   7001   char *s = toStringO(r);
   7002   ck_assert_str_eq(s, "[1,{}]");
   7003   free(s);
   7004 
   7005   value = allocG(rtSmallJsont);
   7006   parseO(value, "{}");
   7007   r = self->f->pushNFreeSmallJson(self, value);
   7008   ck_assert_ptr_ne(r, null);
   7009   ck_assert_int_eq(lenO(r), 3);
   7010   s = toStringO(r);
   7011   ck_assert_str_eq(s, "[1,{},{}]");
   7012   free(s);
   7013   // null
   7014   r = self->f->pushNFreeSmallJson(self, null);
   7015   ck_assert_ptr_eq(r, null);
   7016   ck_assert_int_eq(lenO(self), 3);
   7017   s = toStringO(self);
   7018   ck_assert_str_eq(s, "[1,{},{}]");
   7019   free(s);
   7020   terminateO(self);
   7021 
   7022 }
   7023 
   7024 
   7025 void pushNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
   7026 
   7027   smallJsont* r;
   7028   smallJsont *self    = allocSmallJson();
   7029   createAllocateSmallString(string);
   7030 
   7031   // add an element to check that push adds the second element
   7032   // at the end
   7033   r = self->f->pushInt(self, 1);
   7034   ck_assert_ptr_ne(r, null);
   7035 
   7036   r = self->f->pushNFreeSmallString(self, string);
   7037   ck_assert_ptr_ne(r, null);
   7038   ck_assert_int_eq(lenO(r), 2);
   7039   char *s = toStringO(r);
   7040   ck_assert_str_eq(s, "[1,\"\"]");
   7041   free(s);
   7042   // null
   7043   r = self->f->pushNFreeSmallString(self, null);
   7044   ck_assert_ptr_eq(r, null);
   7045   ck_assert_int_eq(lenO(self), 2);
   7046   s = toStringO(self);
   7047   ck_assert_str_eq(s, "[1,\"\"]");
   7048   free(s);
   7049   terminateO(self);
   7050 
   7051 }
   7052 
   7053 
   7054 void pushNFreeSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   7055 
   7056   smallJsont* r;
   7057   smallJsont *self          = allocSmallJson();
   7058   createAllocateSmallContainer(container);
   7059 
   7060   // add an element to check that push adds the second element
   7061   // at the end
   7062   r = self->f->pushInt(self, 1);
   7063   ck_assert_ptr_ne(r, null);
   7064 
   7065   r = self->f->pushNFreeSmallContainer(self, container);
   7066   ck_assert_ptr_ne(r, null);
   7067   ck_assert_int_eq(lenO(r), 2);
   7068   char *s = toStringO(r);
   7069   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   7070   free(s);
   7071   // null
   7072   r = self->f->pushNFreeSmallContainer(self, null);
   7073   ck_assert_ptr_eq(r, null);
   7074   ck_assert_int_eq(lenO(self), 2);
   7075   s = toStringO(self);
   7076   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   7077   free(s);
   7078   terminateO(self);
   7079 
   7080 }
   7081 
   7082 
   7083 void pushManySmallJsonT(CuTest *tc UNUSED) {
   7084 
   7085   smallJsont* r;
   7086   smallJsont *self = allocSmallJson();
   7087   smallIntt *v1 = allocG(1);
   7088   smallIntt *v2 = allocG(2);
   7089 
   7090   r = self->f->pushMany(self, v1, v2, null);
   7091   finishO(v1);
   7092   finishO(v2);
   7093   ck_assert_ptr_ne(r, null);
   7094   ck_assert_int_eq(lenO(r), 2);
   7095   char *s = toStringO(r);
   7096   ck_assert_str_eq(s, "[1,2]");
   7097   free(s);
   7098   terminateO(self);
   7099   // json string
   7100   self = allocSmallJson();
   7101   setTopSO(self, "qwe");
   7102   smallStringt *s1 = allocSmallString("123");
   7103   smallStringt *s2 = allocSmallString("456");
   7104   r = self->f->pushMany(self, s1, s2, null);
   7105   ck_assert_ptr_ne(r, null);
   7106   terminateO(s1);
   7107   terminateO(s2);
   7108   s = toStringO(r);
   7109   ck_assert_str_eq(s, "qwe123456");
   7110   free(s);
   7111   // non smallString object
   7112   s1 = allocSmallString("123");
   7113   s2 = (smallStringt*) allocSmallInt(1);
   7114   r = self->f->pushMany(self, s1, s2, null);
   7115   ck_assert_ptr_eq(r, null);
   7116   s = toStringO(self);
   7117   ck_assert_str_eq(s, "qwe123456");
   7118   free(s);
   7119   terminateO(s1);
   7120   terminateO(s2);
   7121   terminateO(self);
   7122 
   7123 }
   7124 
   7125 
   7126 void pushManySSmallJsonT(CuTest *tc UNUSED) {
   7127 
   7128   smallJsont* r;
   7129   smallJsont *self = allocSmallJson();
   7130   char *v1 = "a";
   7131   char *v2 = "bb";
   7132 
   7133   r = self->f->pushManyS(self, v1, v2, null);
   7134   ck_assert_ptr_ne(r, null);
   7135   ck_assert_int_eq(lenO(r), 2);
   7136   char *s = toStringO(r);
   7137   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
   7138   free(s);
   7139   terminateO(self);
   7140   // json string
   7141   self = allocSmallJson();
   7142   setTopSO(self, "qwe");
   7143   r = self->f->pushManyS(self, "123", "456", null);
   7144   ck_assert_ptr_ne(r, null);
   7145   s = toStringO(r);
   7146   ck_assert_str_eq(s, "qwe123456");
   7147   free(s);
   7148   terminateO(self);
   7149 
   7150 }
   7151 
   7152 
   7153 void pushNFreeManySmallJsonT(CuTest *tc UNUSED) {
   7154 
   7155   smallJsont* r;
   7156   smallJsont *self = allocSmallJson();
   7157   smallIntt *v1 = allocG(1);
   7158   smallIntt *v2 = allocG(2);
   7159 
   7160   r = self->f->pushNFreeMany(self, v1, v2, null);
   7161   ck_assert_ptr_ne(r, null);
   7162   ck_assert_int_eq(lenO(r), 2);
   7163   char *s = toStringO(r);
   7164   ck_assert_str_eq(s, "[1,2]");
   7165   free(s);
   7166   terminateO(self);
   7167   // json string
   7168   self = allocSmallJson();
   7169   setTopSO(self, "qwe");
   7170   smallStringt *s1 = allocSmallString("123");
   7171   smallStringt *s2 = allocSmallString("456");
   7172   r = pushNFreeManyO(self, s1, s2);
   7173   ck_assert_ptr_ne(r, null);
   7174   s = toStringO(r);
   7175   ck_assert_str_eq(s, "qwe123456");
   7176   free(s);
   7177   // non smallString object
   7178   s1 = allocSmallString("123");
   7179   s2 = (smallStringt*) allocSmallInt(1);
   7180   r = pushNFreeManyO(self, s1, s2);
   7181   ck_assert_ptr_eq(r, null);
   7182   s = toStringO(self);
   7183   ck_assert_str_eq(s, "qwe123456");
   7184   free(s);
   7185   terminateO(s2);
   7186   terminateO(self);
   7187 
   7188 }
   7189 
   7190 
   7191 void pushNFreeManySSmallJsonT(CuTest *tc UNUSED) {
   7192 
   7193   smallJsont* r;
   7194   smallJsont *self = allocSmallJson();
   7195   char *v1 = strdup("a");
   7196   char *v2 = strdup("bb");
   7197 
   7198   r = self->f->pushNFreeManyS(self, v1, v2, null);
   7199   ck_assert_ptr_ne(r, null);
   7200   ck_assert_int_eq(lenO(r), 2);
   7201   char *s = toStringO(r);
   7202   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
   7203   free(s);
   7204   terminateO(self);
   7205   // json string
   7206   self = allocSmallJson();
   7207   setTopSO(self, "qwe");
   7208   r = pushNFreeManySO(self, strdup("123"), strdup("456"));
   7209   ck_assert_ptr_ne(r, null);
   7210   s = toStringO(r);
   7211   ck_assert_str_eq(s, "qwe123456");
   7212   free(s);
   7213   terminateO(self);
   7214 
   7215 }
   7216 
   7217 
   7218 void popSmallJsonT(CuTest *tc UNUSED) {
   7219 
   7220   baset* r;
   7221   smallJsont *self = allocSmallJson();
   7222   smallJsont *r2;
   7223 
   7224   // add an element to check that the second element is poped
   7225   // at the end
   7226   r2 = self->f->pushInt(self, 1);
   7227   ck_assert_ptr_ne(r2, null);
   7228   // push a base object of unknown type
   7229   smallIntt *o    = allocSmallInt(2);
   7230   o->type         = "newType";
   7231   r2 = self->f->pushNFree(self, (baset*)o);
   7232   ck_assert_ptr_ne(r2, null);
   7233   r2 = self->f->pushUndefined(self);
   7234   ck_assert_ptr_ne(r2, null);
   7235   r2 = self->f->pushUndefined(self);
   7236   ck_assert_ptr_ne(r2, null);
   7237   delElemIndexO(self,-1);
   7238   r = self->f->pop(self);
   7239   ck_assert_ptr_ne(r, null);
   7240   ck_assert(isOUndefined(r));
   7241   terminateO(r);
   7242   r = self->f->pop(self);
   7243   ck_assert_ptr_ne(r, null);
   7244   ck_assert_str_eq(r->type, "newType");
   7245   char *s = toStringO(r);
   7246   terminateO(r);
   7247   ck_assert_str_eq(s, "2");
   7248   free(s);
   7249   ck_assert_int_eq(lenO(self), 1);
   7250   s = toStringO(self);
   7251   ck_assert_str_eq(s, "[1]");
   7252   free(s);
   7253   // empty array
   7254   r = self->f->pop(self);
   7255   ck_assert_ptr_ne(r, null);
   7256   terminateO(r);
   7257   s = toStringO(self);
   7258   ck_assert_str_eq(s, "[]");
   7259   free(s);
   7260   r = self->f->pop(self);
   7261   ck_assert_ptr_eq(r, null);
   7262   s = toStringO(self);
   7263   ck_assert_str_eq(s, "[]");
   7264   free(s);
   7265   r2 = self->f->pushUndefined(self);
   7266   ck_assert_ptr_ne(r2, null);
   7267   delElemIndexO(self,-1);
   7268   r = self->f->pop(self);
   7269   ck_assert_ptr_eq(r, null);
   7270   // non json array
   7271   freeO(self);
   7272   setTypeBoolO(self);
   7273   ck_assert_ptr_eq(self->f->pop(self), NULL);
   7274   terminateO(self);
   7275 
   7276 }
   7277 
   7278 
   7279 void popUndefinedSmallJsonT(CuTest *tc UNUSED) {
   7280 
   7281   undefinedt* r;
   7282   smallJsont *self = allocSmallJson();
   7283   smallJsont *r2;
   7284   baset *r3;
   7285 
   7286   // add an element to check that the second element is poped
   7287   // at the end
   7288   r2 = self->f->pushInt(self, 1);
   7289   ck_assert_ptr_ne(r2, null);
   7290   // add second element
   7291   r2 = self->f->pushUndefined(self);
   7292   ck_assert_ptr_ne(r2, null);
   7293   // pop
   7294   r2 = self->f->pushUndefined(self);
   7295   ck_assert_ptr_ne(r2, null);
   7296   delElemIndexO(self,-1);
   7297   r = self->f->popUndefined(self);
   7298   ck_assert_ptr_ne(r, null);
   7299   char *s = toStringO(r);
   7300   terminateO(r);
   7301   ck_assert_str_eq(s, "null");
   7302   free(s);
   7303   ck_assert_int_eq(lenO(self), 1);
   7304   s = toStringO(self);
   7305   ck_assert_str_eq(s, "[1]");
   7306   free(s);
   7307   // pop element of unexpected type
   7308   r = self->f->popUndefined(self);
   7309   ck_assert_ptr_eq(r, null);
   7310   ck_assert_int_eq(lenO(self), 1);
   7311   s = toStringO(self);
   7312   ck_assert_str_eq(s, "[1]");
   7313   free(s);
   7314   // empty array
   7315   r3 = self->f->pop(self);
   7316   ck_assert_ptr_ne(r3, null);
   7317   terminateO(r3);
   7318   s = toStringO(self);
   7319   ck_assert_str_eq(s, "[]");
   7320   free(s);
   7321   r = self->f->popUndefined(self);
   7322   ck_assert_ptr_eq(r, null);
   7323   s = toStringO(self);
   7324   ck_assert_str_eq(s, "[]");
   7325   free(s);
   7326   r2 = self->f->pushUndefined(self);
   7327   ck_assert_ptr_ne(r2, null);
   7328   delElemIndexO(self,-1);
   7329   r = self->f->popUndefined(self);
   7330   ck_assert_ptr_eq(r, null);
   7331   // non json array
   7332   freeO(self);
   7333   setTypeBoolO(self);
   7334   ck_assert_ptr_eq(self->f->popUndefined(self), NULL);
   7335   terminateO(self);
   7336 
   7337 }
   7338 
   7339 
   7340 void popBoolSmallJsonT(CuTest *tc UNUSED) {
   7341 
   7342   bool r;
   7343   smallJsont *self = allocSmallJson();
   7344   smallJsont *r2;
   7345   baset *r3;
   7346 
   7347   // add an element to check that the second element is poped
   7348   // at the end
   7349   r2 = self->f->pushInt(self, 1);
   7350   ck_assert_ptr_ne(r2, null);
   7351   // add second element
   7352   r2 = self->f->pushBool(self, TRUE);
   7353   ck_assert_ptr_ne(r2, null);
   7354   // pop
   7355   r = self->f->popBool(self);
   7356   ck_assert(r);
   7357   ck_assert_int_eq(lenO(self), 1);
   7358   char *s = toStringO(self);
   7359   ck_assert_str_eq(s, "[1]");
   7360   free(s);
   7361   // pop element of unexpected type
   7362   r = self->f->popBool(self);
   7363   ck_assert(!r);
   7364   ck_assert_int_eq(lenO(self), 1);
   7365   s = toStringO(self);
   7366   ck_assert_str_eq(s, "[1]");
   7367   free(s);
   7368   // empty array
   7369   r3 = self->f->pop(self);
   7370   ck_assert_ptr_ne(r3, null);
   7371   terminateO(r3);
   7372   s = toStringO(self);
   7373   ck_assert_str_eq(s, "[]");
   7374   free(s);
   7375   r = self->f->popBool(self);
   7376   ck_assert(!r);
   7377   s = toStringO(self);
   7378   ck_assert_str_eq(s, "[]");
   7379   free(s);
   7380   terminateO(self);
   7381 
   7382 }
   7383 
   7384 
   7385 void popDoubleSmallJsonT(CuTest *tc UNUSED) {
   7386 
   7387   double r;
   7388   smallJsont *self = allocSmallJson();
   7389   smallJsont *r2;
   7390   baset *r3;
   7391 
   7392   // add an element to check that the second element is poped
   7393   // at the end
   7394   r2 = self->f->pushInt(self, 1);
   7395   ck_assert_ptr_ne(r2, null);
   7396   // add second element
   7397   r2 = self->f->pushDouble(self, 2.0);
   7398   ck_assert_ptr_ne(r2, null);
   7399   // pop
   7400   r = self->f->popDouble(self);
   7401   ck_assert(r==2.0);
   7402   ck_assert_int_eq(lenO(self), 1);
   7403   char *s = toStringO(self);
   7404   ck_assert_str_eq(s, "[1]");
   7405   free(s);
   7406   // pop element of unexpected type
   7407   r = self->f->popDouble(self);
   7408   ck_assert(!r);
   7409   ck_assert_int_eq(lenO(self), 1);
   7410   s = toStringO(self);
   7411   ck_assert_str_eq(s, "[1]");
   7412   free(s);
   7413   // empty array
   7414   r3 = self->f->pop(self);
   7415   ck_assert_ptr_ne(r3, null);
   7416   terminateO(r3);
   7417   s = toStringO(self);
   7418   ck_assert_str_eq(s, "[]");
   7419   free(s);
   7420   r = self->f->popDouble(self);
   7421   ck_assert(!r);
   7422   s = toStringO(self);
   7423   ck_assert_str_eq(s, "[]");
   7424   free(s);
   7425   terminateO(self);
   7426 
   7427 }
   7428 
   7429 
   7430 void popIntSmallJsonT(CuTest *tc UNUSED) {
   7431 
   7432   int64_t r;
   7433   smallJsont *self = allocSmallJson();
   7434   smallJsont *r2;
   7435   baset *r3;
   7436 
   7437   // add an element to check that the second element is poped
   7438   // at the end
   7439   r2 = self->f->pushBool(self, FALSE);
   7440   ck_assert_ptr_ne(r2, null);
   7441   // add second element
   7442   r2 = self->f->pushInt(self, 2);
   7443   ck_assert_ptr_ne(r2, null);
   7444   // pop
   7445   r = self->f->popInt(self);
   7446   ck_assert_int_eq(r, 2);
   7447   ck_assert_int_eq(lenO(self), 1);
   7448   char *s = toStringO(self);
   7449   ck_assert_str_eq(s, "[false]");
   7450   free(s);
   7451   // pop element of unexpected type
   7452   r = self->f->popInt(self);
   7453   ck_assert(!r);
   7454   ck_assert_int_eq(lenO(self), 1);
   7455   s = toStringO(self);
   7456   ck_assert_str_eq(s, "[false]");
   7457   free(s);
   7458   // empty array
   7459   r3 = self->f->pop(self);
   7460   ck_assert_ptr_ne(r3, null);
   7461   terminateO(r3);
   7462   s = toStringO(self);
   7463   ck_assert_str_eq(s, "[]");
   7464   free(s);
   7465   r = self->f->popInt(self);
   7466   ck_assert(!r);
   7467   s = toStringO(self);
   7468   ck_assert_str_eq(s, "[]");
   7469   free(s);
   7470   terminateO(self);
   7471 
   7472 }
   7473 
   7474 
   7475 void popInt32SmallJsonT(CuTest *tc UNUSED) {
   7476 
   7477   int32_t r;
   7478   smallJsont *self = allocSmallJson();
   7479   smallJsont *r2;
   7480   baset *r3;
   7481 
   7482   // add an element to check that the second element is poped
   7483   // at the end
   7484   r2 = self->f->pushBool(self, FALSE);
   7485   ck_assert_ptr_ne(r2, null);
   7486   // add second element
   7487   r2 = self->f->pushInt(self, 2);
   7488   ck_assert_ptr_ne(r2, null);
   7489   // pop
   7490   r = self->f->popInt32(self);
   7491   ck_assert_int_eq(r, 2);
   7492   ck_assert_int_eq(lenO(self), 1);
   7493   char *s = toStringO(self);
   7494   ck_assert_str_eq(s, "[false]");
   7495   free(s);
   7496   // pop element of unexpected type
   7497   r = self->f->popInt32(self);
   7498   ck_assert(!r);
   7499   ck_assert_int_eq(lenO(self), 1);
   7500   s = toStringO(self);
   7501   ck_assert_str_eq(s, "[false]");
   7502   free(s);
   7503   // empty array
   7504   r3 = self->f->pop(self);
   7505   ck_assert_ptr_ne(r3, null);
   7506   terminateO(r3);
   7507   s = toStringO(self);
   7508   ck_assert_str_eq(s, "[]");
   7509   free(s);
   7510   r = self->f->popInt32(self);
   7511   ck_assert(!r);
   7512   s = toStringO(self);
   7513   ck_assert_str_eq(s, "[]");
   7514   free(s);
   7515   terminateO(self);
   7516 
   7517 }
   7518 
   7519 
   7520 void popUintSmallJsonT(CuTest *tc UNUSED) {
   7521 
   7522   uint64_t r;
   7523   smallJsont *self = allocSmallJson();
   7524   smallJsont *r2;
   7525   baset *r3;
   7526 
   7527   // add an element to check that the second element is poped
   7528   // at the end
   7529   r2 = self->f->pushBool(self, FALSE);
   7530   ck_assert_ptr_ne(r2, null);
   7531   // add second element
   7532   r2 = self->f->pushInt(self, 2);
   7533   ck_assert_ptr_ne(r2, null);
   7534   // pop
   7535   r = self->f->popUint(self);
   7536   ck_assert_int_eq(r, 2);
   7537   ck_assert_int_eq(lenO(self), 1);
   7538   char *s = toStringO(self);
   7539   ck_assert_str_eq(s, "[false]");
   7540   free(s);
   7541   // pop element of unexpected type
   7542   r = self->f->popUint(self);
   7543   ck_assert(!r);
   7544   ck_assert_int_eq(lenO(self), 1);
   7545   s = toStringO(self);
   7546   ck_assert_str_eq(s, "[false]");
   7547   free(s);
   7548   // empty array
   7549   r3 = self->f->pop(self);
   7550   ck_assert_ptr_ne(r3, null);
   7551   terminateO(r3);
   7552   s = toStringO(self);
   7553   ck_assert_str_eq(s, "[]");
   7554   free(s);
   7555   r = self->f->popUint(self);
   7556   ck_assert(!r);
   7557   s = toStringO(self);
   7558   ck_assert_str_eq(s, "[]");
   7559   free(s);
   7560   terminateO(self);
   7561 
   7562 }
   7563 
   7564 
   7565 void popUint32SmallJsonT(CuTest *tc UNUSED) {
   7566 
   7567   uint32_t r;
   7568   smallJsont *self = allocSmallJson();
   7569   smallJsont *r2;
   7570   baset *r3;
   7571 
   7572   // add an element to check that the second element is poped
   7573   // at the end
   7574   r2 = self->f->pushBool(self, FALSE);
   7575   ck_assert_ptr_ne(r2, null);
   7576   // add second element
   7577   r2 = self->f->pushInt(self, 2);
   7578   ck_assert_ptr_ne(r2, null);
   7579   // pop
   7580   r = self->f->popUint32(self);
   7581   ck_assert_int_eq(r, 2);
   7582   ck_assert_int_eq(lenO(self), 1);
   7583   char *s = toStringO(self);
   7584   ck_assert_str_eq(s, "[false]");
   7585   free(s);
   7586   // pop element of unexpected type
   7587   r = self->f->popUint32(self);
   7588   ck_assert(!r);
   7589   ck_assert_int_eq(lenO(self), 1);
   7590   s = toStringO(self);
   7591   ck_assert_str_eq(s, "[false]");
   7592   free(s);
   7593   // empty array
   7594   r3 = self->f->pop(self);
   7595   ck_assert_ptr_ne(r3, null);
   7596   terminateO(r3);
   7597   s = toStringO(self);
   7598   ck_assert_str_eq(s, "[]");
   7599   free(s);
   7600   r = self->f->popUint32(self);
   7601   ck_assert(!r);
   7602   s = toStringO(self);
   7603   ck_assert_str_eq(s, "[]");
   7604   free(s);
   7605   terminateO(self);
   7606 
   7607 }
   7608 
   7609 
   7610 void popSSmallJsonT(CuTest *tc UNUSED) {
   7611 
   7612   char* r;
   7613   smallJsont *self = allocSmallJson();
   7614   smallJsont *r2;
   7615   baset *r3;
   7616 
   7617   // add an element to check that the second element is poped
   7618   // at the end
   7619   r2 = self->f->pushInt(self, 1);
   7620   ck_assert_ptr_ne(r2, null);
   7621   // add second element
   7622   r2 = self->f->pushS(self, "bb");
   7623   ck_assert_ptr_ne(r2, null);
   7624   // pop
   7625   r = self->f->popS(self);
   7626   ck_assert_str_eq(r, "bb");
   7627   free(r);
   7628   ck_assert_int_eq(lenO(self), 1);
   7629   char *s = toStringO(self);
   7630   ck_assert_str_eq(s, "[1]");
   7631   free(s);
   7632   // pop element of unexpected type
   7633   r = self->f->popS(self);
   7634   ck_assert(!r);
   7635   ck_assert_int_eq(lenO(self), 1);
   7636   s = toStringO(self);
   7637   ck_assert_str_eq(s, "[1]");
   7638   free(s);
   7639   // empty array
   7640   r3 = self->f->pop(self);
   7641   ck_assert_ptr_ne(r3, null);
   7642   terminateO(r3);
   7643   s = toStringO(self);
   7644   ck_assert_str_eq(s, "[]");
   7645   free(s);
   7646   r = self->f->popS(self);
   7647   ck_assert(!r);
   7648   s = toStringO(self);
   7649   ck_assert_str_eq(s, "[]");
   7650   free(s);
   7651   terminateO(self);
   7652 
   7653 }
   7654 
   7655 
   7656 void popDictSmallJsonT(CuTest *tc UNUSED) {
   7657 
   7658   smallDictt* r;
   7659   smallJsont *self = allocSmallJson();
   7660   smallJsont *r2;
   7661   baset *r3;
   7662 
   7663   // add an element to check that the second element is poped
   7664   // at the end
   7665   r2 = self->f->pushInt(self, 1);
   7666   ck_assert_ptr_ne(r2, null);
   7667   // add second element
   7668   createSmallDict(e);
   7669   r2 = self->f->pushDict(self, &e);
   7670   ck_assert_ptr_ne(r2, null);
   7671   // pop
   7672   r2 = self->f->pushUndefined(self);
   7673   ck_assert_ptr_ne(r2, null);
   7674   delElemIndexO(self,-1);
   7675   r = self->f->popDict(self);
   7676   ck_assert_ptr_ne(r, null);
   7677   char *s = toStringO(r);
   7678   terminateO(r);
   7679   ck_assert_str_eq(s, "{}");
   7680   free(s);
   7681   ck_assert_int_eq(lenO(self), 1);
   7682   s = toStringO(self);
   7683   ck_assert_str_eq(s, "[1]");
   7684   free(s);
   7685   // pop element of unexpected type
   7686   r = self->f->popDict(self);
   7687   ck_assert(!r);
   7688   ck_assert_int_eq(lenO(self), 1);
   7689   s = toStringO(self);
   7690   ck_assert_str_eq(s, "[1]");
   7691   free(s);
   7692   // empty array
   7693   r3 = self->f->pop(self);
   7694   ck_assert_ptr_ne(r3, null);
   7695   terminateO(r3);
   7696   s = toStringO(self);
   7697   ck_assert_str_eq(s, "[]");
   7698   free(s);
   7699   r = self->f->popDict(self);
   7700   ck_assert(!r);
   7701   s = toStringO(self);
   7702   ck_assert_str_eq(s, "[]");
   7703   free(s);
   7704   r2 = self->f->pushUndefined(self);
   7705   ck_assert_ptr_ne(r2, null);
   7706   delElemIndexO(self,-1);
   7707   r = self->f->popDict(self);
   7708   ck_assert_ptr_eq(r, null);
   7709   // non json array
   7710   freeO(self);
   7711   setTypeBoolO(self);
   7712   ck_assert_ptr_eq(self->f->popDict(self), NULL);
   7713   terminateO(self);
   7714 
   7715 }
   7716 
   7717 
   7718 void popArraySmallJsonT(CuTest *tc UNUSED) {
   7719 
   7720   smallArrayt* r;
   7721   smallJsont *self = allocSmallJson();
   7722   smallJsont *r2;
   7723   baset *r3;
   7724 
   7725   // add an element to check that the second element is poped
   7726   // at the end
   7727   r2 = self->f->pushInt(self, 1);
   7728   ck_assert_ptr_ne(r2, null);
   7729   // add second element
   7730   createSmallArray(e);
   7731   r2 = self->f->pushArray(self, &e);
   7732   ck_assert_ptr_ne(r2, null);
   7733   // pop
   7734   r2 = self->f->pushUndefined(self);
   7735   ck_assert_ptr_ne(r2, null);
   7736   delElemIndexO(self,-1);
   7737   r = self->f->popArray(self);
   7738   ck_assert_ptr_ne(r, null);
   7739   char *s = toStringO(r);
   7740   terminateO(r);
   7741   ck_assert_str_eq(s, "[]");
   7742   free(s);
   7743   ck_assert_int_eq(lenO(self), 1);
   7744   s = toStringO(self);
   7745   ck_assert_str_eq(s, "[1]");
   7746   free(s);
   7747   // pop element of unexpected type
   7748   r = self->f->popArray(self);
   7749   ck_assert(!r);
   7750   ck_assert_int_eq(lenO(self), 1);
   7751   s = toStringO(self);
   7752   ck_assert_str_eq(s, "[1]");
   7753   free(s);
   7754   // empty array
   7755   r3 = self->f->pop(self);
   7756   ck_assert_ptr_ne(r3, null);
   7757   terminateO(r3);
   7758   s = toStringO(self);
   7759   ck_assert_str_eq(s, "[]");
   7760   free(s);
   7761   r = self->f->popArray(self);
   7762   ck_assert(!r);
   7763   s = toStringO(self);
   7764   ck_assert_str_eq(s, "[]");
   7765   free(s);
   7766   r2 = self->f->pushUndefined(self);
   7767   ck_assert_ptr_ne(r2, null);
   7768   delElemIndexO(self,-1);
   7769   r = self->f->popArray(self);
   7770   // non json array
   7771   freeO(self);
   7772   setTypeBoolO(self);
   7773   ck_assert_ptr_eq(self->f->popArray(self), NULL);
   7774   ck_assert_ptr_eq(r, null);
   7775   terminateO(self);
   7776 
   7777 }
   7778 
   7779 
   7780 void popSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   7781 
   7782   smallBoolt* r;
   7783   smallJsont *self = allocSmallJson();
   7784   smallJsont *r2;
   7785   baset *r3;
   7786 
   7787   // add an element to check that the second element is poped
   7788   // at the end
   7789   r2 = self->f->pushInt(self, 1);
   7790   ck_assert_ptr_ne(r2, null);
   7791   // add second element
   7792   createSmallBool(e);
   7793   r2 = self->f->pushSmallBool(self, &e);
   7794   ck_assert_ptr_ne(r2, null);
   7795   // pop
   7796   r2 = self->f->pushUndefined(self);
   7797   ck_assert_ptr_ne(r2, null);
   7798   delElemIndexO(self,-1);
   7799   r = self->f->popSmallBool(self);
   7800   ck_assert_ptr_ne(r, null);
   7801   char *s = toStringO(r);
   7802   terminateO(r);
   7803   ck_assert_str_eq(s, "false");
   7804   free(s);
   7805   ck_assert_int_eq(lenO(self), 1);
   7806   s = toStringO(self);
   7807   ck_assert_str_eq(s, "[1]");
   7808   free(s);
   7809   // pop element of unexpected type
   7810   r = self->f->popSmallBool(self);
   7811   ck_assert(!r);
   7812   ck_assert_int_eq(lenO(self), 1);
   7813   s = toStringO(self);
   7814   ck_assert_str_eq(s, "[1]");
   7815   free(s);
   7816   // empty array
   7817   r3 = self->f->pop(self);
   7818   ck_assert_ptr_ne(r3, null);
   7819   terminateO(r3);
   7820   s = toStringO(self);
   7821   ck_assert_str_eq(s, "[]");
   7822   free(s);
   7823   r = self->f->popSmallBool(self);
   7824   ck_assert(!r);
   7825   s = toStringO(self);
   7826   ck_assert_str_eq(s, "[]");
   7827   free(s);
   7828   r2 = self->f->pushUndefined(self);
   7829   ck_assert_ptr_ne(r2, null);
   7830   delElemIndexO(self,-1);
   7831   r = self->f->popSmallBool(self);
   7832   ck_assert_ptr_eq(r, null);
   7833   // non json array
   7834   freeO(self);
   7835   setTypeBoolO(self);
   7836   ck_assert_ptr_eq(self->f->popSmallBool(self), NULL);
   7837   terminateO(self);
   7838 
   7839 }
   7840 
   7841 
   7842 void popSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   7843 
   7844   smallBytest* r;
   7845   smallJsont *self = allocSmallJson();
   7846   smallJsont *r2;
   7847   baset *r3;
   7848 
   7849   // add an element to check that the second element is poped
   7850   // at the end
   7851   r2 = self->f->pushInt(self, 1);
   7852   ck_assert_ptr_ne(r2, null);
   7853   // add second element
   7854   createSmallBytes(e);
   7855   r2 = self->f->pushSmallBytes(self, &e);
   7856   ck_assert_ptr_ne(r2, null);
   7857   // pop
   7858   r2 = self->f->pushUndefined(self);
   7859   ck_assert_ptr_ne(r2, null);
   7860   delElemIndexO(self,-1);
   7861   r = self->f->popSmallBytes(self);
   7862   ck_assert_ptr_ne(r, null);
   7863   char *s = toStringO(r);
   7864   terminateO(r);
   7865   ck_assert_str_eq(s, "[]");
   7866   free(s);
   7867   ck_assert_int_eq(lenO(self), 1);
   7868   s = toStringO(self);
   7869   ck_assert_str_eq(s, "[1]");
   7870   free(s);
   7871   // pop element of unexpected type
   7872   r = self->f->popSmallBytes(self);
   7873   ck_assert(!r);
   7874   ck_assert_int_eq(lenO(self), 1);
   7875   s = toStringO(self);
   7876   ck_assert_str_eq(s, "[1]");
   7877   free(s);
   7878   // empty array
   7879   r3 = self->f->pop(self);
   7880   ck_assert_ptr_ne(r3, null);
   7881   terminateO(r3);
   7882   s = toStringO(self);
   7883   ck_assert_str_eq(s, "[]");
   7884   free(s);
   7885   r = self->f->popSmallBytes(self);
   7886   ck_assert(!r);
   7887   s = toStringO(self);
   7888   ck_assert_str_eq(s, "[]");
   7889   free(s);
   7890   r2 = self->f->pushUndefined(self);
   7891   ck_assert_ptr_ne(r2, null);
   7892   delElemIndexO(self,-1);
   7893   r = self->f->popSmallBytes(self);
   7894   ck_assert_ptr_eq(r, null);
   7895   // non json array
   7896   freeO(self);
   7897   setTypeBoolO(self);
   7898   ck_assert_ptr_eq(self->f->popSmallBytes(self), NULL);
   7899   terminateO(self);
   7900 
   7901 }
   7902 
   7903 
   7904 void popSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   7905 
   7906   smallDoublet* r;
   7907   smallJsont *self = allocSmallJson();
   7908   smallJsont *r2;
   7909   baset *r3;
   7910 
   7911   // add an element to check that the second element is poped
   7912   // at the end
   7913   r2 = self->f->pushInt(self, 1);
   7914   ck_assert_ptr_ne(r2, null);
   7915   // add second element
   7916   createSmallDouble(e);
   7917   r2 = self->f->pushSmallDouble(self, &e);
   7918   ck_assert_ptr_ne(r2, null);
   7919   // pop
   7920   r2 = self->f->pushUndefined(self);
   7921   ck_assert_ptr_ne(r2, null);
   7922   delElemIndexO(self,-1);
   7923   r = self->f->popSmallDouble(self);
   7924   ck_assert_ptr_ne(r, null);
   7925   char *s = toStringO(r);
   7926   terminateO(r);
   7927   ck_assert_str_eq(s, "0.000000e+00");
   7928   free(s);
   7929   ck_assert_int_eq(lenO(self), 1);
   7930   s = toStringO(self);
   7931   ck_assert_str_eq(s, "[1]");
   7932   free(s);
   7933   // pop element of unexpected type
   7934   r = self->f->popSmallDouble(self);
   7935   ck_assert(!r);
   7936   ck_assert_int_eq(lenO(self), 1);
   7937   s = toStringO(self);
   7938   ck_assert_str_eq(s, "[1]");
   7939   free(s);
   7940   // empty array
   7941   r3 = self->f->pop(self);
   7942   ck_assert_ptr_ne(r3, null);
   7943   terminateO(r3);
   7944   s = toStringO(self);
   7945   ck_assert_str_eq(s, "[]");
   7946   free(s);
   7947   r = self->f->popSmallDouble(self);
   7948   ck_assert(!r);
   7949   s = toStringO(self);
   7950   ck_assert_str_eq(s, "[]");
   7951   free(s);
   7952   r2 = self->f->pushUndefined(self);
   7953   ck_assert_ptr_ne(r2, null);
   7954   delElemIndexO(self,-1);
   7955   r = self->f->popSmallDouble(self);
   7956   ck_assert_ptr_eq(r, null);
   7957   // non json array
   7958   freeO(self);
   7959   setTypeBoolO(self);
   7960   ck_assert_ptr_eq(self->f->popSmallDouble(self), NULL);
   7961   terminateO(self);
   7962 
   7963 }
   7964 
   7965 
   7966 void popSmallIntSmallJsonT(CuTest *tc UNUSED) {
   7967 
   7968   smallIntt* r;
   7969   smallJsont *self = allocSmallJson();
   7970   smallJsont *r2;
   7971   baset *r3;
   7972 
   7973   // add an element to check that the second element is poped
   7974   // at the end
   7975   r2 = self->f->pushBool(self, TRUE);
   7976   ck_assert_ptr_ne(r2, null);
   7977   // add second element
   7978   createSmallInt(e);
   7979   r2 = self->f->pushSmallInt(self, &e);
   7980   ck_assert_ptr_ne(r2, null);
   7981   // pop
   7982   r2 = self->f->pushUndefined(self);
   7983   ck_assert_ptr_ne(r2, null);
   7984   delElemIndexO(self,-1);
   7985   r = self->f->popSmallInt(self);
   7986   ck_assert_ptr_ne(r, null);
   7987   char *s = toStringO(r);
   7988   terminateO(r);
   7989   ck_assert_str_eq(s, "0");
   7990   free(s);
   7991   ck_assert_int_eq(lenO(self), 1);
   7992   s = toStringO(self);
   7993   ck_assert_str_eq(s, "[true]");
   7994   free(s);
   7995   // pop element of unexpected type
   7996   r = self->f->popSmallInt(self);
   7997   ck_assert(!r);
   7998   ck_assert_int_eq(lenO(self), 1);
   7999   s = toStringO(self);
   8000   ck_assert_str_eq(s, "[true]");
   8001   free(s);
   8002   // empty array
   8003   r3 = self->f->pop(self);
   8004   ck_assert_ptr_ne(r3, null);
   8005   terminateO(r3);
   8006   s = toStringO(self);
   8007   ck_assert_str_eq(s, "[]");
   8008   free(s);
   8009   r = self->f->popSmallInt(self);
   8010   ck_assert(!r);
   8011   s = toStringO(self);
   8012   ck_assert_str_eq(s, "[]");
   8013   free(s);
   8014   r2 = self->f->pushUndefined(self);
   8015   ck_assert_ptr_ne(r2, null);
   8016   delElemIndexO(self,-1);
   8017   r = self->f->popSmallInt(self);
   8018   ck_assert_ptr_eq(r, null);
   8019   // non json array
   8020   freeO(self);
   8021   setTypeBoolO(self);
   8022   ck_assert_ptr_eq(self->f->popSmallInt(self), NULL);
   8023   terminateO(self);
   8024 
   8025 }
   8026 
   8027 
   8028 void popSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   8029 
   8030   smallJsont* r;
   8031   smallJsont *self = allocSmallJson();
   8032   smallJsont *r2;
   8033   baset *r3;
   8034 
   8035   // add an element to check that the second element is poped
   8036   // at the end
   8037   createSmallBytes(B);
   8038   r2 = self->f->pushSmallBytes(self, &B);
   8039   ck_assert_ptr_ne(r2, null);
   8040   // add second element
   8041   createSmallJson(e);
   8042   r2 = self->f->pushSmallJson(self, &e);
   8043   ck_assert_ptr_ne(r2, null);
   8044   // pop
   8045   r2 = self->f->pushUndefined(self);
   8046   ck_assert_ptr_ne(r2, null);
   8047   delElemIndexO(self,-1);
   8048   r = self->f->popSmallJson(self);
   8049   ck_assert_ptr_ne(r, null);
   8050   char *s = toStringO(r);
   8051   terminateO(r);
   8052   ck_assert_str_eq(s, "{}");
   8053   free(s);
   8054   ck_assert_int_eq(lenO(self), 1);
   8055   s = toStringO(self);
   8056   ck_assert_str_eq(s, "[[]]");
   8057   free(s);
   8058   // pop element of unexpected type
   8059   r = self->f->popSmallJson(self);
   8060   ck_assert(!r);
   8061   ck_assert_int_eq(lenO(self), 1);
   8062   s = toStringO(self);
   8063   ck_assert_str_eq(s, "[[]]");
   8064   free(s);
   8065   // empty array
   8066   r3 = self->f->pop(self);
   8067   ck_assert_ptr_ne(r3, null);
   8068   terminateO(r3);
   8069   s = toStringO(self);
   8070   ck_assert_str_eq(s, "[]");
   8071   free(s);
   8072   r = self->f->popSmallJson(self);
   8073   ck_assert(!r);
   8074   s = toStringO(self);
   8075   ck_assert_str_eq(s, "[]");
   8076   free(s);
   8077   r2 = self->f->pushUndefined(self);
   8078   ck_assert_ptr_ne(r2, null);
   8079   delElemIndexO(self,-1);
   8080   r = self->f->popSmallJson(self);
   8081   ck_assert_ptr_eq(r, null);
   8082   // non json array
   8083   freeO(self);
   8084   setTypeBoolO(self);
   8085   ck_assert_ptr_eq(self->f->popSmallJson(self), NULL);
   8086   terminateO(self);
   8087 
   8088 }
   8089 
   8090 
   8091 void popSmallStringSmallJsonT(CuTest *tc UNUSED) {
   8092 
   8093   smallStringt* r;
   8094   smallJsont *self = allocSmallJson();
   8095   smallJsont *r2;
   8096   baset *r3;
   8097 
   8098   // add an element to check that the second element is poped
   8099   // at the end
   8100   r2 = self->f->pushInt(self, 1);
   8101   ck_assert_ptr_ne(r2, null);
   8102   // add second element
   8103   createSmallString(e);
   8104   r2 = self->f->pushSmallString(self, &e);
   8105   ck_assert_ptr_ne(r2, null);
   8106   // pop
   8107   r2 = self->f->pushUndefined(self);
   8108   ck_assert_ptr_ne(r2, null);
   8109   delElemIndexO(self,-1);
   8110   r = self->f->popSmallString(self);
   8111   ck_assert_ptr_ne(r, null);
   8112   char *s = toStringO(r);
   8113   terminateO(r);
   8114   ck_assert_str_eq(s, "");
   8115   free(s);
   8116   ck_assert_int_eq(lenO(self), 1);
   8117   s = toStringO(self);
   8118   ck_assert_str_eq(s, "[1]");
   8119   free(s);
   8120   // pop element of unexpected type
   8121   r = self->f->popSmallString(self);
   8122   ck_assert(!r);
   8123   ck_assert_int_eq(lenO(self), 1);
   8124   s = toStringO(self);
   8125   ck_assert_str_eq(s, "[1]");
   8126   free(s);
   8127   // empty array
   8128   r3 = self->f->pop(self);
   8129   ck_assert_ptr_ne(r3, null);
   8130   terminateO(r3);
   8131   s = toStringO(self);
   8132   ck_assert_str_eq(s, "[]");
   8133   free(s);
   8134   r = self->f->popSmallString(self);
   8135   ck_assert(!r);
   8136   s = toStringO(self);
   8137   ck_assert_str_eq(s, "[]");
   8138   free(s);
   8139   r2 = self->f->pushUndefined(self);
   8140   ck_assert_ptr_ne(r2, null);
   8141   delElemIndexO(self,-1);
   8142   r = self->f->popSmallString(self);
   8143   ck_assert_ptr_eq(r, null);
   8144   // non json array
   8145   freeO(self);
   8146   setTypeBoolO(self);
   8147   ck_assert_ptr_eq(self->f->popSmallString(self), NULL);
   8148   terminateO(self);
   8149 
   8150 }
   8151 
   8152 
   8153 void popVoidSmallJsonT(CuTest *tc UNUSED) {
   8154 
   8155   void* r;
   8156   smallJsont *self = allocSmallJson();
   8157   smallJsont *r2;
   8158   baset *r3;
   8159 
   8160   // add an element to check that the second element is poped
   8161   // at the end
   8162   r2 = self->f->pushInt(self, 1);
   8163   ck_assert_ptr_ne(r2, null);
   8164   // add second element
   8165   createSmallContainer(e);
   8166   setValO(&e, &r);
   8167   r2 = self->f->pushSmallContainer(self, &e);
   8168   ck_assert_ptr_ne(r2, null);
   8169   // pop
   8170   r = self->f->popVoid(self);
   8171   ck_assert_ptr_eq(r, &r);
   8172   ck_assert_int_eq(lenO(self), 1);
   8173   char *s = toStringO(self);
   8174   ck_assert_str_eq(s, "[1]");
   8175   free(s);
   8176   // pop element of unexpected type
   8177   r = self->f->popVoid(self);
   8178   ck_assert(!r);
   8179   ck_assert_int_eq(lenO(self), 1);
   8180   s = toStringO(self);
   8181   ck_assert_str_eq(s, "[1]");
   8182   free(s);
   8183   // empty array
   8184   r3 = self->f->pop(self);
   8185   ck_assert_ptr_ne(r3, null);
   8186   terminateO(r3);
   8187   s = toStringO(self);
   8188   ck_assert_str_eq(s, "[]");
   8189   free(s);
   8190   r = self->f->popVoid(self);
   8191   ck_assert(!r);
   8192   s = toStringO(self);
   8193   ck_assert_str_eq(s, "[]");
   8194   free(s);
   8195   terminateO(self);
   8196 
   8197 }
   8198 
   8199 
   8200 void popSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   8201 
   8202   smallContainert* r;
   8203   smallJsont *self = allocSmallJson();
   8204   smallJsont *r2;
   8205   baset *r3;
   8206 
   8207   // add an element to check that the second element is poped
   8208   // at the end
   8209   r2 = self->f->pushInt(self, 1);
   8210   ck_assert_ptr_ne(r2, null);
   8211   // add second element
   8212   createSmallContainer(e);
   8213   r2 = self->f->pushSmallContainer(self, &e);
   8214   ck_assert_ptr_ne(r2, null);
   8215   // pop
   8216   r2 = self->f->pushUndefined(self);
   8217   ck_assert_ptr_ne(r2, null);
   8218   delElemIndexO(self,-1);
   8219   r = self->f->popSmallContainer(self);
   8220   ck_assert_ptr_ne(r, null);
   8221   char *s = toStringO(r);
   8222   terminateO(r);
   8223   ck_assert_str_eq(s, "<data smallContainer>");
   8224   free(s);
   8225   ck_assert_int_eq(lenO(self), 1);
   8226   s = toStringO(self);
   8227   ck_assert_str_eq(s, "[1]");
   8228   free(s);
   8229   // container with baset object
   8230   // push a base object of unknown type
   8231   smallIntt *o    = allocSmallInt(2);
   8232   o->type         = "newType";
   8233   r2 = self->f->pushNFree(self, (baset*)o);
   8234   ck_assert_ptr_ne(r2, null);
   8235   r = self->f->popSmallContainer(self);
   8236   ck_assert_ptr_eq(r, NULL);
   8237   ck_assert_int_eq(lenO(self), 2);
   8238   s = toStringO(self);
   8239   ck_assert_str_eq(s, "[1,\"<data container>\"]");
   8240   free(s);
   8241   r3 = self->f->pop(self);
   8242   ck_assert_ptr_ne(r3, null);
   8243   terminateO(r3);
   8244   // pop element of unexpected type
   8245   r = self->f->popSmallContainer(self);
   8246   ck_assert_ptr_eq(r, NULL);
   8247   ck_assert_int_eq(lenO(self), 1);
   8248   s = toStringO(self);
   8249   ck_assert_str_eq(s, "[1]");
   8250   free(s);
   8251   // empty array
   8252   r3 = self->f->pop(self);
   8253   ck_assert_ptr_ne(r3, null);
   8254   terminateO(r3);
   8255   s = toStringO(self);
   8256   ck_assert_str_eq(s, "[]");
   8257   free(s);
   8258   r = self->f->popSmallContainer(self);
   8259   ck_assert(!r);
   8260   s = toStringO(self);
   8261   ck_assert_str_eq(s, "[]");
   8262   free(s);
   8263   r2 = self->f->pushUndefined(self);
   8264   ck_assert_ptr_ne(r2, null);
   8265   delElemIndexO(self,-1);
   8266   r = self->f->popSmallContainer(self);
   8267   ck_assert_ptr_eq(r, null);
   8268   // non json array
   8269   freeO(self);
   8270   setTypeBoolO(self);
   8271   ck_assert_ptr_eq(self->f->popSmallContainer(self), NULL);
   8272   terminateO(self);
   8273 
   8274 }
   8275 
   8276 
   8277 void popNumSmallJsonT(CuTest *tc UNUSED) {
   8278 
   8279   double r;
   8280   smallJsont *self = allocSmallJson();
   8281   smallJsont *r2;
   8282   baset *r3;
   8283 
   8284   // add an element to check that the second element is poped
   8285   // at the end
   8286   r2 = self->f->pushBool(self, TRUE);
   8287   ck_assert_ptr_ne(r2, null);
   8288   // add second element
   8289   r2 = self->f->pushInt(self, 2);
   8290   ck_assert_ptr_ne(r2, null);
   8291   r2 = self->f->pushDouble(self, 2.5);
   8292   ck_assert_ptr_ne(r2, null);
   8293   // pop
   8294   r2 = self->f->pushUndefined(self);
   8295   ck_assert_ptr_ne(r2, null);
   8296   delElemIndexO(self,-1);
   8297   r = self->f->popNum(self);
   8298   ck_assert(r==2.5);
   8299   ck_assert_int_eq(lenO(self), 2);
   8300   char *s = toStringO(self);
   8301   ck_assert_str_eq(s, "[true,2]");
   8302   free(s);
   8303   r = self->f->popNum(self);
   8304   ck_assert_int_eq(r, 2);
   8305   ck_assert_int_eq(lenO(self), 1);
   8306   s = toStringO(self);
   8307   ck_assert_str_eq(s, "[true]");
   8308   free(s);
   8309   // pop element of unexpected type
   8310   r = self->f->popNum(self);
   8311   ck_assert(!r);
   8312   ck_assert_int_eq(lenO(self), 1);
   8313   s = toStringO(self);
   8314   ck_assert_str_eq(s, "[true]");
   8315   free(s);
   8316   // empty array
   8317   r3 = self->f->pop(self);
   8318   ck_assert_ptr_ne(r3, null);
   8319   terminateO(r3);
   8320   s = toStringO(self);
   8321   ck_assert_str_eq(s, "[]");
   8322   free(s);
   8323   r = self->f->popNum(self);
   8324   ck_assert(!r);
   8325   s = toStringO(self);
   8326   ck_assert_str_eq(s, "[]");
   8327   free(s);
   8328   r2 = self->f->pushUndefined(self);
   8329   ck_assert_ptr_ne(r2, null);
   8330   delElemIndexO(self,-1);
   8331   r = self->f->popNum(self);
   8332   ck_assert(!r);
   8333   // non json array
   8334   freeO(self);
   8335   setTypeBoolO(self);
   8336   ck_assert(!self->f->popNum(self));
   8337   terminateO(self);
   8338 
   8339 }
   8340 
   8341 
   8342 void prependSmallJsonT(CuTest *tc UNUSED) {
   8343 
   8344   smallJsont* r;
   8345   smallJsont *self = allocSmallJson();
   8346   baset *value = (baset*) allocG(2);
   8347 
   8348   // add an element to check that prepend adds the second element
   8349   // at the start
   8350   r = self->f->pushInt(self, 1);
   8351   ck_assert_ptr_ne(r, null);
   8352   r = self->f->prepend(self, value);
   8353   ck_assert_ptr_ne(r, null);
   8354   ck_assert_int_eq(lenO(r), 2);
   8355   finishO(value);
   8356   char *s = toStringO(r);
   8357   ck_assert_str_eq(s, "[2,1]");
   8358   free(s);
   8359   // null
   8360   r = self->f->prepend(self, null);
   8361   ck_assert_ptr_eq(r, null);
   8362   ck_assert_int_eq(lenO(self), 2);
   8363   s = toStringO(self);
   8364   ck_assert_str_eq(s, "[2,1]");
   8365   free(s);
   8366   // non json array
   8367   freeO(self);
   8368   setTypeBoolO(self);
   8369   value = (baset*) allocSmallInt(2);
   8370   ck_assert_ptr_eq(self->f->prepend(self, value), NULL);
   8371   terminateO(value);
   8372   terminateO(self);
   8373 
   8374 }
   8375 
   8376 
   8377 void prependUndefinedSmallJsonT(CuTest *tc UNUSED) {
   8378 
   8379   smallJsont* r;
   8380   smallJsont *self = allocSmallJson();
   8381 
   8382   // add an element to check that push adds the second element
   8383   // at the end
   8384   r = self->f->pushInt(self, 1);
   8385   ck_assert_ptr_ne(r, null);
   8386   r = self->f->prependUndefined(self);
   8387   ck_assert_ptr_ne(r, null);
   8388   ck_assert_int_eq(lenO(r), 2);
   8389   char *s = toStringO(r);
   8390   ck_assert_str_eq(s, "[null,1]");
   8391   free(s);
   8392   // non json array
   8393   freeO(self);
   8394   setTypeBoolO(self);
   8395   ck_assert_ptr_eq(self->f->prependUndefined(self), NULL);
   8396   terminateO(self);
   8397 
   8398 }
   8399 
   8400 
   8401 void prependBoolSmallJsonT(CuTest *tc UNUSED) {
   8402 
   8403   smallJsont* r;
   8404   smallJsont *self = allocSmallJson();
   8405 
   8406   // add an element to check that push adds the second element
   8407   // at the end
   8408   r = self->f->pushInt(self, 1);
   8409   ck_assert_ptr_ne(r, null);
   8410 
   8411   r = self->f->prependBool(self, TRUE);
   8412   ck_assert_ptr_ne(r, null);
   8413   ck_assert_int_eq(lenO(r), 2);
   8414   char *s = toStringO(r);
   8415   ck_assert_str_eq(s, "[true,1]");
   8416   free(s);
   8417   // non json array
   8418   freeO(self);
   8419   setTypeBoolO(self);
   8420   ck_assert_ptr_eq(self->f->prependBool(self, true), NULL);
   8421   terminateO(self);
   8422 
   8423 }
   8424 
   8425 
   8426 void prependDoubleSmallJsonT(CuTest *tc UNUSED) {
   8427 
   8428   smallJsont* r;
   8429   smallJsont *self = allocSmallJson();
   8430 
   8431   // add an element to check that push adds the second element
   8432   // at the end
   8433   r = self->f->pushInt(self, 1);
   8434   ck_assert_ptr_ne(r, null);
   8435   r = self->f->prependDouble(self, 1.0);
   8436   ck_assert_ptr_ne(r, null);
   8437   ck_assert_int_eq(lenO(r), 2);
   8438   char *s = toStringO(r);
   8439   ck_assert_str_eq(s, "[1.000000e+00,1]");
   8440   free(s);
   8441   // non json array
   8442   freeO(self);
   8443   setTypeBoolO(self);
   8444   ck_assert_ptr_eq(self->f->prependDouble(self, 0), NULL);
   8445   terminateO(self);
   8446 
   8447 }
   8448 
   8449 
   8450 void prependIntSmallJsonT(CuTest *tc UNUSED) {
   8451 
   8452   smallJsont* r;
   8453   smallJsont *self = allocSmallJson();
   8454 
   8455   // add an element to check that push adds the second element
   8456   // at the end
   8457   r = self->f->prependInt(self, 1);
   8458   ck_assert_ptr_ne(r, null);
   8459   r = self->f->prependInt(self, 1);
   8460   ck_assert_ptr_ne(r, null);
   8461   ck_assert_int_eq(lenO(r), 2);
   8462   char *s = toStringO(r);
   8463   ck_assert_str_eq(s, "[1,1]");
   8464   free(s);
   8465   // non json array
   8466   freeO(self);
   8467   setTypeBoolO(self);
   8468   ck_assert_ptr_eq(self->f->prependInt(self, 0), NULL);
   8469   terminateO(self);
   8470 
   8471 }
   8472 
   8473 
   8474 void prependSSmallJsonT(CuTest *tc UNUSED) {
   8475 
   8476   smallJsont* r;
   8477   smallJsont *self = allocSmallJson();
   8478 
   8479   // add an element to check that push adds the second element
   8480   // at the end
   8481   r = self->f->pushInt(self, 1);
   8482   ck_assert_ptr_ne(r, null);
   8483   r = self->f->prependS(self, null);
   8484   ck_assert_ptr_eq(r, null);
   8485   ck_assert_int_eq(lenO(self), 1);
   8486   char *s = toStringO(self);
   8487   ck_assert_str_eq(s, "[1]");
   8488   free(s);
   8489   char *str = "poi";
   8490   r = self->f->prependS(self, str);
   8491   ck_assert_ptr_ne(r, null);
   8492   ck_assert_int_eq(lenO(self), 2);
   8493   s = toStringO(r);
   8494   ck_assert_str_eq(s, "[\"poi\",1]");
   8495   free(s);
   8496   // non json array
   8497   freeO(self);
   8498   setTypeBoolO(self);
   8499   ck_assert_ptr_eq(self->f->prependS(self, ""), NULL);
   8500   terminateO(self);
   8501   // json string
   8502   self = allocSmallJson();
   8503   setTopSO(self, "qwe");
   8504   r = prependSO(self, "!@#");
   8505   ck_assert_ptr_ne(r, null);
   8506   s = toStringO(r);
   8507   ck_assert_str_eq(s, "!@#qwe");
   8508   free(s);
   8509   // empty string
   8510   r = prependSO(self, "");
   8511   ck_assert_ptr_ne(r, null);
   8512   s = toStringO(r);
   8513   ck_assert_str_eq(s, "!@#qwe");
   8514   free(s);
   8515   // empty self
   8516   freeO(self);
   8517   setTypeStringO(self);
   8518   r = prependSO(self, "asd");
   8519   ck_assert_ptr_ne(r, null);
   8520   s = toStringO(r);
   8521   ck_assert_str_eq(s, "asd");
   8522   free(s);
   8523   // null parameter
   8524   r = prependSO(self, null);
   8525   ck_assert_ptr_eq(r, null);
   8526   terminateO(self);
   8527 
   8528 }
   8529 
   8530 
   8531 void prependCharSmallJsonT(CuTest *tc UNUSED) {
   8532 
   8533   smallJsont* r;
   8534   smallJsont *self = allocSmallJson();
   8535 
   8536   // add an element to check that push adds the second element
   8537   // at the end
   8538   r = self->f->pushInt(self, 1);
   8539   ck_assert_ptr_ne(r, null);
   8540   r = self->f->prependChar(self, 'a');
   8541   ck_assert_ptr_ne(r, null);
   8542   ck_assert_int_eq(lenO(r), 2);
   8543   char *s = toStringO(r);
   8544   ck_assert_str_eq(s, "[\"a\",1]");
   8545   free(s);
   8546   // non json array
   8547   freeO(self);
   8548   setTypeBoolO(self);
   8549   ck_assert_ptr_eq(self->f->prependChar(self, 't'), NULL);
   8550   terminateO(self);
   8551 
   8552 }
   8553 
   8554 
   8555 void prependDictSmallJsonT(CuTest *tc UNUSED) {
   8556 
   8557   smallJsont* r;
   8558   smallJsont *self = allocSmallJson();
   8559   smallDictt *dict  = allocG(rtSmallDictt);
   8560 
   8561   // add an element to check that push adds the second element
   8562   // at the end
   8563   r = self->f->pushInt(self, 1);
   8564   ck_assert_ptr_ne(r, null);
   8565   // push dict
   8566   r = self->f->prependDict(self, dict);
   8567   ck_assert_ptr_ne(r, null);
   8568   ck_assert_int_eq(lenO(r), 2);
   8569   finishO(dict);
   8570   ck_assert_ptr_ne(r, null);
   8571   char *s = toStringO(r);
   8572   ck_assert_str_eq(s, "[{},1]");
   8573   free(s);
   8574   // non smallDict object
   8575   dict = (smallDictt*) allocSmallInt(2);
   8576   r = self->f->prependDict(self, dict);
   8577   ck_assert_ptr_eq(r, null);
   8578   terminateO(dict);
   8579   // null
   8580   r = self->f->prependDict(self, null);
   8581   ck_assert_ptr_eq(r, null);
   8582   ck_assert_int_eq(lenO(self), 2);
   8583   s = toStringO(self);
   8584   ck_assert_str_eq(s, "[{},1]");
   8585   free(s);
   8586   // non json array
   8587   freeO(self);
   8588   setTypeBoolO(self);
   8589   smallDictt *value = allocSmallDict();
   8590   ck_assert_ptr_eq(self->f->prependDict(self, value), NULL);
   8591   terminateO(value);
   8592   terminateO(self);
   8593 
   8594 }
   8595 
   8596 
   8597 void prependArraySmallJsonT(CuTest *tc UNUSED) {
   8598 
   8599   smallJsont* r;
   8600   smallJsont *self  = allocSmallJson();
   8601   smallArrayt *array = allocG(rtSmallArrayt);
   8602 
   8603   // add an element to check that push adds the second element
   8604   // at the end
   8605   r = self->f->pushInt(self, 1);
   8606   ck_assert_ptr_ne(r, null);
   8607   r = self->f->prependArray(self, array);
   8608   ck_assert_ptr_ne(r, null);
   8609   ck_assert_int_eq(lenO(r), 2);
   8610   finishO(array);
   8611   char *s = toStringO(r);
   8612   ck_assert_str_eq(s, "[[],1]");
   8613   free(s);
   8614   // non smallArray object
   8615   array = (smallArrayt*) allocSmallInt(2);
   8616   r = self->f->prependArray(self, array);
   8617   ck_assert_ptr_eq(r, null);
   8618   terminateO(array);
   8619   // null
   8620   r = self->f->prependArray(self, null);
   8621   ck_assert_ptr_eq(r, null);
   8622   ck_assert_int_eq(lenO(self), 2);
   8623   s = toStringO(self);
   8624   ck_assert_str_eq(s, "[[],1]");
   8625   free(s);
   8626   // non json array
   8627   freeO(self);
   8628   setTypeBoolO(self);
   8629   smallArrayt *value = allocSmallArray();
   8630   ck_assert_ptr_eq(self->f->prependArray(self, value), NULL);
   8631   terminateO(value);
   8632   terminateO(self);
   8633 
   8634 }
   8635 
   8636 
   8637 void prependArraycSmallJsonT(CuTest *tc UNUSED) {
   8638 
   8639   smallJsont* r;
   8640   smallJsont *self = allocSmallJson();
   8641   char **array     = listCreateS("a","bb");
   8642 
   8643   // add an element to check that push adds the second element
   8644   // at the end
   8645   r = self->f->pushInt(self, 1);
   8646   ck_assert_ptr_ne(r, null);
   8647   r = self->f->prependArrayc(self, array);
   8648   ck_assert_ptr_ne(r, null);
   8649   ck_assert_int_eq(lenO(r), 2);
   8650   listFreeS(array);
   8651   char *s = toStringO(r);
   8652   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   8653   free(s);
   8654   // null
   8655   r = self->f->prependArrayc(self, null);
   8656   ck_assert_ptr_eq(r, null);
   8657   ck_assert_int_eq(lenO(self), 2);
   8658   s = toStringO(self);
   8659   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   8660   free(s);
   8661   // non json array
   8662   freeO(self);
   8663   setTypeBoolO(self);
   8664   char **value = listCreateS("a","bb");
   8665   ck_assert_ptr_eq(self->f->prependArrayc(self, value), NULL);
   8666   listFreeS(value);
   8667   terminateO(self);
   8668 
   8669 }
   8670 
   8671 
   8672 void prependSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   8673 
   8674   smallJsont* r;
   8675   smallJsont *self = allocSmallJson();
   8676   smallBoolt *value = allocG(TRUE);
   8677 
   8678   // add an element to check that push adds the second element
   8679   // at the end
   8680   r = self->f->pushInt(self, 1);
   8681   ck_assert_ptr_ne(r, null);
   8682   r = self->f->prependSmallBool(self, value);
   8683   ck_assert_ptr_ne(r, null);
   8684   ck_assert_int_eq(lenO(r), 2);
   8685   finishO(value);
   8686   char *s = toStringO(r);
   8687   ck_assert_str_eq(s, "[true,1]");
   8688   free(s);
   8689   // bool object with no data
   8690   createAllocateSmallBool(b);
   8691   r = self->f->prependSmallBool(self, b);
   8692   ck_assert_ptr_ne(r, null);
   8693   ck_assert_int_eq(lenO(r), 3);
   8694   finishO(b);
   8695   s = toStringO(r);
   8696   ck_assert_str_eq(s, "[false,true,1]");
   8697   free(s);
   8698   // non smallBool object
   8699   value = (smallBoolt*) allocSmallInt(2);
   8700   r = self->f->prependSmallBool(self, value);
   8701   ck_assert_ptr_eq(r, null);
   8702   terminateO(value);
   8703   // null
   8704   r = self->f->prependSmallBool(self, null);
   8705   ck_assert_ptr_eq(r, null);
   8706   ck_assert_int_eq(lenO(self), 3);
   8707   s = toStringO(self);
   8708   ck_assert_str_eq(s, "[false,true,1]");
   8709   free(s);
   8710   // non json array
   8711   freeO(self);
   8712   setTypeBoolO(self);
   8713   value = allocSmallBool(true);
   8714   ck_assert_ptr_eq(self->f->prependSmallBool(self, value), NULL);
   8715   terminateO(value);
   8716   terminateO(self);
   8717 
   8718 }
   8719 
   8720 
   8721 void prependSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   8722 
   8723   smallJsont* r;
   8724   smallJsont *self = allocSmallJson();
   8725   createAllocateSmallBytes(value);
   8726 
   8727   // add an element to check that push adds the second element
   8728   // at the end
   8729   r = self->f->pushInt(self, 1);
   8730   ck_assert_ptr_ne(r, null);
   8731   // the smallBytes container is empty
   8732   r = self->f->prependSmallBytes(self, value);
   8733   ck_assert_ptr_ne(r, null);
   8734   ck_assert_int_eq(lenO(r), 2);
   8735   char *s = toStringO(r);
   8736   ck_assert_str_eq(s, "[[],1]");
   8737   free(s);
   8738   //  reuse value
   8739   value->B = null;
   8740   char *buffer = "poi";
   8741   pushBufferO(value, buffer, strlen(buffer));
   8742   r = self->f->prependSmallBytes(self, value);
   8743   finishO(value);
   8744   ck_assert_ptr_ne(r, null);
   8745   ck_assert_int_eq(lenO(r), 3);
   8746   s = toStringO(r);
   8747   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   8748   free(s);
   8749   // non smallBytes object
   8750   value = (smallBytest*) allocSmallInt(2);
   8751   r = self->f->prependSmallBytes(self, value);
   8752   ck_assert_ptr_eq(r, null);
   8753   terminateO(value);
   8754   // null
   8755   r = self->f->prependSmallBytes(self, null);
   8756   ck_assert_ptr_eq(r, null);
   8757   ck_assert_int_eq(lenO(self), 3);
   8758   s = toStringO(self);
   8759   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   8760   free(s);
   8761   // non json array
   8762   freeO(self);
   8763   setTypeBoolO(self);
   8764   value = allocSmallBytes("", sizeof(""));
   8765   ck_assert_ptr_eq(self->f->prependSmallBytes(self, value), NULL);
   8766   terminateO(value);
   8767   terminateO(self);
   8768 
   8769 }
   8770 
   8771 
   8772 void prependSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   8773 
   8774   smallJsont* r;
   8775   smallJsont *self   = allocSmallJson();
   8776   smallDoublet *value = allocG(1.0);
   8777 
   8778   // add an element to check that push adds the second element
   8779   // at the end
   8780   r = self->f->pushInt(self, 1);
   8781   ck_assert_ptr_ne(r, null);
   8782   r = self->f->prependSmallDouble(self, value);
   8783   ck_assert_ptr_ne(r, null);
   8784   ck_assert_int_eq(lenO(r), 2);
   8785   finishO(value);
   8786   char *s = toStringO(r);
   8787   ck_assert_str_eq(s, "[1.000000e+00,1]");
   8788   free(s);
   8789   // object with no data
   8790   createAllocateSmallDouble(b);
   8791   r = self->f->prependSmallDouble(self, b);
   8792   ck_assert_ptr_ne(r, null);
   8793   ck_assert_int_eq(lenO(r), 3);
   8794   finishO(b);
   8795   s = toStringO(r);
   8796   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   8797   free(s);
   8798   // non smallDouble object
   8799   value = (smallDoublet*) allocSmallInt(2);
   8800   r = self->f->prependSmallDouble(self, value);
   8801   ck_assert_ptr_eq(r, null);
   8802   terminateO(value);
   8803   // null
   8804   r = self->f->prependSmallDouble(self, null);
   8805   ck_assert_ptr_eq(r, null);
   8806   ck_assert_int_eq(lenO(self), 3);
   8807   s = toStringO(self);
   8808   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   8809   free(s);
   8810   // non json array
   8811   freeO(self);
   8812   setTypeBoolO(self);
   8813   value = allocSmallDouble(2);
   8814   ck_assert_ptr_eq(self->f->prependSmallDouble(self, value), NULL);
   8815   terminateO(value);
   8816   terminateO(self);
   8817 
   8818 }
   8819 
   8820 
   8821 void prependSmallIntSmallJsonT(CuTest *tc UNUSED) {
   8822 
   8823   smallJsont* r;
   8824   smallJsont *self = allocSmallJson();
   8825   smallIntt *value  = allocG(1);
   8826 
   8827   // add an element to check that push adds the second element
   8828   // at the end
   8829   r = self->f->pushInt(self, 1);
   8830   ck_assert_ptr_ne(r, null);
   8831   r = self->f->prependSmallInt(self, value);
   8832   ck_assert_ptr_ne(r, null);
   8833   ck_assert_int_eq(lenO(r), 2);
   8834   finishO(value);
   8835   char *s = toStringO(r);
   8836   ck_assert_str_eq(s, "[1,1]");
   8837   free(s);
   8838   // bool object with no data
   8839   createAllocateSmallInt(b);
   8840   r = self->f->prependSmallInt(self, b);
   8841   ck_assert_ptr_ne(r, null);
   8842   ck_assert_int_eq(lenO(r), 3);
   8843   finishO(b);
   8844   s = toStringO(r);
   8845   ck_assert_str_eq(s, "[0,1,1]");
   8846   free(s);
   8847   // non smallInt object
   8848   value = (smallIntt*) allocSmallBool(true);
   8849   r = self->f->prependSmallInt(self, value);
   8850   ck_assert_ptr_eq(r, null);
   8851   terminateO(value);
   8852   // null
   8853   r = self->f->prependSmallInt(self, null);
   8854   ck_assert_ptr_eq(r, null);
   8855   ck_assert_int_eq(lenO(self), 3);
   8856   s = toStringO(self);
   8857   ck_assert_str_eq(s, "[0,1,1]");
   8858   free(s);
   8859   // non json array
   8860   freeO(self);
   8861   setTypeBoolO(self);
   8862   value = allocSmallInt(2);
   8863   ck_assert_ptr_eq(self->f->prependSmallInt(self, value), NULL);
   8864   terminateO(value);
   8865   terminateO(self);
   8866 
   8867 }
   8868 
   8869 
   8870 void prependSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   8871 
   8872   smallJsont* r;
   8873   smallJsont *self = allocSmallJson();
   8874   smallJsont *value = allocG(rtSmallJsont);
   8875 
   8876   // add an element to check that push adds the second element
   8877   // at the end
   8878   r = self->f->pushInt(self, 1);
   8879   ck_assert_ptr_ne(r, null);
   8880   // the smallJson container is empty
   8881   r = self->f->prependSmallJson(self, value);
   8882   ck_assert_ptr_ne(r, null);
   8883   ck_assert_int_eq(lenO(r), 2);
   8884   char *s = toStringO(r);
   8885   ck_assert_str_eq(s, "[{},1]");
   8886   free(s);
   8887   resetO(value);
   8888   parseO(value, "{}");
   8889   r = self->f->prependSmallJson(self, value);
   8890   finishO(value);
   8891   ck_assert_ptr_ne(r, null);
   8892   ck_assert_int_eq(lenO(r), 3);
   8893   s = toStringO(r);
   8894   ck_assert_str_eq(s, "[{},{},1]");
   8895   free(s);
   8896   // non smallJson object
   8897   value = (smallJsont*) allocSmallInt(2);
   8898   r = self->f->prependSmallJson(self, value);
   8899   ck_assert_ptr_eq(r, null);
   8900   terminateO(value);
   8901   // null
   8902   r = self->f->prependSmallJson(self, null);
   8903   ck_assert_ptr_eq(r, null);
   8904   ck_assert_int_eq(lenO(self), 3);
   8905   s = toStringO(self);
   8906   ck_assert_str_eq(s, "[{},{},1]");
   8907   free(s);
   8908   // non json array
   8909   freeO(self);
   8910   setTypeBoolO(self);
   8911   value = allocSmallJson();
   8912   ck_assert_ptr_eq(self->f->prependSmallJson(self, value), NULL);
   8913   terminateO(value);
   8914   terminateO(self);
   8915 
   8916 }
   8917 
   8918 
   8919 void prependSmallStringSmallJsonT(CuTest *tc UNUSED) {
   8920 
   8921   smallJsont* r;
   8922   smallJsont *self    = allocSmallJson();
   8923   createAllocateSmallString(string);
   8924 
   8925   // add an element to check that push adds the second element
   8926   // at the end
   8927   r = self->f->pushInt(self, 1);
   8928   ck_assert_ptr_ne(r, null);
   8929   r = self->f->prependSmallString(self, string);
   8930   ck_assert_ptr_ne(r, null);
   8931   ck_assert_int_eq(lenO(r), 2);
   8932   finishO(string);
   8933   char *s = toStringO(r);
   8934   ck_assert_str_eq(s, "[\"\",1]");
   8935   free(s);
   8936   // non smallString object
   8937   string = (smallStringt*) allocSmallInt(2);
   8938   r = self->f->prependSmallString(self, string);
   8939   ck_assert_ptr_eq(r, null);
   8940   terminateO(string);
   8941   // null
   8942   r = self->f->prependSmallString(self, null);
   8943   ck_assert_ptr_eq(r, null);
   8944   ck_assert_int_eq(lenO(self), 2);
   8945   s = toStringO(self);
   8946   ck_assert_str_eq(s, "[\"\",1]");
   8947   free(s);
   8948   // non json array
   8949   freeO(self);
   8950   setTypeBoolO(self);
   8951   smallStringt *value = allocSmallString("");
   8952   ck_assert_ptr_eq(self->f->prependSmallString(self, value), NULL);
   8953   terminateO(value);
   8954   terminateO(self);
   8955   // json string
   8956   self   = allocSmallJson();
   8957   setTopSO(self, "qwe");
   8958   string = allocSmallString("!@#");
   8959   r = self->f->prependSmallString(self, string);
   8960   ck_assert_ptr_ne(r, null);
   8961   s = toStringO(r);
   8962   ck_assert_str_eq(s, "!@#qwe");
   8963   free(s);
   8964   // empty string
   8965   setValO(string, "");
   8966   r = self->f->prependSmallString(self, string);
   8967   ck_assert_ptr_ne(r, null);
   8968   s = toStringO(r);
   8969   ck_assert_str_eq(s, "!@#qwe");
   8970   free(s);
   8971   freeO(string);
   8972   r = self->f->prependSmallString(self, string);
   8973   ck_assert_ptr_ne(r, null);
   8974   s = toStringO(r);
   8975   ck_assert_str_eq(s, "!@#qwe");
   8976   free(s);
   8977   // empty self
   8978   freeO(self);
   8979   setTypeStringO(self);
   8980   setValO(string, "asd");
   8981   r = self->f->prependSmallString(self, string);
   8982   ck_assert_ptr_ne(r, null);
   8983   s = toStringO(r);
   8984   ck_assert_str_eq(s, "asd");
   8985   free(s);
   8986   terminateO(string);
   8987   // not smallString object
   8988   string = (smallStringt*) allocSmallInt(1);
   8989   r = self->f->prependSmallString(self, string);
   8990   ck_assert_ptr_eq(r, null);
   8991   terminateO(string);
   8992   // null parameter
   8993   r = self->f->prependSmallString(self, null);
   8994   ck_assert_ptr_eq(r, null);
   8995   terminateO(self);
   8996 
   8997 }
   8998 
   8999 
   9000 void prependSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   9001 
   9002   smallJsont* r;
   9003   smallJsont *self          = allocSmallJson();
   9004   createAllocateSmallContainer(container);
   9005 
   9006   // add an element to check that push adds the second element
   9007   // at the end
   9008   r = self->f->pushInt(self, 1);
   9009   ck_assert_ptr_ne(r, null);
   9010   r = self->f->prependSmallContainer(self, container);
   9011   ck_assert_ptr_ne(r, null);
   9012   ck_assert_int_eq(lenO(r), 2);
   9013   finishO(container);
   9014   char *s = toStringO(r);
   9015   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9016   free(s);
   9017   // non smallContainer object
   9018   container = (smallContainert*) allocSmallInt(2);
   9019   r = self->f->prependSmallContainer(self, container);
   9020   ck_assert_ptr_eq(r, null);
   9021   terminateO(container);
   9022   // null
   9023   r = self->f->prependSmallContainer(self, null);
   9024   ck_assert_ptr_eq(r, null);
   9025   ck_assert_int_eq(lenO(self), 2);
   9026   s = toStringO(self);
   9027   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9028   free(s);
   9029   // non json array
   9030   freeO(self);
   9031   setTypeBoolO(self);
   9032   smallContainert *value = allocSmallContainer(null);
   9033   ck_assert_ptr_eq(self->f->prependSmallContainer(self, value), NULL);
   9034   terminateO(value);
   9035   terminateO(self);
   9036 
   9037 }
   9038 
   9039 
   9040 void prependNFreeSmallJsonT(CuTest *tc UNUSED) {
   9041 
   9042   smallJsont* r;
   9043   smallJsont *self = allocSmallJson();
   9044   baset *value = (baset*) allocG(2);
   9045 
   9046   // add an element to check that prepend adds the second element
   9047   // at the start
   9048   r = self->f->pushInt(self, 1);
   9049   ck_assert_ptr_ne(r, null);
   9050 
   9051   r = self->f->prependNFree(self, value);
   9052   ck_assert_ptr_ne(r, null);
   9053   ck_assert_int_eq(lenO(r), 2);
   9054   char *s = toStringO(r);
   9055   ck_assert_str_eq(s, "[2,1]");
   9056   free(s);
   9057   // null
   9058   r = self->f->prependNFree(self, null);
   9059   ck_assert_ptr_eq(r, null);
   9060   ck_assert_int_eq(lenO(self), 2);
   9061   s = toStringO(self);
   9062   ck_assert_str_eq(s, "[2,1]");
   9063   free(s);
   9064   terminateO(self);
   9065 
   9066 }
   9067 
   9068 
   9069 void prependNFreeUndefinedSmallJsonT(CuTest *tc UNUSED) {
   9070 
   9071   smallJsont* r;
   9072   smallJsont *self = allocSmallJson();
   9073 
   9074   // add an element to check that push adds the second element
   9075   // at the end
   9076   r = self->f->pushInt(self, 1);
   9077   ck_assert_ptr_ne(r, null);
   9078 
   9079   createAllocateUndefined(value);
   9080   r = self->f->prependNFreeUndefined(self, value);
   9081   ck_assert_ptr_ne(r, null);
   9082   ck_assert_int_eq(lenO(r), 2);
   9083   char *s = toStringO(r);
   9084   ck_assert_str_eq(s, "[null,1]");
   9085   free(s);
   9086   terminateO(self);
   9087 
   9088 }
   9089 
   9090 
   9091 void prependNFreeSSmallJsonT(CuTest *tc UNUSED) {
   9092 
   9093   smallJsont* r;
   9094   smallJsont *self = allocSmallJson();
   9095 
   9096   // add an element to check that push adds the second element
   9097   // at the end
   9098   r = self->f->pushInt(self, 1);
   9099   ck_assert_ptr_ne(r, null);
   9100 
   9101   r = self->f->prependNFreeS(self, null);
   9102   ck_assert_ptr_eq(r, null);
   9103   ck_assert_int_eq(lenO(self), 1);
   9104   char *s = toStringO(self);
   9105   ck_assert_str_eq(s, "[1]");
   9106   free(s);
   9107 
   9108   char *str = strdup("poi");
   9109   r = self->f->prependNFreeS(self, str);
   9110   ck_assert_ptr_ne(r, null);
   9111   ck_assert_int_eq(lenO(self), 2);
   9112   s = toStringO(r);
   9113   ck_assert_str_eq(s, "[\"poi\",1]");
   9114   free(s);
   9115 
   9116   terminateO(self);
   9117 
   9118 }
   9119 
   9120 
   9121 void prependNFreeDictSmallJsonT(CuTest *tc UNUSED) {
   9122 
   9123   smallJsont* r;
   9124   smallJsont *self = allocSmallJson();
   9125   smallDictt *dict  = allocG(rtSmallDictt);
   9126 
   9127   // add an element to check that push adds the second element
   9128   // at the end
   9129   r = self->f->pushInt(self, 1);
   9130   ck_assert_ptr_ne(r, null);
   9131 
   9132   // push dict
   9133   r = self->f->prependNFreeDict(self, dict);
   9134   ck_assert_ptr_ne(r, null);
   9135   ck_assert_int_eq(lenO(r), 2);
   9136   ck_assert_ptr_ne(r, null);
   9137   char *s = toStringO(r);
   9138   ck_assert_str_eq(s, "[{},1]");
   9139   free(s);
   9140   // null
   9141   r = self->f->prependNFreeDict(self, null);
   9142   ck_assert_ptr_eq(r, null);
   9143   ck_assert_int_eq(lenO(self), 2);
   9144   s = toStringO(self);
   9145   ck_assert_str_eq(s, "[{},1]");
   9146   free(s);
   9147   terminateO(self);
   9148 
   9149 }
   9150 
   9151 
   9152 void prependNFreeArraySmallJsonT(CuTest *tc UNUSED) {
   9153 
   9154   smallJsont* r;
   9155   smallJsont *self  = allocSmallJson();
   9156   smallArrayt *array = allocG(rtSmallArrayt);
   9157 
   9158   // add an element to check that push adds the second element
   9159   // at the end
   9160   r = self->f->pushInt(self, 1);
   9161   ck_assert_ptr_ne(r, null);
   9162 
   9163   r = self->f->prependNFreeArray(self, array);
   9164   ck_assert_ptr_ne(r, null);
   9165   ck_assert_int_eq(lenO(r), 2);
   9166   char *s = toStringO(r);
   9167   ck_assert_str_eq(s, "[[],1]");
   9168   free(s);
   9169   // null
   9170   r = self->f->prependNFreeArray(self, null);
   9171   ck_assert_ptr_eq(r, null);
   9172   ck_assert_int_eq(lenO(self), 2);
   9173   s = toStringO(self);
   9174   ck_assert_str_eq(s, "[[],1]");
   9175   free(s);
   9176   terminateO(self);
   9177 
   9178 }
   9179 
   9180 
   9181 void prependNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
   9182 
   9183   smallJsont* r;
   9184   smallJsont *self = allocSmallJson();
   9185   char **array      = listCreateS("a","bb");
   9186 
   9187   // add an element to check that push adds the second element
   9188   // at the end
   9189   r = self->f->pushInt(self, 1);
   9190   ck_assert_ptr_ne(r, null);
   9191 
   9192   r = self->f->prependNFreeArrayc(self, array);
   9193   ck_assert_ptr_ne(r, null);
   9194   ck_assert_int_eq(lenO(r), 2);
   9195   char *s = toStringO(r);
   9196   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   9197   free(s);
   9198   // null
   9199   r = self->f->prependNFreeArrayc(self, null);
   9200   ck_assert_ptr_eq(r, null);
   9201   ck_assert_int_eq(lenO(self), 2);
   9202   s = toStringO(self);
   9203   ck_assert_str_eq(s, "[[\"a\",\"bb\"],1]");
   9204   free(s);
   9205   terminateO(self);
   9206 
   9207 }
   9208 
   9209 
   9210 void prependNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
   9211 
   9212   smallJsont* r;
   9213   smallJsont *self = allocSmallJson();
   9214   smallBoolt *value = allocG(TRUE);
   9215 
   9216   // add an element to check that push adds the second element
   9217   // at the end
   9218   r = self->f->pushInt(self, 1);
   9219   ck_assert_ptr_ne(r, null);
   9220 
   9221   r = self->f->prependNFreeSmallBool(self, value);
   9222   ck_assert_ptr_ne(r, null);
   9223   ck_assert_int_eq(lenO(r), 2);
   9224   char *s = toStringO(r);
   9225   ck_assert_str_eq(s, "[true,1]");
   9226   free(s);
   9227   // bool object with no data
   9228   createAllocateSmallBool(b);
   9229   r = self->f->prependNFreeSmallBool(self, b);
   9230   ck_assert_ptr_ne(r, null);
   9231   ck_assert_int_eq(lenO(r), 3);
   9232   s = toStringO(r);
   9233   ck_assert_str_eq(s, "[false,true,1]");
   9234   free(s);
   9235   // null
   9236   r = self->f->prependNFreeSmallBool(self, null);
   9237   ck_assert_ptr_eq(r, null);
   9238   ck_assert_int_eq(lenO(self), 3);
   9239   s = toStringO(self);
   9240   ck_assert_str_eq(s, "[false,true,1]");
   9241   free(s);
   9242   terminateO(self);
   9243 
   9244 }
   9245 
   9246 
   9247 void prependNFreeSmallBytesSmallJsonT(CuTest *tc UNUSED) {
   9248 
   9249   smallJsont* r;
   9250   smallJsont *self = allocSmallJson();
   9251   createAllocateSmallBytes(value);
   9252 
   9253   // add an element to check that push adds the second element
   9254   // at the end
   9255   r = self->f->pushInt(self, 1);
   9256   ck_assert_ptr_ne(r, null);
   9257 
   9258   // the smallBytes container is empty
   9259   r = self->f->prependNFreeSmallBytes(self, value);
   9260   ck_assert_ptr_ne(r, null);
   9261   ck_assert_int_eq(lenO(r), 2);
   9262   char *s = toStringO(r);
   9263   ck_assert_str_eq(s, "[[],1]");
   9264   free(s);
   9265 
   9266   char *buffer = "poi";
   9267   value        = allocSmallBytes(buffer, strlen(buffer));
   9268   r = self->f->prependNFreeSmallBytes(self, value);
   9269   ck_assert_ptr_ne(r, null);
   9270   ck_assert_int_eq(lenO(r), 3);
   9271   s = toStringO(r);
   9272   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   9273   free(s);
   9274   // null
   9275   r = self->f->prependNFreeSmallBytes(self, null);
   9276   ck_assert_ptr_eq(r, null);
   9277   ck_assert_int_eq(lenO(self), 3);
   9278   s = toStringO(self);
   9279   ck_assert_str_eq(s, "[[0x70,0x6f,0x69],[],1]");
   9280   free(s);
   9281   terminateO(self);
   9282 
   9283 }
   9284 
   9285 
   9286 void prependNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
   9287 
   9288   smallJsont* r;
   9289   smallJsont *self   = allocSmallJson();
   9290   smallDoublet *value = allocG(1.0);
   9291 
   9292   // add an element to check that push adds the second element
   9293   // at the end
   9294   r = self->f->pushInt(self, 1);
   9295   ck_assert_ptr_ne(r, null);
   9296 
   9297   r = self->f->prependNFreeSmallDouble(self, value);
   9298   ck_assert_ptr_ne(r, null);
   9299   ck_assert_int_eq(lenO(r), 2);
   9300   char *s = toStringO(r);
   9301   ck_assert_str_eq(s, "[1.000000e+00,1]");
   9302   free(s);
   9303   // object with no data
   9304   createAllocateSmallDouble(b);
   9305   r = self->f->prependNFreeSmallDouble(self, b);
   9306   ck_assert_ptr_ne(r, null);
   9307   ck_assert_int_eq(lenO(r), 3);
   9308   s = toStringO(r);
   9309   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   9310   free(s);
   9311   // null
   9312   r = self->f->prependNFreeSmallDouble(self, null);
   9313   ck_assert_ptr_eq(r, null);
   9314   ck_assert_int_eq(lenO(self), 3);
   9315   s = toStringO(self);
   9316   ck_assert_str_eq(s, "[0.000000e+00,1.000000e+00,1]");
   9317   free(s);
   9318   terminateO(self);
   9319 
   9320 }
   9321 
   9322 
   9323 void prependNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
   9324 
   9325   smallJsont* r;
   9326   smallJsont *self = allocSmallJson();
   9327   smallIntt *value  = allocG(1);
   9328 
   9329   // add an element to check that push adds the second element
   9330   // at the end
   9331   r = self->f->pushInt(self, 1);
   9332   ck_assert_ptr_ne(r, null);
   9333 
   9334   r = self->f->prependNFreeSmallInt(self, value);
   9335   ck_assert_ptr_ne(r, null);
   9336   ck_assert_int_eq(lenO(r), 2);
   9337   char *s = toStringO(r);
   9338   ck_assert_str_eq(s, "[1,1]");
   9339   free(s);
   9340   // bool object with no data
   9341   createAllocateSmallInt(b);
   9342   r = self->f->prependNFreeSmallInt(self, b);
   9343   ck_assert_ptr_ne(r, null);
   9344   ck_assert_int_eq(lenO(r), 3);
   9345   s = toStringO(r);
   9346   ck_assert_str_eq(s, "[0,1,1]");
   9347   free(s);
   9348   // null
   9349   r = self->f->prependNFreeSmallInt(self, null);
   9350   ck_assert_ptr_eq(r, null);
   9351   ck_assert_int_eq(lenO(self), 3);
   9352   s = toStringO(self);
   9353   ck_assert_str_eq(s, "[0,1,1]");
   9354   free(s);
   9355   terminateO(self);
   9356 
   9357 }
   9358 
   9359 
   9360 void prependNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
   9361 
   9362   smallJsont* r;
   9363   smallJsont *self = allocSmallJson();
   9364   smallJsont *value = allocG(rtSmallJsont);
   9365 
   9366   // add an element to check that push adds the second element
   9367   // at the end
   9368   r = self->f->pushInt(self, 1);
   9369   ck_assert_ptr_ne(r, null);
   9370 
   9371   // the smallJson container is empty
   9372   r = self->f->prependNFreeSmallJson(self, value);
   9373   ck_assert_ptr_ne(r, null);
   9374   ck_assert_int_eq(lenO(r), 2);
   9375   char *s = toStringO(r);
   9376   ck_assert_str_eq(s, "[{},1]");
   9377   free(s);
   9378 
   9379   value = allocG(rtSmallJsont);
   9380   parseO(value, "{}");
   9381   r = self->f->prependNFreeSmallJson(self, value);
   9382   ck_assert_ptr_ne(r, null);
   9383   ck_assert_int_eq(lenO(r), 3);
   9384   s = toStringO(r);
   9385   ck_assert_str_eq(s, "[{},{},1]");
   9386   free(s);
   9387   // null
   9388   r = self->f->prependNFreeSmallJson(self, null);
   9389   ck_assert_ptr_eq(r, null);
   9390   ck_assert_int_eq(lenO(self), 3);
   9391   s = toStringO(self);
   9392   ck_assert_str_eq(s, "[{},{},1]");
   9393   free(s);
   9394   terminateO(self);
   9395 
   9396 }
   9397 
   9398 
   9399 void prependNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
   9400 
   9401   smallJsont* r;
   9402   smallJsont *self    = allocSmallJson();
   9403   createAllocateSmallString(string);
   9404 
   9405   // add an element to check that push adds the second element
   9406   // at the end
   9407   r = self->f->pushInt(self, 1);
   9408   ck_assert_ptr_ne(r, null);
   9409 
   9410   r = self->f->prependNFreeSmallString(self, string);
   9411   ck_assert_ptr_ne(r, null);
   9412   ck_assert_int_eq(lenO(r), 2);
   9413   char *s = toStringO(r);
   9414   ck_assert_str_eq(s, "[\"\",1]");
   9415   free(s);
   9416   // null
   9417   r = self->f->prependNFreeSmallString(self, null);
   9418   ck_assert_ptr_eq(r, null);
   9419   ck_assert_int_eq(lenO(self), 2);
   9420   s = toStringO(self);
   9421   ck_assert_str_eq(s, "[\"\",1]");
   9422   free(s);
   9423   terminateO(self);
   9424 
   9425 }
   9426 
   9427 
   9428 void prependNFreeSmallContainerSmallJsonT(CuTest *tc UNUSED) {
   9429 
   9430   smallJsont* r;
   9431   smallJsont *self          = allocSmallJson();
   9432   createAllocateSmallContainer(container);
   9433 
   9434   // add an element to check that push adds the second element
   9435   // at the end
   9436   r = self->f->pushInt(self, 1);
   9437   ck_assert_ptr_ne(r, null);
   9438 
   9439   r = self->f->prependNFreeSmallContainer(self, container);
   9440   ck_assert_ptr_ne(r, null);
   9441   ck_assert_int_eq(lenO(r), 2);
   9442   char *s = toStringO(r);
   9443   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9444   free(s);
   9445   // null
   9446   r = self->f->prependNFreeSmallContainer(self, null);
   9447   ck_assert_ptr_eq(r, null);
   9448   ck_assert_int_eq(lenO(self), 2);
   9449   s = toStringO(self);
   9450   ck_assert_str_eq(s, "[\"<data container>\",1]");
   9451   free(s);
   9452   terminateO(self);
   9453 
   9454 }
   9455 
   9456 
   9457 void dequeueSmallJsonT(CuTest *tc UNUSED) {
   9458 
   9459   baset* r;
   9460   smallJsont *self = allocSmallJson();
   9461   smallJsont *r2;
   9462 
   9463   // add an element to check that the second element is dequeueed
   9464   // at the end
   9465   r2 = self->f->prependInt(self, 1);
   9466   ck_assert_ptr_ne(r2, null);
   9467   // prepend a base object of unknown type
   9468   smallIntt *o    = allocSmallInt(2);
   9469   o->type         = "newType";
   9470   r2 = self->f->prependNFree(self, (baset*)o);
   9471   ck_assert_ptr_ne(r2, null);
   9472   r2 = self->f->prependUndefined(self);
   9473   ck_assert_ptr_ne(r2, null);
   9474   r = self->f->dequeue(self);
   9475   ck_assert_ptr_ne(r, null);
   9476   ck_assert(isOUndefined(r));
   9477   terminateO(r);
   9478   r = self->f->dequeue(self);
   9479   ck_assert_ptr_ne(r, null);
   9480   ck_assert_str_eq(r->type, "newType");
   9481   char *s = toStringO(r);
   9482   terminateO(r);
   9483   ck_assert_str_eq(s, "2");
   9484   free(s);
   9485   ck_assert_int_eq(lenO(self), 1);
   9486   s = toStringO(self);
   9487   ck_assert_str_eq(s, "[1]");
   9488   free(s);
   9489   // empty array
   9490   r = self->f->dequeue(self);
   9491   ck_assert_ptr_ne(r, null);
   9492   terminateO(r);
   9493   s = toStringO(self);
   9494   ck_assert_str_eq(s, "[]");
   9495   free(s);
   9496   r = self->f->dequeue(self);
   9497   ck_assert_ptr_eq(r, null);
   9498   s = toStringO(self);
   9499   ck_assert_str_eq(s, "[]");
   9500   free(s);
   9501   r2 = self->f->pushUndefined(self);
   9502   ck_assert_ptr_ne(r2, null);
   9503   delElemIndexO(self,-1);
   9504   r = self->f->dequeue(self);
   9505   ck_assert_ptr_eq(r, null);
   9506   // non json array
   9507   freeO(self);
   9508   setTypeBoolO(self);
   9509   ck_assert_ptr_eq(self->f->dequeue(self), NULL);
   9510   terminateO(self);
   9511 
   9512 }
   9513 
   9514 
   9515 void dequeueUndefinedSmallJsonT(CuTest *tc UNUSED) {
   9516 
   9517   undefinedt* r;
   9518   smallJsont *self = allocSmallJson();
   9519   smallJsont *r2;
   9520   baset *r3;
   9521 
   9522   // add an element to check that the second element is poped
   9523   // at the end
   9524   r2 = self->f->pushInt(self, 1);
   9525   ck_assert_ptr_ne(r2, null);
   9526   // add second element
   9527   r2 = self->f->prependUndefined(self);
   9528   ck_assert_ptr_ne(r2, null);
   9529   // pop
   9530   r = self->f->dequeueUndefined(self);
   9531   ck_assert_ptr_ne(r, null);
   9532   char *s = toStringO(r);
   9533   terminateO(r);
   9534   ck_assert_str_eq(s, "null");
   9535   free(s);
   9536   ck_assert_int_eq(lenO(self), 1);
   9537   s = toStringO(self);
   9538   ck_assert_str_eq(s, "[1]");
   9539   free(s);
   9540   // pop element of unexpected type
   9541   r = self->f->dequeueUndefined(self);
   9542   ck_assert_ptr_eq(r, null);
   9543   ck_assert_int_eq(lenO(self), 1);
   9544   s = toStringO(self);
   9545   ck_assert_str_eq(s, "[1]");
   9546   free(s);
   9547   // empty array
   9548   r3 = self->f->pop(self);
   9549   ck_assert_ptr_ne(r3, null);
   9550   terminateO(r3);
   9551   s = toStringO(self);
   9552   ck_assert_str_eq(s, "[]");
   9553   free(s);
   9554   r = self->f->dequeueUndefined(self);
   9555   ck_assert_ptr_eq(r, null);
   9556   s = toStringO(self);
   9557   ck_assert_str_eq(s, "[]");
   9558   free(s);
   9559   r2 = self->f->pushUndefined(self);
   9560   ck_assert_ptr_ne(r2, null);
   9561   delElemIndexO(self,-1);
   9562   r = self->f->dequeueUndefined(self);
   9563   ck_assert_ptr_eq(r, null);
   9564   // non json array
   9565   freeO(self);
   9566   setTypeBoolO(self);
   9567   ck_assert_ptr_eq(self->f->dequeueUndefined(self), NULL);
   9568   terminateO(self);
   9569 
   9570 }
   9571 
   9572 
   9573 void dequeueBoolSmallJsonT(CuTest *tc UNUSED) {
   9574 
   9575   bool r;
   9576   smallJsont *self = allocSmallJson();
   9577   smallJsont *r2;
   9578   baset *r3;
   9579 
   9580   // add an element to check that the second element is poped
   9581   // at the end
   9582   r2 = self->f->pushInt(self, 1);
   9583   ck_assert_ptr_ne(r2, null);
   9584 
   9585   // add second element
   9586   r2 = self->f->prependBool(self, TRUE);
   9587   ck_assert_ptr_ne(r2, null);
   9588 
   9589   // pop
   9590   r = self->f->dequeueBool(self);
   9591   ck_assert(r);
   9592   ck_assert_int_eq(lenO(self), 1);
   9593   char *s = toStringO(self);
   9594   ck_assert_str_eq(s, "[1]");
   9595   free(s);
   9596 
   9597   // pop element of unexpected type
   9598   r = self->f->dequeueBool(self);
   9599   ck_assert(!r);
   9600   ck_assert_int_eq(lenO(self), 1);
   9601   s = toStringO(self);
   9602   ck_assert_str_eq(s, "[1]");
   9603   free(s);
   9604 
   9605   // empty array
   9606   r3 = self->f->pop(self);
   9607   ck_assert_ptr_ne(r3, null);
   9608   terminateO(r3);
   9609   s = toStringO(self);
   9610   ck_assert_str_eq(s, "[]");
   9611   free(s);
   9612   r = self->f->dequeueBool(self);
   9613   ck_assert(!r);
   9614   s = toStringO(self);
   9615   ck_assert_str_eq(s, "[]");
   9616   free(s);
   9617   terminateO(self);
   9618 
   9619 }
   9620 
   9621 
   9622 void dequeueDoubleSmallJsonT(CuTest *tc UNUSED) {
   9623 
   9624   double r;
   9625   smallJsont *self = allocSmallJson();
   9626   smallJsont *r2;
   9627   baset *r3;
   9628 
   9629   // add an element to check that the second element is poped
   9630   // at the end
   9631   r2 = self->f->pushInt(self, 1);
   9632   ck_assert_ptr_ne(r2, null);
   9633 
   9634   // add second element
   9635   r2 = self->f->prependDouble(self, 2.0);
   9636   ck_assert_ptr_ne(r2, null);
   9637 
   9638   // pop
   9639   r = self->f->dequeueDouble(self);
   9640   ck_assert(r==2.0);
   9641   ck_assert_int_eq(lenO(self), 1);
   9642   char *s = toStringO(self);
   9643   ck_assert_str_eq(s, "[1]");
   9644   free(s);
   9645 
   9646   // pop element of unexpected type
   9647   r = self->f->dequeueDouble(self);
   9648   ck_assert(!r);
   9649   ck_assert_int_eq(lenO(self), 1);
   9650   s = toStringO(self);
   9651   ck_assert_str_eq(s, "[1]");
   9652   free(s);
   9653 
   9654   // empty array
   9655   r3 = self->f->pop(self);
   9656   ck_assert_ptr_ne(r3, null);
   9657   terminateO(r3);
   9658   s = toStringO(self);
   9659   ck_assert_str_eq(s, "[]");
   9660   free(s);
   9661   r = self->f->dequeueDouble(self);
   9662   ck_assert(!r);
   9663   s = toStringO(self);
   9664   ck_assert_str_eq(s, "[]");
   9665   free(s);
   9666   terminateO(self);
   9667 
   9668 }
   9669 
   9670 
   9671 void dequeueIntSmallJsonT(CuTest *tc UNUSED) {
   9672 
   9673   int64_t r;
   9674   smallJsont *self = allocSmallJson();
   9675   smallJsont *r2;
   9676   baset *r3;
   9677 
   9678   // add an element to check that the second element is poped
   9679   // at the end
   9680   r2 = self->f->pushBool(self, FALSE);
   9681   ck_assert_ptr_ne(r2, null);
   9682 
   9683   // add second element
   9684   r2 = self->f->prependInt(self, 2);
   9685   ck_assert_ptr_ne(r2, null);
   9686 
   9687   // pop
   9688   r = self->f->dequeueInt(self);
   9689   ck_assert_int_eq(r, 2);
   9690   ck_assert_int_eq(lenO(self), 1);
   9691   char *s = toStringO(self);
   9692   ck_assert_str_eq(s, "[false]");
   9693   free(s);
   9694 
   9695   // pop element of unexpected type
   9696   r = self->f->dequeueInt(self);
   9697   ck_assert(!r);
   9698   ck_assert_int_eq(lenO(self), 1);
   9699   s = toStringO(self);
   9700   ck_assert_str_eq(s, "[false]");
   9701   free(s);
   9702 
   9703   // empty array
   9704   r3 = self->f->pop(self);
   9705   ck_assert_ptr_ne(r3, null);
   9706   terminateO(r3);
   9707   s = toStringO(self);
   9708   ck_assert_str_eq(s, "[]");
   9709   free(s);
   9710   r = self->f->dequeueInt(self);
   9711   ck_assert(!r);
   9712   s = toStringO(self);
   9713   ck_assert_str_eq(s, "[]");
   9714   free(s);
   9715   terminateO(self);
   9716 
   9717 }
   9718 
   9719 
   9720 void dequeueInt32SmallJsonT(CuTest *tc UNUSED) {
   9721 
   9722   int32_t r;
   9723   smallJsont *self = allocSmallJson();
   9724   smallJsont *r2;
   9725   baset *r3;
   9726 
   9727   // add an element to check that the second element is poped
   9728   // at the end
   9729   r2 = self->f->pushBool(self, FALSE);
   9730   ck_assert_ptr_ne(r2, null);
   9731 
   9732   // add second element
   9733   r2 = self->f->prependInt(self, 2);
   9734   ck_assert_ptr_ne(r2, null);
   9735 
   9736   // pop
   9737   r = self->f->dequeueInt32(self);
   9738   ck_assert_int_eq(r, 2);
   9739   ck_assert_int_eq(lenO(self), 1);
   9740   char *s = toStringO(self);
   9741   ck_assert_str_eq(s, "[false]");
   9742   free(s);
   9743 
   9744   // pop element of unexpected type
   9745   r = self->f->dequeueInt32(self);
   9746   ck_assert(!r);
   9747   ck_assert_int_eq(lenO(self), 1);
   9748   s = toStringO(self);
   9749   ck_assert_str_eq(s, "[false]");
   9750   free(s);
   9751 
   9752   // empty array
   9753   r3 = self->f->pop(self);
   9754   ck_assert_ptr_ne(r3, null);
   9755   terminateO(r3);
   9756   s = toStringO(self);
   9757   ck_assert_str_eq(s, "[]");
   9758   free(s);
   9759   r = self->f->dequeueInt32(self);
   9760   ck_assert(!r);
   9761   s = toStringO(self);
   9762   ck_assert_str_eq(s, "[]");
   9763   free(s);
   9764   terminateO(self);
   9765 
   9766 }
   9767 
   9768 
   9769 void dequeueUintSmallJsonT(CuTest *tc UNUSED) {
   9770 
   9771   uint64_t r;
   9772   smallJsont *self = allocSmallJson();
   9773   smallJsont *r2;
   9774   baset *r3;
   9775 
   9776   // add an element to check that the second element is poped
   9777   // at the end
   9778   r2 = self->f->pushBool(self, FALSE);
   9779   ck_assert_ptr_ne(r2, null);
   9780 
   9781   // add second element
   9782   r2 = self->f->prependInt(self, 2);
   9783   ck_assert_ptr_ne(r2, null);
   9784 
   9785   // pop
   9786   r = self->f->dequeueUint(self);
   9787   ck_assert_int_eq(r, 2);
   9788   ck_assert_int_eq(lenO(self), 1);
   9789   char *s = toStringO(self);
   9790   ck_assert_str_eq(s, "[false]");
   9791   free(s);
   9792 
   9793   // pop element of unexpected type
   9794   r = self->f->dequeueUint(self);
   9795   ck_assert(!r);
   9796   ck_assert_int_eq(lenO(self), 1);
   9797   s = toStringO(self);
   9798   ck_assert_str_eq(s, "[false]");
   9799   free(s);
   9800 
   9801   // empty array
   9802   r3 = self->f->pop(self);
   9803   ck_assert_ptr_ne(r3, null);
   9804   terminateO(r3);
   9805   s = toStringO(self);
   9806   ck_assert_str_eq(s, "[]");
   9807   free(s);
   9808   r = self->f->dequeueUint(self);
   9809   ck_assert(!r);
   9810   s = toStringO(self);
   9811   ck_assert_str_eq(s, "[]");
   9812   free(s);
   9813   terminateO(self);
   9814 
   9815 }
   9816 
   9817 
   9818 void dequeueUint32SmallJsonT(CuTest *tc UNUSED) {
   9819 
   9820   uint32_t r;
   9821   smallJsont *self = allocSmallJson();
   9822   smallJsont *r2;
   9823   baset *r3;
   9824 
   9825   // add an element to check that the second element is poped
   9826   // at the end
   9827   r2 = self->f->pushBool(self, FALSE);
   9828   ck_assert_ptr_ne(r2, null);
   9829 
   9830   // add second element
   9831   r2 = self->f->prependInt(self, 2);
   9832   ck_assert_ptr_ne(r2, null);
   9833 
   9834   // pop
   9835   r = self->f->dequeueUint32(self);
   9836   ck_assert_int_eq(r, 2);
   9837   ck_assert_int_eq(lenO(self), 1);
   9838   char *s = toStringO(self);
   9839   ck_assert_str_eq(s, "[false]");
   9840   free(s);
   9841 
   9842   // pop element of unexpected type
   9843   r = self->f->dequeueUint32(self);
   9844   ck_assert(!r);
   9845   ck_assert_int_eq(lenO(self), 1);
   9846   s = toStringO(self);
   9847   ck_assert_str_eq(s, "[false]");
   9848   free(s);
   9849 
   9850   // empty array
   9851   r3 = self->f->pop(self);
   9852   ck_assert_ptr_ne(r3, null);
   9853   terminateO(r3);
   9854   s = toStringO(self);
   9855   ck_assert_str_eq(s, "[]");
   9856   free(s);
   9857   r = self->f->dequeueUint32(self);
   9858   ck_assert(!r);
   9859   s = toStringO(self);
   9860   ck_assert_str_eq(s, "[]");
   9861   free(s);
   9862   terminateO(self);
   9863 
   9864 }
   9865 
   9866 
   9867 void dequeueSSmallJsonT(CuTest *tc UNUSED) {
   9868 
   9869   char* r;
   9870   smallJsont *self = allocSmallJson();
   9871   smallJsont *r2;
   9872   baset *r3;
   9873 
   9874   // add an element to check that the second element is poped
   9875   // at the end
   9876   r2 = self->f->pushInt(self, 1);
   9877   ck_assert_ptr_ne(r2, null);
   9878 
   9879   // add second element
   9880   r2 = self->f->prependS(self, "bb");
   9881   ck_assert_ptr_ne(r2, null);
   9882 
   9883   // pop
   9884   r = self->f->dequeueS(self);
   9885   ck_assert_str_eq(r, "bb");
   9886   free(r);
   9887   ck_assert_int_eq(lenO(self), 1);
   9888   char *s = toStringO(self);
   9889   ck_assert_str_eq(s, "[1]");
   9890   free(s);
   9891 
   9892   // pop element of unexpected type
   9893   r = self->f->dequeueS(self);
   9894   ck_assert(!r);
   9895   ck_assert_int_eq(lenO(self), 1);
   9896   s = toStringO(self);
   9897   ck_assert_str_eq(s, "[1]");
   9898   free(s);
   9899 
   9900   // empty array
   9901   r3 = self->f->pop(self);
   9902   ck_assert_ptr_ne(r3, null);
   9903   terminateO(r3);
   9904   s = toStringO(self);
   9905   ck_assert_str_eq(s, "[]");
   9906   free(s);
   9907   r = self->f->dequeueS(self);
   9908   ck_assert(!r);
   9909   s = toStringO(self);
   9910   ck_assert_str_eq(s, "[]");
   9911   free(s);
   9912   terminateO(self);
   9913 
   9914 }
   9915 
   9916 
   9917 void dequeueDictSmallJsonT(CuTest *tc UNUSED) {
   9918 
   9919   smallDictt* r;
   9920   smallJsont *self = allocSmallJson();
   9921   smallJsont *r2;
   9922   baset *r3;
   9923 
   9924   // add an element to check that the second element is poped
   9925   // at the end
   9926   r2 = self->f->pushInt(self, 1);
   9927   ck_assert_ptr_ne(r2, null);
   9928   // add second element
   9929   createSmallDict(e);
   9930   r2 = self->f->prependDict(self, &e);
   9931   ck_assert_ptr_ne(r2, null);
   9932   // pop
   9933   r = self->f->dequeueDict(self);
   9934   ck_assert_ptr_ne(r, null);
   9935   char *s = toStringO(r);
   9936   terminateO(r);
   9937   ck_assert_str_eq(s, "{}");
   9938   free(s);
   9939   ck_assert_int_eq(lenO(self), 1);
   9940   s = toStringO(self);
   9941   ck_assert_str_eq(s, "[1]");
   9942   free(s);
   9943   // pop element of unexpected type
   9944   r = self->f->dequeueDict(self);
   9945   ck_assert(!r);
   9946   ck_assert_int_eq(lenO(self), 1);
   9947   s = toStringO(self);
   9948   ck_assert_str_eq(s, "[1]");
   9949   free(s);
   9950   // empty array
   9951   r3 = self->f->pop(self);
   9952   ck_assert_ptr_ne(r3, null);
   9953   terminateO(r3);
   9954   s = toStringO(self);
   9955   ck_assert_str_eq(s, "[]");
   9956   free(s);
   9957   r = self->f->dequeueDict(self);
   9958   ck_assert(!r);
   9959   s = toStringO(self);
   9960   ck_assert_str_eq(s, "[]");
   9961   free(s);
   9962   r2 = self->f->pushUndefined(self);
   9963   ck_assert_ptr_ne(r2, null);
   9964   delElemIndexO(self,-1);
   9965   r = self->f->dequeueDict(self);
   9966   ck_assert_ptr_eq(r, null);
   9967   // non json array
   9968   freeO(self);
   9969   setTypeBoolO(self);
   9970   ck_assert_ptr_eq(self->f->dequeueDict(self), NULL);
   9971   terminateO(self);
   9972 
   9973 }
   9974 
   9975 
   9976 void dequeueArraySmallJsonT(CuTest *tc UNUSED) {
   9977 
   9978   smallArrayt* r;
   9979   smallJsont *self = allocSmallJson();
   9980   smallJsont *r2;
   9981   baset *r3;
   9982 
   9983   // add an element to check that the second element is poped
   9984   // at the end
   9985   r2 = self->f->pushInt(self, 1);
   9986   ck_assert_ptr_ne(r2, null);
   9987   // add second element
   9988   createSmallArray(e);
   9989   r2 = self->f->prependArray(self, &e);
   9990   ck_assert_ptr_ne(r2, null);
   9991   // pop
   9992   r = self->f->dequeueArray(self);
   9993   ck_assert_ptr_ne(r, null);
   9994   char *s = toStringO(r);
   9995   terminateO(r);
   9996   ck_assert_str_eq(s, "[]");
   9997   free(s);
   9998   ck_assert_int_eq(lenO(self), 1);
   9999   s = toStringO(self);
  10000   ck_assert_str_eq(s, "[1]");
  10001   free(s);
  10002   // pop element of unexpected type
  10003   r = self->f->dequeueArray(self);
  10004   ck_assert(!r);
  10005   ck_assert_int_eq(lenO(self), 1);
  10006   s = toStringO(self);
  10007   ck_assert_str_eq(s, "[1]");
  10008   free(s);
  10009   // empty array
  10010   r3 = self->f->pop(self);
  10011   ck_assert_ptr_ne(r3, null);
  10012   terminateO(r3);
  10013   s = toStringO(self);
  10014   ck_assert_str_eq(s, "[]");
  10015   free(s);
  10016   r = self->f->dequeueArray(self);
  10017   ck_assert(!r);
  10018   s = toStringO(self);
  10019   ck_assert_str_eq(s, "[]");
  10020   free(s);
  10021   r2 = self->f->pushUndefined(self);
  10022   ck_assert_ptr_ne(r2, null);
  10023   delElemIndexO(self,-1);
  10024   r = self->f->dequeueArray(self);
  10025   ck_assert_ptr_eq(r, null);
  10026   // non json array
  10027   freeO(self);
  10028   setTypeBoolO(self);
  10029   ck_assert_ptr_eq(self->f->dequeueArray(self), NULL);
  10030   terminateO(self);
  10031 
  10032 }
  10033 
  10034 
  10035 void dequeueSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  10036 
  10037   smallBoolt* r;
  10038   smallJsont *self = allocSmallJson();
  10039   smallJsont *r2;
  10040   baset *r3;
  10041 
  10042   // add an element to check that the second element is poped
  10043   // at the end
  10044   r2 = self->f->pushInt(self, 1);
  10045   ck_assert_ptr_ne(r2, null);
  10046   // add second element
  10047   createSmallBool(e);
  10048   r2 = self->f->prependSmallBool(self, &e);
  10049   ck_assert_ptr_ne(r2, null);
  10050   // pop
  10051   r = self->f->dequeueSmallBool(self);
  10052   ck_assert_ptr_ne(r, null);
  10053   char *s = toStringO(r);
  10054   terminateO(r);
  10055   ck_assert_str_eq(s, "false");
  10056   free(s);
  10057   ck_assert_int_eq(lenO(self), 1);
  10058   s = toStringO(self);
  10059   ck_assert_str_eq(s, "[1]");
  10060   free(s);
  10061   // pop element of unexpected type
  10062   r = self->f->dequeueSmallBool(self);
  10063   ck_assert(!r);
  10064   ck_assert_int_eq(lenO(self), 1);
  10065   s = toStringO(self);
  10066   ck_assert_str_eq(s, "[1]");
  10067   free(s);
  10068   // empty array
  10069   r3 = self->f->pop(self);
  10070   ck_assert_ptr_ne(r3, null);
  10071   terminateO(r3);
  10072   s = toStringO(self);
  10073   ck_assert_str_eq(s, "[]");
  10074   free(s);
  10075   r = self->f->dequeueSmallBool(self);
  10076   ck_assert(!r);
  10077   s = toStringO(self);
  10078   ck_assert_str_eq(s, "[]");
  10079   free(s);
  10080   r2 = self->f->pushUndefined(self);
  10081   ck_assert_ptr_ne(r2, null);
  10082   delElemIndexO(self,-1);
  10083   r = self->f->dequeueSmallBool(self);
  10084   ck_assert_ptr_eq(r, null);
  10085   // non json array
  10086   freeO(self);
  10087   setTypeBoolO(self);
  10088   ck_assert_ptr_eq(self->f->dequeueSmallBool(self), NULL);
  10089   terminateO(self);
  10090 
  10091 }
  10092 
  10093 
  10094 void dequeueSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  10095 
  10096   smallBytest* r;
  10097   smallJsont *self = allocSmallJson();
  10098   smallJsont *r2;
  10099   baset *r3;
  10100 
  10101   // add an element to check that the second element is poped
  10102   // at the end
  10103   r2 = self->f->pushInt(self, 1);
  10104   ck_assert_ptr_ne(r2, null);
  10105   // add second element
  10106   createSmallBytes(e);
  10107   r2 = self->f->prependSmallBytes(self, &e);
  10108   ck_assert_ptr_ne(r2, null);
  10109   // pop
  10110   r = self->f->dequeueSmallBytes(self);
  10111   ck_assert_ptr_ne(r, null);
  10112   char *s = toStringO(r);
  10113   terminateO(r);
  10114   ck_assert_str_eq(s, "[]");
  10115   free(s);
  10116   ck_assert_int_eq(lenO(self), 1);
  10117   s = toStringO(self);
  10118   ck_assert_str_eq(s, "[1]");
  10119   free(s);
  10120   // pop element of unexpected type
  10121   r = self->f->dequeueSmallBytes(self);
  10122   ck_assert(!r);
  10123   ck_assert_int_eq(lenO(self), 1);
  10124   s = toStringO(self);
  10125   ck_assert_str_eq(s, "[1]");
  10126   free(s);
  10127   // empty array
  10128   r3 = self->f->pop(self);
  10129   ck_assert_ptr_ne(r3, null);
  10130   terminateO(r3);
  10131   s = toStringO(self);
  10132   ck_assert_str_eq(s, "[]");
  10133   free(s);
  10134   r = self->f->dequeueSmallBytes(self);
  10135   ck_assert(!r);
  10136   s = toStringO(self);
  10137   ck_assert_str_eq(s, "[]");
  10138   free(s);
  10139   r2 = self->f->pushUndefined(self);
  10140   ck_assert_ptr_ne(r2, null);
  10141   delElemIndexO(self,-1);
  10142   r = self->f->dequeueSmallBytes(self);
  10143   ck_assert_ptr_eq(r, null);
  10144   // non json array
  10145   freeO(self);
  10146   setTypeBoolO(self);
  10147   ck_assert_ptr_eq(self->f->dequeueSmallBytes(self), NULL);
  10148   terminateO(self);
  10149 
  10150 }
  10151 
  10152 
  10153 void dequeueSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  10154 
  10155   smallDoublet* r;
  10156   smallJsont *self = allocSmallJson();
  10157   smallJsont *r2;
  10158   baset *r3;
  10159 
  10160   // add an element to check that the second element is poped
  10161   // at the end
  10162   r2 = self->f->pushInt(self, 1);
  10163   ck_assert_ptr_ne(r2, null);
  10164   // add second element
  10165   createSmallDouble(e);
  10166   r2 = self->f->prependSmallDouble(self, &e);
  10167   ck_assert_ptr_ne(r2, null);
  10168   // pop
  10169   r = self->f->dequeueSmallDouble(self);
  10170   ck_assert_ptr_ne(r, null);
  10171   char *s = toStringO(r);
  10172   terminateO(r);
  10173   ck_assert_str_eq(s, "0.000000e+00");
  10174   free(s);
  10175   ck_assert_int_eq(lenO(self), 1);
  10176   s = toStringO(self);
  10177   ck_assert_str_eq(s, "[1]");
  10178   free(s);
  10179   // pop element of unexpected type
  10180   r = self->f->dequeueSmallDouble(self);
  10181   ck_assert(!r);
  10182   ck_assert_int_eq(lenO(self), 1);
  10183   s = toStringO(self);
  10184   ck_assert_str_eq(s, "[1]");
  10185   free(s);
  10186   // empty array
  10187   r3 = self->f->pop(self);
  10188   ck_assert_ptr_ne(r3, null);
  10189   terminateO(r3);
  10190   s = toStringO(self);
  10191   ck_assert_str_eq(s, "[]");
  10192   free(s);
  10193   r = self->f->dequeueSmallDouble(self);
  10194   ck_assert(!r);
  10195   s = toStringO(self);
  10196   ck_assert_str_eq(s, "[]");
  10197   free(s);
  10198   r2 = self->f->pushUndefined(self);
  10199   ck_assert_ptr_ne(r2, null);
  10200   delElemIndexO(self,-1);
  10201   r = self->f->dequeueSmallDouble(self);
  10202   ck_assert_ptr_eq(r, null);
  10203   // non json array
  10204   freeO(self);
  10205   setTypeBoolO(self);
  10206   ck_assert_ptr_eq(self->f->dequeueSmallDouble(self), NULL);
  10207   terminateO(self);
  10208 
  10209 }
  10210 
  10211 
  10212 void dequeueSmallIntSmallJsonT(CuTest *tc UNUSED) {
  10213 
  10214   smallIntt* r;
  10215   smallJsont *self = allocSmallJson();
  10216   smallJsont *r2;
  10217   baset *r3;
  10218 
  10219   // add an element to check that the second element is poped
  10220   // at the end
  10221   r2 = self->f->pushBool(self, TRUE);
  10222   ck_assert_ptr_ne(r2, null);
  10223   // add second element
  10224   createSmallInt(e);
  10225   r2 = self->f->prependSmallInt(self, &e);
  10226   ck_assert_ptr_ne(r2, null);
  10227   // pop
  10228   r = self->f->dequeueSmallInt(self);
  10229   ck_assert_ptr_ne(r, null);
  10230   char *s = toStringO(r);
  10231   terminateO(r);
  10232   ck_assert_str_eq(s, "0");
  10233   free(s);
  10234   ck_assert_int_eq(lenO(self), 1);
  10235   s = toStringO(self);
  10236   ck_assert_str_eq(s, "[true]");
  10237   free(s);
  10238   // pop element of unexpected type
  10239   r = self->f->dequeueSmallInt(self);
  10240   ck_assert(!r);
  10241   ck_assert_int_eq(lenO(self), 1);
  10242   s = toStringO(self);
  10243   ck_assert_str_eq(s, "[true]");
  10244   free(s);
  10245   // empty array
  10246   r3 = self->f->pop(self);
  10247   ck_assert_ptr_ne(r3, null);
  10248   terminateO(r3);
  10249   s = toStringO(self);
  10250   ck_assert_str_eq(s, "[]");
  10251   free(s);
  10252   r = self->f->dequeueSmallInt(self);
  10253   ck_assert(!r);
  10254   s = toStringO(self);
  10255   ck_assert_str_eq(s, "[]");
  10256   free(s);
  10257   r2 = self->f->pushUndefined(self);
  10258   ck_assert_ptr_ne(r2, null);
  10259   delElemIndexO(self,-1);
  10260   r = self->f->dequeueSmallInt(self);
  10261   ck_assert_ptr_eq(r, null);
  10262   r2 = self->f->pushUndefined(self);
  10263   ck_assert_ptr_ne(r2, null);
  10264   delElemIndexO(self,-1);
  10265   r = self->f->dequeueSmallInt(self);
  10266   ck_assert_ptr_eq(r, null);
  10267   // non json array
  10268   freeO(self);
  10269   setTypeBoolO(self);
  10270   ck_assert_ptr_eq(self->f->dequeueSmallInt(self), NULL);
  10271   terminateO(self);
  10272 
  10273 }
  10274 
  10275 
  10276 void dequeueSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  10277 
  10278   smallJsont* r;
  10279   smallJsont *self = allocSmallJson();
  10280   smallJsont *r2;
  10281   baset *r3;
  10282 
  10283   // add an element to check that the second element is poped
  10284   // at the end
  10285   createSmallBytes(B);
  10286   r2 = self->f->pushSmallBytes(self, &B);
  10287   ck_assert_ptr_ne(r2, null);
  10288   // add second element
  10289   createSmallJson(e);
  10290   r2 = self->f->prependSmallJson(self, &e);
  10291   ck_assert_ptr_ne(r2, null);
  10292   // pop
  10293   r = self->f->dequeueSmallJson(self);
  10294   ck_assert_ptr_ne(r, null);
  10295   char *s = toStringO(r);
  10296   terminateO(r);
  10297   ck_assert_str_eq(s, "{}");
  10298   free(s);
  10299   ck_assert_int_eq(lenO(self), 1);
  10300   s = toStringO(self);
  10301   ck_assert_str_eq(s, "[[]]");
  10302   free(s);
  10303   // pop element of unexpected type
  10304   r = self->f->dequeueSmallJson(self);
  10305   ck_assert(!r);
  10306   ck_assert_int_eq(lenO(self), 1);
  10307   s = toStringO(self);
  10308   ck_assert_str_eq(s, "[[]]");
  10309   free(s);
  10310   // empty array
  10311   r3 = self->f->pop(self);
  10312   ck_assert_ptr_ne(r3, null);
  10313   terminateO(r3);
  10314   s = toStringO(self);
  10315   ck_assert_str_eq(s, "[]");
  10316   free(s);
  10317   r = self->f->dequeueSmallJson(self);
  10318   ck_assert(!r);
  10319   s = toStringO(self);
  10320   ck_assert_str_eq(s, "[]");
  10321   free(s);
  10322   r2 = self->f->pushUndefined(self);
  10323   ck_assert_ptr_ne(r2, null);
  10324   delElemIndexO(self,-1);
  10325   r = self->f->dequeueSmallJson(self);
  10326   ck_assert_ptr_eq(r, null);
  10327   // non json array
  10328   freeO(self);
  10329   setTypeBoolO(self);
  10330   ck_assert_ptr_eq(self->f->dequeueSmallJson(self), NULL);
  10331   terminateO(self);
  10332 
  10333 }
  10334 
  10335 
  10336 void dequeueSmallStringSmallJsonT(CuTest *tc UNUSED) {
  10337 
  10338   smallStringt* r;
  10339   smallJsont *self = allocSmallJson();
  10340   smallJsont *r2;
  10341   baset *r3;
  10342 
  10343   // add an element to check that the second element is poped
  10344   // at the end
  10345   r2 = self->f->pushInt(self, 1);
  10346   ck_assert_ptr_ne(r2, null);
  10347   // add second element
  10348   createSmallString(e);
  10349   r2 = self->f->prependSmallString(self, &e);
  10350   ck_assert_ptr_ne(r2, null);
  10351   // pop
  10352   r = self->f->dequeueSmallString(self);
  10353   ck_assert_ptr_ne(r, null);
  10354   char *s = toStringO(r);
  10355   terminateO(r);
  10356   ck_assert_str_eq(s, "");
  10357   free(s);
  10358   ck_assert_int_eq(lenO(self), 1);
  10359   s = toStringO(self);
  10360   ck_assert_str_eq(s, "[1]");
  10361   free(s);
  10362   // pop element of unexpected type
  10363   r = self->f->dequeueSmallString(self);
  10364   ck_assert(!r);
  10365   ck_assert_int_eq(lenO(self), 1);
  10366   s = toStringO(self);
  10367   ck_assert_str_eq(s, "[1]");
  10368   free(s);
  10369   // empty array
  10370   r3 = self->f->pop(self);
  10371   ck_assert_ptr_ne(r3, null);
  10372   terminateO(r3);
  10373   s = toStringO(self);
  10374   ck_assert_str_eq(s, "[]");
  10375   free(s);
  10376   r = self->f->dequeueSmallString(self);
  10377   ck_assert(!r);
  10378   s = toStringO(self);
  10379   ck_assert_str_eq(s, "[]");
  10380   free(s);
  10381   r2 = self->f->pushUndefined(self);
  10382   ck_assert_ptr_ne(r2, null);
  10383   delElemIndexO(self,-1);
  10384   r = self->f->dequeueSmallString(self);
  10385   ck_assert_ptr_eq(r, null);
  10386   // non json array
  10387   freeO(self);
  10388   setTypeBoolO(self);
  10389   ck_assert_ptr_eq(self->f->dequeueSmallString(self), NULL);
  10390   terminateO(self);
  10391 
  10392 }
  10393 
  10394 
  10395 void dequeueVoidSmallJsonT(CuTest *tc UNUSED) {
  10396 
  10397   void* r;
  10398   smallJsont *self = allocSmallJson();
  10399   smallJsont *r2;
  10400   baset *r3;
  10401 
  10402   // add an element to check that the second element is poped
  10403   // at the end
  10404   r2 = self->f->pushInt(self, 1);
  10405   ck_assert_ptr_ne(r2, null);
  10406 
  10407   // add second element
  10408   createSmallContainer(e);
  10409   setValO(&e, &r);
  10410   r2 = self->f->prependSmallContainer(self, &e);
  10411   ck_assert_ptr_ne(r2, null);
  10412 
  10413   // pop
  10414   r = self->f->dequeueVoid(self);
  10415   ck_assert_ptr_eq(r, &r);
  10416   ck_assert_int_eq(lenO(self), 1);
  10417   char *s = toStringO(self);
  10418   ck_assert_str_eq(s, "[1]");
  10419   free(s);
  10420 
  10421   // pop element of unexpected type
  10422   r = self->f->dequeueVoid(self);
  10423   ck_assert(!r);
  10424   ck_assert_int_eq(lenO(self), 1);
  10425   s = toStringO(self);
  10426   ck_assert_str_eq(s, "[1]");
  10427   free(s);
  10428 
  10429   // empty array
  10430   r3 = self->f->pop(self);
  10431   ck_assert_ptr_ne(r3, null);
  10432   terminateO(r3);
  10433   s = toStringO(self);
  10434   ck_assert_str_eq(s, "[]");
  10435   free(s);
  10436   r = self->f->dequeueVoid(self);
  10437   ck_assert(!r);
  10438   s = toStringO(self);
  10439   ck_assert_str_eq(s, "[]");
  10440   free(s);
  10441   terminateO(self);
  10442 
  10443 }
  10444 
  10445 
  10446 void dequeueSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  10447 
  10448   smallContainert* r;
  10449   smallJsont *self = allocSmallJson();
  10450   smallJsont *r2;
  10451   baset *r3;
  10452 
  10453   // add an element to check that the second element is poped
  10454   // at the end
  10455   r2 = self->f->pushInt(self, 1);
  10456   ck_assert_ptr_ne(r2, null);
  10457   // add second element
  10458   createSmallContainer(e);
  10459   r2 = self->f->prependSmallContainer(self, &e);
  10460   ck_assert_ptr_ne(r2, null);
  10461   // pop
  10462   r = self->f->dequeueSmallContainer(self);
  10463   ck_assert_ptr_ne(r, null);
  10464   char *s = toStringO(r);
  10465   terminateO(r);
  10466   ck_assert_str_eq(s, "<data smallContainer>");
  10467   free(s);
  10468   ck_assert_int_eq(lenO(self), 1);
  10469   s = toStringO(self);
  10470   ck_assert_str_eq(s, "[1]");
  10471   free(s);
  10472   // container with baset object
  10473   // push a base object of unknown type
  10474   smallIntt *o    = allocSmallInt(2);
  10475   o->type         = "newType";
  10476   r2 = self->f->prependNFree(self, (baset*)o);
  10477   ck_assert_ptr_ne(r2, null);
  10478   r = self->f->dequeueSmallContainer(self);
  10479   ck_assert_ptr_eq(r, NULL);
  10480   ck_assert_int_eq(lenO(self), 2);
  10481   s = toStringO(self);
  10482   ck_assert_str_eq(s, "[\"<data container>\",1]");
  10483   free(s);
  10484   r3 = self->f->dequeue(self);
  10485   ck_assert_ptr_ne(r3, null);
  10486   terminateO(r3);
  10487   // pop element of unexpected type
  10488   r = self->f->dequeueSmallContainer(self);
  10489   ck_assert_ptr_eq(r, NULL);
  10490   ck_assert_int_eq(lenO(self), 1);
  10491   s = toStringO(self);
  10492   ck_assert_str_eq(s, "[1]");
  10493   free(s);
  10494   // empty array
  10495   r3 = self->f->pop(self);
  10496   ck_assert_ptr_ne(r3, null);
  10497   terminateO(r3);
  10498   s = toStringO(self);
  10499   ck_assert_str_eq(s, "[]");
  10500   free(s);
  10501   r = self->f->dequeueSmallContainer(self);
  10502   ck_assert(!r);
  10503   s = toStringO(self);
  10504   ck_assert_str_eq(s, "[]");
  10505   free(s);
  10506   r2 = self->f->pushUndefined(self);
  10507   ck_assert_ptr_ne(r2, null);
  10508   delElemIndexO(self,-1);
  10509   r = self->f->dequeueSmallContainer(self);
  10510   ck_assert_ptr_eq(r, null);
  10511   // non json array
  10512   freeO(self);
  10513   setTypeBoolO(self);
  10514   ck_assert_ptr_eq(self->f->dequeueSmallContainer(self), NULL);
  10515   terminateO(self);
  10516 
  10517 }
  10518 
  10519 
  10520 void dequeueNumSmallJsonT(CuTest *tc UNUSED) {
  10521 
  10522   double r;
  10523   smallJsont *self = allocSmallJson();
  10524   smallJsont *r2;
  10525   baset *r3;
  10526 
  10527   // add an element to check that the second element is poped
  10528   // at the end
  10529   r2 = self->f->pushBool(self, TRUE);
  10530   ck_assert_ptr_ne(r2, null);
  10531   // add second element
  10532   r2 = self->f->prependInt(self, 2);
  10533   ck_assert_ptr_ne(r2, null);
  10534   r2 = self->f->prependDouble(self, 2.5);
  10535   ck_assert_ptr_ne(r2, null);
  10536   // pop
  10537   r = self->f->dequeueNum(self);
  10538   ck_assert(r==2.5);
  10539   ck_assert_int_eq(lenO(self), 2);
  10540   char *s = toStringO(self);
  10541   ck_assert_str_eq(s, "[2,true]");
  10542   free(s);
  10543   r = self->f->dequeueNum(self);
  10544   ck_assert_int_eq(r, 2);
  10545   ck_assert_int_eq(lenO(self), 1);
  10546   s = toStringO(self);
  10547   ck_assert_str_eq(s, "[true]");
  10548   free(s);
  10549   // pop element of unexpected type
  10550   r = self->f->dequeueNum(self);
  10551   ck_assert(!r);
  10552   ck_assert_int_eq(lenO(self), 1);
  10553   s = toStringO(self);
  10554   ck_assert_str_eq(s, "[true]");
  10555   free(s);
  10556   // empty array
  10557   r3 = self->f->pop(self);
  10558   ck_assert_ptr_ne(r3, null);
  10559   terminateO(r3);
  10560   s = toStringO(self);
  10561   ck_assert_str_eq(s, "[]");
  10562   free(s);
  10563   r = self->f->dequeueNum(self);
  10564   ck_assert(!r);
  10565   s = toStringO(self);
  10566   ck_assert_str_eq(s, "[]");
  10567   free(s);
  10568   r2 = self->f->pushUndefined(self);
  10569   ck_assert_ptr_ne(r2, null);
  10570   delElemIndexO(self,-1);
  10571   r = self->f->dequeueNum(self);
  10572   ck_assert(!r);
  10573   // non json array
  10574   freeO(self);
  10575   setTypeBoolO(self);
  10576   ck_assert(!self->f->dequeueNum(self));
  10577   terminateO(self);
  10578 
  10579 }
  10580 
  10581 
  10582 void reverseSmallJsonT(CuTest *tc UNUSED) {
  10583 
  10584   smallJsont* r;
  10585   smallJsont *self = allocSmallJson();
  10586   setTypeArrayO(self);
  10587 
  10588   // empty array
  10589   r = reverseO(self);
  10590   ck_assert_ptr_ne(r, NULL);
  10591   char *s = toStringO(r);
  10592   ck_assert_str_eq(s, "[]");
  10593   free(s);
  10594   // 1 element array
  10595   self->f->pushInt(self,1);
  10596   r = reverseO(self);
  10597   ck_assert_ptr_ne(r, NULL);
  10598   s = toStringO(r);
  10599   ck_assert_str_eq(s, "[1]");
  10600   free(s);
  10601   // 2 elements array
  10602   self->f->pushInt(self,2);
  10603   r = reverseO(self);
  10604   ck_assert_ptr_ne(r, NULL);
  10605   s = toStringO(r);
  10606   ck_assert_str_eq(s, "[2,1]");
  10607   free(s);
  10608   // non json array
  10609   freeO(self);
  10610   setTypeBoolO(self);
  10611   ck_assert_ptr_eq(reverseO(self), NULL);
  10612   terminateO(self);
  10613 
  10614 }
  10615 
  10616 
  10617 void catSmallJsonT(CuTest *tc UNUSED) {
  10618 
  10619   smallJsont* r;
  10620   smallJsont *self = allocSmallJson();
  10621 
  10622   // cat arrays
  10623   self->f->pushInt(self,1);
  10624   createAllocateSmallArray(a);
  10625   createAllocateSmallArray(a2);
  10626   a2->f->pushInt(a2,2);
  10627   r = catO(self, a, a2);
  10628   ck_assert_ptr_ne(r, null);
  10629   char *s = toStringO(r);
  10630   ck_assert_str_eq(s, "[1,2]");
  10631   free(s);
  10632   smashManyO(a,a2);
  10633   emptyO(self);
  10634   // null parameter
  10635   r = catO(self, null);
  10636   ck_assert_ptr_ne(r, null);
  10637   s = toStringO(r);
  10638   ck_assert_str_eq(s, "[]");
  10639   free(s);
  10640   terminateO(self);
  10641   // json string
  10642   self = allocSmallJson();
  10643   setTopSO(self, "qwe");
  10644   smallStringt *s1 = allocSmallString("123");
  10645   smallStringt *s2 = allocSmallString("456");
  10646   r = catO(self, s1, s2);
  10647   ck_assert_ptr_ne(r, null);
  10648   s = toStringO(r);
  10649   ck_assert_str_eq(s, "qwe123456");
  10650   free(s);
  10651   // non smallString object
  10652   terminateO(s2);
  10653   s2 = (smallStringt*) allocSmallInt(1);
  10654   r = catO(self, s1, s2);
  10655   ck_assert_ptr_eq(r, null);
  10656   s = toStringO(self);
  10657   ck_assert_str_eq(s, "qwe123456");
  10658   free(s);
  10659   // non json array
  10660   freeO(self);
  10661   setTypeBoolO(self);
  10662   ck_assert_ptr_eq(catO(self, s1), NULL);
  10663   terminateO(s1);
  10664   terminateO(s2);
  10665   terminateO(self);
  10666 
  10667 }
  10668 
  10669 
  10670 void mergeDictSmallJsonT(CuTest *tc UNUSED) {
  10671 
  10672   smallJsont* r;
  10673   smallJsont *self      = allocG(rtSmallJsont);
  10674   smallDictt *smallDict = allocSmallDict();
  10675 
  10676   r = mergeDictO(self, smallDict);
  10677   ck_assert_ptr_ne(r, null);
  10678   smallDict->f->setInt(smallDict, "a", 1);
  10679   r = mergeDictO(self, smallDict);
  10680   ck_assert_ptr_ne(r, null);
  10681   smashO(smallDict);
  10682   char *s = toStringO(r);
  10683   ck_assert_str_eq(s, "{\"a\":1}");
  10684   free(s);
  10685   // same sObject in json and smallDict
  10686   smallDict = allocSmallDict();
  10687   setsoO(smallDict, (sDictt*) getsoO(self));
  10688   r = mergeDictO(self, smallDict);
  10689   ck_assert_ptr_eq(r, null);
  10690   // non json array
  10691   freeO(self);
  10692   setTypeBoolO(self);
  10693   ck_assert_ptr_eq(mergeDictO(self, smallDict), NULL);
  10694   finishO(smallDict);
  10695   terminateO(self);
  10696 
  10697 }
  10698 
  10699 
  10700 void mergeDictNSmashSmallJsonT(CuTest *tc UNUSED) {
  10701 
  10702   smallJsont* r;
  10703   smallJsont *self = allocSmallJson();
  10704   smallDictt *value = allocSmallDict();
  10705 
  10706   self->f->setS(self, "1", "2");
  10707   self->f->setS(self, "3", "4");
  10708   value->f->setS(value, "3", "#");
  10709   value->f->setInt(value, "4", 0);
  10710   r = self->f->mergeDictNSmash(self, value);
  10711   ck_assert_ptr_ne(r, null);
  10712   char *s = toStringO(r);
  10713   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  10714   free(s);
  10715   // empty dict
  10716   value = allocSmallDict();
  10717   r = self->f->mergeDictNSmash(self, value);
  10718   ck_assert_ptr_eq(r, self);
  10719   // non smallDict object
  10720   createAllocateSmallInt(i);
  10721   r = self->f->mergeDictNSmash(self, (smallDictt*)i);
  10722   ck_assert_ptr_eq(r, null);
  10723   terminateO(i);
  10724   // null
  10725   r = self->f->mergeDictNSmash(self, null);
  10726   ck_assert_ptr_eq(r, null);
  10727   terminateO(self);
  10728 
  10729 }
  10730 
  10731 
  10732 void mergeSmallJsonT(CuTest *tc UNUSED) {
  10733 
  10734   smallJsont* r;
  10735   smallJsont *self = allocSmallJson();
  10736   createAllocateSmallJson(json);
  10737 
  10738   // add an element to check that the second array is appended
  10739   // at the end
  10740   r = self->f->pushInt(self, 1);
  10741   ck_assert_ptr_ne(r, null);
  10742 
  10743   // append json array
  10744   json->f->pushInt(json, 2);
  10745   r = mergeO(self, json);
  10746   smashO(json);
  10747   ck_assert_ptr_ne(r, null);
  10748   char *s = toStringO(r);
  10749   ck_assert_str_eq(s, "[1,2]");
  10750   free(s);
  10751   // length 0
  10752   json = allocSmallJson();
  10753   json->f->pushInt(json, 2);
  10754   baset *o = json->f->pop(json);
  10755   terminateO(o);
  10756   r = mergeO(self, json);
  10757   smashO(json);
  10758   ck_assert_ptr_ne(r, null);
  10759   s = toStringO(r);
  10760   ck_assert_str_eq(s, "[1,2]");
  10761   free(s);
  10762   // same sArray in both self and json
  10763   json = allocSmallJson();
  10764   setsoO(json, (smallt*) getsoO(self));
  10765   r = mergeO(self, json);
  10766   ck_assert_ptr_eq(r, null);
  10767   finishO(json);
  10768   s = toStringO(self);
  10769   ck_assert_str_eq(s, "[1,2]");
  10770   free(s);
  10771   // json of type not array
  10772   json = allocSmallJson();
  10773   setTopIntO(json, 1);
  10774   r = mergeO(self, json);
  10775   ck_assert_ptr_eq(r, null);
  10776   terminateO(json);
  10777   s = toStringO(self);
  10778   ck_assert_str_eq(s, "[1,2]");
  10779   free(s);
  10780   // non smallJson object
  10781   json = (smallJsont*) allocSmallInt(2);
  10782   r = mergeO(self, json);
  10783   ck_assert_ptr_eq(r, null);
  10784   terminateO(json);
  10785   // null
  10786   r = mergeO(self, null);
  10787   ck_assert_ptr_eq(r, null);
  10788   s = toStringO(self);
  10789   ck_assert_str_eq(s, "[1,2]");
  10790   free(s);
  10791   // json empty json
  10792   freeO(self);
  10793   json = allocSmallJson();
  10794   json->f->pushInt(json, 2);
  10795   r = mergeO(self, json);
  10796   smashO(json);
  10797   ck_assert_ptr_ne(r, null);
  10798   s = toStringO(r);
  10799   ck_assert_str_eq(s, "[2]");
  10800   free(s);
  10801   freeO(self);
  10802   json = allocSmallJson();
  10803   json->f->setInt(json, "a", 1);
  10804   r = mergeO(self, json);
  10805   smashO(json);
  10806   ck_assert_ptr_ne(r, null);
  10807   s = toStringO(r);
  10808   ck_assert_str_eq(s, "{\"a\":1}");
  10809   free(s);
  10810   // same dict in self and json
  10811   json = allocSmallJson();
  10812   setsoO(json, getsoO(self));
  10813   r = mergeO(self, json);
  10814   ck_assert_ptr_eq(r, null);
  10815   finishO(json);
  10816   // non json array or dict
  10817   freeO(self);
  10818   setTypeBoolO(self);
  10819   json = allocSmallJson();
  10820   ck_assert_ptr_eq(mergeO(self, json), NULL);
  10821   terminateO(json);
  10822   terminateO(self);
  10823 
  10824 }
  10825 
  10826 
  10827 void mergeNSmashSmallJsonT(CuTest *tc UNUSED) {
  10828 
  10829   smallJsont* r;
  10830   smallJsont *self = allocSmallJson();
  10831   createAllocateSmallJson(json);
  10832 
  10833   // add an element to check that the second array is appended
  10834   // at the end
  10835   r = self->f->pushInt(self, 1);
  10836   ck_assert_ptr_ne(r, null);
  10837 
  10838   // append json array
  10839   json->f->pushInt(json, 2);
  10840   r = mergeNSmashO(self, json);
  10841   ck_assert_ptr_ne(r, null);
  10842   char *s = toStringO(r);
  10843   ck_assert_str_eq(s, "[1,2]");
  10844   free(s);
  10845   // null
  10846   r = mergeNSmashO(self, null);
  10847   ck_assert_ptr_eq(r, null);
  10848   s = toStringO(self);
  10849   ck_assert_str_eq(s, "[1,2]");
  10850   free(s);
  10851   terminateO(self);
  10852 
  10853 }
  10854 
  10855 
  10856 void appendSmallJsonT(CuTest *tc UNUSED) {
  10857 
  10858   smallJsont* r;
  10859   smallJsont *self   = allocG(rtSmallJsont);
  10860   smallArrayt *array = allocSmallArray();
  10861 
  10862   array->f->pushInt(array, 12);
  10863   r = appendO(self, array);
  10864   ck_assert_ptr_ne(r, null);
  10865   smashO(array);
  10866   char *s = toStringO(r);
  10867   ck_assert_str_eq(s, "[12]");
  10868   free(s);
  10869   // non smallArray array
  10870   array = (smallArrayt*) allocSmallInt(1);
  10871   r = appendO(self, array);
  10872   ck_assert_ptr_eq(r, null);
  10873   terminateO(array);
  10874   // non json array
  10875   freeO(self);
  10876   setTypeBoolO(self);
  10877   array = allocSmallArray();
  10878   ck_assert_ptr_eq(appendO(self, array), NULL);
  10879   terminateO(array);
  10880   terminateO(self);
  10881 
  10882 }
  10883 
  10884 
  10885 void appendNSmashSmallJsonT(CuTest *tc UNUSED) {
  10886 
  10887   smallJsont* r;
  10888   smallJsont *self = allocSmallJson();
  10889   createAllocateSmallArray(a);
  10890 
  10891   // add an element to check that the second array is appended
  10892   // at the end
  10893   r = self->f->pushInt(self, 1);
  10894   ck_assert_ptr_ne(r, null);
  10895 
  10896   // append array
  10897   a->f->pushInt(a, 2);
  10898   r = self->f->appendNSmash(self, a);
  10899   ck_assert_ptr_ne(r, null);
  10900   char *s = toStringO(r);
  10901   ck_assert_str_eq(s, "[1,2]");
  10902   free(s);
  10903   // length 0
  10904   a = allocSmallArray();
  10905   a->f->pushInt(a, 2);
  10906   delElemO(a,0);
  10907   r = self->f->appendNSmash(self, a);
  10908   ck_assert_ptr_ne(r, null);
  10909   s = toStringO(r);
  10910   ck_assert_str_eq(s, "[1,2]");
  10911   free(s);
  10912   // same sArray in both self and a
  10913   a = allocSmallArray();
  10914   setsoO(a, (sArrayt*) getsoO(self));
  10915   r = self->f->appendNSmash(self, a);
  10916   ck_assert_ptr_eq(r, null);
  10917   finishO(a);
  10918   s = toStringO(self);
  10919   ck_assert_str_eq(s, "[1,2]");
  10920   free(s);
  10921   // null
  10922   r = self->f->appendNSmash(self, null);
  10923   ck_assert_ptr_eq(r, null);
  10924   s = toStringO(self);
  10925   ck_assert_str_eq(s, "[1,2]");
  10926   free(s);
  10927   terminateO(self);
  10928 
  10929 }
  10930 
  10931 
  10932 void appendArraySmallJsonT(CuTest *tc UNUSED) {
  10933 
  10934   smallJsont* r;
  10935   smallJsont *self = allocSmallJson();
  10936   char **array;
  10937 
  10938   // add an element to check that the second array is appended
  10939   // at the end
  10940   r = self->f->pushInt(self, 1);
  10941   ck_assert_ptr_ne(r, null);
  10942 
  10943   // append array
  10944   array = null;
  10945   listPushS(&array, "2");
  10946   r = self->f->appendArray(self, array);
  10947   listFreeS(array);
  10948   ck_assert_ptr_ne(r, null);
  10949   char *s = toStringO(r);
  10950   ck_assert_str_eq(s, "[1,\"2\"]");
  10951   free(s);
  10952   // length 0
  10953   listEmptyS(array);
  10954   r = self->f->appendArray(self, array);
  10955   free(array);
  10956   ck_assert_ptr_ne(r, null);
  10957   s = toStringO(r);
  10958   ck_assert_str_eq(s, "[1,\"2\"]");
  10959   free(s);
  10960   // null
  10961   r = self->f->appendArray(self, null);
  10962   ck_assert_ptr_eq(r, null);
  10963   s = toStringO(self);
  10964   ck_assert_str_eq(s, "[1,\"2\"]");
  10965   free(s);
  10966   // empty json
  10967   freeO(self);
  10968   array = null;
  10969   listPushS(&array, "2");
  10970   r = self->f->appendArray(self, array);
  10971   listFreeS(array);
  10972   ck_assert_ptr_ne(r, null);
  10973   s = toStringO(r);
  10974   ck_assert_str_eq(s, "[\"2\"]");
  10975   free(s);
  10976   // non json array
  10977   freeO(self);
  10978   setTypeBoolO(self);
  10979   listEmptyS(array);
  10980   ck_assert_ptr_eq(self->f->appendArray(self, array), NULL);
  10981   free(array);
  10982   terminateO(self);
  10983 
  10984 }
  10985 
  10986 
  10987 void appendNSmashArraySmallJsonT(CuTest *tc UNUSED) {
  10988 
  10989   smallJsont* r;
  10990   smallJsont *self = allocSmallJson();
  10991   char **array;
  10992 
  10993   // add an element to check that the second array is appended
  10994   // at the end
  10995   r = self->f->pushInt(self, 1);
  10996   ck_assert_ptr_ne(r, null);
  10997 
  10998   // append array
  10999   array = null;
  11000   listPushS(&array, "2");
  11001   r = self->f->appendNSmashArray(self, array);
  11002   ck_assert_ptr_ne(r, null);
  11003   char *s = toStringO(r);
  11004   ck_assert_str_eq(s, "[1,\"2\"]");
  11005   free(s);
  11006   // length 0
  11007   listEmptyS(array);
  11008   r = self->f->appendNSmashArray(self, array);
  11009   ck_assert_ptr_ne(r, null);
  11010   s = toStringO(r);
  11011   ck_assert_str_eq(s, "[1,\"2\"]");
  11012   free(s);
  11013   // null
  11014   r = self->f->appendNSmashArray(self, null);
  11015   ck_assert_ptr_eq(r, null);
  11016   s = toStringO(self);
  11017   ck_assert_str_eq(s, "[1,\"2\"]");
  11018   free(s);
  11019   // empty json
  11020   freeO(self);
  11021   array = null;
  11022   listPushS(&array, "2");
  11023   r = self->f->appendNSmashArray(self, array);
  11024   ck_assert_ptr_ne(r, null);
  11025   s = toStringO(r);
  11026   ck_assert_str_eq(s, "[\"2\"]");
  11027   free(s);
  11028   // non json array
  11029   freeO(self);
  11030   setTypeBoolO(self);
  11031   listEmptyS(array);
  11032   ck_assert_ptr_eq(self->f->appendNSmashArray(self, array), NULL);
  11033   free(array);
  11034   terminateO(self);
  11035 
  11036 }
  11037 
  11038 
  11039 void shiftSmallJsonT(CuTest *tc UNUSED) {
  11040 
  11041   smallJsont* r;
  11042   smallJsont *self = allocSmallJson();
  11043   createAllocateSmallArray(a);
  11044 
  11045   // add an element to check that the second array is appended
  11046   // at the end
  11047   r = self->f->pushInt(self, 1);
  11048   ck_assert_ptr_ne(r, null);
  11049 
  11050   // append array
  11051   a->f->pushInt(a, 2);
  11052   r = self->f->shift(self, a);
  11053   smashO(a);
  11054   ck_assert_ptr_ne(r, null);
  11055   char *s = toStringO(r);
  11056   ck_assert_str_eq(s, "[2,1]");
  11057   free(s);
  11058   // length 0
  11059   a = allocSmallArray();
  11060   a->f->pushInt(a, 2);
  11061   delElemO(a,0);
  11062   r = self->f->shift(self, a);
  11063   smashO(a);
  11064   ck_assert_ptr_ne(r, null);
  11065   s = toStringO(r);
  11066   ck_assert_str_eq(s, "[2,1]");
  11067   free(s);
  11068   // same sArray in both self and a
  11069   a = allocSmallArray();
  11070   setsoO(a, (sArrayt*) getsoO(self));
  11071   r = self->f->shift(self, a);
  11072   ck_assert_ptr_eq(r, null);
  11073   finishO(a);
  11074   s = toStringO(self);
  11075   ck_assert_str_eq(s, "[2,1]");
  11076   free(s);
  11077   // null
  11078   r = self->f->shift(self, null);
  11079   ck_assert_ptr_eq(r, null);
  11080   s = toStringO(self);
  11081   ck_assert_str_eq(s, "[2,1]");
  11082   free(s);
  11083   terminateO(self);
  11084 
  11085 }
  11086 
  11087 
  11088 void shiftNSmashSmallJsonT(CuTest *tc UNUSED) {
  11089 
  11090   smallJsont* r;
  11091   smallJsont *self = allocSmallJson();
  11092   createAllocateSmallArray(a);
  11093 
  11094   // add an element to check that the second array is appended
  11095   // at the end
  11096   r = self->f->pushInt(self, 1);
  11097   ck_assert_ptr_ne(r, null);
  11098 
  11099   // append array
  11100   a->f->pushInt(a, 2);
  11101   r = self->f->shiftNSmash(self, a);
  11102   ck_assert_ptr_ne(r, null);
  11103   char *s = toStringO(r);
  11104   ck_assert_str_eq(s, "[2,1]");
  11105   free(s);
  11106   // length 0
  11107   a = allocSmallArray();
  11108   a->f->pushInt(a, 2);
  11109   delElemO(a,0);
  11110   r = self->f->shiftNSmash(self, a);
  11111   ck_assert_ptr_ne(r, null);
  11112   s = toStringO(r);
  11113   ck_assert_str_eq(s, "[2,1]");
  11114   free(s);
  11115   // same sArray in both self and a
  11116   a = allocSmallArray();
  11117   setsoO(a, (sArrayt*) getsoO(self));
  11118   r = self->f->shiftNSmash(self, a);
  11119   ck_assert_ptr_eq(r, null);
  11120   finishO(a);
  11121   s = toStringO(self);
  11122   ck_assert_str_eq(s, "[2,1]");
  11123   free(s);
  11124   // null
  11125   r = self->f->shiftNSmash(self, null);
  11126   ck_assert_ptr_eq(r, null);
  11127   s = toStringO(self);
  11128   ck_assert_str_eq(s, "[2,1]");
  11129   free(s);
  11130   terminateO(self);
  11131 
  11132 }
  11133 
  11134 
  11135 void shiftSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  11136 
  11137   smallJsont* r;
  11138   smallJsont *self = allocSmallJson();
  11139   createAllocateSmallJson(json);
  11140 
  11141   // add an element to check that the second array is shifted
  11142   // at the end
  11143   r = self->f->pushInt(self, 1);
  11144   ck_assert_ptr_ne(r, null);
  11145 
  11146   // shift json array
  11147   json->f->pushInt(json, 2);
  11148   r = self->f->shiftSmallJson(self, json);
  11149   smashO(json);
  11150   ck_assert_ptr_ne(r, null);
  11151   char *s = toStringO(r);
  11152   ck_assert_str_eq(s, "[2,1]");
  11153   free(s);
  11154   // length 0
  11155   json = allocSmallJson();
  11156   json->f->pushInt(json, 2);
  11157   baset *o = json->f->pop(json);
  11158   terminateO(o);
  11159   r = self->f->shiftSmallJson(self, json);
  11160   smashO(json);
  11161   ck_assert_ptr_ne(r, null);
  11162   s = toStringO(r);
  11163   ck_assert_str_eq(s, "[2,1]");
  11164   free(s);
  11165   // same sArray in both self and json
  11166   json = allocSmallJson();
  11167   setsoO(json, (smallt*) getsoO(self));
  11168   r = self->f->shiftSmallJson(self, json);
  11169   ck_assert_ptr_eq(r, null);
  11170   finishO(json);
  11171   s = toStringO(self);
  11172   ck_assert_str_eq(s, "[2,1]");
  11173   free(s);
  11174   // json of type not array
  11175   json = allocSmallJson();
  11176   setTopIntO(json, 1);
  11177   r = self->f->shiftSmallJson(self, json);
  11178   ck_assert_ptr_eq(r, null);
  11179   terminateO(json);
  11180   s = toStringO(self);
  11181   ck_assert_str_eq(s, "[2,1]");
  11182   free(s);
  11183   // null
  11184   r = self->f->shiftSmallJson(self, null);
  11185   ck_assert_ptr_eq(r, null);
  11186   s = toStringO(self);
  11187   ck_assert_str_eq(s, "[2,1]");
  11188   free(s);
  11189   terminateO(self);
  11190 
  11191 }
  11192 
  11193 
  11194 void shiftNSmashSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  11195 
  11196   smallJsont* r;
  11197   smallJsont *self = allocSmallJson();
  11198   createAllocateSmallJson(json);
  11199 
  11200   // add an element to check that the second array is shifted
  11201   // at the end
  11202   r = self->f->pushInt(self, 1);
  11203   ck_assert_ptr_ne(r, null);
  11204 
  11205   // shift json array
  11206   json->f->pushInt(json, 2);
  11207   r = self->f->shiftNSmashSmallJson(self, json);
  11208   ck_assert_ptr_ne(r, null);
  11209   char *s = toStringO(r);
  11210   ck_assert_str_eq(s, "[2,1]");
  11211   free(s);
  11212   // length 0
  11213   json = allocSmallJson();
  11214   json->f->pushInt(json, 2);
  11215   baset *o = json->f->pop(json);
  11216   terminateO(o);
  11217   r = self->f->shiftNSmashSmallJson(self, json);
  11218   ck_assert_ptr_ne(r, null);
  11219   s = toStringO(r);
  11220   ck_assert_str_eq(s, "[2,1]");
  11221   free(s);
  11222   // same sArray in both self and json
  11223   json = allocSmallJson();
  11224   setsoO(json, (smallt*) getsoO(self));
  11225   r = self->f->shiftNSmashSmallJson(self, json);
  11226   ck_assert_ptr_eq(r, null);
  11227   finishO(json);
  11228   s = toStringO(self);
  11229   ck_assert_str_eq(s, "[2,1]");
  11230   free(s);
  11231   // json of type not array
  11232   json = allocSmallJson();
  11233   setTopIntO(json, 1);
  11234   r = self->f->shiftNSmashSmallJson(self, json);
  11235   ck_assert_ptr_eq(r, null);
  11236   terminateO(json);
  11237   s = toStringO(self);
  11238   ck_assert_str_eq(s, "[2,1]");
  11239   free(s);
  11240   // null
  11241   r = self->f->shiftNSmashSmallJson(self, null);
  11242   ck_assert_ptr_eq(r, null);
  11243   s = toStringO(self);
  11244   ck_assert_str_eq(s, "[2,1]");
  11245   free(s);
  11246   terminateO(self);
  11247 
  11248 }
  11249 
  11250 
  11251 void addSmallJsonT(CuTest *tc UNUSED) {
  11252 
  11253   smallJsont* r;
  11254   smallJsont *self = allocSmallJson();
  11255   createAllocateSmallArray(a);
  11256 
  11257   // add an element to check that the second array is added
  11258   // at the end
  11259   r = self->f->pushInt(self, 1);
  11260   ck_assert_ptr_ne(r, null);
  11261 
  11262   // add array
  11263   a->f->pushInt(a, 2);
  11264   r = addO(self, a);
  11265   smashO(a);
  11266   ck_assert_ptr_ne(r, null);
  11267   char *s = toStringO(r);
  11268   terminateO(r);
  11269   ck_assert_str_eq(s, "[1,2]");
  11270   free(s);
  11271   // length 0
  11272   a = allocSmallArray();
  11273   a->f->pushInt(a, 2);
  11274   delElemO(a,0);
  11275   r = addO(self, a);
  11276   smashO(a);
  11277   ck_assert_ptr_ne(r, null);
  11278   s = toStringO(r);
  11279   terminateO(r);
  11280   ck_assert_str_eq(s, "[1]");
  11281   free(s);
  11282   a = allocSmallArray();
  11283   r = addO(self, a);
  11284   smashO(a);
  11285   ck_assert_ptr_ne(r, null);
  11286   s = toStringO(r);
  11287   terminateO(r);
  11288   ck_assert_str_eq(s, "[1]");
  11289   free(s);
  11290   // same sArray in both self and a
  11291   a = allocSmallArray();
  11292   setsoO(a, (sArrayt*) getsoO(self));
  11293   r = addO(self, a);
  11294   ck_assert_ptr_eq(r, null);
  11295   finishO(a);
  11296   s = toStringO(self);
  11297   ck_assert_str_eq(s, "[1]");
  11298   free(s);
  11299   // null
  11300   r = addO(self, null);
  11301   ck_assert_ptr_eq(r, null);
  11302   s = toStringO(self);
  11303   ck_assert_str_eq(s, "[1]");
  11304   free(s);
  11305   // non smallArray a
  11306   a = (smallArrayt*) allocSmallInt(1);
  11307   ck_assert_ptr_eq(addO(self, a), NULL);
  11308   terminateO(a);
  11309   // non json array
  11310   freeO(self);
  11311   setTypeBoolO(self);
  11312   a = allocSmallArray();
  11313   ck_assert_ptr_eq(addO(self, a), NULL);
  11314   terminateO(a);
  11315   terminateO(self);
  11316 
  11317 }
  11318 
  11319 
  11320 void addJsonSmallJsonT(CuTest *tc UNUSED) {
  11321 
  11322   smallJsont* r;
  11323   smallJsont *self = allocSmallJson();
  11324   smallJsont *a    = allocSmallJson();
  11325 
  11326   // add an element to check that the second array is added
  11327   // at the end
  11328   r = self->f->pushInt(self, 1);
  11329   ck_assert_ptr_ne(r, null);
  11330 
  11331   // add array
  11332   a->f->pushInt(a, 2);
  11333   r = addJsonO(self, a);
  11334   smashO(a);
  11335   ck_assert_ptr_ne(r, null);
  11336   char *s = toStringO(r);
  11337   terminateO(r);
  11338   ck_assert_str_eq(s, "[1,2]");
  11339   free(s);
  11340   // length 0
  11341   a = allocSmallJson();
  11342   a->f->pushInt(a, 2);
  11343   delElemIndexO(a,0);
  11344   r = addJsonO(self, a);
  11345   smashO(a);
  11346   ck_assert_ptr_ne(r, null);
  11347   s = toStringO(r);
  11348   terminateO(r);
  11349   ck_assert_str_eq(s, "[1]");
  11350   free(s);
  11351   a = allocSmallJson();
  11352   setTypeArrayO(a);
  11353   r = addJsonO(self, a);
  11354   smashO(a);
  11355   ck_assert_ptr_ne(r, null);
  11356   s = toStringO(r);
  11357   terminateO(r);
  11358   ck_assert_str_eq(s, "[1]");
  11359   free(s);
  11360   // same sArray in both self and a
  11361   a = allocSmallJson();
  11362   setsoO(a, getsoO(self));
  11363   r = addJsonO(self, a);
  11364   ck_assert_ptr_eq(r, null);
  11365   finishO(a);
  11366   s = toStringO(self);
  11367   ck_assert_str_eq(s, "[1]");
  11368   free(s);
  11369   // non json array a
  11370   a = allocSmallJson();
  11371   r = addJsonO(self, a);
  11372   ck_assert_ptr_eq(r, null);
  11373   finishO(a);
  11374   s = toStringO(self);
  11375   ck_assert_str_eq(s, "[1]");
  11376   free(s);
  11377   // null
  11378   r = addJsonO(self, null);
  11379   ck_assert_ptr_eq(r, null);
  11380   s = toStringO(self);
  11381   ck_assert_str_eq(s, "[1]");
  11382   free(s);
  11383   // non json a
  11384   a = (smallJsont*) allocSmallInt(1);
  11385   ck_assert_ptr_eq(addJsonO(self, a), NULL);
  11386   terminateO(a);
  11387   // non json array
  11388   freeO(self);
  11389   setTypeBoolO(self);
  11390   a = allocSmallJson();
  11391   ck_assert_ptr_eq(addJsonO(self, a), NULL);
  11392   terminateO(a);
  11393   terminateO(self);
  11394 
  11395 }
  11396 
  11397 
  11398 void sliceSmallJsonT(CuTest *tc UNUSED) {
  11399 
  11400   smallJsont* r;
  11401   smallJsont *self = allocSmallJson();
  11402 
  11403   //r = sliceO(self);
  11404   // slice
  11405   self->f->pushS(self, "asd");
  11406   self->f->pushInt(self, 123);
  11407   self->f->pushS(self, "sheepy");
  11408   self->f->pushInt(self, 5345);
  11409   r = sliceO(self,1,-1);
  11410   ck_assert_ptr_ne(r, null);
  11411   char *s = toStringO(r);
  11412   ck_assert_str_eq(s, "[123,\"sheepy\"]");
  11413   free(s);
  11414   terminateO(self);
  11415     // start outside
  11416   self = allocSmallJson();
  11417   self->f->pushS(self, "asd");
  11418   self->f->pushInt(self, 123);
  11419   self->f->pushS(self, "sheepy");
  11420   self->f->pushInt(self, 5345);
  11421   r = sliceO(self,20,-1);
  11422   ck_assert_ptr_eq(r, null);
  11423   s = toStringO(self);
  11424   ck_assert_str_eq(s, "[]");
  11425   free(s);
  11426   terminateO(self);
  11427     // start negative and outside
  11428   self = allocSmallJson();
  11429   self->f->pushUndefined(self);
  11430   self->f->pushInt(self, 123);
  11431   self->f->pushS(self, "sheepy");
  11432   self->f->pushInt(self, 5345);
  11433   r = sliceO(self,-20,1);
  11434   ck_assert_ptr_ne(r, null);
  11435   s = toStringO(r);
  11436   ck_assert_str_eq(s, "[null]");
  11437   free(s);
  11438   terminateO(self);
  11439     // end outside
  11440   self = allocSmallJson();
  11441   self->f->pushUndefined(self);
  11442   self->f->pushInt(self, 123);
  11443   self->f->pushS(self, "sheepy");
  11444   self->f->pushInt(self, 5345);
  11445   r = sliceO(self,2,40);
  11446   ck_assert_ptr_ne(r, null);
  11447   s = toStringO(self);
  11448   ck_assert_str_eq(s, "[\"sheepy\",5345]");
  11449   free(s);
  11450   terminateO(self);
  11451     // end negative and outside
  11452   self = allocSmallJson();
  11453   self->f->pushUndefined(self);
  11454   self->f->pushInt(self, 123);
  11455   self->f->pushS(self, "sheepy");
  11456   self->f->pushInt(self, 5345);
  11457   r = sliceO(self,2,-40);
  11458   ck_assert_ptr_eq(r, null);
  11459   s = toStringO(self);
  11460   ck_assert_str_eq(s, "[]");
  11461   free(s);
  11462   terminateO(self);
  11463     // end before start
  11464   self = allocSmallJson();
  11465   self->f->pushUndefined(self);
  11466   self->f->pushInt(self, 123);
  11467   self->f->pushS(self, "sheepy");
  11468   self->f->pushInt(self, 5345);
  11469   r = sliceO(self,3,2);
  11470   ck_assert_ptr_eq(r, null);
  11471   s = toStringO(self);
  11472   ck_assert_str_eq(s, "[]");
  11473   free(s);
  11474   terminateO(self);
  11475     // negative start last element
  11476   self = allocSmallJson();
  11477   self->f->pushUndefined(self);
  11478   self->f->pushInt(self, 123);
  11479   self->f->pushS(self, "sheepy");
  11480   self->f->pushInt(self, 5345);
  11481   r = sliceO(self,-1,0);
  11482   ck_assert_ptr_ne(r, null);
  11483   s = toStringO(r);
  11484   ck_assert_str_eq(s, "[5345]");
  11485   free(s);
  11486   terminateO(self);
  11487     // start = end
  11488   self = allocSmallJson();
  11489   self->f->pushUndefined(self);
  11490   self->f->pushInt(self, 123);
  11491   self->f->pushS(self, "sheepy");
  11492   self->f->pushInt(self, 5345);
  11493   r = sliceO(self,1,1);
  11494   ck_assert_ptr_ne(r, null);
  11495   s = toStringO(r);
  11496   ck_assert_str_eq(s, "[]");
  11497   free(s);
  11498   terminateO(self);
  11499     // empty list
  11500   initiateAllocateSmallJson(&self);
  11501   setTypeArrayO(self);
  11502   r = sliceO(self,0,0);
  11503   ck_assert_ptr_eq(r, null);
  11504   s = toStringO(self);
  11505   ck_assert_str_eq(s, "[]");
  11506   free(s);
  11507   // non json array
  11508   freeO(self);
  11509   setTypeBoolO(self);
  11510   ck_assert_ptr_eq(sliceO(self, 0, 1), NULL);
  11511   terminateO(self);
  11512   // json string
  11513   self = allocSmallJson();
  11514   // slice
  11515   setTopSO(self, "sheepy");
  11516   r = sliceO(self, 0,2);
  11517   ck_assert_ptr_ne(r, null);
  11518   ck_assert_str_eq(sjGet(self), "sh");
  11519   // negative index
  11520   freeO(self);
  11521   setTopSO(self, "sheepy");
  11522   r = sliceO(self, -2,0);
  11523   ck_assert_ptr_ne(r, null);
  11524   ck_assert_str_eq(sjGet(self), "py");
  11525   // positive and negative indexes
  11526   freeO(self);
  11527   setTopSO(self, "sheepy");
  11528   r = sliceO(self, 2,-2);
  11529   ck_assert_ptr_ne(r, null);
  11530   ck_assert_str_eq(sjGet(self), "ee");
  11531   // start = end
  11532   freeO(self);
  11533   setTopSO(self, "sheepy");
  11534   r = sliceO(self, 2,-4);
  11535   ck_assert_ptr_ne(r, null);
  11536   ck_assert_str_eq(sjGet(self), "");
  11537   // end of string
  11538   freeO(self);
  11539   setTopSO(self, "sheepy");
  11540   r = sliceO(self, 2,6);
  11541   ck_assert_ptr_ne(r, null);
  11542   ck_assert_str_eq(sjGet(self), "eepy");
  11543   // NULL string
  11544   freeO(self);
  11545   ck_assert_ptr_eq(sliceO(self, 2,-4), NULL);
  11546   // start outside string
  11547   freeO(self);
  11548   setTopSO(self, "sheepy");
  11549   ck_assert_ptr_eq(sliceO(self, 20,-4), NULL);
  11550   // end outside string
  11551   freeO(self);
  11552   setTopSO(self, "sheepy");
  11553   r = sliceO(self, 2,40);
  11554   ck_assert_ptr_ne(r, null);
  11555   ck_assert_str_eq(sjGet(self), "eepy");
  11556   freeO(self);
  11557   setTopSO(self, "sheepy");
  11558   r = sliceO(self, -22,3);
  11559   ck_assert_ptr_ne(r, null);
  11560   ck_assert_str_eq(sjGet(self), "she");
  11561   freeO(self);
  11562   setTopSO(self, "sheepy");
  11563   ck_assert_ptr_eq(sliceO(self, 2,-40), NULL);
  11564   // end before start
  11565   freeO(self);
  11566   setTopSO(self, "sheepy");
  11567   ck_assert_ptr_eq(sliceO(self, 4,2), NULL);
  11568   terminateO(self);
  11569 
  11570 }
  11571 
  11572 
  11573 void cropSmallJsonT(CuTest *tc UNUSED) {
  11574 
  11575   smallJsont* r;
  11576   smallJsont *self = allocSmallJson();
  11577 
  11578   // add elements to self
  11579   r = self->f->pushInt(self, 1);
  11580   ck_assert_ptr_ne(r, null);
  11581   r = self->f->pushInt(self, 2);
  11582   ck_assert_ptr_ne(r, null);
  11583   r = self->f->pushInt(self, 3);
  11584   ck_assert_ptr_ne(r, null);
  11585   r = self->f->pushInt(self, 4);
  11586   ck_assert_ptr_ne(r, null);
  11587 
  11588   // negative index
  11589   r = cropO(self, 1, -1);
  11590   ck_assert_ptr_ne(r, null);
  11591   ck_assert_int_eq(lenO(r), 2);
  11592   char *s = toStringO(r);
  11593   terminateO(r);
  11594   ck_assert_str_eq(s, "[2,3]");
  11595   free(s);
  11596   s = toStringO(self);
  11597   ck_assert_str_eq(s, "[1,4]");
  11598   free(s);
  11599   // start outside
  11600   ck_assert_ptr_eq(cropO(self, 20, -4), NULL);
  11601   // end outside
  11602   r = cropO(self, 0, 40);
  11603   ck_assert_ptr_ne(r, null);
  11604   ck_assert_int_eq(lenO(r), 2);
  11605   s = toStringO(r);
  11606   terminateO(r);
  11607   ck_assert_str_eq(s, "[1,4]");
  11608   free(s);
  11609   s = toStringO(self);
  11610   ck_assert_str_eq(s, "[]");
  11611   free(s);
  11612   // end negative and outside
  11613   //   add elements to self
  11614   r = self->f->pushInt(self, 1);
  11615   ck_assert_ptr_ne(r, null);
  11616   r = self->f->pushInt(self, 2);
  11617   ck_assert_ptr_ne(r, null);
  11618   r = self->f->pushInt(self, 3);
  11619   ck_assert_ptr_ne(r, null);
  11620   r = self->f->pushInt(self, 4);
  11621   ck_assert_ptr_ne(r, null);
  11622   ck_assert_ptr_eq(cropO(self, 2, -40), NULL);
  11623   s = toStringO(self);
  11624   ck_assert_str_eq(s, "[1,2,3,4]");
  11625   free(s);
  11626   // end before start
  11627   ck_assert_ptr_eq(cropO(self, 3, 2), NULL);
  11628   s = toStringO(self);
  11629   ck_assert_str_eq(s, "[1,2,3,4]");
  11630   free(s);
  11631   // negative start last element
  11632   r = cropO(self, -1, 0);
  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, "[4]");
  11638   free(s);
  11639   s = toStringO(self);
  11640   ck_assert_str_eq(s, "[1,2,3]");
  11641   free(s);
  11642   // negative start and outside
  11643   r = cropO(self, -10, 1);
  11644   ck_assert_ptr_ne(r, null);
  11645   ck_assert_int_eq(lenO(r), 1);
  11646   s = toStringO(r);
  11647   terminateO(r);
  11648   ck_assert_str_eq(s, "[1]");
  11649   free(s);
  11650   s = toStringO(self);
  11651   ck_assert_str_eq(s, "[2,3]");
  11652   free(s);
  11653   // start = end
  11654   r = cropO(self, 1, 1);
  11655   ck_assert_ptr_ne(r, null);
  11656   ck_assert_int_eq(lenO(r), 0);
  11657   terminateO(r);
  11658   s = toStringO(self);
  11659   ck_assert_str_eq(s, "[2,3]");
  11660   free(s);
  11661   // empty list
  11662   emptyO(self);
  11663   ck_assert_ptr_eq(cropO(self, 0, 0), NULL);
  11664   ck_assert_ptr_eq(cropO(self, -1, 0), NULL);
  11665   // non json array
  11666   freeO(self);
  11667   setTypeBoolO(self);
  11668   ck_assert_ptr_eq(cropO(self, 0, 1), NULL);
  11669   terminateO(self);
  11670   // json string
  11671   self = allocSmallJson();
  11672   setTopSO(self, "");
  11673   // crop
  11674   freeO(self);
  11675   setTopSO(self, "sheepy");
  11676   r = cropO(self, 0,2);
  11677   ck_assert_ptr_ne(r, null);
  11678   ck_assert_str_eq(sjGet(r), "sh");
  11679   ck_assert_str_eq(sjGet(self), "eepy");
  11680   terminateO(r);
  11681   // negative index
  11682   freeO(self);
  11683   setTopSO(self, "sheepy");
  11684   r = cropO(self, -2,0);
  11685   ck_assert_ptr_ne(r, null);
  11686   ck_assert_str_eq(sjGet(r), "py");
  11687   ck_assert_str_eq(sjGet(self), "shee");
  11688   terminateO(r);
  11689   // positive and negative indexes
  11690   freeO(self);
  11691   setTopSO(self, "sheepy");
  11692   r = cropO(self, 2,-2);
  11693   ck_assert_ptr_ne(r, null);
  11694   ck_assert_str_eq(sjGet(r), "ee");
  11695   ck_assert_str_eq(sjGet(self), "shpy");
  11696   terminateO(r);
  11697   // start = end
  11698   freeO(self);
  11699   setTopSO(self, "sheepy");
  11700   r = cropO(self, 2,-4);
  11701   ck_assert_ptr_ne(r, null);
  11702   ck_assert_str_eq(sjGet(r), "");
  11703   ck_assert_str_eq(sjGet(self), "sheepy");
  11704   terminateO(r);
  11705   // end of string
  11706   freeO(self);
  11707   setTopSO(self, "sheepy");
  11708   r = cropO(self, 2,6);
  11709   ck_assert_ptr_ne(r, null);
  11710   ck_assert_str_eq(sjGet(r), "eepy");
  11711   ck_assert_str_eq(sjGet(self), "sh");
  11712   terminateO(r);
  11713   // NULL string
  11714   freeO(self);
  11715   ck_assert_ptr_eq(cropO(self, 2,-4), NULL);
  11716   // start outside string
  11717   freeO(self);
  11718   setTopSO(self, "sheepy");
  11719   ck_assert_ptr_eq(cropO(self, 20,-4), NULL);
  11720   // end outside string
  11721   freeO(self);
  11722   setTopSO(self, "sheepy");
  11723   r = cropO(self, 2,40);
  11724   ck_assert_ptr_ne(r, null);
  11725   ck_assert_str_eq(sjGet(r), "eepy");
  11726   ck_assert_str_eq(sjGet(self), "sh");
  11727   terminateO(r);
  11728   freeO(self);
  11729   setTopSO(self, "sheepy");
  11730   r = cropO(self, -22,3);
  11731   ck_assert_ptr_ne(r, null);
  11732   ck_assert_str_eq(sjGet(r), "she");
  11733   ck_assert_str_eq(sjGet(self), "epy");
  11734   terminateO(r);
  11735   freeO(self);
  11736   setTopSO(self, "sheepy");
  11737   ck_assert_ptr_eq(cropO(self, 2,-40), NULL);
  11738   // end before start
  11739   ck_assert_ptr_eq(cropO(self, 4,2), NULL);
  11740   terminateO(self);
  11741 
  11742 }
  11743 
  11744 
  11745 void cropSSmallJsonT(CuTest *tc UNUSED) {
  11746 
  11747   char* s;
  11748   smallJsont *self = allocSmallJson();
  11749   setTopSO(self, "");
  11750 
  11751   // crop
  11752   freeO(self);
  11753   setTopSO(self, "sheepy");
  11754   s = cropSO(self, 0,2);
  11755   ck_assert_str_eq(s, "sh");
  11756   ck_assert_str_eq(sjGet(self), "eepy");
  11757   free(s);
  11758   // negative index
  11759   freeO(self);
  11760   setTopSO(self, "sheepy");
  11761   s = cropSO(self, -2,0);
  11762   ck_assert_str_eq(s, "py");
  11763   ck_assert_str_eq(sjGet(self), "shee");
  11764   free(s);
  11765   // positive and negative indexes
  11766   freeO(self);
  11767   setTopSO(self, "sheepy");
  11768   s = cropSO(self, 2,-2);
  11769   ck_assert_str_eq(s, "ee");
  11770   ck_assert_str_eq(sjGet(self), "shpy");
  11771   free(s);
  11772   // start = end
  11773   freeO(self);
  11774   setTopSO(self, "sheepy");
  11775   s = cropSO(self, 2,-4);
  11776   ck_assert_str_eq(s, "");
  11777   ck_assert_str_eq(sjGet(self), "sheepy");
  11778   free(s);
  11779   // end of string
  11780   freeO(self);
  11781   setTopSO(self, "sheepy");
  11782   s = cropSO(self, 2,6);
  11783   ck_assert_str_eq(s, "eepy");
  11784   ck_assert_str_eq(sjGet(self), "sh");
  11785   free(s);
  11786   // empty string
  11787   freeO(self);
  11788   setTopSO(self, "");
  11789   ck_assert_ptr_eq(cropSO(self, 0,1), NULL);
  11790   // NULL string
  11791   freeO(self);
  11792   ck_assert_ptr_eq(cropSO(self, 2,-4), NULL);
  11793   // start outside string
  11794   freeO(self);
  11795   setTopSO(self, "sheepy");
  11796   ck_assert_ptr_eq(cropSO(self, 20,-4), NULL);
  11797   // end outside string
  11798   freeO(self);
  11799   setTopSO(self, "sheepy");
  11800   s = cropSO(self, 2,40);
  11801   ck_assert_str_eq(s, "eepy");
  11802   ck_assert_str_eq(sjGet(self), "sh");
  11803   free(s);
  11804   freeO(self);
  11805   setTopSO(self, "sheepy");
  11806   s = cropSO(self, -22,3);
  11807   ck_assert_str_eq(s, "she");
  11808   ck_assert_str_eq(sjGet(self), "epy");
  11809   free(s);
  11810   freeO(self);
  11811   setTopSO(self, "sheepy");
  11812   ck_assert_ptr_eq(cropSO(self, 2,-40), NULL);
  11813   // end before start
  11814   ck_assert_ptr_eq(cropSO(self, 4,2), NULL);
  11815   terminateO(self);
  11816 
  11817 }
  11818 
  11819 
  11820 void cropSmallStringSmallJsonT(CuTest *tc UNUSED) {
  11821 
  11822   smallStringt* r;
  11823   smallJsont *self = allocSmallJson();
  11824   setTopSO(self, "");
  11825 
  11826   // crop
  11827   freeO(self);
  11828   setTopSO(self, "sheepy");
  11829   r = cropSmallStringO(self, 0,2);
  11830   ck_assert_ptr_ne(r, null);
  11831   ck_assert_str_eq(ssGet(r), "sh");
  11832   ck_assert_str_eq(sjGet(self), "eepy");
  11833   terminateO(r);
  11834   // negative index
  11835   freeO(self);
  11836   setTopSO(self, "sheepy");
  11837   r = cropSmallStringO(self, -2,0);
  11838   ck_assert_ptr_ne(r, null);
  11839   ck_assert_str_eq(ssGet(r), "py");
  11840   ck_assert_str_eq(sjGet(self), "shee");
  11841   terminateO(r);
  11842   // positive and negative indexes
  11843   freeO(self);
  11844   setTopSO(self, "sheepy");
  11845   r = cropSmallStringO(self, 2,-2);
  11846   ck_assert_ptr_ne(r, null);
  11847   ck_assert_str_eq(ssGet(r), "ee");
  11848   ck_assert_str_eq(sjGet(self), "shpy");
  11849   terminateO(r);
  11850   // start = end
  11851   freeO(self);
  11852   setTopSO(self, "sheepy");
  11853   r = cropSmallStringO(self, 2,-4);
  11854   ck_assert_ptr_ne(r, null);
  11855   ck_assert_str_eq(ssGet(r), "");
  11856   ck_assert_str_eq(sjGet(self), "sheepy");
  11857   terminateO(r);
  11858   // end of string
  11859   freeO(self);
  11860   setTopSO(self, "sheepy");
  11861   r = cropSmallStringO(self, 2,6);
  11862   ck_assert_ptr_ne(r, null);
  11863   ck_assert_str_eq(ssGet(r), "eepy");
  11864   ck_assert_str_eq(sjGet(self), "sh");
  11865   terminateO(r);
  11866   // NULL string
  11867   freeO(self);
  11868   ck_assert_ptr_eq(cropSmallStringO(self, 2,-4), NULL);
  11869   // start outside string
  11870   freeO(self);
  11871   setTopSO(self, "sheepy");
  11872   ck_assert_ptr_eq(cropSmallStringO(self, 20,-4), NULL);
  11873   // end outside string
  11874   freeO(self);
  11875   setTopSO(self, "sheepy");
  11876   r = cropSmallStringO(self, 2,40);
  11877   ck_assert_ptr_ne(r, null);
  11878   ck_assert_str_eq(ssGet(r), "eepy");
  11879   ck_assert_str_eq(sjGet(self), "sh");
  11880   terminateO(r);
  11881   freeO(self);
  11882   setTopSO(self, "sheepy");
  11883   r = cropSmallStringO(self, -22,3);
  11884   ck_assert_ptr_ne(r, null);
  11885   ck_assert_str_eq(ssGet(r), "she");
  11886   ck_assert_str_eq(sjGet(self), "epy");
  11887   terminateO(r);
  11888   freeO(self);
  11889   setTopSO(self, "sheepy");
  11890   ck_assert_ptr_eq(cropSmallStringO(self, 2,-40), NULL);
  11891   // end before start
  11892   ck_assert_ptr_eq(cropSmallStringO(self, 4,2), NULL);
  11893   terminateO(self);
  11894 
  11895 }
  11896 
  11897 
  11898 void cropElemAtSmallJsonT(CuTest *tc UNUSED) {
  11899 
  11900   baset* r;
  11901   smallJsont *self = allocSmallJson();
  11902   smallJsont *r2;
  11903 
  11904   // add elements to self
  11905   r2 = self->f->pushInt(self, 1);
  11906   ck_assert_ptr_ne(r2, null);
  11907   r2 = self->f->pushInt(self, 2);
  11908   ck_assert_ptr_ne(r2, null);
  11909   r2 = self->f->pushInt(self, 3);
  11910   ck_assert_ptr_ne(r2, null);
  11911   r2 = self->f->pushInt(self, 4);
  11912   ck_assert_ptr_ne(r2, null);
  11913 
  11914   // positive index
  11915   r       = cropElemAtO(self,1);
  11916   ck_assert_ptr_ne(r, null);
  11917   char *s = toStringO(r);
  11918   terminateO(r);
  11919   ck_assert_str_eq(s, "2");
  11920   free(s);
  11921   s = toStringO(self);
  11922   ck_assert_str_eq(s, "[1,3,4]");
  11923   free(s);
  11924   // negative index
  11925   r = cropElemAtO(self,-1);
  11926   ck_assert_ptr_ne(r, null);
  11927   s = toStringO(r);
  11928   terminateO(r);
  11929   ck_assert_str_eq(s, "4");
  11930   free(s);
  11931   s = toStringO(self);
  11932   ck_assert_str_eq(s, "[1,3]");
  11933   free(s);
  11934   // undefined object
  11935   r2 = self->f->pushUndefined(self);
  11936   ck_assert_ptr_ne(r2, null);
  11937   r = cropElemAtO(self,2);
  11938   ck_assert_ptr_ne(r, null);
  11939   s = toStringO(r);
  11940   terminateO(r);
  11941   ck_assert_str_eq(s, "null");
  11942   free(s);
  11943   s = toStringO(self);
  11944   ck_assert_str_eq(s, "[1,3]");
  11945   free(s);
  11946   // container
  11947   createSmallContainer(c);
  11948   r2 = self->f->pushSmallContainer(self, &c);
  11949   r = cropElemAtO(self,2);
  11950   ck_assert_ptr_ne(r, null);
  11951   s = toStringO(r);
  11952   terminateO(r);
  11953   ck_assert_str_eq(s, "<data smallContainer>");
  11954   free(s);
  11955   s = toStringO(self);
  11956   ck_assert_str_eq(s, "[1,3]");
  11957   free(s);
  11958   // base object in container
  11959   createAllocateSmallInt(I);
  11960   setValG(I, 11);
  11961   I->type = "anothertype";
  11962   r2 = self->f->push(self, (baset*)I);
  11963   r = cropElemAtO(self,2);
  11964   ck_assert_ptr_ne(r, null);
  11965   ck_assert_str_eq(r->type, "anothertype");
  11966   s = toStringO(r);
  11967   terminateO(r);
  11968   ck_assert_str_eq(s, "11");
  11969   free(s);
  11970   s = toStringO(self);
  11971   ck_assert_str_eq(s, "[1,3]");
  11972   free(s);
  11973   // index outside
  11974   ck_assert_ptr_eq(cropElemAtO(self, 20), NULL);
  11975   ck_assert_ptr_eq(cropElemAtO(self, -4), NULL);
  11976   // empty list
  11977   emptyO(self);
  11978   ck_assert_ptr_eq(cropElemAtO(self, 0), NULL);
  11979   ck_assert_ptr_eq(cropElemAtO(self, -1), NULL);
  11980   r2 = self->f->pushUndefined(self);
  11981   ck_assert_ptr_ne(r2, null);
  11982   delElemIndexO(self,-1);
  11983   r = cropElemAtO(self, 0);
  11984   ck_assert_ptr_eq(r, null);
  11985   // non json array
  11986   freeO(self);
  11987   setTypeBoolO(self);
  11988   ck_assert_ptr_eq(cropElemAtO(self, 0), NULL);
  11989   terminateO(self);
  11990 
  11991 }
  11992 
  11993 
  11994 void cropElemAtUndefinedSmallJsonT(CuTest *tc UNUSED) {
  11995 
  11996   undefinedt* r;
  11997   smallJsont *self = allocSmallJson();
  11998   smallJsont *r2;
  11999 
  12000   // add elements to self
  12001   r2 = self->f->pushInt(self, 1);
  12002   ck_assert_ptr_ne(r2, null);
  12003   r2 = self->f->pushUndefined(self);
  12004   ck_assert_ptr_ne(r2, null);
  12005   r2 = self->f->pushInt(self, 3);
  12006   ck_assert_ptr_ne(r2, null);
  12007   r2 = self->f->pushUndefined(self);
  12008   ck_assert_ptr_ne(r2, null);
  12009 
  12010   // positive index
  12011   r       = cropElemAtUndefinedO(self,1);
  12012   ck_assert_ptr_ne(r, null);
  12013   char *s = toStringO(r);
  12014   terminateO(r);
  12015   ck_assert_str_eq(s, "null");
  12016   free(s);
  12017   s = toStringO(self);
  12018   ck_assert_str_eq(s, "[1,3,null]");
  12019   free(s);
  12020   // negative index
  12021   r = cropElemAtUndefinedO(self,-1);
  12022   ck_assert_ptr_ne(r, null);
  12023   s = toStringO(r);
  12024   terminateO(r);
  12025   ck_assert_str_eq(s, "null");
  12026   free(s);
  12027   s = toStringO(self);
  12028   ck_assert_str_eq(s, "[1,3]");
  12029   free(s);
  12030   // wrong object type
  12031   createSmallInt(I);
  12032   setValG(&I, 11);
  12033   r2 = self->f->pushSmallInt(self, &I);
  12034   ck_assert_ptr_ne(r2, null);
  12035   r = cropElemAtUndefinedO(self,2);
  12036   ck_assert_ptr_eq(r, null);
  12037   s = toStringO(self);
  12038   ck_assert_str_eq(s, "[1,3,11]");
  12039   free(s);
  12040   // index outside
  12041   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 20), NULL);
  12042   ck_assert_ptr_eq(cropElemAtUndefinedO(self, -4), NULL);
  12043   // empty list
  12044   emptyO(self);
  12045   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 0), NULL);
  12046   ck_assert_ptr_eq(cropElemAtUndefinedO(self, -1), NULL);
  12047   r2 = self->f->pushUndefined(self);
  12048   ck_assert_ptr_ne(r2, null);
  12049   delElemIndexO(self,-1);
  12050   r = cropElemAtUndefinedO(self, 0);
  12051   ck_assert_ptr_eq(r, null);
  12052   // non json array
  12053   freeO(self);
  12054   setTypeBoolO(self);
  12055   ck_assert_ptr_eq(cropElemAtUndefinedO(self, 0), NULL);
  12056   terminateO(self);
  12057 
  12058 }
  12059 
  12060 
  12061 void cropElemAtBoolSmallJsonT(CuTest *tc UNUSED) {
  12062 
  12063   bool r;
  12064   smallJsont *self = allocSmallJson();
  12065   smallJsont *r2;
  12066 
  12067   // add elements to self
  12068   r2 = self->f->pushInt(self, 1);
  12069   ck_assert_ptr_ne(r2, null);
  12070   r2 = self->f->pushBool(self, TRUE);
  12071   ck_assert_ptr_ne(r2, null);
  12072   r2 = self->f->pushInt(self, 3);
  12073   ck_assert_ptr_ne(r2, null);
  12074   r2 = self->f->pushBool(self, TRUE);
  12075   ck_assert_ptr_ne(r2, null);
  12076 
  12077   // positive index
  12078   r       = cropElemAtBoolO(self,1);
  12079   ck_assert(r);
  12080   char *s = toStringO(self);
  12081   ck_assert_str_eq(s, "[1,3,true]");
  12082   free(s);
  12083   // negative index
  12084   r = cropElemAtBoolO(self,-1);
  12085   ck_assert(r);
  12086   s = toStringO(self);
  12087   ck_assert_str_eq(s, "[1,3]");
  12088   free(s);
  12089   // wrong object type
  12090   createSmallInt(I);
  12091   setValG(&I, 11);
  12092   r2 = self->f->pushSmallInt(self, &I);
  12093   r = cropElemAtBoolO(self,2);
  12094   ck_assert(!r);
  12095   s = toStringO(self);
  12096   ck_assert_str_eq(s, "[1,3,11]");
  12097   free(s);
  12098   // wrong object type of another user class
  12099   //   User classes are stored in containers transparently
  12100   createAllocateSmallInt(ip);
  12101   ip->type = "anothertype";
  12102   setValG(ip, 11);
  12103   r2 = self->f->push(self, (baset*)ip);
  12104   ck_assert_ptr_ne(r2, null);
  12105   r = cropElemAtBoolO(self,3);
  12106   ck_assert(!r);
  12107   s = toStringO(self);
  12108   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12109   free(s);
  12110   // index outside
  12111   ck_assert(!cropElemAtBoolO(self, 20));
  12112   ck_assert(!cropElemAtBoolO(self, -5));
  12113   // empty list
  12114   emptyO(self);
  12115   ck_assert(!cropElemAtBoolO(self, 0));
  12116   ck_assert(!cropElemAtBoolO(self, -1));
  12117   r2 = self->f->pushUndefined(self);
  12118   ck_assert_ptr_ne(r2, null);
  12119   delElemIndexO(self,-1);
  12120   r = cropElemAtBoolO(self, 0);
  12121   ck_assert(!r);
  12122   // non json array
  12123   freeO(self);
  12124   setTypeBoolO(self);
  12125   ck_assert(!cropElemAtBoolO(self, 0));
  12126   terminateO(self);
  12127 
  12128 }
  12129 
  12130 
  12131 void cropElemAtDoubleSmallJsonT(CuTest *tc UNUSED) {
  12132 
  12133   double r;
  12134   smallJsont *self = allocSmallJson();
  12135   smallJsont *r2;
  12136 
  12137   // add elements to self
  12138   r2 = self->f->pushInt(self, 1);
  12139   ck_assert_ptr_ne(r2, null);
  12140   r2 = self->f->pushDouble(self, 2);
  12141   ck_assert_ptr_ne(r2, null);
  12142   r2 = self->f->pushInt(self, 3);
  12143   ck_assert_ptr_ne(r2, null);
  12144   r2 = self->f->pushDouble(self, 4);
  12145   ck_assert_ptr_ne(r2, null);
  12146 
  12147   // positive index
  12148   r       = cropElemAtDoubleO(self,1);
  12149   ck_assert(r==2);
  12150   char *s = toStringO(self);
  12151   ck_assert_str_eq(s, "[1,3,4.000000e+00]");
  12152   free(s);
  12153   // negative index
  12154   r = cropElemAtDoubleO(self,-1);
  12155   ck_assert(r==4);
  12156   s = toStringO(self);
  12157   ck_assert_str_eq(s, "[1,3]");
  12158   free(s);
  12159   // wrong object type
  12160   createSmallInt(I);
  12161   setValG(&I, 11);
  12162   r2 = self->f->pushSmallInt(self, &I);
  12163   r = cropElemAtDoubleO(self,2);
  12164   ck_assert(!r);
  12165   s = toStringO(self);
  12166   ck_assert_str_eq(s, "[1,3,11]");
  12167   free(s);
  12168   // wrong object type of another user class
  12169   //   User classes are stored in containers transparently
  12170   createAllocateSmallInt(ip);
  12171   ip->type = "anothertype";
  12172   setValG(ip, 11);
  12173   r2 = self->f->push(self, (baset*)ip);
  12174   ck_assert_ptr_ne(r2, null);
  12175   r = cropElemAtDoubleO(self,3);
  12176   ck_assert(!r);
  12177   s = toStringO(self);
  12178   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12179   free(s);
  12180   // index outside
  12181   ck_assert(!cropElemAtDoubleO(self, 20));
  12182   ck_assert(!cropElemAtDoubleO(self, -5));
  12183   // empty list
  12184   emptyO(self);
  12185   ck_assert(!cropElemAtDoubleO(self, 0));
  12186   ck_assert(!cropElemAtDoubleO(self, -1));
  12187   r2 = self->f->pushUndefined(self);
  12188   ck_assert_ptr_ne(r2, null);
  12189   delElemIndexO(self,-1);
  12190   r = cropElemAtDoubleO(self, 0);
  12191   ck_assert(!r);
  12192   // non json array
  12193   freeO(self);
  12194   setTypeBoolO(self);
  12195   ck_assert(!cropElemAtDoubleO(self, 0));
  12196   terminateO(self);
  12197 
  12198 }
  12199 
  12200 
  12201 void cropElemAtIntSmallJsonT(CuTest *tc UNUSED) {
  12202 
  12203   int64_t r;
  12204   smallJsont *self = allocSmallJson();
  12205   smallJsont *r2;
  12206 
  12207   // add elements to self
  12208   r2 = self->f->pushInt(self, 1);
  12209   ck_assert_ptr_ne(r2, null);
  12210   r2 = self->f->pushInt(self, 2);
  12211   ck_assert_ptr_ne(r2, null);
  12212   r2 = self->f->pushInt(self, 3);
  12213   ck_assert_ptr_ne(r2, null);
  12214   r2 = self->f->pushInt(self, 4);
  12215   ck_assert_ptr_ne(r2, null);
  12216 
  12217   // positive index
  12218   r       = cropElemAtIntO(self,1);
  12219   ck_assert(r==2);
  12220   char *s = toStringO(self);
  12221   ck_assert_str_eq(s, "[1,3,4]");
  12222   free(s);
  12223   // negative index
  12224   r = cropElemAtIntO(self,-1);
  12225   ck_assert(r==4);
  12226   s = toStringO(self);
  12227   ck_assert_str_eq(s, "[1,3]");
  12228   free(s);
  12229   // wrong object type
  12230   createSmallDouble(I);
  12231   setValG(&I, 11);
  12232   r2 = self->f->pushSmallDouble(self, &I);
  12233   r = cropElemAtIntO(self,2);
  12234   ck_assert(!r);
  12235   s = toStringO(self);
  12236   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12237   free(s);
  12238   // wrong object type of another user class
  12239   //   User classes are stored in containers transparently
  12240   createAllocateSmallInt(ip);
  12241   ip->type = "anothertype";
  12242   setValG(ip, 11);
  12243   r2 = self->f->push(self, (baset*)ip);
  12244   ck_assert_ptr_ne(r2, null);
  12245   r = cropElemAtIntO(self,3);
  12246   ck_assert(!r);
  12247   s = toStringO(self);
  12248   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12249   free(s);
  12250   // index outside
  12251   ck_assert(!cropElemAtIntO(self, 20));
  12252   ck_assert(!cropElemAtIntO(self, -5));
  12253   // empty list
  12254   emptyO(self);
  12255   ck_assert(!cropElemAtIntO(self, 0));
  12256   ck_assert(!cropElemAtIntO(self, -1));
  12257   r2 = self->f->pushUndefined(self);
  12258   ck_assert_ptr_ne(r2, null);
  12259   delElemIndexO(self,-1);
  12260   r = cropElemAtIntO(self, 0);
  12261   ck_assert(!r);
  12262   // non json array
  12263   freeO(self);
  12264   setTypeBoolO(self);
  12265   ck_assert(!cropElemAtO(self, 0));
  12266   terminateO(self);
  12267 
  12268 }
  12269 
  12270 
  12271 void cropElemAtInt32SmallJsonT(CuTest *tc UNUSED) {
  12272 
  12273   int32_t r;
  12274   smallJsont *self = allocSmallJson();
  12275   smallJsont *r2;
  12276 
  12277   // add elements to self
  12278   r2 = self->f->pushInt(self, 1);
  12279   ck_assert_ptr_ne(r2, null);
  12280   r2 = self->f->pushInt(self, 2);
  12281   ck_assert_ptr_ne(r2, null);
  12282   r2 = self->f->pushInt(self, 3);
  12283   ck_assert_ptr_ne(r2, null);
  12284   r2 = self->f->pushInt(self, 4);
  12285   ck_assert_ptr_ne(r2, null);
  12286 
  12287   // positive index
  12288   r       = cropElemAtInt32O(self,1);
  12289   ck_assert(r==2);
  12290   char *s = toStringO(self);
  12291   ck_assert_str_eq(s, "[1,3,4]");
  12292   free(s);
  12293   // negative index
  12294   r = cropElemAtInt32O(self,-1);
  12295   ck_assert(r==4);
  12296   s = toStringO(self);
  12297   ck_assert_str_eq(s, "[1,3]");
  12298   free(s);
  12299   // wrong object type
  12300   createSmallDouble(I);
  12301   setValG(&I, 11);
  12302   r2 = self->f->pushSmallDouble(self, &I);
  12303   r = cropElemAtInt32O(self,2);
  12304   ck_assert(!r);
  12305   s = toStringO(self);
  12306   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12307   free(s);
  12308   // wrong object type of another user class
  12309   //   User classes are stored in containers transparently
  12310   createAllocateSmallInt(ip);
  12311   ip->type = "anothertype";
  12312   setValG(ip, 11);
  12313   r2 = self->f->push(self, (baset*)ip);
  12314   ck_assert_ptr_ne(r2, null);
  12315   r = cropElemAtInt32O(self,3);
  12316   ck_assert(!r);
  12317   s = toStringO(self);
  12318   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12319   free(s);
  12320   // index outside
  12321   ck_assert(!cropElemAtInt32O(self, 20));
  12322   ck_assert(!cropElemAtInt32O(self, -5));
  12323   // empty list
  12324   emptyO(self);
  12325   ck_assert(!cropElemAtInt32O(self, 0));
  12326   ck_assert(!cropElemAtInt32O(self, -1));
  12327   r2 = self->f->pushUndefined(self);
  12328   ck_assert_ptr_ne(r2, null);
  12329   delElemIndexO(self,-1);
  12330   r = cropElemAtInt32O(self, 0);
  12331   ck_assert(!r);
  12332   // non json array
  12333   freeO(self);
  12334   setTypeBoolO(self);
  12335   ck_assert(!cropElemAtO(self, 0));
  12336   terminateO(self);
  12337 
  12338 }
  12339 
  12340 
  12341 void cropElemAtUintSmallJsonT(CuTest *tc UNUSED) {
  12342 
  12343   uint64_t r;
  12344   smallJsont *self = allocSmallJson();
  12345   smallJsont *r2;
  12346 
  12347   // add elements to self
  12348   r2 = self->f->pushInt(self, 1);
  12349   ck_assert_ptr_ne(r2, null);
  12350   r2 = self->f->pushInt(self, 2);
  12351   ck_assert_ptr_ne(r2, null);
  12352   r2 = self->f->pushInt(self, 3);
  12353   ck_assert_ptr_ne(r2, null);
  12354   r2 = self->f->pushInt(self, 4);
  12355   ck_assert_ptr_ne(r2, null);
  12356 
  12357   // positive index
  12358   r       = cropElemAtUintO(self,1);
  12359   ck_assert(r==2);
  12360   char *s = toStringO(self);
  12361   ck_assert_str_eq(s, "[1,3,4]");
  12362   free(s);
  12363   // negative index
  12364   r = cropElemAtUintO(self,-1);
  12365   ck_assert(r==4);
  12366   s = toStringO(self);
  12367   ck_assert_str_eq(s, "[1,3]");
  12368   free(s);
  12369   // wrong object type
  12370   createSmallDouble(I);
  12371   setValG(&I, 11);
  12372   r2 = self->f->pushSmallDouble(self, &I);
  12373   r = cropElemAtUintO(self,2);
  12374   ck_assert(!r);
  12375   s = toStringO(self);
  12376   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12377   free(s);
  12378   // wrong object type of another user class
  12379   //   User classes are stored in containers transparently
  12380   createAllocateSmallInt(ip);
  12381   ip->type = "anothertype";
  12382   setValG(ip, 11);
  12383   r2 = self->f->push(self, (baset*)ip);
  12384   ck_assert_ptr_ne(r2, null);
  12385   r = cropElemAtUintO(self,3);
  12386   ck_assert(!r);
  12387   s = toStringO(self);
  12388   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12389   free(s);
  12390   // index outside
  12391   ck_assert(!cropElemAtUintO(self, 20));
  12392   ck_assert(!cropElemAtUintO(self, -5));
  12393   // empty list
  12394   emptyO(self);
  12395   ck_assert(!cropElemAtUintO(self, 0));
  12396   ck_assert(!cropElemAtUintO(self, -1));
  12397   r2 = self->f->pushUndefined(self);
  12398   ck_assert_ptr_ne(r2, null);
  12399   delElemIndexO(self,-1);
  12400   r = cropElemAtUintO(self, 0);
  12401   ck_assert(!r);
  12402   // non json array
  12403   freeO(self);
  12404   setTypeBoolO(self);
  12405   ck_assert(!cropElemAtUintO(self, 0));
  12406   terminateO(self);
  12407 
  12408 }
  12409 
  12410 
  12411 void cropElemAtUint32SmallJsonT(CuTest *tc UNUSED) {
  12412 
  12413   uint32_t r;
  12414   smallJsont *self = allocSmallJson();
  12415   smallJsont *r2;
  12416 
  12417   // add elements to self
  12418   r2 = self->f->pushInt(self, 1);
  12419   ck_assert_ptr_ne(r2, null);
  12420   r2 = self->f->pushInt(self, 2);
  12421   ck_assert_ptr_ne(r2, null);
  12422   r2 = self->f->pushInt(self, 3);
  12423   ck_assert_ptr_ne(r2, null);
  12424   r2 = self->f->pushInt(self, 4);
  12425   ck_assert_ptr_ne(r2, null);
  12426 
  12427   // positive index
  12428   r       = cropElemAtUint32O(self,1);
  12429   ck_assert(r==2);
  12430   char *s = toStringO(self);
  12431   ck_assert_str_eq(s, "[1,3,4]");
  12432   free(s);
  12433   // negative index
  12434   r = cropElemAtUint32O(self,-1);
  12435   ck_assert(r==4);
  12436   s = toStringO(self);
  12437   ck_assert_str_eq(s, "[1,3]");
  12438   free(s);
  12439   // wrong object type
  12440   createSmallDouble(I);
  12441   setValG(&I, 11);
  12442   r2 = self->f->pushSmallDouble(self, &I);
  12443   r = cropElemAtUint32O(self,2);
  12444   ck_assert(!r);
  12445   s = toStringO(self);
  12446   ck_assert_str_eq(s, "[1,3,1.100000e+01]");
  12447   free(s);
  12448   // wrong object type of another user class
  12449   //   User classes are stored in containers transparently
  12450   createAllocateSmallInt(ip);
  12451   ip->type = "anothertype";
  12452   setValG(ip, 11);
  12453   r2 = self->f->push(self, (baset*)ip);
  12454   ck_assert_ptr_ne(r2, null);
  12455   r = cropElemAtUint32O(self,3);
  12456   ck_assert(!r);
  12457   s = toStringO(self);
  12458   ck_assert_str_eq(s, "[1,3,1.100000e+01,\"<data container>\"]");
  12459   free(s);
  12460   // index outside
  12461   ck_assert(!cropElemAtUint32O(self, 20));
  12462   ck_assert(!cropElemAtUint32O(self, -5));
  12463   // empty list
  12464   emptyO(self);
  12465   ck_assert(!cropElemAtUint32O(self, 0));
  12466   ck_assert(!cropElemAtUint32O(self, -1));
  12467   r2 = self->f->pushUndefined(self);
  12468   ck_assert_ptr_ne(r2, null);
  12469   delElemIndexO(self,-1);
  12470   r = cropElemAtUint32O(self, 0);
  12471   ck_assert(!r);
  12472   // non json array
  12473   freeO(self);
  12474   setTypeBoolO(self);
  12475   ck_assert(!cropElemAtUint32O(self, 0));
  12476   terminateO(self);
  12477 
  12478 }
  12479 
  12480 
  12481 void cropElemAtSSmallJsonT(CuTest *tc UNUSED) {
  12482 
  12483   char* r;
  12484   smallJsont *self = allocSmallJson();
  12485   smallJsont *r2;
  12486 
  12487   // add elements to self
  12488   r2 = self->f->pushInt(self, 1);
  12489   ck_assert_ptr_ne(r2, null);
  12490   r2 = self->f->pushS(self, "2");
  12491   ck_assert_ptr_ne(r2, null);
  12492   r2 = self->f->pushInt(self, 3);
  12493   ck_assert_ptr_ne(r2, null);
  12494   r2 = self->f->pushS(self, "4");
  12495   ck_assert_ptr_ne(r2, null);
  12496 
  12497   // positive index
  12498   r       = cropElemAtSO(self,1);
  12499   ck_assert_ptr_ne(r, null);
  12500   ck_assert_str_eq(r, "2");
  12501   free(r);
  12502   char *s = toStringO(self);
  12503   ck_assert_str_eq(s, "[1,3,\"4\"]");
  12504   free(s);
  12505   // negative index
  12506   r = cropElemAtSO(self,-1);
  12507   ck_assert_ptr_ne(r, null);
  12508   ck_assert_str_eq(r, "4");
  12509   free(r);
  12510   s = toStringO(self);
  12511   ck_assert_str_eq(s, "[1,3]");
  12512   free(s);
  12513   // wrong object type
  12514   createSmallInt(I);
  12515   setValG(&I, 11);
  12516   r2 = self->f->pushSmallInt(self, &I);
  12517   r = cropElemAtSO(self,2);
  12518   ck_assert_ptr_eq(r, NULL);
  12519   s = toStringO(self);
  12520   ck_assert_str_eq(s, "[1,3,11]");
  12521   free(s);
  12522   // wrong object type of another user class
  12523   //   User classes are stored in containers transparently
  12524   createAllocateSmallInt(ip);
  12525   ip->type = "anothertype";
  12526   setValG(ip, 11);
  12527   r2 = self->f->push(self, (baset*)ip);
  12528   ck_assert_ptr_ne(r2, null);
  12529   r = cropElemAtSO(self,3);
  12530   ck_assert_ptr_eq(r, NULL);
  12531   s = toStringO(self);
  12532   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12533   free(s);
  12534   // index outside
  12535   ck_assert_ptr_eq(cropElemAtSO(self, 20), NULL);
  12536   ck_assert_ptr_eq(cropElemAtSO(self, -5), NULL);
  12537   // empty list
  12538   emptyO(self);
  12539   ck_assert_ptr_eq(cropElemAtSO(self, 0), NULL);
  12540   ck_assert_ptr_eq(cropElemAtSO(self, -1), NULL);
  12541   r2 = self->f->pushUndefined(self);
  12542   ck_assert_ptr_ne(r2, null);
  12543   delElemIndexO(self,-1);
  12544   r = cropElemAtSO(self, 0);
  12545   ck_assert_ptr_eq(r, null);
  12546   // non json array
  12547   freeO(self);
  12548   setTypeBoolO(self);
  12549   ck_assert_ptr_eq(cropElemAtSO(self, 0), NULL);
  12550   terminateO(self);
  12551 
  12552 }
  12553 
  12554 
  12555 void cropElemAtCharSmallJsonT(CuTest *tc UNUSED) {
  12556 
  12557   char r;
  12558   smallJsont *self = allocSmallJson();
  12559   setTopSO(self, "");
  12560 
  12561   // crop
  12562   freeO(self);
  12563   setTopSO(self, "sheepy");
  12564   r = cropElemAtCharO(self, 0);
  12565   ck_assert_int_eq(r, 's');
  12566   ck_assert_str_eq(sjGet(self), "heepy");
  12567   freeO(self);
  12568   setTopSO(self, "sheepy");
  12569   r = cropElemAtCharO(self, 5);
  12570   ck_assert_int_eq(r, 'y');
  12571   ck_assert_str_eq(sjGet(self), "sheep");
  12572   // negative index
  12573   freeO(self);
  12574   setTopSO(self, "sheepy");
  12575   r = cropElemAtCharO(self, -1);
  12576   ck_assert_int_eq(r, 'y');
  12577   ck_assert_str_eq(sjGet(self), "sheep");
  12578   freeO(self);
  12579   setTopSO(self, "sheepy");
  12580   r = cropElemAtCharO(self, -6);
  12581   ck_assert_int_eq(r, 's');
  12582   ck_assert_str_eq(sjGet(self), "heepy");
  12583   // index outside string
  12584   freeO(self);
  12585   setTopSO(self, "sheepy");
  12586   r = cropElemAtCharO(self, 6);
  12587   ck_assert_int_eq(r, 0);
  12588   ck_assert_str_eq(sjGet(self), "sheepy");
  12589   freeO(self);
  12590   setTopSO(self, "sheepy");
  12591   r = cropElemAtCharO(self, -7);
  12592   ck_assert_int_eq(r, 0);
  12593   ck_assert_str_eq(sjGet(self), "sheepy");
  12594   // null string
  12595   freeO(self);
  12596   ck_assert_int_eq(cropElemAtCharO(self, 0), 0);
  12597   terminateO(self);
  12598 
  12599 }
  12600 
  12601 
  12602 void cropElemAtDictSmallJsonT(CuTest *tc UNUSED) {
  12603 
  12604   smallDictt* r;
  12605   smallJsont *self = allocSmallJson();
  12606   smallJsont *r2;
  12607 
  12608   // add elements to self
  12609   r2 = self->f->pushInt(self, 1);
  12610   ck_assert_ptr_ne(r2, null);
  12611   createSmallDict(e2);
  12612   r2 = self->f->pushDict(self, &e2);
  12613   ck_assert_ptr_ne(r2, null);
  12614   r2 = self->f->pushInt(self, 3);
  12615   ck_assert_ptr_ne(r2, null);
  12616   createSmallDict(e4);
  12617   r2 = self->f->pushDict(self, &e4);
  12618   ck_assert_ptr_ne(r2, null);
  12619 
  12620   // positive index
  12621   r       = cropElemAtDictO(self,1);
  12622   ck_assert_ptr_ne(r, null);
  12623   char *s = toStringO(r);
  12624   terminateO(r);
  12625   ck_assert_str_eq(s, "{}");
  12626   free(s);
  12627   s = toStringO(self);
  12628   ck_assert_str_eq(s, "[1,3,{}]");
  12629   free(s);
  12630   // negative index
  12631   r = cropElemAtDictO(self,-1);
  12632   ck_assert_ptr_ne(r, null);
  12633   s = toStringO(r);
  12634   terminateO(r);
  12635   ck_assert_str_eq(s, "{}");
  12636   free(s);
  12637   s = toStringO(self);
  12638   ck_assert_str_eq(s, "[1,3]");
  12639   free(s);
  12640   // wrong object type
  12641   createSmallInt(I);
  12642   setValG(&I, 11);
  12643   r2 = self->f->pushSmallInt(self, &I);
  12644   r = cropElemAtDictO(self,2);
  12645   ck_assert_ptr_eq(r, NULL);
  12646   s = toStringO(self);
  12647   ck_assert_str_eq(s, "[1,3,11]");
  12648   free(s);
  12649   // wrong object type of another user class
  12650   //   User classes are stored in containers transparently
  12651   createAllocateSmallInt(ip);
  12652   ip->type = "anothertype";
  12653   setValG(ip, 11);
  12654   r2 = self->f->push(self, (baset*)ip);
  12655   ck_assert_ptr_ne(r2, null);
  12656   r = cropElemAtDictO(self,3);
  12657   ck_assert_ptr_eq(r, NULL);
  12658   s = toStringO(self);
  12659   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12660   free(s);
  12661   // index outside
  12662   ck_assert_ptr_eq(cropElemAtDictO(self, 20), NULL);
  12663   ck_assert_ptr_eq(cropElemAtDictO(self, -5), NULL);
  12664   // empty list
  12665   emptyO(self);
  12666   ck_assert_ptr_eq(cropElemAtDictO(self, 0), NULL);
  12667   ck_assert_ptr_eq(cropElemAtDictO(self, -1), NULL);
  12668   r2 = self->f->pushUndefined(self);
  12669   ck_assert_ptr_ne(r2, null);
  12670   delElemIndexO(self,-1);
  12671   r = cropElemAtDictO(self, 0);
  12672   ck_assert_ptr_eq(r, null);
  12673   // non json array
  12674   freeO(self);
  12675   setTypeBoolO(self);
  12676   ck_assert_ptr_eq(cropElemAtDictO(self, 0), NULL);
  12677   terminateO(self);
  12678 
  12679 }
  12680 
  12681 
  12682 void cropElemAtArraySmallJsonT(CuTest *tc UNUSED) {
  12683 
  12684   smallArrayt* r;
  12685   smallJsont *self = allocSmallJson();
  12686   smallJsont *r2;
  12687 
  12688   // add elements to self
  12689   r2 = self->f->pushInt(self, 1);
  12690   ck_assert_ptr_ne(r2, null);
  12691   createSmallArray(e2);
  12692   r2 = self->f->pushArray(self, &e2);
  12693   ck_assert_ptr_ne(r2, null);
  12694   r2 = self->f->pushInt(self, 3);
  12695   ck_assert_ptr_ne(r2, null);
  12696   createSmallArray(e4);
  12697   r2 = self->f->pushArray(self, &e4);
  12698   ck_assert_ptr_ne(r2, null);
  12699 
  12700   // positive index
  12701   r       = cropElemAtArrayO(self,1);
  12702   ck_assert_ptr_ne(r, null);
  12703   char *s = toStringO(r);
  12704   terminateO(r);
  12705   ck_assert_str_eq(s, "[]");
  12706   free(s);
  12707   s = toStringO(self);
  12708   ck_assert_str_eq(s, "[1,3,[]]");
  12709   free(s);
  12710   // negative index
  12711   r = cropElemAtArrayO(self,-1);
  12712   ck_assert_ptr_ne(r, null);
  12713   s = toStringO(r);
  12714   terminateO(r);
  12715   ck_assert_str_eq(s, "[]");
  12716   free(s);
  12717   s = toStringO(self);
  12718   ck_assert_str_eq(s, "[1,3]");
  12719   free(s);
  12720   // wrong object type
  12721   createSmallInt(I);
  12722   setValG(&I, 11);
  12723   r2 = self->f->pushSmallInt(self, &I);
  12724   r = cropElemAtArrayO(self,2);
  12725   ck_assert_ptr_eq(r, NULL);
  12726   s = toStringO(self);
  12727   ck_assert_str_eq(s, "[1,3,11]");
  12728   free(s);
  12729   // wrong object type of another user class
  12730   //   User classes are stored in containers transparently
  12731   createAllocateSmallInt(ip);
  12732   ip->type = "anothertype";
  12733   setValG(ip, 11);
  12734   r2 = self->f->push(self, (baset*)ip);
  12735   ck_assert_ptr_ne(r2, null);
  12736   r = cropElemAtArrayO(self,3);
  12737   ck_assert_ptr_eq(r, NULL);
  12738   s = toStringO(self);
  12739   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12740   free(s);
  12741   // index outside
  12742   ck_assert_ptr_eq(cropElemAtArrayO(self, 20), NULL);
  12743   ck_assert_ptr_eq(cropElemAtArrayO(self, -5), NULL);
  12744   // empty list
  12745   emptyO(self);
  12746   ck_assert_ptr_eq(cropElemAtArrayO(self, 0), NULL);
  12747   ck_assert_ptr_eq(cropElemAtArrayO(self, -1), NULL);
  12748   r2 = self->f->pushUndefined(self);
  12749   ck_assert_ptr_ne(r2, null);
  12750   delElemIndexO(self,-1);
  12751   r = cropElemAtArrayO(self, 0);
  12752   ck_assert_ptr_eq(r, null);
  12753   // non json array
  12754   freeO(self);
  12755   setTypeBoolO(self);
  12756   ck_assert_ptr_eq(cropElemAtArrayO(self, 0), NULL);
  12757   terminateO(self);
  12758 
  12759 }
  12760 
  12761 
  12762 void cropElemAtSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  12763 
  12764   smallBoolt* r;
  12765   smallJsont *self = allocSmallJson();
  12766   smallJsont *r2;
  12767 
  12768   // add elements to self
  12769   r2 = self->f->pushInt(self, 1);
  12770   ck_assert_ptr_ne(r2, null);
  12771   createSmallBool(e2);
  12772   r2 = self->f->pushBool(self, true);
  12773   ck_assert_ptr_ne(r2, null);
  12774   r2 = self->f->pushInt(self, 3);
  12775   ck_assert_ptr_ne(r2, null);
  12776   createSmallBool(e4);
  12777   r2 = self->f->pushBool(self, true);
  12778   ck_assert_ptr_ne(r2, null);
  12779 
  12780   // positive index
  12781   r       = cropElemAtSmallBoolO(self,1);
  12782   ck_assert_ptr_ne(r, null);
  12783   char *s = toStringO(r);
  12784   terminateO(r);
  12785   ck_assert_str_eq(s, "true");
  12786   free(s);
  12787   s = toStringO(self);
  12788   ck_assert_str_eq(s, "[1,3,true]");
  12789   free(s);
  12790   // negative index
  12791   r = cropElemAtSmallBoolO(self,-1);
  12792   ck_assert_ptr_ne(r, null);
  12793   s = toStringO(r);
  12794   terminateO(r);
  12795   ck_assert_str_eq(s, "true");
  12796   free(s);
  12797   s = toStringO(self);
  12798   ck_assert_str_eq(s, "[1,3]");
  12799   free(s);
  12800   // wrong object type
  12801   createSmallInt(I);
  12802   setValG(&I, 11);
  12803   r2 = self->f->pushSmallInt(self, &I);
  12804   r = cropElemAtSmallBoolO(self,2);
  12805   ck_assert_ptr_eq(r, NULL);
  12806   s = toStringO(self);
  12807   ck_assert_str_eq(s, "[1,3,11]");
  12808   free(s);
  12809   // wrong object type of another user class
  12810   //   User classes are stored in containers transparently
  12811   createAllocateSmallInt(ip);
  12812   ip->type = "anothertype";
  12813   setValG(ip, 11);
  12814   r2 = self->f->push(self, (baset*)ip);
  12815   ck_assert_ptr_ne(r2, null);
  12816   r = cropElemAtSmallBoolO(self,3);
  12817   ck_assert_ptr_eq(r, NULL);
  12818   s = toStringO(self);
  12819   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12820   free(s);
  12821   // index outside
  12822   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 20), NULL);
  12823   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, -5), NULL);
  12824   // empty list
  12825   emptyO(self);
  12826   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 0), NULL);
  12827   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, -1), NULL);
  12828   r2 = self->f->pushUndefined(self);
  12829   ck_assert_ptr_ne(r2, null);
  12830   delElemIndexO(self,-1);
  12831   r = cropElemAtSmallBoolO(self, 0);
  12832   ck_assert_ptr_eq(r, null);
  12833   // non json array
  12834   freeO(self);
  12835   setTypeBoolO(self);
  12836   ck_assert_ptr_eq(cropElemAtSmallBoolO(self, 0), NULL);
  12837   terminateO(self);
  12838 
  12839 }
  12840 
  12841 
  12842 void cropElemAtSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  12843 
  12844   smallBytest* r;
  12845   smallJsont *self = allocSmallJson();
  12846   smallJsont *r2;
  12847 
  12848   // add elements to self
  12849   r2 = self->f->pushInt(self, 1);
  12850   ck_assert_ptr_ne(r2, null);
  12851   createSmallBytes(e2);
  12852   r2 = self->f->pushSmallBytes(self, &e2);
  12853   ck_assert_ptr_ne(r2, null);
  12854   r2 = self->f->pushInt(self, 3);
  12855   ck_assert_ptr_ne(r2, null);
  12856   createSmallBytes(e4);
  12857   r2 = self->f->pushSmallBytes(self, &e4);
  12858   ck_assert_ptr_ne(r2, null);
  12859 
  12860   // positive index
  12861   r       = cropElemAtSmallBytesO(self,1);
  12862   ck_assert_ptr_ne(r, null);
  12863   char *s = toStringO(r);
  12864   terminateO(r);
  12865   ck_assert_str_eq(s, "[]");
  12866   free(s);
  12867   s = toStringO(self);
  12868   ck_assert_str_eq(s, "[1,3,[]]");
  12869   free(s);
  12870   // negative index
  12871   r = cropElemAtSmallBytesO(self,-1);
  12872   ck_assert_ptr_ne(r, null);
  12873   s = toStringO(r);
  12874   terminateO(r);
  12875   ck_assert_str_eq(s, "[]");
  12876   free(s);
  12877   s = toStringO(self);
  12878   ck_assert_str_eq(s, "[1,3]");
  12879   free(s);
  12880   // wrong object type
  12881   createSmallInt(I);
  12882   setValG(&I, 11);
  12883   r2 = self->f->pushSmallInt(self, &I);
  12884   r = cropElemAtSmallBytesO(self,2);
  12885   ck_assert_ptr_eq(r, NULL);
  12886   s = toStringO(self);
  12887   ck_assert_str_eq(s, "[1,3,11]");
  12888   free(s);
  12889   // wrong object type of another user class
  12890   //   User classes are stored in containers transparently
  12891   createAllocateSmallInt(ip);
  12892   ip->type = "anothertype";
  12893   setValG(ip, 11);
  12894   r2 = self->f->push(self, (baset*)ip);
  12895   ck_assert_ptr_ne(r2, null);
  12896   r = cropElemAtSmallBytesO(self,3);
  12897   ck_assert_ptr_eq(r, NULL);
  12898   s = toStringO(self);
  12899   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12900   free(s);
  12901   // index outside
  12902   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 20), NULL);
  12903   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, -5), NULL);
  12904   // empty list
  12905   emptyO(self);
  12906   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 0), NULL);
  12907   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, -1), NULL);
  12908   r2 = self->f->pushUndefined(self);
  12909   ck_assert_ptr_ne(r2, null);
  12910   delElemIndexO(self,-1);
  12911   r = cropElemAtSmallBytesO(self, 0);
  12912   ck_assert_ptr_eq(r, null);
  12913   // non json array
  12914   freeO(self);
  12915   setTypeBoolO(self);
  12916   ck_assert_ptr_eq(cropElemAtSmallBytesO(self, 0), NULL);
  12917   terminateO(self);
  12918 
  12919 }
  12920 
  12921 
  12922 void cropElemAtSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  12923 
  12924   smallDoublet* r;
  12925   smallJsont *self = allocSmallJson();
  12926   smallJsont *r2;
  12927 
  12928   // add elements to self
  12929   r2 = self->f->pushInt(self, 1);
  12930   ck_assert_ptr_ne(r2, null);
  12931   createSmallDouble(e2);
  12932   r2 = self->f->pushSmallDouble(self, &e2);
  12933   ck_assert_ptr_ne(r2, null);
  12934   r2 = self->f->pushInt(self, 3);
  12935   ck_assert_ptr_ne(r2, null);
  12936   createSmallDouble(e4);
  12937   r2 = self->f->pushSmallDouble(self, &e4);
  12938   ck_assert_ptr_ne(r2, null);
  12939 
  12940   // positive index
  12941   r       = cropElemAtSmallDoubleO(self,1);
  12942   ck_assert_ptr_ne(r, null);
  12943   char *s = toStringO(r);
  12944   terminateO(r);
  12945   ck_assert_str_eq(s, "0.000000e+00");
  12946   free(s);
  12947   s = toStringO(self);
  12948   ck_assert_str_eq(s, "[1,3,0.000000e+00]");
  12949   free(s);
  12950   // negative index
  12951   r = cropElemAtSmallDoubleO(self,-1);
  12952   ck_assert_ptr_ne(r, null);
  12953   s = toStringO(r);
  12954   terminateO(r);
  12955   ck_assert_str_eq(s, "0.000000e+00");
  12956   free(s);
  12957   s = toStringO(self);
  12958   ck_assert_str_eq(s, "[1,3]");
  12959   free(s);
  12960   // wrong object type
  12961   createSmallInt(I);
  12962   setValG(&I, 11);
  12963   r2 = self->f->pushSmallInt(self, &I);
  12964   r = cropElemAtSmallDoubleO(self,2);
  12965   ck_assert_ptr_eq(r, NULL);
  12966   s = toStringO(self);
  12967   ck_assert_str_eq(s, "[1,3,11]");
  12968   free(s);
  12969   // wrong object type of another user class
  12970   //   User classes are stored in containers transparently
  12971   createAllocateSmallInt(ip);
  12972   ip->type = "anothertype";
  12973   setValG(ip, 11);
  12974   r2 = self->f->push(self, (baset*)ip);
  12975   ck_assert_ptr_ne(r2, null);
  12976   r = cropElemAtSmallDoubleO(self,3);
  12977   ck_assert_ptr_eq(r, NULL);
  12978   s = toStringO(self);
  12979   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  12980   free(s);
  12981   // index outside
  12982   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 20), NULL);
  12983   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, -5), NULL);
  12984   // empty list
  12985   emptyO(self);
  12986   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 0), NULL);
  12987   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, -1), NULL);
  12988   r2 = self->f->pushUndefined(self);
  12989   ck_assert_ptr_ne(r2, null);
  12990   delElemIndexO(self,-1);
  12991   r = cropElemAtSmallDoubleO(self, 0);
  12992   ck_assert_ptr_eq(r, null);
  12993   // non json array
  12994   freeO(self);
  12995   setTypeBoolO(self);
  12996   ck_assert_ptr_eq(cropElemAtSmallDoubleO(self, 0), NULL);
  12997   terminateO(self);
  12998 
  12999 }
  13000 
  13001 
  13002 void cropElemAtSmallIntSmallJsonT(CuTest *tc UNUSED) {
  13003 
  13004   smallIntt* r;
  13005   smallJsont *self = allocSmallJson();
  13006   smallJsont *r2;
  13007 
  13008   // add elements to self
  13009   r2 = self->f->pushBool(self, true);
  13010   ck_assert_ptr_ne(r2, null);
  13011   createSmallInt(e2);
  13012   r2 = self->f->pushSmallInt(self, &e2);
  13013   ck_assert_ptr_ne(r2, null);
  13014   r2 = self->f->pushBool(self, true);
  13015   ck_assert_ptr_ne(r2, null);
  13016   createSmallInt(e4);
  13017   r2 = self->f->pushSmallInt(self, &e4);
  13018   ck_assert_ptr_ne(r2, null);
  13019 
  13020   // positive index
  13021   r       = cropElemAtSmallIntO(self,1);
  13022   ck_assert_ptr_ne(r, null);
  13023   char *s = toStringO(r);
  13024   terminateO(r);
  13025   ck_assert_str_eq(s, "0");
  13026   free(s);
  13027   s = toStringO(self);
  13028   ck_assert_str_eq(s, "[true,true,0]");
  13029   free(s);
  13030   // negative index
  13031   r = cropElemAtSmallIntO(self,-1);
  13032   ck_assert_ptr_ne(r, null);
  13033   s = toStringO(r);
  13034   terminateO(r);
  13035   ck_assert_str_eq(s, "0");
  13036   free(s);
  13037   s = toStringO(self);
  13038   ck_assert_str_eq(s, "[true,true]");
  13039   free(s);
  13040   // wrong object type
  13041   createSmallDouble(I);
  13042   setValG(&I, 11);
  13043   r2 = self->f->pushSmallDouble(self, &I);
  13044   r = cropElemAtSmallIntO(self,2);
  13045   ck_assert_ptr_eq(r, NULL);
  13046   s = toStringO(self);
  13047   ck_assert_str_eq(s, "[true,true,1.100000e+01]");
  13048   free(s);
  13049   // wrong object type of another user class
  13050   //   User classes are stored in containers transparently
  13051   createAllocateSmallInt(ip);
  13052   ip->type = "anothertype";
  13053   setValG(ip, 11);
  13054   r2 = self->f->push(self, (baset*)ip);
  13055   ck_assert_ptr_ne(r2, null);
  13056   r = cropElemAtSmallIntO(self,3);
  13057   ck_assert_ptr_eq(r, NULL);
  13058   s = toStringO(self);
  13059   ck_assert_str_eq(s, "[true,true,1.100000e+01,\"<data container>\"]");
  13060   free(s);
  13061   // index outside
  13062   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 20), NULL);
  13063   ck_assert_ptr_eq(cropElemAtSmallIntO(self, -5), NULL);
  13064   // empty list
  13065   emptyO(self);
  13066   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 0), NULL);
  13067   ck_assert_ptr_eq(cropElemAtSmallIntO(self, -1), NULL);
  13068   r2 = self->f->pushUndefined(self);
  13069   ck_assert_ptr_ne(r2, null);
  13070   delElemIndexO(self,-1);
  13071   r = cropElemAtSmallIntO(self, 0);
  13072   ck_assert_ptr_eq(r, null);
  13073   // non json array
  13074   freeO(self);
  13075   setTypeBoolO(self);
  13076   ck_assert_ptr_eq(cropElemAtSmallIntO(self, 0), NULL);
  13077   terminateO(self);
  13078 
  13079 }
  13080 
  13081 
  13082 void cropElemAtSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  13083 
  13084   smallJsont* r;
  13085   smallJsont *self = allocSmallJson();
  13086   smallJsont *r2;
  13087 
  13088   // add elements to self
  13089   r2 = self->f->pushInt(self, 1);
  13090   ck_assert_ptr_ne(r2, null);
  13091   createSmallJson(e2);
  13092   r2 = self->f->pushSmallJson(self, &e2);
  13093   ck_assert_ptr_ne(r2, null);
  13094   r2 = self->f->pushInt(self, 3);
  13095   ck_assert_ptr_ne(r2, null);
  13096   createSmallJson(e4);
  13097   r2 = self->f->pushSmallJson(self, &e4);
  13098   ck_assert_ptr_ne(r2, null);
  13099 
  13100   // positive index
  13101   r       = cropElemAtSmallJsonO(self,1);
  13102   ck_assert_ptr_ne(r, null);
  13103   char *s = toStringO(r);
  13104   terminateO(r);
  13105   ck_assert_str_eq(s, "{}");
  13106   free(s);
  13107   s = toStringO(self);
  13108   ck_assert_str_eq(s, "[1,3,{}]");
  13109   free(s);
  13110   // negative index
  13111   r = cropElemAtSmallJsonO(self,-1);
  13112   ck_assert_ptr_ne(r, null);
  13113   s = toStringO(r);
  13114   terminateO(r);
  13115   ck_assert_str_eq(s, "{}");
  13116   free(s);
  13117   s = toStringO(self);
  13118   ck_assert_str_eq(s, "[1,3]");
  13119   free(s);
  13120   // wrong object type
  13121   createSmallBytes(I);
  13122   r2 = self->f->pushSmallBytes(self, &I);
  13123   r = cropElemAtSmallJsonO(self,2);
  13124   ck_assert_ptr_eq(r, NULL);
  13125   s = toStringO(self);
  13126   ck_assert_str_eq(s, "[1,3,[]]");
  13127   free(s);
  13128   // wrong object type of another user class
  13129   //   User classes are stored in containers transparently
  13130   createAllocateSmallInt(ip);
  13131   ip->type = "anothertype";
  13132   setValG(ip, 11);
  13133   r2 = self->f->push(self, (baset*)ip);
  13134   ck_assert_ptr_ne(r2, null);
  13135   r = cropElemAtSmallJsonO(self,3);
  13136   ck_assert_ptr_eq(r, NULL);
  13137   s = toStringO(self);
  13138   ck_assert_str_eq(s, "[1,3,[],\"<data container>\"]");
  13139   free(s);
  13140   // index outside
  13141   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 20), NULL);
  13142   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, -5), NULL);
  13143   // empty list
  13144   emptyO(self);
  13145   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 0), NULL);
  13146   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, -1), NULL);
  13147   r2 = self->f->pushUndefined(self);
  13148   ck_assert_ptr_ne(r2, null);
  13149   delElemIndexO(self,-1);
  13150   r = cropElemAtSmallJsonO(self, 0);
  13151   ck_assert_ptr_eq(r, null);
  13152   // non json array
  13153   freeO(self);
  13154   setTypeBoolO(self);
  13155   ck_assert_ptr_eq(cropElemAtSmallJsonO(self, 0), NULL);
  13156   terminateO(self);
  13157 
  13158 }
  13159 
  13160 
  13161 void cropElemAtSmallStringSmallJsonT(CuTest *tc UNUSED) {
  13162 
  13163   smallStringt* r;
  13164   smallJsont *self = allocSmallJson();
  13165   smallJsont *r2;
  13166 
  13167   // add elements to self
  13168   r2 = self->f->pushInt(self, 1);
  13169   ck_assert_ptr_ne(r2, null);
  13170   createSmallString(e2);
  13171   r2 = self->f->pushSmallString(self, &e2);
  13172   ck_assert_ptr_ne(r2, null);
  13173   r2 = self->f->pushInt(self, 3);
  13174   ck_assert_ptr_ne(r2, null);
  13175   createSmallString(e4);
  13176   r2 = self->f->pushSmallString(self, &e4);
  13177   ck_assert_ptr_ne(r2, null);
  13178 
  13179   // positive index
  13180   r       = cropElemAtSmallStringO(self,1);
  13181   ck_assert_ptr_ne(r, null);
  13182   char *s = toStringO(r);
  13183   terminateO(r);
  13184   ck_assert_str_eq(s, "");
  13185   free(s);
  13186   s = toStringO(self);
  13187   ck_assert_str_eq(s, "[1,3,\"\"]");
  13188   free(s);
  13189   // negative index
  13190   r = cropElemAtSmallStringO(self,-1);
  13191   ck_assert_ptr_ne(r, null);
  13192   s = toStringO(r);
  13193   terminateO(r);
  13194   ck_assert_str_eq(s, "");
  13195   free(s);
  13196   s = toStringO(self);
  13197   ck_assert_str_eq(s, "[1,3]");
  13198   free(s);
  13199   // wrong object type
  13200   createSmallInt(I);
  13201   setValG(&I, 11);
  13202   r2 = self->f->pushSmallInt(self, &I);
  13203   r = cropElemAtSmallStringO(self,2);
  13204   ck_assert_ptr_eq(r, NULL);
  13205   s = toStringO(self);
  13206   ck_assert_str_eq(s, "[1,3,11]");
  13207   free(s);
  13208   // wrong object type of another user class
  13209   //   User classes are stored in containers transparently
  13210   createAllocateSmallInt(ip);
  13211   ip->type = "anothertype";
  13212   setValG(ip, 11);
  13213   r2 = self->f->push(self, (baset*)ip);
  13214   ck_assert_ptr_ne(r2, null);
  13215   r = cropElemAtSmallStringO(self,3);
  13216   ck_assert_ptr_eq(r, NULL);
  13217   s = toStringO(self);
  13218   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13219   free(s);
  13220   // index outside
  13221   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 20), NULL);
  13222   ck_assert_ptr_eq(cropElemAtSmallStringO(self, -5), NULL);
  13223   // empty list
  13224   emptyO(self);
  13225   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 0), NULL);
  13226   ck_assert_ptr_eq(cropElemAtSmallStringO(self, -1), NULL);
  13227   r2 = self->f->pushUndefined(self);
  13228   ck_assert_ptr_ne(r2, null);
  13229   delElemIndexO(self,-1);
  13230   r = cropElemAtSmallStringO(self, 0);
  13231   ck_assert_ptr_eq(r, null);
  13232   // non json array
  13233   freeO(self);
  13234   setTypeBoolO(self);
  13235   ck_assert_ptr_eq(cropElemAtSmallStringO(self, 0), NULL);
  13236   terminateO(self);
  13237 
  13238 }
  13239 
  13240 
  13241 void cropElemAtVoidSmallJsonT(CuTest *tc UNUSED) {
  13242 
  13243   void* r;
  13244   smallJsont *self = allocSmallJson();
  13245   smallJsont *r2;
  13246 
  13247   // add elements to self
  13248   r2 = self->f->pushInt(self, 1);
  13249   ck_assert_ptr_ne(r2, null);
  13250   r2 = pushVoidSmallJsonG(self, &r);
  13251   ck_assert_ptr_ne(r2, null);
  13252   r2 = self->f->pushInt(self, 3);
  13253   ck_assert_ptr_ne(r2, null);
  13254   r2 = pushVoidSmallJsonG(self, &self);
  13255   ck_assert_ptr_ne(r2, null);
  13256 
  13257   // positive index
  13258   r       = cropElemAtVoidO(self,1);
  13259   ck_assert_ptr_eq(r, &r);
  13260   char *s = toStringO(self);
  13261   ck_assert_str_eq(s, "[1,3,\"<data container>\"]");
  13262   free(s);
  13263   // negative index
  13264   r = cropElemAtVoidO(self,-1);
  13265   ck_assert_ptr_eq(r, &self);
  13266   s = toStringO(self);
  13267   ck_assert_str_eq(s, "[1,3]");
  13268   free(s);
  13269   // wrong object type
  13270   createSmallInt(I);
  13271   setValG(&I, 11);
  13272   r2 = self->f->pushSmallInt(self, &I);
  13273   r = cropElemAtVoidO(self,2);
  13274   ck_assert_ptr_eq(r, NULL);
  13275   s = toStringO(self);
  13276   ck_assert_str_eq(s, "[1,3,11]");
  13277   free(s);
  13278   // wrong object type of another user class
  13279   //   User classes are stored in containers transparently
  13280   createAllocateSmallInt(ip);
  13281   ip->type = "anothertype";
  13282   setValG(ip, 11);
  13283   r2 = self->f->push(self, (baset*)ip);
  13284   ck_assert_ptr_ne(r2, null);
  13285   r = cropElemAtVoidO(self,3);
  13286   ck_assert_ptr_eq(r, NULL);
  13287   s = toStringO(self);
  13288   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13289   free(s);
  13290   // index outside
  13291   ck_assert_ptr_eq(cropElemAtVoidO(self, 20), NULL);
  13292   ck_assert_ptr_eq(cropElemAtVoidO(self, -5), NULL);
  13293   // empty list
  13294   emptyO(self);
  13295   ck_assert_ptr_eq(cropElemAtVoidO(self, 0), NULL);
  13296   ck_assert_ptr_eq(cropElemAtVoidO(self, -1), NULL);
  13297   r2 = self->f->pushUndefined(self);
  13298   ck_assert_ptr_ne(r2, null);
  13299   delElemIndexO(self,-1);
  13300   r = cropElemAtVoidO(self, 0);
  13301   ck_assert_ptr_eq(r, null);
  13302   // non json array
  13303   freeO(self);
  13304   setTypeBoolO(self);
  13305   ck_assert_ptr_eq(cropElemAtVoidO(self, 0), NULL);
  13306   terminateO(self);
  13307 
  13308 }
  13309 
  13310 
  13311 void cropElemAtSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  13312 
  13313   smallContainert* r;
  13314   smallJsont *self = allocSmallJson();
  13315   smallJsont *r2;
  13316 
  13317   // add elements to self
  13318   r2 = self->f->pushInt(self, 1);
  13319   ck_assert_ptr_ne(r2, null);
  13320   createSmallContainer(e2);
  13321   r2 = self->f->pushSmallContainer(self, &e2);
  13322   ck_assert_ptr_ne(r2, null);
  13323   r2 = self->f->pushInt(self, 3);
  13324   ck_assert_ptr_ne(r2, null);
  13325   createSmallContainer(e4);
  13326   r2 = self->f->pushSmallContainer(self, &e4);
  13327   ck_assert_ptr_ne(r2, null);
  13328 
  13329   // positive index
  13330   r       = cropElemAtSmallContainerO(self,1);
  13331   ck_assert_ptr_ne(r, null);
  13332   char *s = toStringO(r);
  13333   terminateO(r);
  13334   ck_assert_str_eq(s, "<data smallContainer>");
  13335   free(s);
  13336   s = toStringO(self);
  13337   ck_assert_str_eq(s, "[1,3,\"<data container>\"]");
  13338   free(s);
  13339   // negative index
  13340   r = cropElemAtSmallContainerO(self,-1);
  13341   ck_assert_ptr_ne(r, null);
  13342   s = toStringO(r);
  13343   terminateO(r);
  13344   ck_assert_str_eq(s, "<data smallContainer>");
  13345   free(s);
  13346   s = toStringO(self);
  13347   ck_assert_str_eq(s, "[1,3]");
  13348   free(s);
  13349   // wrong object type
  13350   createSmallInt(I);
  13351   setValG(&I, 11);
  13352   r2 = self->f->pushSmallInt(self, &I);
  13353   r = cropElemAtSmallContainerO(self,2);
  13354   ck_assert_ptr_eq(r, NULL);
  13355   s = toStringO(self);
  13356   ck_assert_str_eq(s, "[1,3,11]");
  13357   free(s);
  13358   // wrong object type of another user class
  13359   //   User classes are stored in containers transparently
  13360   createAllocateSmallInt(ip);
  13361   ip->type = "anothertype";
  13362   setValG(ip, 11);
  13363   r2 = self->f->push(self, (baset*)ip);
  13364   ck_assert_ptr_ne(r2, null);
  13365   r = cropElemAtSmallContainerO(self,3);
  13366   ck_assert_ptr_eq(r, NULL);
  13367   s = toStringO(self);
  13368   ck_assert_str_eq(s, "[1,3,11,\"<data container>\"]");
  13369   free(s);
  13370   // index outside
  13371   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 20), NULL);
  13372   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, -5), NULL);
  13373   // empty list
  13374   emptyO(self);
  13375   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 0), NULL);
  13376   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, -1), NULL);
  13377   r2 = self->f->pushUndefined(self);
  13378   ck_assert_ptr_ne(r2, null);
  13379   delElemIndexO(self,-1);
  13380   r = cropElemAtSmallContainerO(self, 0);
  13381   ck_assert_ptr_eq(r, null);
  13382   // non json array
  13383   freeO(self);
  13384   setTypeBoolO(self);
  13385   ck_assert_ptr_eq(cropElemAtSmallContainerO(self, 0), NULL);
  13386   terminateO(self);
  13387 
  13388 }
  13389 
  13390 
  13391 void cropElemKeySmallJsonT(CuTest *tc UNUSED) {
  13392 
  13393   baset* r;
  13394   smallJsont *self = allocSmallJson();
  13395   smallJsont *r2;
  13396 
  13397   r2 = self->f->setInt(self, "1", 1);
  13398   ck_assert_ptr_ne(r2, null);
  13399   r2 = self->f->setDouble(self, "2", 2.2);
  13400   ck_assert_ptr_ne(r2, null);
  13401   r2 = self->f->setS(self, "3", "2");
  13402   ck_assert_ptr_ne(r2, null);
  13403   r2 = self->f->setUndefined(self, "u");
  13404   ck_assert_ptr_ne(r2, null);
  13405   createSmallContainer(c);
  13406   r2 = self->f->setSmallContainer(self, "c", &c);
  13407   ck_assert_ptr_ne(r2, null);
  13408   createAllocateSmallInt(I);
  13409   setValG(I, 11);
  13410   I->type = "anothertype";
  13411   r2 = self->f->set(self, "b", (baset*)I);
  13412   ck_assert_ptr_ne(r2, null);
  13413   // get int
  13414   r = cropElemKeyO(self, "3");
  13415   ck_assert_ptr_ne(r, null);
  13416   char *s = toStringO(r);
  13417   terminateO(r);
  13418   ck_assert_str_eq(s, "2");
  13419   free(s);
  13420   s = toStringO(self);
  13421   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  13422   free(s);
  13423   // undefined object
  13424   r = cropElemKeyO(self, "u");
  13425   ck_assert_ptr_ne(r, null);
  13426   s = toStringO(r);
  13427   terminateO(r);
  13428   ck_assert_str_eq(s, "null");
  13429   free(s);
  13430   s = toStringO(self);
  13431   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  13432   free(s);
  13433   // container
  13434   r = cropElemKeyO(self, "c");
  13435   ck_assert_ptr_ne(r, null);
  13436   s = toStringO(r);
  13437   terminateO(r);
  13438   ck_assert_str_eq(s, "<data smallContainer>");
  13439   free(s);
  13440   s = toStringO(self);
  13441   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"b\":\"<data container>\"}");
  13442   free(s);
  13443   // base object in container
  13444   r = cropElemKeyO(self, "b");
  13445   ck_assert_ptr_ne(r, null);
  13446   s = toStringO(r);
  13447   terminateO(r);
  13448   ck_assert_str_eq(s, "11");
  13449   free(s);
  13450   s = toStringO(self);
  13451   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13452   free(s);
  13453   // non existing key
  13454   r = cropElemKeyO(self, "qwe");
  13455   ck_assert_ptr_eq(r, null);
  13456   // null key
  13457   r = cropElemKeyO(self, null);
  13458   ck_assert_ptr_eq(r, null);
  13459 	// empty self
  13460   freeO(self);
  13461   r = cropElemKeyO(self, "1");
  13462   ck_assert_ptr_eq(r, null);
  13463   terminateO(self);
  13464 
  13465 }
  13466 
  13467 
  13468 void cropElemKeyUndefinedSmallJsonT(CuTest *tc UNUSED) {
  13469 
  13470   undefinedt* r;
  13471   smallJsont *self = allocSmallJson();
  13472   smallJsont *r2;
  13473 
  13474   r2 = self->f->setInt(self, "1", 1);
  13475   ck_assert_ptr_ne(r2, null);
  13476   r2 = self->f->setDouble(self, "2", 2.2);
  13477   ck_assert_ptr_ne(r2, null);
  13478   r2 = self->f->setUndefined(self, "u");
  13479   ck_assert_ptr_ne(r2, null);
  13480   r = cropElemKeyUndefinedO(self, "u");
  13481   ck_assert_ptr_ne(r, null);
  13482   char *s = toStringO(r);
  13483   terminateO(r);
  13484   ck_assert_str_eq(s, "null");
  13485   free(s);
  13486   s = toStringO(self);
  13487   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13488   free(s);
  13489   // wrong object type
  13490   r = cropElemKeyUndefinedO(self, "1");
  13491   ck_assert_ptr_eq(r, null);
  13492   s = toStringO(self);
  13493   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  13494   free(s);
  13495   // non existing key
  13496   r = cropElemKeyUndefinedO(self, "qwe");
  13497   ck_assert_ptr_eq(r, null);
  13498   // null key
  13499   r = cropElemKeyUndefinedO(self, null);
  13500   ck_assert_ptr_eq(r, null);
  13501 	// empty self
  13502   freeO(self);
  13503   r = cropElemKeyUndefinedO(self, "1");
  13504   ck_assert_ptr_eq(r, null);
  13505   terminateO(self);
  13506 
  13507 }
  13508 
  13509 
  13510 void cropElemKeyBoolSmallJsonT(CuTest *tc UNUSED) {
  13511 
  13512   bool r;
  13513   smallJsont *self = allocSmallJson();
  13514   smallJsont *r2;
  13515 
  13516   r2 = self->f->setInt(self, "1", 1);
  13517   ck_assert_ptr_ne(r2, null);
  13518   r2 = self->f->setDouble(self, "2", 2.2);
  13519   ck_assert_ptr_ne(r2, null);
  13520   r2 = self->f->setBool(self, "b", true);
  13521   ck_assert_ptr_ne(r2, null);
  13522   createAllocateSmallInt(I);
  13523   setValG(I, 11);
  13524   I->type = "anothertype";
  13525   r2 = self->f->set(self, "B", (baset*)I);
  13526   ck_assert_ptr_ne(r2, null);
  13527   r = cropElemKeyBoolO(self, "b");
  13528   ck_assert(r);
  13529   char *s = toStringO(self);
  13530   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13531   free(s);
  13532   // wrong object type
  13533   r = cropElemKeyBoolO(self, "1");
  13534   ck_assert(!r);
  13535   s = toStringO(self);
  13536   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13537   free(s);
  13538   r = cropElemKeyBoolO(self, "B");
  13539   ck_assert(!r);
  13540   s = toStringO(self);
  13541   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13542   free(s);
  13543   // non existing key
  13544   r = cropElemKeyBoolO(self, "qwe");
  13545   ck_assert(!r);
  13546   // null key
  13547   r = cropElemKeyBoolO(self, null);
  13548   ck_assert(!r);
  13549 	// empty self
  13550   freeO(self);
  13551   r = cropElemKeyBoolO(self, "1");
  13552   ck_assert(!r);
  13553   terminateO(self);
  13554 
  13555 }
  13556 
  13557 
  13558 void cropElemKeyDoubleSmallJsonT(CuTest *tc UNUSED) {
  13559 
  13560   double r;
  13561   smallJsont *self = allocSmallJson();
  13562   smallJsont *r2;
  13563 
  13564   r2 = self->f->setInt(self, "1", 1);
  13565   ck_assert_ptr_ne(r2, null);
  13566   r2 = self->f->setDouble(self, "2", 2.2);
  13567   ck_assert_ptr_ne(r2, null);
  13568   r2 = self->f->setDouble(self, "b", 3.3);
  13569   ck_assert_ptr_ne(r2, null);
  13570   createAllocateSmallInt(I);
  13571   setValG(I, 11);
  13572   I->type = "anothertype";
  13573   r2 = self->f->set(self, "B", (baset*)I);
  13574   ck_assert_ptr_ne(r2, null);
  13575   r = cropElemKeyDoubleO(self, "b");
  13576   ck_assert(r == 3.3);
  13577   char *s = toStringO(self);
  13578   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13579   free(s);
  13580   // wrong object type
  13581   r = cropElemKeyDoubleO(self, "1");
  13582   ck_assert(!r);
  13583   s = toStringO(self);
  13584   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13585   free(s);
  13586   r = cropElemKeyDoubleO(self, "B");
  13587   ck_assert(!r);
  13588   s = toStringO(self);
  13589   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13590   free(s);
  13591   // non existing key
  13592   r = cropElemKeyDoubleO(self, "qwe");
  13593   ck_assert(!r);
  13594   // null key
  13595   r = cropElemKeyDoubleO(self, null);
  13596   ck_assert(r == 0);
  13597 	// empty self
  13598   freeO(self);
  13599   r = cropElemKeyDoubleO(self, "1");
  13600   ck_assert(r == 0);
  13601   terminateO(self);
  13602 
  13603 }
  13604 
  13605 
  13606 void cropElemKeyIntSmallJsonT(CuTest *tc UNUSED) {
  13607 
  13608   int64_t r;
  13609   smallJsont *self = allocSmallJson();
  13610   smallJsont *r2;
  13611 
  13612   r2 = self->f->setInt(self, "1", 1);
  13613   ck_assert_ptr_ne(r2, null);
  13614   r2 = self->f->setDouble(self, "2", 2.2);
  13615   ck_assert_ptr_ne(r2, null);
  13616   r2 = self->f->setInt(self, "b", 2);
  13617   ck_assert_ptr_ne(r2, null);
  13618   createAllocateSmallInt(I);
  13619   setValG(I, 11);
  13620   I->type = "anothertype";
  13621   r2 = self->f->set(self, "B", (baset*)I);
  13622   ck_assert_ptr_ne(r2, null);
  13623   r = cropElemKeyIntO(self, "b");
  13624   ck_assert_int_eq(r, 2);
  13625   char *s = toStringO(self);
  13626   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13627   free(s);
  13628   // wrong object type
  13629   r = cropElemKeyIntO(self, "2");
  13630   ck_assert(!r);
  13631   s = toStringO(self);
  13632   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13633   free(s);
  13634   r = cropElemKeyIntO(self, "B");
  13635   ck_assert(!r);
  13636   s = toStringO(self);
  13637   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13638   free(s);
  13639   // non existing key
  13640   r = cropElemKeyIntO(self, "qwe");
  13641   ck_assert(!r);
  13642   // null key
  13643   r = cropElemKeyIntO(self, null);
  13644   ck_assert_int_eq(r, 0);
  13645 	// empty self
  13646   freeO(self);
  13647   r = cropElemKeyIntO(self, "1");
  13648   ck_assert_int_eq(r, 0);
  13649   terminateO(self);
  13650 
  13651 }
  13652 
  13653 
  13654 void cropElemKeyInt32SmallJsonT(CuTest *tc UNUSED) {
  13655 
  13656   int32_t r;
  13657   smallJsont *self = allocSmallJson();
  13658   smallJsont *r2;
  13659 
  13660   r2 = self->f->setInt(self, "1", 1);
  13661   ck_assert_ptr_ne(r2, null);
  13662   r2 = self->f->setDouble(self, "2", 2.2);
  13663   ck_assert_ptr_ne(r2, null);
  13664   r2 = self->f->setInt(self, "b", 2);
  13665   ck_assert_ptr_ne(r2, null);
  13666   createAllocateSmallInt(I);
  13667   setValG(I, 11);
  13668   I->type = "anothertype";
  13669   r2 = self->f->set(self, "B", (baset*)I);
  13670   ck_assert_ptr_ne(r2, null);
  13671   r = cropElemKeyInt32O(self, "b");
  13672   ck_assert_int_eq(r, 2);
  13673   char *s = toStringO(self);
  13674   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13675   free(s);
  13676   // wrong object type
  13677   r = cropElemKeyInt32O(self, "2");
  13678   ck_assert(!r);
  13679   s = toStringO(self);
  13680   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13681   free(s);
  13682   r = cropElemKeyInt32O(self, "B");
  13683   ck_assert(!r);
  13684   s = toStringO(self);
  13685   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13686   free(s);
  13687   // non existing key
  13688   r = cropElemKeyInt32O(self, "qwe");
  13689   ck_assert(!r);
  13690   // null key
  13691   r = cropElemKeyInt32O(self, null);
  13692   ck_assert_int_eq(r, 0);
  13693 	// empty self
  13694   freeO(self);
  13695   r = cropElemKeyInt32O(self, "1");
  13696   ck_assert_int_eq(r, 0);
  13697   terminateO(self);
  13698 
  13699 }
  13700 
  13701 
  13702 void cropElemKeyUintSmallJsonT(CuTest *tc UNUSED) {
  13703 
  13704   uint64_t r;
  13705   smallJsont *self = allocSmallJson();
  13706   smallJsont *r2;
  13707 
  13708   r2 = self->f->setInt(self, "1", 1);
  13709   ck_assert_ptr_ne(r2, null);
  13710   r2 = self->f->setDouble(self, "2", 2.2);
  13711   ck_assert_ptr_ne(r2, null);
  13712   r2 = self->f->setInt(self, "b", 2);
  13713   ck_assert_ptr_ne(r2, null);
  13714   createAllocateSmallInt(I);
  13715   setValG(I, 11);
  13716   I->type = "anothertype";
  13717   r2 = self->f->set(self, "B", (baset*)I);
  13718   ck_assert_ptr_ne(r2, null);
  13719   r = cropElemKeyUintO(self, "b");
  13720   ck_assert_int_eq(r, 2);
  13721   char *s = toStringO(self);
  13722   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13723   free(s);
  13724   // wrong object type
  13725   r = cropElemKeyUintO(self, "2");
  13726   ck_assert(!r);
  13727   s = toStringO(self);
  13728   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13729   free(s);
  13730   r = cropElemKeyUintO(self, "B");
  13731   ck_assert(!r);
  13732   s = toStringO(self);
  13733   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13734   free(s);
  13735   // non existing key
  13736   r = cropElemKeyUintO(self, "qwe");
  13737   ck_assert(!r);
  13738   // null key
  13739   r = cropElemKeyUintO(self, null);
  13740   ck_assert_int_eq(r, 0);
  13741 	// empty self
  13742   freeO(self);
  13743   r = cropElemKeyUintO(self, "1");
  13744   ck_assert_int_eq(r, 0);
  13745   terminateO(self);
  13746 
  13747 }
  13748 
  13749 
  13750 void cropElemKeyUint32SmallJsonT(CuTest *tc UNUSED) {
  13751 
  13752   uint32_t r;
  13753   smallJsont *self = allocSmallJson();
  13754   smallJsont *r2;
  13755 
  13756   r2 = self->f->setInt(self, "1", 1);
  13757   ck_assert_ptr_ne(r2, null);
  13758   r2 = self->f->setDouble(self, "2", 2.2);
  13759   ck_assert_ptr_ne(r2, null);
  13760   r2 = self->f->setInt(self, "b", 2);
  13761   ck_assert_ptr_ne(r2, null);
  13762   createAllocateSmallInt(I);
  13763   setValG(I, 11);
  13764   I->type = "anothertype";
  13765   r2 = self->f->set(self, "B", (baset*)I);
  13766   ck_assert_ptr_ne(r2, null);
  13767   r = cropElemKeyUint32O(self, "b");
  13768   ck_assert_int_eq(r, 2);
  13769   char *s = toStringO(self);
  13770   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13771   free(s);
  13772   // wrong object type
  13773   r = cropElemKeyUint32O(self, "2");
  13774   ck_assert(!r);
  13775   s = toStringO(self);
  13776   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13777   free(s);
  13778   r = cropElemKeyUint32O(self, "B");
  13779   ck_assert(!r);
  13780   s = toStringO(self);
  13781   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13782   free(s);
  13783   // non existing key
  13784   r = cropElemKeyUint32O(self, "qwe");
  13785   ck_assert(!r);
  13786   // null key
  13787   r = cropElemKeyUint32O(self, null);
  13788   ck_assert_int_eq(r, 0);
  13789 	// empty self
  13790   freeO(self);
  13791   r = cropElemKeyUint32O(self, "1");
  13792   ck_assert_int_eq(r, 0);
  13793   terminateO(self);
  13794 
  13795 }
  13796 
  13797 
  13798 void cropElemKeySSmallJsonT(CuTest *tc UNUSED) {
  13799 
  13800   char* r;
  13801   smallJsont *self = allocSmallJson();
  13802   smallJsont *r2;
  13803 
  13804   r2 = self->f->setInt(self, "1", 1);
  13805   ck_assert_ptr_ne(r2, null);
  13806   r2 = self->f->setDouble(self, "2", 2.2);
  13807   ck_assert_ptr_ne(r2, null);
  13808   r2 = self->f->setS(self, "b", "qwe");
  13809   ck_assert_ptr_ne(r2, null);
  13810   createAllocateSmallInt(I);
  13811   setValG(I, 11);
  13812   I->type = "anothertype";
  13813   r2 = self->f->set(self, "B", (baset*)I);
  13814   ck_assert_ptr_ne(r2, null);
  13815   r = cropElemKeySO(self, "b");
  13816   ck_assert_str_eq(r, "qwe");
  13817   free(r);
  13818   char *s = toStringO(self);
  13819   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13820   free(s);
  13821   // wrong object type
  13822   r = cropElemKeySO(self, "2");
  13823   ck_assert_ptr_eq(r, null);
  13824   s = toStringO(self);
  13825   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13826   free(s);
  13827   r = cropElemKeySO(self, "B");
  13828   ck_assert_ptr_eq(r, null);
  13829   s = toStringO(self);
  13830   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13831   free(s);
  13832   // non existing key
  13833   r = cropElemKeySO(self, "qwe");
  13834   ck_assert_ptr_eq(r, null);
  13835   // null key
  13836   r = cropElemKeySO(self, null);
  13837   ck_assert_ptr_eq(r, null);
  13838 	// empty self
  13839   freeO(self);
  13840   r = cropElemKeySO(self, "1");
  13841   ck_assert_ptr_eq(r, null);
  13842   terminateO(self);
  13843 
  13844 }
  13845 
  13846 
  13847 void cropElemKeyDictSmallJsonT(CuTest *tc UNUSED) {
  13848 
  13849   smallDictt* r;
  13850   smallJsont *self = allocSmallJson();
  13851   smallJsont *r2;
  13852 
  13853   r2 = self->f->setInt(self, "1", 1);
  13854   ck_assert_ptr_ne(r2, null);
  13855   r2 = self->f->setDouble(self, "2", 2.2);
  13856   ck_assert_ptr_ne(r2, null);
  13857   createAllocateSmallDict(d);
  13858   r2 = self->f->setNFreeDict(self, "b", d);
  13859   ck_assert_ptr_ne(r2, null);
  13860   createAllocateSmallInt(I);
  13861   setValG(I, 11);
  13862   I->type = "anothertype";
  13863   r2 = self->f->set(self, "B", (baset*)I);
  13864   ck_assert_ptr_ne(r2, null);
  13865   r = cropElemKeyDictO(self, "b");
  13866   ck_assert_ptr_ne(r, null);
  13867   char *s = toStringO(r);
  13868   terminateO(r);
  13869   ck_assert_str_eq(s, "{}");
  13870   free(s);
  13871   s = toStringO(self);
  13872   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13873   free(s);
  13874   // wrong object type
  13875   r = cropElemKeyDictO(self, "2");
  13876   ck_assert_ptr_eq(r, null);
  13877   s = toStringO(self);
  13878   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13879   free(s);
  13880   r = cropElemKeyDictO(self, "B");
  13881   ck_assert_ptr_eq(r, null);
  13882   s = toStringO(self);
  13883   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13884   free(s);
  13885   // non existing key
  13886   r = cropElemKeyDictO(self, "qwe");
  13887   ck_assert_ptr_eq(r, null);
  13888   // null key
  13889   r = cropElemKeyDictO(self, null);
  13890   ck_assert_ptr_eq(r, null);
  13891 	// empty self
  13892   freeO(self);
  13893   r = cropElemKeyDictO(self, "1");
  13894   ck_assert_ptr_eq(r, null);
  13895   terminateO(self);
  13896 
  13897 }
  13898 
  13899 
  13900 void cropElemKeyArraySmallJsonT(CuTest *tc UNUSED) {
  13901 
  13902   smallArrayt* r;
  13903   smallJsont *self = allocSmallJson();
  13904   smallJsont *r2;
  13905 
  13906   r2 = self->f->setInt(self, "1", 1);
  13907   ck_assert_ptr_ne(r2, null);
  13908   r2 = self->f->setDouble(self, "2", 2.2);
  13909   ck_assert_ptr_ne(r2, null);
  13910   createAllocateSmallArray(d);
  13911   r2 = self->f->setNFreeArray(self, "b", d);
  13912   ck_assert_ptr_ne(r2, null);
  13913   createAllocateSmallInt(I);
  13914   setValG(I, 11);
  13915   I->type = "anothertype";
  13916   r2 = self->f->set(self, "B", (baset*)I);
  13917   ck_assert_ptr_ne(r2, null);
  13918   r = cropElemKeyArrayO(self, "b");
  13919   ck_assert_ptr_ne(r, null);
  13920   char *s = toStringO(r);
  13921   terminateO(r);
  13922   ck_assert_str_eq(s, "[]");
  13923   free(s);
  13924   s = toStringO(self);
  13925   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13926   free(s);
  13927   // wrong object type
  13928   r = cropElemKeyArrayO(self, "2");
  13929   ck_assert_ptr_eq(r, null);
  13930   s = toStringO(self);
  13931   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13932   free(s);
  13933   r = cropElemKeyArrayO(self, "B");
  13934   ck_assert_ptr_eq(r, null);
  13935   s = toStringO(self);
  13936   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13937   free(s);
  13938   // non existing key
  13939   r = cropElemKeyArrayO(self, "qwe");
  13940   ck_assert_ptr_eq(r, null);
  13941   // null key
  13942   r = cropElemKeyArrayO(self, null);
  13943   ck_assert_ptr_eq(r, null);
  13944 	// empty self
  13945   freeO(self);
  13946   r = cropElemKeyArrayO(self, "1");
  13947   ck_assert_ptr_eq(r, null);
  13948   terminateO(self);
  13949 
  13950 }
  13951 
  13952 
  13953 void cropElemKeySmallBoolSmallJsonT(CuTest *tc UNUSED) {
  13954 
  13955   smallBoolt* r;
  13956   smallJsont *self = allocSmallJson();
  13957   smallJsont *r2;
  13958 
  13959   r2 = self->f->setInt(self, "1", 1);
  13960   ck_assert_ptr_ne(r2, null);
  13961   r2 = self->f->setDouble(self, "2", 2.2);
  13962   ck_assert_ptr_ne(r2, null);
  13963   r2 = self->f->setBool(self, "b", true);
  13964   ck_assert_ptr_ne(r2, null);
  13965   createAllocateSmallInt(I);
  13966   setValG(I, 11);
  13967   I->type = "anothertype";
  13968   r2 = self->f->set(self, "B", (baset*)I);
  13969   ck_assert_ptr_ne(r2, null);
  13970   r = cropElemKeySmallBoolO(self, "b");
  13971   ck_assert_ptr_ne(r, null);
  13972   char *s = toStringO(r);
  13973   terminateO(r);
  13974   ck_assert_str_eq(s, "true");
  13975   free(s);
  13976   s = toStringO(self);
  13977   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13978   free(s);
  13979   // wrong object type
  13980   r = cropElemKeySmallBoolO(self, "2");
  13981   ck_assert_ptr_eq(r, null);
  13982   s = toStringO(self);
  13983   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13984   free(s);
  13985   r = cropElemKeySmallBoolO(self, "B");
  13986   ck_assert_ptr_eq(r, null);
  13987   s = toStringO(self);
  13988   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  13989   free(s);
  13990   // non existing key
  13991   r = cropElemKeySmallBoolO(self, "qwe");
  13992   ck_assert_ptr_eq(r, null);
  13993   // null key
  13994   r = cropElemKeySmallBoolO(self, null);
  13995   ck_assert_ptr_eq(r, null);
  13996 	// empty self
  13997   freeO(self);
  13998   r = cropElemKeySmallBoolO(self, "1");
  13999   ck_assert_ptr_eq(r, null);
  14000   terminateO(self);
  14001 
  14002 }
  14003 
  14004 
  14005 void cropElemKeySmallBytesSmallJsonT(CuTest *tc UNUSED) {
  14006 
  14007   smallBytest* r;
  14008   smallJsont *self = allocSmallJson();
  14009   smallJsont *r2;
  14010 
  14011   r2 = self->f->setInt(self, "1", 1);
  14012   ck_assert_ptr_ne(r2, null);
  14013   r2 = self->f->setDouble(self, "2", 2.2);
  14014   ck_assert_ptr_ne(r2, null);
  14015   createAllocateSmallBytes(d);
  14016   r2 = self->f->setNFreeSmallBytes(self, "b", d);
  14017   ck_assert_ptr_ne(r2, null);
  14018   createAllocateSmallInt(I);
  14019   setValG(I, 11);
  14020   I->type = "anothertype";
  14021   r2 = self->f->set(self, "B", (baset*)I);
  14022   ck_assert_ptr_ne(r2, null);
  14023   r = cropElemKeySmallBytesO(self, "b");
  14024   ck_assert_ptr_ne(r, null);
  14025   char *s = toStringO(r);
  14026   terminateO(r);
  14027   ck_assert_str_eq(s, "[]");
  14028   free(s);
  14029   s = toStringO(self);
  14030   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14031   free(s);
  14032   // wrong object type
  14033   r = cropElemKeySmallBytesO(self, "2");
  14034   ck_assert_ptr_eq(r, null);
  14035   s = toStringO(self);
  14036   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14037   free(s);
  14038   r = cropElemKeySmallBytesO(self, "B");
  14039   ck_assert_ptr_eq(r, null);
  14040   s = toStringO(self);
  14041   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14042   free(s);
  14043   // non existing key
  14044   r = cropElemKeySmallBytesO(self, "qwe");
  14045   ck_assert_ptr_eq(r, null);
  14046   // null key
  14047   r = cropElemKeySmallBytesO(self, null);
  14048   ck_assert_ptr_eq(r, null);
  14049 	// empty self
  14050   freeO(self);
  14051   r = cropElemKeySmallBytesO(self, "1");
  14052   ck_assert_ptr_eq(r, null);
  14053   terminateO(self);
  14054 
  14055 }
  14056 
  14057 
  14058 void cropElemKeySmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  14059 
  14060   smallDoublet* r;
  14061   smallJsont *self = allocSmallJson();
  14062   smallJsont *r2;
  14063 
  14064   r2 = self->f->setInt(self, "1", 1);
  14065   ck_assert_ptr_ne(r2, null);
  14066   r2 = self->f->setDouble(self, "2", 2.2);
  14067   ck_assert_ptr_ne(r2, null);
  14068   r2 = self->f->setDouble(self, "b", 3.3);
  14069   ck_assert_ptr_ne(r2, null);
  14070   createAllocateSmallInt(I);
  14071   setValG(I, 11);
  14072   I->type = "anothertype";
  14073   r2 = self->f->set(self, "B", (baset*)I);
  14074   ck_assert_ptr_ne(r2, null);
  14075   r = cropElemKeySmallDoubleO(self, "b");
  14076   ck_assert_ptr_ne(r, null);
  14077   char *s = toStringO(r);
  14078   terminateO(r);
  14079   ck_assert_str_eq(s, "3.300000e+00");
  14080   free(s);
  14081   s = toStringO(self);
  14082   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14083   free(s);
  14084   // wrong object type
  14085   r = cropElemKeySmallDoubleO(self, "1");
  14086   ck_assert_ptr_eq(r, null);
  14087   s = toStringO(self);
  14088   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14089   free(s);
  14090   r = cropElemKeySmallDoubleO(self, "B");
  14091   ck_assert_ptr_eq(r, null);
  14092   s = toStringO(self);
  14093   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14094   free(s);
  14095   // non existing key
  14096   r = cropElemKeySmallDoubleO(self, "qwe");
  14097   ck_assert_ptr_eq(r, null);
  14098   // null key
  14099   r = cropElemKeySmallDoubleO(self, null);
  14100   ck_assert_ptr_eq(r, null);
  14101 	// empty self
  14102   freeO(self);
  14103   r = cropElemKeySmallDoubleO(self, "1");
  14104   ck_assert_ptr_eq(r, null);
  14105   terminateO(self);
  14106 
  14107 }
  14108 
  14109 
  14110 void cropElemKeySmallIntSmallJsonT(CuTest *tc UNUSED) {
  14111 
  14112   smallIntt* r;
  14113   smallJsont *self = allocSmallJson();
  14114   smallJsont *r2;
  14115 
  14116   r2 = self->f->setInt(self, "1", 1);
  14117   ck_assert_ptr_ne(r2, null);
  14118   r2 = self->f->setDouble(self, "2", 2.2);
  14119   ck_assert_ptr_ne(r2, null);
  14120   r2 = self->f->setInt(self, "b", 2);
  14121   ck_assert_ptr_ne(r2, null);
  14122   createAllocateSmallInt(I);
  14123   setValG(I, 11);
  14124   I->type = "anothertype";
  14125   r2 = self->f->set(self, "B", (baset*)I);
  14126   ck_assert_ptr_ne(r2, null);
  14127   r = cropElemKeySmallIntO(self, "b");
  14128   ck_assert_ptr_ne(r, null);
  14129   char *s = toStringO(r);
  14130   terminateO(r);
  14131   ck_assert_str_eq(s, "2");
  14132   free(s);
  14133   s = toStringO(self);
  14134   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14135   free(s);
  14136   // wrong object type
  14137   r = cropElemKeySmallIntO(self, "2");
  14138   ck_assert_ptr_eq(r, null);
  14139   s = toStringO(self);
  14140   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14141   free(s);
  14142   r = cropElemKeySmallIntO(self, "B");
  14143   ck_assert_ptr_eq(r, null);
  14144   s = toStringO(self);
  14145   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14146   free(s);
  14147   // non existing key
  14148   r = cropElemKeySmallIntO(self, "qwe");
  14149   ck_assert_ptr_eq(r, null);
  14150   // null key
  14151   r = cropElemKeySmallIntO(self, null);
  14152   ck_assert_ptr_eq(r, null);
  14153 	// empty self
  14154   freeO(self);
  14155   r = cropElemKeySmallIntO(self, "1");
  14156   ck_assert_ptr_eq(r, null);
  14157   terminateO(self);
  14158 
  14159 }
  14160 
  14161 
  14162 void cropElemKeySmallJsonSmallJsonT(CuTest *tc UNUSED) {
  14163 
  14164   smallJsont* r;
  14165   smallJsont *self = allocSmallJson();
  14166   smallJsont *r2;
  14167 
  14168   r2 = self->f->setInt(self, "1", 1);
  14169   ck_assert_ptr_ne(r2, null);
  14170   createAllocateSmallBytes(b);
  14171   r2 = self->f->setNFreeSmallBytes(self, "2", b);
  14172   ck_assert_ptr_ne(r2, null);
  14173   createAllocateSmallJson(d);
  14174   r2 = self->f->setNFreeSmallJson(self, "b", d);
  14175   ck_assert_ptr_ne(r2, null);
  14176   createAllocateSmallInt(I);
  14177   setValG(I, 11);
  14178   I->type = "anothertype";
  14179   r2 = self->f->set(self, "B", (baset*)I);
  14180   ck_assert_ptr_ne(r2, null);
  14181   r = cropElemKeySmallJsonO(self, "b");
  14182   ck_assert_ptr_ne(r, null);
  14183   char *s = toStringO(r);
  14184   terminateO(r);
  14185   ck_assert_str_eq(s, "{}");
  14186   free(s);
  14187   s = toStringO(self);
  14188   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14189   free(s);
  14190   // wrong object type
  14191   r = cropElemKeySmallJsonO(self, "2");
  14192   ck_assert_ptr_eq(r, null);
  14193   s = toStringO(self);
  14194   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14195   free(s);
  14196   r = cropElemKeySmallJsonO(self, "B");
  14197   ck_assert_ptr_eq(r, null);
  14198   s = toStringO(self);
  14199   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  14200   free(s);
  14201   // non existing key
  14202   r = cropElemKeySmallJsonO(self, "qwe");
  14203   ck_assert_ptr_eq(r, null);
  14204   // null key
  14205   r = cropElemKeySmallJsonO(self, null);
  14206   ck_assert_ptr_eq(r, null);
  14207 	// empty self
  14208   freeO(self);
  14209   r = cropElemKeySmallJsonO(self, "1");
  14210   ck_assert_ptr_eq(r, null);
  14211   terminateO(self);
  14212 
  14213 }
  14214 
  14215 
  14216 void cropElemKeySmallStringSmallJsonT(CuTest *tc UNUSED) {
  14217 
  14218   smallStringt* r;
  14219   smallJsont *self = allocSmallJson();
  14220   smallJsont *r2;
  14221 
  14222   r2 = self->f->setInt(self, "1", 1);
  14223   ck_assert_ptr_ne(r2, null);
  14224   r2 = self->f->setDouble(self, "2", 2.2);
  14225   ck_assert_ptr_ne(r2, null);
  14226   r2 = self->f->setS(self, "b", "qwe");
  14227   ck_assert_ptr_ne(r2, null);
  14228   createAllocateSmallInt(I);
  14229   setValG(I, 11);
  14230   I->type = "anothertype";
  14231   r2 = self->f->set(self, "B", (baset*)I);
  14232   ck_assert_ptr_ne(r2, null);
  14233   r = cropElemKeySmallStringO(self, "b");
  14234   ck_assert_ptr_ne(r, null);
  14235   char *s = toStringO(r);
  14236   terminateO(r);
  14237   ck_assert_str_eq(s, "qwe");
  14238   free(s);
  14239   s = toStringO(self);
  14240   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14241   free(s);
  14242   // wrong object type
  14243   r = cropElemKeySmallStringO(self, "2");
  14244   ck_assert_ptr_eq(r, null);
  14245   s = toStringO(self);
  14246   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14247   free(s);
  14248   r = cropElemKeySmallStringO(self, "B");
  14249   ck_assert_ptr_eq(r, null);
  14250   s = toStringO(self);
  14251   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14252   free(s);
  14253   // non existing key
  14254   r = cropElemKeySmallStringO(self, "qwe");
  14255   ck_assert_ptr_eq(r, null);
  14256   // null key
  14257   r = cropElemKeySmallStringO(self, null);
  14258   ck_assert_ptr_eq(r, null);
  14259 	// empty self
  14260   freeO(self);
  14261   r = cropElemKeySmallStringO(self, "1");
  14262   ck_assert_ptr_eq(r, null);
  14263   terminateO(self);
  14264 
  14265 }
  14266 
  14267 
  14268 void cropElemKeyVoidSmallJsonT(CuTest *tc UNUSED) {
  14269 
  14270   void* r;
  14271   smallJsont *self = allocSmallJson();
  14272   smallJsont *r2;
  14273 
  14274   r2 = self->f->setInt(self, "1", 1);
  14275   ck_assert_ptr_ne(r2, null);
  14276   r2 = self->f->setDouble(self, "2", 2.2);
  14277   ck_assert_ptr_ne(r2, null);
  14278   smallContainert *c = allocSmallContainer(&r);
  14279   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  14280   ck_assert_ptr_ne(r2, null);
  14281   createAllocateSmallInt(I);
  14282   setValG(I, 11);
  14283   I->type = "anothertype";
  14284   r2 = self->f->set(self, "B", (baset*)I);
  14285   ck_assert_ptr_ne(r2, null);
  14286   r = cropElemKeyVoidO(self, "b");
  14287   ck_assert_ptr_eq(r, &r);
  14288   char *s = toStringO(self);
  14289   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14290   free(s);
  14291   // wrong object type
  14292   r = cropElemKeyVoidO(self, "2");
  14293   ck_assert_ptr_eq(r, null);
  14294   s = toStringO(self);
  14295   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14296   free(s);
  14297   r = cropElemKeyVoidO(self, "B");
  14298   ck_assert_ptr_eq(r, null);
  14299   s = toStringO(self);
  14300   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14301   free(s);
  14302   // non existing key
  14303   r = cropElemKeyVoidO(self, "qwe");
  14304   ck_assert_ptr_eq(r, null);
  14305   // null key
  14306   r = cropElemKeyVoidO(self, null);
  14307   ck_assert_ptr_eq(r, null);
  14308 	// empty self
  14309   freeO(self);
  14310   r = cropElemKeyVoidO(self, "1");
  14311   ck_assert_ptr_eq(r, null);
  14312   terminateO(self);
  14313 
  14314 }
  14315 
  14316 
  14317 void cropElemKeySmallContainerSmallJsonT(CuTest *tc UNUSED) {
  14318 
  14319   smallContainert* r;
  14320   smallJsont *self = allocSmallJson();
  14321   smallJsont *r2;
  14322 
  14323   r2 = self->f->setInt(self, "1", 1);
  14324   ck_assert_ptr_ne(r2, null);
  14325   r2 = self->f->setDouble(self, "2", 2.2);
  14326   ck_assert_ptr_ne(r2, null);
  14327   smallContainert *c = allocSmallContainer(&r);
  14328   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  14329   ck_assert_ptr_ne(r2, null);
  14330   createAllocateSmallInt(I);
  14331   setValG(I, 11);
  14332   I->type = "anothertype";
  14333   r2 = self->f->set(self, "B", (baset*)I);
  14334   ck_assert_ptr_ne(r2, null);
  14335   r = cropElemKeySmallContainerO(self, "b");
  14336   ck_assert_ptr_ne(r, null);
  14337   char *s = toStringO(r);
  14338   terminateO(r);
  14339   ck_assert_str_eq(s, "<data smallContainer>");
  14340   free(s);
  14341   s = toStringO(self);
  14342   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14343   free(s);
  14344   // wrong object type
  14345   r = cropElemKeySmallContainerO(self, "2");
  14346   ck_assert_ptr_eq(r, null);
  14347   s = toStringO(self);
  14348   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14349   free(s);
  14350   r = cropElemKeySmallContainerO(self, "B");
  14351   ck_assert_ptr_eq(r, null);
  14352   s = toStringO(self);
  14353   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  14354   free(s);
  14355   // non existing key
  14356   r = cropElemKeySmallContainerO(self, "qwe");
  14357   ck_assert_ptr_eq(r, null);
  14358   // null key
  14359   r = cropElemKeySmallContainerO(self, null);
  14360   ck_assert_ptr_eq(r, null);
  14361 	// empty self
  14362   freeO(self);
  14363   r = cropElemKeySmallContainerO(self, "1");
  14364   ck_assert_ptr_eq(r, null);
  14365   terminateO(self);
  14366 
  14367 }
  14368 
  14369 
  14370 void copySmallJsonT(CuTest *tc UNUSED) {
  14371 
  14372   smallJsont* r;
  14373   smallJsont *self = allocSmallJson();
  14374 
  14375   // add elements to self
  14376   r = self->f->pushInt(self, 1);
  14377   ck_assert_ptr_ne(r, null);
  14378   r = self->f->pushInt(self, 2);
  14379   ck_assert_ptr_ne(r, null);
  14380   r = self->f->pushInt(self, 3);
  14381   ck_assert_ptr_ne(r, null);
  14382   r = self->f->pushInt(self, 4);
  14383   ck_assert_ptr_ne(r, null);
  14384 
  14385   // negative index
  14386   r = copyRngO(self, 1, -1);
  14387   ck_assert_ptr_ne(r, null);
  14388   ck_assert_int_eq(lenO(r), 2);
  14389   char *s = toStringO(r);
  14390   terminateO(r);
  14391   ck_assert_str_eq(s, "[2,3]");
  14392   free(s);
  14393   s = toStringO(self);
  14394   ck_assert_str_eq(s, "[1,2,3,4]");
  14395   free(s);
  14396   // start outside
  14397   ck_assert_ptr_eq(copyRngO(self, 20, -3), NULL);
  14398   // end outside
  14399   r = copyRngO(self, 0, 40);
  14400   ck_assert_ptr_ne(r, null);
  14401   ck_assert_int_eq(lenO(r), 4);
  14402   s = toStringO(r);
  14403   terminateO(r);
  14404   ck_assert_str_eq(s, "[1,2,3,4]");
  14405   free(s);
  14406   s = toStringO(self);
  14407   ck_assert_str_eq(s, "[1,2,3,4]");
  14408   free(s);
  14409   // end negative and outside
  14410   ck_assert_ptr_eq(copyRngO(self, 2, -40), NULL);
  14411   s = toStringO(self);
  14412   ck_assert_str_eq(s, "[1,2,3,4]");
  14413   free(s);
  14414   // end before start
  14415   ck_assert_ptr_eq(copyRngO(self, 3, 2), NULL);
  14416   s = toStringO(self);
  14417   ck_assert_str_eq(s, "[1,2,3,4]");
  14418   free(s);
  14419   // negative start last element
  14420   r = copyRngO(self, -1, 0);
  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, "[4]");
  14426   free(s);
  14427   s = toStringO(self);
  14428   ck_assert_str_eq(s, "[1,2,3,4]");
  14429   free(s);
  14430   // negative start and outside
  14431   r = copyRngO(self, -10, 1);
  14432   ck_assert_ptr_ne(r, null);
  14433   ck_assert_int_eq(lenO(r), 1);
  14434   s = toStringO(r);
  14435   terminateO(r);
  14436   ck_assert_str_eq(s, "[1]");
  14437   free(s);
  14438   s = toStringO(self);
  14439   ck_assert_str_eq(s, "[1,2,3,4]");
  14440   free(s);
  14441   // start = end
  14442   r = copyRngO(self, 1, 1);
  14443   ck_assert_ptr_ne(r, null);
  14444   ck_assert_int_eq(lenO(r), 0);
  14445   terminateO(r);
  14446   s = toStringO(self);
  14447   ck_assert_str_eq(s, "[1,2,3,4]");
  14448   free(s);
  14449   // empty list
  14450   emptyO(self);
  14451   ck_assert_ptr_eq(copyRngO(self, 0, 0), NULL);
  14452   ck_assert_ptr_eq(copyRngO(self, -1, 0), NULL);
  14453   // non json array
  14454   freeO(self);
  14455   setTypeBoolO(self);
  14456   ck_assert_ptr_eq(copyRngO(self, 0, 1), NULL);
  14457   terminateO(self);
  14458   // json string
  14459   self = allocSmallJson();
  14460   // copy range
  14461   setTopSO(self, "sheepy");
  14462   r = copyRngO(self, 0,2);
  14463   ck_assert_ptr_ne(r, null);
  14464   ck_assert_str_eq(sjGet(r), "sh");
  14465   ck_assert_str_eq(sjGet(self), "sheepy");
  14466   terminateO(r);
  14467   // negative index
  14468   r = copyRngO(self, -2,0);
  14469   ck_assert_ptr_ne(r, null);
  14470   ck_assert_str_eq(sjGet(r), "py");
  14471   ck_assert_str_eq(sjGet(self), "sheepy");
  14472   terminateO(r);
  14473   // positive and negative indexes
  14474   r = copyRngO(self, 2,-2);
  14475   ck_assert_ptr_ne(r, null);
  14476   ck_assert_str_eq(sjGet(r), "ee");
  14477   ck_assert_str_eq(sjGet(self), "sheepy");
  14478   terminateO(r);
  14479   // start = end
  14480   r = copyRngO(self, 2,-4);
  14481   ck_assert_ptr_ne(r, null);
  14482   ck_assert_str_eq(sjGet(r), "");
  14483   ck_assert_str_eq(sjGet(self), "sheepy");
  14484   terminateO(r);
  14485   // end of string
  14486   r = copyRngO(self, 2,6);
  14487   ck_assert_ptr_ne(r, null);
  14488   ck_assert_str_eq(sjGet(r), "eepy");
  14489   ck_assert_str_eq(sjGet(self), "sheepy");
  14490   terminateO(r);
  14491   // NULL string
  14492   freeO(self);
  14493   ck_assert_ptr_eq(copyRngO(self, 2,-4), NULL);
  14494   // start outside string
  14495   setTopSO(self, "sheepy");
  14496   ck_assert_ptr_eq(copyRngO(self, 20,-4), NULL);
  14497   // end outside string
  14498   r = copyRngO(self, 2,40);
  14499   ck_assert_ptr_ne(r, null);
  14500   ck_assert_str_eq(sjGet(r), "eepy");
  14501   ck_assert_str_eq(sjGet(self), "sheepy");
  14502   terminateO(r);
  14503   r = copyRngO(self, -22,3);
  14504   ck_assert_ptr_ne(r, null);
  14505   ck_assert_str_eq(sjGet(r), "she");
  14506   ck_assert_str_eq(sjGet(self), "sheepy");
  14507   terminateO(r);
  14508   ck_assert_ptr_eq(copyRngO(self, 2,-40), NULL);
  14509   // end before start
  14510   ck_assert_ptr_eq(copyRngO(self, 4,2), NULL);
  14511   terminateO(self);
  14512 
  14513 }
  14514 
  14515 
  14516 void insertSmallJsonT(CuTest *tc UNUSED) {
  14517 
  14518   smallJsont* r;
  14519   smallJsont *self = allocSmallJson();
  14520   smallArrayt *toInsert;
  14521 
  14522   // add elements to self
  14523   r = self->f->pushInt(self, 1);
  14524   ck_assert_ptr_ne(r, null);
  14525   r = self->f->pushInt(self, 2);
  14526   ck_assert_ptr_ne(r, null);
  14527 
  14528   // positive index
  14529   toInsert = allocSmallArray();
  14530   toInsert->f->pushInt(toInsert, 3);
  14531   r        = self->f->insert(self, 1, toInsert);
  14532   smashO(toInsert);
  14533   ck_assert_ptr_ne(r, null);
  14534   char *s  = toStringO(r);
  14535   ck_assert_str_eq(s, "[1,3,2]");
  14536   free(s);
  14537   // negative index
  14538   toInsert = allocSmallArray();
  14539   toInsert->f->pushInt(toInsert, 4);
  14540   r = self->f->insert(self, -1, toInsert);
  14541   smashO(toInsert);
  14542   ck_assert_ptr_ne(r, null);
  14543   s = toStringO(r);
  14544   ck_assert_str_eq(s, "[1,3,2,4]");
  14545   free(s);
  14546   // empty list
  14547   emptyO(self);
  14548   toInsert = allocSmallArray();
  14549   toInsert->f->pushInt(toInsert, 3);
  14550   r = self->f->insert(self, 0, toInsert);
  14551   smashO(toInsert);
  14552   ck_assert_ptr_ne(r, null);
  14553   s = toStringO(r);
  14554   ck_assert_str_eq(s, "[3]");
  14555   free(s);
  14556   emptyO(self);
  14557   toInsert = allocSmallArray();
  14558   toInsert->f->pushInt(toInsert, 3);
  14559   r = self->f->insert(self, -1, toInsert);
  14560   smashO(toInsert);
  14561   ck_assert_ptr_ne(r, null);
  14562   s = toStringO(r);
  14563   ck_assert_str_eq(s, "[3]");
  14564   free(s);
  14565   // Array array length 0
  14566   toInsert = allocSmallArray();
  14567   r = self->f->insert(self, -1, toInsert);
  14568   smashO(toInsert);
  14569   ck_assert_ptr_ne(r, null);
  14570   s = toStringO(r);
  14571   ck_assert_str_eq(s, "[3]");
  14572   free(s);
  14573   // index outside
  14574   toInsert = allocSmallArray();
  14575   ck_assert_ptr_eq(self->f->insert(self, 20, toInsert), NULL);
  14576   ck_assert_ptr_eq(self->f->insert(self, -5, toInsert), NULL);
  14577   smashO(toInsert);
  14578   // non smallArray toInsert
  14579   toInsert = (smallArrayt*) allocSmallInt(1);
  14580   ck_assert_ptr_eq(self->f->insert(self, 0, toInsert), NULL);
  14581   terminateO(toInsert);
  14582   // insert NULL
  14583   ck_assert_ptr_eq(self->f->insert(self, 0, NULL), NULL);
  14584   // non json array
  14585   freeO(self);
  14586   setTypeBoolO(self);
  14587   toInsert = allocSmallArray();
  14588   ck_assert_ptr_eq(self->f->insert(self, 0, toInsert), NULL);
  14589   terminateO(toInsert);
  14590   terminateO(self);
  14591 
  14592 }
  14593 
  14594 
  14595 void insertNSmashSmallJsonT(CuTest *tc UNUSED) {
  14596 
  14597   smallJsont* r;
  14598   smallJsont *self = allocSmallJson();
  14599   smallArrayt *toInsert;
  14600 
  14601   // add elements to self
  14602   r = self->f->pushInt(self, 1);
  14603   ck_assert_ptr_ne(r, null);
  14604   r = self->f->pushInt(self, 2);
  14605   ck_assert_ptr_ne(r, null);
  14606 
  14607   // positive index
  14608   toInsert = allocSmallArray();
  14609   toInsert->f->pushInt(toInsert, 3);
  14610   r        = self->f->insertNSmash(self, 1, toInsert);
  14611   ck_assert_ptr_ne(r, null);
  14612   char *s  = toStringO(r);
  14613   ck_assert_str_eq(s, "[1,3,2]");
  14614   free(s);
  14615   // negative index
  14616   toInsert = allocSmallArray();
  14617   toInsert->f->pushInt(toInsert, 4);
  14618   r = self->f->insertNSmash(self, -1, toInsert);
  14619   ck_assert_ptr_ne(r, null);
  14620   s = toStringO(r);
  14621   ck_assert_str_eq(s, "[1,3,2,4]");
  14622   free(s);
  14623   // empty list
  14624   emptyO(self);
  14625   toInsert = allocSmallArray();
  14626   toInsert->f->pushInt(toInsert, 3);
  14627   r = self->f->insertNSmash(self, 0, toInsert);
  14628   ck_assert_ptr_ne(r, null);
  14629   s = toStringO(r);
  14630   ck_assert_str_eq(s, "[3]");
  14631   free(s);
  14632   emptyO(self);
  14633   toInsert = allocSmallArray();
  14634   toInsert->f->pushInt(toInsert, 3);
  14635   r = self->f->insertNSmash(self, -1, toInsert);
  14636   ck_assert_ptr_ne(r, null);
  14637   s = toStringO(r);
  14638   ck_assert_str_eq(s, "[3]");
  14639   free(s);
  14640   // Array array length 0
  14641   toInsert = allocSmallArray();
  14642   r = self->f->insertNSmash(self, -1, toInsert);
  14643   ck_assert_ptr_ne(r, null);
  14644   s = toStringO(r);
  14645   ck_assert_str_eq(s, "[3]");
  14646   free(s);
  14647   // index outside
  14648   toInsert = allocSmallArray();
  14649   ck_assert_ptr_eq(self->f->insertNSmash(self, 20, toInsert), NULL);
  14650   ck_assert_ptr_eq(self->f->insertNSmash(self, -5, toInsert), NULL);
  14651   smashO(toInsert);
  14652   // insert NULL
  14653   ck_assert_ptr_eq(self->f->insertNSmash(self, 0, NULL), NULL);
  14654   terminateO(self);
  14655 
  14656 }
  14657 
  14658 
  14659 void insertSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  14660 
  14661   smallJsont* r;
  14662   smallJsont *self = allocSmallJson();
  14663   smallJsont *toInsert;
  14664 
  14665   // add elements to self
  14666   r = self->f->pushInt(self, 1);
  14667   ck_assert_ptr_ne(r, null);
  14668   r = self->f->pushInt(self, 2);
  14669   ck_assert_ptr_ne(r, null);
  14670 
  14671   // positive index
  14672   toInsert = allocSmallJson();
  14673   toInsert->f->pushInt(toInsert, 3);
  14674   r        = self->f->insertSmallJson(self, 1, toInsert);
  14675   smashO(toInsert);
  14676   ck_assert_ptr_ne(r, null);
  14677   char *s  = toStringO(r);
  14678   ck_assert_str_eq(s, "[1,3,2]");
  14679   free(s);
  14680   // negative index
  14681   toInsert = allocSmallJson();
  14682   toInsert->f->pushInt(toInsert, 4);
  14683   r = self->f->insertSmallJson(self, -1, toInsert);
  14684   smashO(toInsert);
  14685   ck_assert_ptr_ne(r, null);
  14686   s = toStringO(r);
  14687   ck_assert_str_eq(s, "[1,3,2,4]");
  14688   free(s);
  14689   // empty list
  14690   emptyO(self);
  14691   toInsert = allocSmallJson();
  14692   toInsert->f->pushInt(toInsert, 3);
  14693   r = self->f->insertSmallJson(self, 0, toInsert);
  14694   smashO(toInsert);
  14695   ck_assert_ptr_ne(r, null);
  14696   s = toStringO(r);
  14697   ck_assert_str_eq(s, "[3]");
  14698   free(s);
  14699   emptyO(self);
  14700   toInsert = allocSmallJson();
  14701   toInsert->f->pushInt(toInsert, 3);
  14702   r = self->f->insertSmallJson(self, -1, toInsert);
  14703   smashO(toInsert);
  14704   ck_assert_ptr_ne(r, null);
  14705   s = toStringO(r);
  14706   ck_assert_str_eq(s, "[3]");
  14707   free(s);
  14708   // json array length 0
  14709   toInsert = allocSmallJson();
  14710   setTypeArrayG(toInsert);
  14711   r = self->f->insertSmallJson(self, -1, toInsert);
  14712   smashO(toInsert);
  14713   ck_assert_ptr_ne(r, null);
  14714   s = toStringO(r);
  14715   ck_assert_str_eq(s, "[3]");
  14716   free(s);
  14717   // json with no type
  14718   toInsert = allocSmallJson();
  14719   r = self->f->insertSmallJson(self, -1, toInsert);
  14720   smashO(toInsert);
  14721   ck_assert_ptr_eq(r, null);
  14722   s = toStringO(self);
  14723   ck_assert_str_eq(s, "[3]");
  14724   free(s);
  14725   // non smallJson object
  14726   toInsert = (smallJsont*) allocSmallInt(2);
  14727   r = self->f->insertSmallJson(self, -1, toInsert);
  14728   ck_assert_ptr_eq(r, null);
  14729   terminateO(toInsert);
  14730   // index outside
  14731   toInsert = allocSmallJson();
  14732   ck_assert_ptr_eq(self->f->insertSmallJson(self, 20, toInsert), NULL);
  14733   ck_assert_ptr_eq(self->f->insertSmallJson(self, -5, toInsert), NULL);
  14734   smashO(toInsert);
  14735   // insert NULL
  14736   ck_assert_ptr_eq(self->f->insertSmallJson(self, 0, NULL), NULL);
  14737   terminateO(self);
  14738 
  14739 }
  14740 
  14741 
  14742 void insertNSmashSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  14743 
  14744   smallJsont* r;
  14745   smallJsont *self = allocSmallJson();
  14746   smallJsont *toInsert;
  14747 
  14748   // add elements to self
  14749   r = self->f->pushInt(self, 1);
  14750   ck_assert_ptr_ne(r, null);
  14751   r = self->f->pushInt(self, 2);
  14752   ck_assert_ptr_ne(r, null);
  14753 
  14754   // positive index
  14755   toInsert = allocSmallJson();
  14756   toInsert->f->pushInt(toInsert, 3);
  14757   r        = self->f->insertNSmashSmallJson(self, 1, toInsert);
  14758   ck_assert_ptr_ne(r, null);
  14759   char *s  = toStringO(r);
  14760   ck_assert_str_eq(s, "[1,3,2]");
  14761   free(s);
  14762   // negative index
  14763   toInsert = allocSmallJson();
  14764   toInsert->f->pushInt(toInsert, 4);
  14765   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14766   ck_assert_ptr_ne(r, null);
  14767   s = toStringO(r);
  14768   ck_assert_str_eq(s, "[1,3,2,4]");
  14769   free(s);
  14770   // empty list
  14771   emptyO(self);
  14772   toInsert = allocSmallJson();
  14773   toInsert->f->pushInt(toInsert, 3);
  14774   r = self->f->insertNSmashSmallJson(self, 0, toInsert);
  14775   ck_assert_ptr_ne(r, null);
  14776   s = toStringO(r);
  14777   ck_assert_str_eq(s, "[3]");
  14778   free(s);
  14779   emptyO(self);
  14780   toInsert = allocSmallJson();
  14781   toInsert->f->pushInt(toInsert, 3);
  14782   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14783   ck_assert_ptr_ne(r, null);
  14784   s = toStringO(r);
  14785   ck_assert_str_eq(s, "[3]");
  14786   free(s);
  14787   // json array length 0
  14788   toInsert = allocSmallJson();
  14789   setTypeArrayG(toInsert);
  14790   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14791   ck_assert_ptr_ne(r, null);
  14792   s = toStringO(r);
  14793   ck_assert_str_eq(s, "[3]");
  14794   free(s);
  14795   // json with no type
  14796   toInsert = allocSmallJson();
  14797   r = self->f->insertNSmashSmallJson(self, -1, toInsert);
  14798   smashO(toInsert);
  14799   ck_assert_ptr_eq(r, null);
  14800   s = toStringO(self);
  14801   ck_assert_str_eq(s, "[3]");
  14802   free(s);
  14803   // index outside
  14804   toInsert = allocSmallJson();
  14805   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, 20, toInsert), NULL);
  14806   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, -5, toInsert), NULL);
  14807   smashO(toInsert);
  14808   // insert NULL
  14809   ck_assert_ptr_eq(self->f->insertNSmashSmallJson(self, 0, NULL), NULL);
  14810   terminateO(self);
  14811 
  14812 }
  14813 
  14814 
  14815 void insertStringSmallJsonT(CuTest *tc UNUSED) {
  14816 
  14817   smallJsont* r;
  14818   smallJsont *self = allocSmallJson();
  14819   setTopSO(self, "");
  14820   smallStringt *toInsert = allocSmallString("");
  14821 
  14822   // insert
  14823   freeO(self);
  14824   setTopSO(self, "sheepy");
  14825   setValO(toInsert, "lib");
  14826   r = insertStringO(self, 0, toInsert);
  14827   ck_assert_ptr_ne(r, null);
  14828   char *s = toStringO(r);
  14829   ck_assert_str_eq(s, "libsheepy");
  14830   free(s);
  14831   // negative index
  14832   setValO(toInsert, "P");
  14833   r = insertStringO(self, -2, toInsert);
  14834   ck_assert_ptr_ne(r, null);
  14835   s = toStringO(r);
  14836   ck_assert_str_eq(s, "libsheepPy");
  14837   free(s);
  14838   // edge
  14839   freeO(self);
  14840   setTopSO(self, "qwe");
  14841   setValO(toInsert, "C");
  14842   r = insertStringO(self, 3, toInsert);
  14843   ck_assert_ptr_ne(r, null);
  14844   s = toStringO(r);
  14845   ck_assert_str_eq(s, "qweC");
  14846   free(s);
  14847   // outside string
  14848   freeO(self);
  14849   setTopSO(self, "qwe");
  14850   r = insertStringO(self, 4, toInsert);
  14851   ck_assert_ptr_eq(r, NULL);
  14852   r = insertStringO(self, -5, toInsert);
  14853   ck_assert_ptr_eq(r, NULL);
  14854   // negative index in a one char string
  14855   freeO(self);
  14856   setTopSO(self, "s");
  14857   setValO(toInsert, "S");
  14858   r = insertStringO(self, -1, toInsert);
  14859   ck_assert_ptr_ne(r, null);
  14860   s = toStringO(r);
  14861   ck_assert_str_eq(s, "sS");
  14862   free(s);
  14863   // empty string
  14864   freeO(self);
  14865   setTopSO(self, "");
  14866   setValO(toInsert, "s");
  14867   r = insertStringO(self, 0, toInsert);
  14868   ck_assert_ptr_ne(r, null);
  14869   s = toStringO(r);
  14870   ck_assert_str_eq(s, "s");
  14871   free(s);
  14872   freeO(self);
  14873   setTopSO(self, "");
  14874   r = insertStringO(self, -1, toInsert);
  14875   ck_assert_ptr_ne(r, null);
  14876   s = toStringO(r);
  14877   ck_assert_str_eq(s, "s");
  14878   free(s);
  14879   // empty insert string
  14880   freeO(self);
  14881   setTopSO(self, "a");
  14882   setValO(toInsert, "");
  14883   r = insertStringO(self, 0, toInsert);
  14884   ck_assert_ptr_ne(r, null);
  14885   s = toStringO(r);
  14886   ck_assert_str_eq(s, "a");
  14887   free(s);
  14888   freeO(toInsert);
  14889   r = insertStringO(self, 0, toInsert);
  14890   ck_assert_ptr_ne(r, null);
  14891   s = toStringO(r);
  14892   ck_assert_str_eq(s, "a");
  14893   free(s);
  14894   // non smallString toInsert
  14895   terminateO(toInsert);
  14896   toInsert = (smallStringt*) allocSmallInt(1);
  14897   r = insertStringO(self, 0, toInsert);
  14898   ck_assert_ptr_eq(r, null);
  14899   terminateO(toInsert);
  14900   toInsert = allocSmallString("");
  14901   // NULL insert string
  14902   r = insertStringO(self, 0, NULL);
  14903   ck_assert_ptr_eq(r, null);
  14904   // NULL string
  14905   freeO(self);
  14906   setValO(toInsert, "s");
  14907   r = insertStringO(self, 1, toInsert);
  14908   ck_assert_ptr_eq(r, null);
  14909   r = insertStringO(self, 0, toInsert);
  14910   ck_assert_ptr_ne(r, null);
  14911   s = toStringO(r);
  14912   ck_assert_str_eq(s, "s");
  14913   free(s);
  14914   terminateO(toInsert);
  14915   terminateO(self);
  14916 
  14917 }
  14918 
  14919 
  14920 void insertSSmallJsonT(CuTest *tc UNUSED) {
  14921 
  14922   smallJsont* r;
  14923   smallJsont *self = allocSmallJson();
  14924   setTopSO(self, "");
  14925 
  14926   // insert
  14927   freeO(self);
  14928   setTopSO(self, "sheepy");
  14929   r = insertSO(self, 0, "lib");
  14930   ck_assert_ptr_ne(r, null);
  14931   char *s = toStringO(r);
  14932   ck_assert_str_eq(s, "libsheepy");
  14933   free(s);
  14934   // negative index
  14935   r = insertSO(self, -2, "P");
  14936   ck_assert_ptr_ne(r, null);
  14937   s = toStringO(r);
  14938   ck_assert_str_eq(s, "libsheepPy");
  14939   free(s);
  14940   // edge
  14941   freeO(self);
  14942   setTopSO(self, "qwe");
  14943   r = insertSO(self, 3, "C");
  14944   ck_assert_ptr_ne(r, null);
  14945   s = toStringO(r);
  14946   ck_assert_str_eq(s, "qweC");
  14947   free(s);
  14948   // outside string
  14949   freeO(self);
  14950   setTopSO(self, "qwe");
  14951   r = insertSO(self, 4, "C");
  14952   ck_assert_ptr_eq(r, NULL);
  14953   r = insertSO(self, -5, "C");
  14954   ck_assert_ptr_eq(r, NULL);
  14955   // negative index in a one char string
  14956   freeO(self);
  14957   setTopSO(self, "s");
  14958   r = insertSO(self, -1, "S");
  14959   ck_assert_ptr_ne(r, null);
  14960   s = toStringO(r);
  14961   ck_assert_str_eq(s, "sS");
  14962   free(s);
  14963   // empty string
  14964   freeO(self);
  14965   setTopSO(self, "");
  14966   r = insertSO(self, 0, "s");
  14967   ck_assert_ptr_ne(r, null);
  14968   s = toStringO(r);
  14969   ck_assert_str_eq(s, "s");
  14970   free(s);
  14971   freeO(self);
  14972   setTopSO(self, "");
  14973   r = insertSO(self, -1, "s");
  14974   ck_assert_ptr_ne(r, null);
  14975   s = toStringO(r);
  14976   ck_assert_str_eq(s, "s");
  14977   free(s);
  14978   // empty insert string
  14979   freeO(self);
  14980   setTopSO(self, "a");
  14981   r = insertSO(self, 0, "");
  14982   ck_assert_ptr_ne(r, null);
  14983   s = toStringO(r);
  14984   ck_assert_str_eq(s, "a");
  14985   free(s);
  14986   // NULL insert string
  14987   r = insertSO(self, 0, NULL);
  14988   ck_assert_ptr_ne(r, null);
  14989   s = toStringO(r);
  14990   ck_assert_str_eq(s, "a");
  14991   free(s);
  14992   // NULL string
  14993   freeO(self);
  14994   r = insertSO(self, 0, "s");
  14995   ck_assert_ptr_ne(r, null);
  14996   s = toStringO(r);
  14997   ck_assert_str_eq(s, "s");
  14998   free(s);
  14999   // non json array
  15000   freeO(self);
  15001   setTypeBoolO(self);
  15002   ck_assert_ptr_eq(insertSO(self, 0, "asd"), NULL);
  15003   terminateO(self);
  15004 
  15005 }
  15006 
  15007 
  15008 void insertNFreeStringSmallJsonT(CuTest *tc UNUSED) {
  15009 
  15010   smallJsont* r;
  15011   smallJsont *self = allocSmallJson();
  15012   setTopSO(self, "");
  15013   smallStringt *toInsert = allocSmallString("");
  15014 
  15015   // insert
  15016   freeO(self);
  15017   setTopSO(self, "sheepy");
  15018   setValO(toInsert, "lib");
  15019   r = self->f->insertNFreeString(self, 0, toInsert);
  15020   ck_assert_ptr_ne(r, null);
  15021   char *s = toStringO(r);
  15022   ck_assert_str_eq(s, "libsheepy");
  15023   free(s);
  15024   // negative index
  15025   toInsert = allocSmallString("P");
  15026   r = self->f->insertNFreeString(self, -2, toInsert);
  15027   ck_assert_ptr_ne(r, null);
  15028   s = toStringO(r);
  15029   ck_assert_str_eq(s, "libsheepPy");
  15030   free(s);
  15031   // edge
  15032   freeO(self);
  15033   setTopSO(self, "qwe");
  15034   toInsert = allocSmallString("C");
  15035   r = self->f->insertNFreeString(self, 3, toInsert);
  15036   ck_assert_ptr_ne(r, null);
  15037   s = toStringO(r);
  15038   ck_assert_str_eq(s, "qweC");
  15039   free(s);
  15040   // outside string
  15041   freeO(self);
  15042   setTopSO(self, "qwe");
  15043   toInsert = allocSmallString("S");
  15044   r = self->f->insertNFreeString(self, 4, toInsert);
  15045   ck_assert_ptr_eq(r, NULL);
  15046   r = self->f->insertNFreeString(self, -5, toInsert);
  15047   ck_assert_ptr_eq(r, NULL);
  15048   // negative index in a one char string
  15049   freeO(self);
  15050   setTopSO(self, "s");
  15051   r = self->f->insertNFreeString(self, -1, toInsert);
  15052   ck_assert_ptr_ne(r, null);
  15053   s = toStringO(r);
  15054   ck_assert_str_eq(s, "sS");
  15055   free(s);
  15056   // empty string
  15057   freeO(self);
  15058   setTopSO(self, "");
  15059   toInsert = allocSmallString("s");
  15060   r = self->f->insertNFreeString(self, 0, toInsert);
  15061   ck_assert_ptr_ne(r, null);
  15062   s = toStringO(r);
  15063   ck_assert_str_eq(s, "s");
  15064   free(s);
  15065   freeO(self);
  15066   setTopSO(self, "");
  15067   toInsert = allocSmallString("s");
  15068   r = self->f->insertNFreeString(self, -1, toInsert);
  15069   ck_assert_ptr_ne(r, null);
  15070   s = toStringO(r);
  15071   ck_assert_str_eq(s, "s");
  15072   free(s);
  15073   // empty insert string
  15074   freeO(self);
  15075   setTopSO(self, "a");
  15076   toInsert = allocSmallString("");
  15077   r = self->f->insertNFreeString(self, 0, toInsert);
  15078   ck_assert_ptr_ne(r, null);
  15079   s = toStringO(r);
  15080   ck_assert_str_eq(s, "a");
  15081   free(s);
  15082   toInsert = allocSmallString("");
  15083   freeO(toInsert);
  15084   r = self->f->insertNFreeString(self, 0, toInsert);
  15085   ck_assert_ptr_ne(r, null);
  15086   s = toStringO(r);
  15087   ck_assert_str_eq(s, "a");
  15088   free(s);
  15089   // non smallString toInsert
  15090   toInsert = (smallStringt*) allocSmallInt(1);
  15091   r = self->f->insertNFreeString(self, 0, toInsert);
  15092   ck_assert_ptr_eq(r, null);
  15093   terminateO(toInsert);
  15094   toInsert = allocSmallString("s");
  15095   // NULL insert string
  15096   r = self->f->insertNFreeString(self, 0, NULL);
  15097   ck_assert_ptr_eq(r, null);
  15098   // NULL string
  15099   freeO(self);
  15100   r = self->f->insertNFreeString(self, 1, toInsert);
  15101   ck_assert_ptr_eq(r, null);
  15102   r = self->f->insertNFreeString(self, 0, toInsert);
  15103   ck_assert_ptr_ne(r, null);
  15104   s = toStringO(r);
  15105   ck_assert_str_eq(s, "s");
  15106   free(s);
  15107   terminateO(self);
  15108 
  15109 }
  15110 
  15111 
  15112 void insertSNFreeSmallJsonT(CuTest *tc UNUSED) {
  15113 
  15114   smallJsont* r;
  15115   smallJsont *self = allocSmallJson();
  15116   setTopSO(self, "");
  15117 
  15118   // insert
  15119   freeO(self);
  15120   setTopSO(self, "sheepy");
  15121   r = insertSNFreeO(self, 0, strdup("lib"));
  15122   ck_assert_ptr_ne(r, null);
  15123   char *s = toStringO(r);
  15124   ck_assert_str_eq(s, "libsheepy");
  15125   free(s);
  15126   // negative index
  15127   r = insertSNFreeO(self, -2, strdup("P"));
  15128   ck_assert_ptr_ne(r, null);
  15129   s = toStringO(r);
  15130   ck_assert_str_eq(s, "libsheepPy");
  15131   free(s);
  15132   // edge
  15133   freeO(self);
  15134   setTopSO(self, "qwe");
  15135   r = insertSNFreeO(self, 3, strdup("C"));
  15136   ck_assert_ptr_ne(r, null);
  15137   s = toStringO(r);
  15138   ck_assert_str_eq(s, "qweC");
  15139   free(s);
  15140   // outside string
  15141   freeO(self);
  15142   setTopSO(self, "qwe");
  15143   r = insertSNFreeO(self, 4, "C");
  15144   ck_assert_ptr_eq(r, NULL);
  15145   r = insertSNFreeO(self, -5, "C");
  15146   ck_assert_ptr_eq(r, NULL);
  15147   // negative index in a one char string
  15148   freeO(self);
  15149   setTopSO(self, "s");
  15150   r = insertSNFreeO(self, -1, strdup("S"));
  15151   ck_assert_ptr_ne(r, null);
  15152   s = toStringO(r);
  15153   ck_assert_str_eq(s, "sS");
  15154   free(s);
  15155   // empty string
  15156   freeO(self);
  15157   setTopSO(self, "");
  15158   r = insertSNFreeO(self, 0, strdup("s"));
  15159   ck_assert_ptr_ne(r, null);
  15160   s = toStringO(r);
  15161   ck_assert_str_eq(s, "s");
  15162   free(s);
  15163   freeO(self);
  15164   setTopSO(self, "");
  15165   r = insertSNFreeO(self, -1, strdup("s"));
  15166   ck_assert_ptr_ne(r, null);
  15167   s = toStringO(r);
  15168   ck_assert_str_eq(s, "s");
  15169   free(s);
  15170   // empty insert string
  15171   freeO(self);
  15172   setTopSO(self, "a");
  15173   r = insertSNFreeO(self, 0, strdup(""));
  15174   ck_assert_ptr_ne(r, null);
  15175   s = toStringO(r);
  15176   ck_assert_str_eq(s, "a");
  15177   free(s);
  15178   // NULL insert string
  15179   r = insertSNFreeO(self, 0, NULL);
  15180   ck_assert_ptr_ne(r, null);
  15181   s = toStringO(r);
  15182   ck_assert_str_eq(s, "a");
  15183   free(s);
  15184   // NULL string
  15185   freeO(self);
  15186   r = insertSNFreeO(self, 0, strdup("s"));
  15187   ck_assert_ptr_ne(r, null);
  15188   s = toStringO(r);
  15189   ck_assert_str_eq(s, "s");
  15190   free(s);
  15191   terminateO(self);
  15192 
  15193 }
  15194 
  15195 
  15196 void injectSmallJsonT(CuTest *tc UNUSED) {
  15197 
  15198   smallJsont* r;
  15199   smallJsont *self = allocSmallJson();
  15200   baset *toInject;
  15201 
  15202   // add elements to self
  15203   r = self->f->pushInt(self, 1);
  15204   ck_assert_ptr_ne(r, null);
  15205   r = self->f->pushInt(self, 2);
  15206   ck_assert_ptr_ne(r, null);
  15207   r = self->f->pushInt(self, 3);
  15208   ck_assert_ptr_ne(r, null);
  15209   r = self->f->pushInt(self, 4);
  15210   ck_assert_ptr_ne(r, null);
  15211 
  15212   // positive index
  15213   toInject = (baset*) allocSmallInt(8);
  15214   r        = self->f->inject(self, 1, toInject);
  15215   ck_assert_ptr_ne(r, null);
  15216   finishO(toInject);
  15217   char *s  = toStringO(r);
  15218   ck_assert_str_eq(s, "[1,8,2,3,4]");
  15219   free(s);
  15220   // negative index
  15221   toInject = (baset*) allocSmallInt(9);
  15222   r = self->f->inject(self,-1, toInject);
  15223   ck_assert_ptr_ne(r, null);
  15224   finishO(toInject);
  15225   s = toStringO(r);
  15226   ck_assert_str_eq(s, "[1,8,2,3,4,9]");
  15227   free(s);
  15228   // index 0
  15229   toInject = (baset*) allocSmallInt(6);
  15230   r = self->f->inject(self,0, toInject);
  15231   ck_assert_ptr_ne(r, null);
  15232   finishO(toInject);
  15233   s = toStringO(r);
  15234   ck_assert_str_eq(s, "[6,1,8,2,3,4,9]");
  15235   free(s);
  15236   // index outside
  15237   toInject = (baset*) allocSmallInt(7);
  15238   ck_assert_ptr_eq(self->f->inject(self, 20, toInject), NULL);
  15239   ck_assert_ptr_eq(self->f->inject(self, -9, toInject), NULL);
  15240   terminateO(toInject);
  15241   // empty list
  15242   emptyO(self);
  15243   toInject = (baset*) allocSmallInt(7);
  15244   ck_assert_ptr_ne(self->f->inject(self, 0, toInject), NULL);
  15245   finishO(toInject);
  15246   s = toStringO(r);
  15247   ck_assert_str_eq(s, "[7]");
  15248   free(s);
  15249   emptyO(self);
  15250   toInject = (baset*) allocSmallInt(7);
  15251   ck_assert_ptr_ne(self->f->inject(self, -1, toInject), NULL);
  15252   finishO(toInject);
  15253   s = toStringO(r);
  15254   ck_assert_str_eq(s, "[7]");
  15255   free(s);
  15256   // null toInject
  15257   ck_assert_ptr_eq(self->f->inject(self, 0, NULL), NULL);
  15258   // non json array
  15259   freeO(self);
  15260   setTypeBoolO(self);
  15261   toInject = (baset*) allocSmallInt(7);
  15262   ck_assert_ptr_eq(self->f->inject(self, 0, toInject), NULL);
  15263   terminateO(toInject);
  15264   terminateO(self);
  15265 
  15266 }
  15267 
  15268 
  15269 void injectUndefinedSmallJsonT(CuTest *tc UNUSED) {
  15270 
  15271   smallJsont* r;
  15272   smallJsont *self = allocSmallJson();
  15273 
  15274   // add elements to self
  15275   r = self->f->pushInt(self, 1);
  15276   ck_assert_ptr_ne(r, null);
  15277   r = self->f->pushInt(self, 2);
  15278   ck_assert_ptr_ne(r, null);
  15279   r = self->f->pushInt(self, 3);
  15280   ck_assert_ptr_ne(r, null);
  15281   r = self->f->pushInt(self, 4);
  15282   ck_assert_ptr_ne(r, null);
  15283 
  15284   // positive index
  15285   r        = self->f->injectUndefined(self, 1);
  15286   ck_assert_ptr_ne(r, null);
  15287   char *s  = toStringO(r);
  15288   ck_assert_str_eq(s, "[1,null,2,3,4]");
  15289   free(s);
  15290   // negative index
  15291   r = self->f->injectUndefined(self,-1);
  15292   ck_assert_ptr_ne(r, null);
  15293   s = toStringO(r);
  15294   ck_assert_str_eq(s, "[1,null,2,3,4,null]");
  15295   free(s);
  15296   // index 0
  15297   r = self->f->injectUndefined(self,0);
  15298   ck_assert_ptr_ne(r, null);
  15299   s = toStringO(r);
  15300   ck_assert_str_eq(s, "[null,1,null,2,3,4,null]");
  15301   free(s);
  15302   // index outside
  15303   ck_assert_ptr_eq(self->f->injectUndefined(self, 20), NULL);
  15304   ck_assert_ptr_eq(self->f->injectUndefined(self, -9), NULL);
  15305   // empty list
  15306   emptyO(self);
  15307   ck_assert_ptr_ne(self->f->injectUndefined(self, 0), NULL);
  15308   s = toStringO(r);
  15309   ck_assert_str_eq(s, "[null]");
  15310   free(s);
  15311   emptyO(self);
  15312   ck_assert_ptr_ne(self->f->injectUndefined(self, -1), NULL);
  15313   s = toStringO(r);
  15314   ck_assert_str_eq(s, "[null]");
  15315   free(s);
  15316   terminateO(self);
  15317 
  15318 }
  15319 
  15320 
  15321 void injectBoolSmallJsonT(CuTest *tc UNUSED) {
  15322 
  15323   smallJsont* r;
  15324   smallJsont *self = allocSmallJson();
  15325 
  15326   // add elements to self
  15327   r = self->f->pushInt(self, 1);
  15328   ck_assert_ptr_ne(r, null);
  15329   r = self->f->pushInt(self, 2);
  15330   ck_assert_ptr_ne(r, null);
  15331   r = self->f->pushInt(self, 3);
  15332   ck_assert_ptr_ne(r, null);
  15333   r = self->f->pushInt(self, 4);
  15334   ck_assert_ptr_ne(r, null);
  15335 
  15336   // positive index
  15337   r        = self->f->injectBool(self, 1, true);
  15338   ck_assert_ptr_ne(r, null);
  15339   char *s  = toStringO(r);
  15340   ck_assert_str_eq(s, "[1,true,2,3,4]");
  15341   free(s);
  15342   // negative index
  15343   r = self->f->injectBool(self,-1, true);
  15344   ck_assert_ptr_ne(r, null);
  15345   s = toStringO(r);
  15346   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  15347   free(s);
  15348   // index 0
  15349   r = self->f->injectBool(self,0, true);
  15350   ck_assert_ptr_ne(r, null);
  15351   s = toStringO(r);
  15352   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  15353   free(s);
  15354   // index outside
  15355   ck_assert_ptr_eq(self->f->injectBool(self, 20, true), NULL);
  15356   ck_assert_ptr_eq(self->f->injectBool(self, -9, true), NULL);
  15357   // empty list
  15358   emptyO(self);
  15359   ck_assert_ptr_ne(self->f->injectBool(self, 0, true), NULL);
  15360   s = toStringO(r);
  15361   ck_assert_str_eq(s, "[true]");
  15362   free(s);
  15363   emptyO(self);
  15364   ck_assert_ptr_ne(self->f->injectBool(self, -1, true), NULL);
  15365   s = toStringO(r);
  15366   ck_assert_str_eq(s, "[true]");
  15367   free(s);
  15368   // non json array
  15369   freeO(self);
  15370   setTypeBoolO(self);
  15371   ck_assert_ptr_eq(self->f->injectBool(self, 0, true), NULL);
  15372   terminateO(self);
  15373 
  15374 }
  15375 
  15376 
  15377 void injectDoubleSmallJsonT(CuTest *tc UNUSED) {
  15378 
  15379   smallJsont* r;
  15380   smallJsont *self = allocSmallJson();
  15381 
  15382   // add elements to self
  15383   r = self->f->pushInt(self, 1);
  15384   ck_assert_ptr_ne(r, null);
  15385   r = self->f->pushInt(self, 2);
  15386   ck_assert_ptr_ne(r, null);
  15387   r = self->f->pushInt(self, 3);
  15388   ck_assert_ptr_ne(r, null);
  15389   r = self->f->pushInt(self, 4);
  15390   ck_assert_ptr_ne(r, null);
  15391 
  15392   // positive index
  15393   r        = self->f->injectDouble(self, 1, 7);
  15394   ck_assert_ptr_ne(r, null);
  15395   char *s  = toStringO(r);
  15396   ck_assert_str_eq(s, "[1,7.000000e+00,2,3,4]");
  15397   free(s);
  15398   // negative index
  15399   r = self->f->injectDouble(self,-1, 8);
  15400   ck_assert_ptr_ne(r, null);
  15401   s = toStringO(r);
  15402   ck_assert_str_eq(s, "[1,7.000000e+00,2,3,4,8.000000e+00]");
  15403   free(s);
  15404   // index 0
  15405   r = self->f->injectDouble(self,0, 9);
  15406   ck_assert_ptr_ne(r, null);
  15407   s = toStringO(r);
  15408   ck_assert_str_eq(s, "[9.000000e+00,1,7.000000e+00,2,3,4,8.000000e+00]");
  15409   free(s);
  15410   // index outside
  15411   ck_assert_ptr_eq(self->f->injectDouble(self, 20, 7.000000e+00), NULL);
  15412   ck_assert_ptr_eq(self->f->injectDouble(self, -9, 7.000000e+00), NULL);
  15413   // empty list
  15414   emptyO(self);
  15415   ck_assert_ptr_ne(self->f->injectDouble(self, 0, 9), NULL);
  15416   s = toStringO(r);
  15417   ck_assert_str_eq(s, "[9.000000e+00]");
  15418   free(s);
  15419   emptyO(self);
  15420   ck_assert_ptr_ne(self->f->injectDouble(self, -1, 9), NULL);
  15421   s = toStringO(r);
  15422   ck_assert_str_eq(s, "[9.000000e+00]");
  15423   free(s);
  15424   // non json array
  15425   freeO(self);
  15426   setTypeBoolO(self);
  15427   ck_assert_ptr_eq(self->f->injectDouble(self, 0, 0), NULL);
  15428   terminateO(self);
  15429 
  15430 }
  15431 
  15432 
  15433 void injectIntSmallJsonT(CuTest *tc UNUSED) {
  15434 
  15435   smallJsont* r;
  15436   smallJsont *self = allocSmallJson();
  15437 
  15438   // add elements to self
  15439   r = self->f->pushInt(self, 1);
  15440   ck_assert_ptr_ne(r, null);
  15441   r = self->f->pushInt(self, 2);
  15442   ck_assert_ptr_ne(r, null);
  15443   r = self->f->pushInt(self, 3);
  15444   ck_assert_ptr_ne(r, null);
  15445   r = self->f->pushInt(self, 4);
  15446   ck_assert_ptr_ne(r, null);
  15447 
  15448   // positive index
  15449   r        = self->f->injectInt(self, 1, 5);
  15450   ck_assert_ptr_ne(r, null);
  15451   char *s  = toStringO(r);
  15452   ck_assert_str_eq(s, "[1,5,2,3,4]");
  15453   free(s);
  15454   // negative index
  15455   r = self->f->injectInt(self,-1, 6);
  15456   ck_assert_ptr_ne(r, null);
  15457   s = toStringO(r);
  15458   ck_assert_str_eq(s, "[1,5,2,3,4,6]");
  15459   free(s);
  15460   // index 0
  15461   r = self->f->injectInt(self,0, 7);
  15462   ck_assert_ptr_ne(r, null);
  15463   s = toStringO(r);
  15464   ck_assert_str_eq(s, "[7,1,5,2,3,4,6]");
  15465   free(s);
  15466   // index outside
  15467   ck_assert_ptr_eq(self->f->injectInt(self, 20, true), NULL);
  15468   ck_assert_ptr_eq(self->f->injectInt(self, -9, true), NULL);
  15469   // empty list
  15470   emptyO(self);
  15471   ck_assert_ptr_ne(self->f->injectInt(self, 0, 7), NULL);
  15472   s = toStringO(r);
  15473   ck_assert_str_eq(s, "[7]");
  15474   free(s);
  15475   emptyO(self);
  15476   ck_assert_ptr_ne(self->f->injectInt(self, -1, 7), NULL);
  15477   s = toStringO(r);
  15478   ck_assert_str_eq(s, "[7]");
  15479   free(s);
  15480   // non json array
  15481   freeO(self);
  15482   setTypeBoolO(self);
  15483   ck_assert_ptr_eq(self->f->injectInt(self, 0, 0), NULL);
  15484   terminateO(self);
  15485 
  15486 }
  15487 
  15488 
  15489 void injectSSmallJsonT(CuTest *tc UNUSED) {
  15490 
  15491   smallJsont* r;
  15492   smallJsont *self = allocSmallJson();
  15493 
  15494   // add elements to self
  15495   r = self->f->pushInt(self, 1);
  15496   ck_assert_ptr_ne(r, null);
  15497   r = self->f->pushInt(self, 2);
  15498   ck_assert_ptr_ne(r, null);
  15499   r = self->f->pushInt(self, 3);
  15500   ck_assert_ptr_ne(r, null);
  15501   r = self->f->pushInt(self, 4);
  15502   ck_assert_ptr_ne(r, null);
  15503   // positive index
  15504   r        = self->f->injectS(self, 1, "5");
  15505   ck_assert_ptr_ne(r, null);
  15506   char *s  = toStringO(r);
  15507   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  15508   free(s);
  15509   // negative index
  15510   r = self->f->injectS(self,-1, "6");
  15511   ck_assert_ptr_ne(r, null);
  15512   s = toStringO(r);
  15513   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  15514   free(s);
  15515   // index 0
  15516   r = self->f->injectS(self,0, "7");
  15517   ck_assert_ptr_ne(r, null);
  15518   s = toStringO(r);
  15519   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15520   free(s);
  15521   // null toInject
  15522   r = self->f->injectS(self,0, null);
  15523   ck_assert_ptr_eq(r, null);
  15524   s = toStringO(self);
  15525   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15526   free(s);
  15527   // index outside
  15528   ck_assert_ptr_eq(self->f->injectS(self, 20, ""), NULL);
  15529   ck_assert_ptr_eq(self->f->injectS(self, -9, ""), NULL);
  15530   // empty list
  15531   emptyO(self);
  15532   ck_assert_ptr_ne(self->f->injectS(self, 0, "7"), NULL);
  15533   s = toStringO(self);
  15534   ck_assert_str_eq(s, "[\"7\"]");
  15535   free(s);
  15536   emptyO(self);
  15537   ck_assert_ptr_ne(self->f->injectS(self, -1, "7"), NULL);
  15538   s = toStringO(self);
  15539   ck_assert_str_eq(s, "[\"7\"]");
  15540   free(s);
  15541   // non json array
  15542   freeO(self);
  15543   setTypeBoolO(self);
  15544   ck_assert_ptr_eq(self->f->injectS(self, 0, "7"), NULL);
  15545   terminateO(self);
  15546   // json string
  15547   self = allocSmallJson();
  15548   setTopSO(self, "s");
  15549   r = self->f->injectS(self,1, "heepy");
  15550   ck_assert_ptr_ne(r, null);
  15551   s = toStringO(r);
  15552   ck_assert_str_eq(s, "sheepy");
  15553   free(s);
  15554   terminateO(self);
  15555 
  15556 }
  15557 
  15558 
  15559 void injectCharSmallJsonT(CuTest *tc UNUSED) {
  15560 
  15561   smallJsont* r;
  15562   smallJsont *self = allocSmallJson();
  15563 
  15564   // add elements to self
  15565   r = self->f->pushInt(self, 1);
  15566   ck_assert_ptr_ne(r, null);
  15567   r = self->f->pushInt(self, 2);
  15568   ck_assert_ptr_ne(r, null);
  15569   r = self->f->pushInt(self, 3);
  15570   ck_assert_ptr_ne(r, null);
  15571   r = self->f->pushInt(self, 4);
  15572   ck_assert_ptr_ne(r, null);
  15573 
  15574   // positive index
  15575   r        = self->f->injectChar(self, 1, '5');
  15576   ck_assert_ptr_ne(r, null);
  15577   char *s  = toStringO(r);
  15578   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  15579   free(s);
  15580   // negative index
  15581   r = self->f->injectChar(self,-1, '6');
  15582   ck_assert_ptr_ne(r, null);
  15583   s = toStringO(r);
  15584   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  15585   free(s);
  15586   // index 0
  15587   r = self->f->injectChar(self,0, '7');
  15588   ck_assert_ptr_ne(r, null);
  15589   s = toStringO(r);
  15590   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  15591   free(s);
  15592   // index outside
  15593   ck_assert_ptr_eq(self->f->injectChar(self, 20, 'y'), NULL);
  15594   ck_assert_ptr_eq(self->f->injectChar(self, -9, 'y'), NULL);
  15595   // empty list
  15596   emptyO(self);
  15597   ck_assert_ptr_ne(self->f->injectChar(self, 0, '7'), NULL);
  15598   s = toStringO(r);
  15599   ck_assert_str_eq(s, "[\"7\"]");
  15600   free(s);
  15601   emptyO(self);
  15602   ck_assert_ptr_ne(self->f->injectChar(self, -1, '7'), NULL);
  15603   s = toStringO(r);
  15604   ck_assert_str_eq(s, "[\"7\"]");
  15605   free(s);
  15606   terminateO(self);
  15607 
  15608 }
  15609 
  15610 
  15611 void injectDictSmallJsonT(CuTest *tc UNUSED) {
  15612 
  15613   smallJsont* r;
  15614   smallJsont *self = allocSmallJson();
  15615   smallDictt *toInject;
  15616 
  15617   // add elements to self
  15618   r = self->f->pushInt(self, 1);
  15619   ck_assert_ptr_ne(r, null);
  15620   r = self->f->pushInt(self, 2);
  15621   ck_assert_ptr_ne(r, null);
  15622   r = self->f->pushInt(self, 3);
  15623   ck_assert_ptr_ne(r, null);
  15624   r = self->f->pushInt(self, 4);
  15625   ck_assert_ptr_ne(r, null);
  15626 
  15627   // positive index
  15628   toInject = allocSmallDict();
  15629   r        = self->f->injectDict(self, 1, toInject);
  15630   ck_assert_ptr_ne(r, null);
  15631   finishO(toInject);
  15632   char *s  = toStringO(r);
  15633   ck_assert_str_eq(s, "[1,{},2,3,4]");
  15634   free(s);
  15635   // negative index
  15636   toInject = allocSmallDict();
  15637   r = self->f->injectDict(self,-1, toInject);
  15638   ck_assert_ptr_ne(r, null);
  15639   finishO(toInject);
  15640   s = toStringO(r);
  15641   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  15642   free(s);
  15643   // index 0
  15644   toInject = allocSmallDict();
  15645   r = self->f->injectDict(self,0, toInject);
  15646   ck_assert_ptr_ne(r, null);
  15647   finishO(toInject);
  15648   s = toStringO(r);
  15649   ck_assert_str_eq(s, "[{},1,{},2,3,4,{}]");
  15650   free(s);
  15651   // index outside
  15652   toInject = allocSmallDict();
  15653   ck_assert_ptr_eq(self->f->injectDict(self, 20, toInject), NULL);
  15654   ck_assert_ptr_eq(self->f->injectDict(self, -9, toInject), NULL);
  15655   terminateO(toInject);
  15656   // empty list
  15657   emptyO(self);
  15658   toInject = allocSmallDict();
  15659   ck_assert_ptr_ne(self->f->injectDict(self, 0, toInject), NULL);
  15660   finishO(toInject);
  15661   s = toStringO(r);
  15662   ck_assert_str_eq(s, "[{}]");
  15663   free(s);
  15664   emptyO(self);
  15665   toInject = allocSmallDict();
  15666   ck_assert_ptr_ne(self->f->injectDict(self, -1, toInject), NULL);
  15667   finishO(toInject);
  15668   s = toStringO(r);
  15669   ck_assert_str_eq(s, "[{}]");
  15670   free(s);
  15671   // non smallDict object
  15672   toInject = (smallDictt*) allocSmallInt(2);
  15673   r = self->f->injectDict(self, 0, toInject);
  15674   ck_assert_ptr_eq(r, null);
  15675   terminateO(toInject);
  15676   // null toInsert
  15677   ck_assert_ptr_eq(self->f->injectDict(self, 0, NULL), NULL);
  15678   // non json array
  15679   freeO(self);
  15680   setTypeBoolO(self);
  15681   toInject = allocSmallDict();
  15682   ck_assert_ptr_eq(self->f->injectDict(self, 0, toInject), NULL);
  15683   terminateO(toInject);
  15684   terminateO(self);
  15685 
  15686 }
  15687 
  15688 
  15689 void injectArraySmallJsonT(CuTest *tc UNUSED) {
  15690 
  15691   smallJsont* r;
  15692   smallJsont *self = allocSmallJson();
  15693   smallArrayt *toInject;
  15694 
  15695   // add elements to self
  15696   r = self->f->pushInt(self, 1);
  15697   ck_assert_ptr_ne(r, null);
  15698   r = self->f->pushInt(self, 2);
  15699   ck_assert_ptr_ne(r, null);
  15700   r = self->f->pushInt(self, 3);
  15701   ck_assert_ptr_ne(r, null);
  15702   r = self->f->pushInt(self, 4);
  15703   ck_assert_ptr_ne(r, null);
  15704 
  15705   // positive index
  15706   toInject = allocSmallArray();
  15707   r        = self->f->injectArray(self, 1, toInject);
  15708   ck_assert_ptr_ne(r, null);
  15709   finishO(toInject);
  15710   char *s  = toStringO(r);
  15711   ck_assert_str_eq(s, "[1,[],2,3,4]");
  15712   free(s);
  15713   // negative index
  15714   toInject = allocSmallArray();
  15715   r = self->f->injectArray(self,-1, toInject);
  15716   ck_assert_ptr_ne(r, null);
  15717   finishO(toInject);
  15718   s = toStringO(r);
  15719   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  15720   free(s);
  15721   // index 0
  15722   toInject = allocSmallArray();
  15723   r = self->f->injectArray(self,0, toInject);
  15724   ck_assert_ptr_ne(r, null);
  15725   finishO(toInject);
  15726   s = toStringO(r);
  15727   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  15728   free(s);
  15729   // index outside
  15730   toInject = allocSmallArray();
  15731   ck_assert_ptr_eq(self->f->injectArray(self, 20, toInject), NULL);
  15732   ck_assert_ptr_eq(self->f->injectArray(self, -9, toInject), NULL);
  15733   terminateO(toInject);
  15734   // empty list
  15735   emptyO(self);
  15736   toInject = allocSmallArray();
  15737   ck_assert_ptr_ne(self->f->injectArray(self, 0, toInject), NULL);
  15738   finishO(toInject);
  15739   s = toStringO(r);
  15740   ck_assert_str_eq(s, "[[]]");
  15741   free(s);
  15742   emptyO(self);
  15743   toInject = allocSmallArray();
  15744   ck_assert_ptr_ne(self->f->injectArray(self, -1, toInject), NULL);
  15745   finishO(toInject);
  15746   s = toStringO(r);
  15747   ck_assert_str_eq(s, "[[]]");
  15748   free(s);
  15749   // non smallArray object
  15750   toInject = (smallArrayt*) allocSmallInt(2);
  15751   r = self->f->injectArray(self, 0, toInject);
  15752   ck_assert_ptr_eq(r, null);
  15753   terminateO(toInject);
  15754   // null toInsert
  15755   ck_assert_ptr_eq(self->f->injectArray(self, 0, NULL), NULL);
  15756   // non json array
  15757   freeO(self);
  15758   setTypeBoolO(self);
  15759   toInject = allocSmallArray();
  15760   ck_assert_ptr_eq(self->f->injectArray(self, 0, toInject), NULL);
  15761   terminateO(toInject);
  15762   terminateO(self);
  15763 
  15764 }
  15765 
  15766 
  15767 void injectArraycSmallJsonT(CuTest *tc UNUSED) {
  15768 
  15769   smallJsont* r;
  15770   smallJsont *self = allocSmallJson();
  15771   char **toInject;
  15772 
  15773   // add elements to self
  15774   r = self->f->pushInt(self, 1);
  15775   ck_assert_ptr_ne(r, null);
  15776   r = self->f->pushInt(self, 2);
  15777   ck_assert_ptr_ne(r, null);
  15778   r = self->f->pushInt(self, 3);
  15779   ck_assert_ptr_ne(r, null);
  15780   r = self->f->pushInt(self, 4);
  15781   ck_assert_ptr_ne(r, null);
  15782 
  15783   // positive index
  15784   toInject = listCreateS("a","b");
  15785   r        = self->f->injectArrayc(self, 1, toInject);
  15786   listFreeS(toInject);
  15787   ck_assert_ptr_ne(r, null);
  15788   char *s  = toStringO(r);
  15789   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4]");
  15790   free(s);
  15791   // negative index
  15792   toInject = listCreateS("c","d");
  15793   r = self->f->injectArrayc(self,-1, toInject);
  15794   listFreeS(toInject);
  15795   ck_assert_ptr_ne(r, null);
  15796   s = toStringO(r);
  15797   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  15798   free(s);
  15799   // index 0
  15800   toInject = listCreateS("e","ff");
  15801   r = self->f->injectArrayc(self,0, toInject);
  15802   listFreeS(toInject);
  15803   ck_assert_ptr_ne(r, null);
  15804   s = toStringO(r);
  15805   ck_assert_str_eq(s, "[[\"e\",\"ff\"],1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  15806   free(s);
  15807   // index outside
  15808   toInject = listCreateS("a","b");
  15809   ck_assert_ptr_eq(self->f->injectArrayc(self, 20, toInject), NULL);
  15810   ck_assert_ptr_eq(self->f->injectArrayc(self, -9, toInject), NULL);
  15811   listFreeS(toInject);
  15812   // empty list
  15813   emptyO(self);
  15814   toInject = listCreateS("a","b");
  15815   ck_assert_ptr_ne(self->f->injectArrayc(self, 0, toInject), NULL);
  15816   listFreeS(toInject);
  15817   s = toStringO(r);
  15818   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  15819   free(s);
  15820   emptyO(self);
  15821   toInject = listCreateS("a","b");
  15822   ck_assert_ptr_ne(self->f->injectArrayc(self, -1, toInject), NULL);
  15823   listFreeS(toInject);
  15824   s = toStringO(r);
  15825   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  15826   free(s);
  15827   // null toInsert
  15828   ck_assert_ptr_eq(self->f->injectArrayc(self, 0, NULL), NULL);
  15829   // non json array
  15830   freeO(self);
  15831   setTypeBoolO(self);
  15832   toInject = listCreateS("e","ff");
  15833   ck_assert_ptr_eq(self->f->injectArrayc(self, 0, toInject), NULL);
  15834   listFreeS(toInject);
  15835   terminateO(self);
  15836 
  15837 }
  15838 
  15839 
  15840 void injectSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  15841 
  15842   smallJsont* r;
  15843   smallJsont *self = allocSmallJson();
  15844   smallBoolt *toInject;
  15845 
  15846   // add elements to self
  15847   r = self->f->pushInt(self, 1);
  15848   ck_assert_ptr_ne(r, null);
  15849   r = self->f->pushInt(self, 2);
  15850   ck_assert_ptr_ne(r, null);
  15851   r = self->f->pushInt(self, 3);
  15852   ck_assert_ptr_ne(r, null);
  15853   r = self->f->pushInt(self, 4);
  15854   ck_assert_ptr_ne(r, null);
  15855 
  15856   // positive index
  15857   toInject = allocSmallBool(true);
  15858   r        = self->f->injectSmallBool(self, 1, toInject);
  15859   ck_assert_ptr_ne(r, null);
  15860   finishO(toInject);
  15861   char *s  = toStringO(r);
  15862   ck_assert_str_eq(s, "[1,true,2,3,4]");
  15863   free(s);
  15864   // negative index
  15865   toInject = allocSmallBool(true);
  15866   r = self->f->injectSmallBool(self,-1, toInject);
  15867   ck_assert_ptr_ne(r, null);
  15868   finishO(toInject);
  15869   s = toStringO(r);
  15870   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  15871   free(s);
  15872   // index 0
  15873   toInject = allocSmallBool(true);
  15874   r = self->f->injectSmallBool(self,0, toInject);
  15875   ck_assert_ptr_ne(r, null);
  15876   finishO(toInject);
  15877   s = toStringO(r);
  15878   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  15879   free(s);
  15880   // index outside
  15881   toInject = allocSmallBool(true);
  15882   ck_assert_ptr_eq(self->f->injectSmallBool(self, 20, toInject), NULL);
  15883   ck_assert_ptr_eq(self->f->injectSmallBool(self, -9, toInject), NULL);
  15884   terminateO(toInject);
  15885   // empty object
  15886   emptyO(self);
  15887   toInject = allocSmallBool(true);
  15888   freeO(toInject);
  15889   ck_assert_ptr_ne(self->f->injectSmallBool(self, 0, toInject), NULL);
  15890   finishO(toInject);
  15891   s = toStringO(r);
  15892   ck_assert_str_eq(s, "[false]");
  15893   free(s);
  15894   // empty list
  15895   emptyO(self);
  15896   toInject = allocSmallBool(true);
  15897   ck_assert_ptr_ne(self->f->injectSmallBool(self, 0, toInject), NULL);
  15898   finishO(toInject);
  15899   s = toStringO(r);
  15900   ck_assert_str_eq(s, "[true]");
  15901   free(s);
  15902   emptyO(self);
  15903   toInject = allocSmallBool(true);
  15904   ck_assert_ptr_ne(self->f->injectSmallBool(self, -1, toInject), NULL);
  15905   finishO(toInject);
  15906   s = toStringO(r);
  15907   ck_assert_str_eq(s, "[true]");
  15908   free(s);
  15909   // non smallBool object
  15910   toInject = (smallBoolt*) allocSmallInt(2);
  15911   r = self->f->injectSmallBool(self, 0, toInject);
  15912   ck_assert_ptr_eq(r, null);
  15913   terminateO(toInject);
  15914   // null toInsert
  15915   ck_assert_ptr_eq(self->f->injectSmallBool(self, 0, NULL), NULL);
  15916   terminateO(self);
  15917 
  15918 }
  15919 
  15920 
  15921 void injectSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  15922 
  15923   smallJsont* r;
  15924   smallJsont *self = allocSmallJson();
  15925   smallBytest *toInject;
  15926 
  15927   // add elements to self
  15928   r = self->f->pushInt(self, 1);
  15929   ck_assert_ptr_ne(r, null);
  15930   r = self->f->pushInt(self, 2);
  15931   ck_assert_ptr_ne(r, null);
  15932   r = self->f->pushInt(self, 3);
  15933   ck_assert_ptr_ne(r, null);
  15934   r = self->f->pushInt(self, 4);
  15935   ck_assert_ptr_ne(r, null);
  15936 
  15937   // positive index
  15938   toInject = allocSmallBytes(null, 0);
  15939   r        = self->f->injectSmallBytes(self, 1, toInject);
  15940   ck_assert_ptr_ne(r, null);
  15941   finishO(toInject);
  15942   char *s  = toStringO(r);
  15943   ck_assert_str_eq(s, "[1,[],2,3,4]");
  15944   free(s);
  15945   // negative index
  15946   toInject = allocSmallBytes(null, 0);
  15947   r = self->f->injectSmallBytes(self,-1, toInject);
  15948   ck_assert_ptr_ne(r, null);
  15949   finishO(toInject);
  15950   s = toStringO(r);
  15951   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  15952   free(s);
  15953   // index 0
  15954   toInject = allocSmallBytes(null, 0);
  15955   r = self->f->injectSmallBytes(self,0, toInject);
  15956   ck_assert_ptr_ne(r, null);
  15957   finishO(toInject);
  15958   s = toStringO(r);
  15959   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  15960   free(s);
  15961   // index outside
  15962   toInject = allocSmallBytes(null, 0);
  15963   ck_assert_ptr_eq(self->f->injectSmallBytes(self, 20, toInject), NULL);
  15964   ck_assert_ptr_eq(self->f->injectSmallBytes(self, -9, toInject), NULL);
  15965   terminateO(toInject);
  15966   // empty object
  15967   emptyO(self);
  15968   toInject = allocSmallBytes(null, 0);
  15969   freeO(toInject);
  15970   ck_assert_ptr_ne(self->f->injectSmallBytes(self, 0, toInject), NULL);
  15971   finishO(toInject);
  15972   s = toStringO(r);
  15973   ck_assert_str_eq(s, "[[]]");
  15974   free(s);
  15975   // empty list
  15976   emptyO(self);
  15977   toInject = allocSmallBytes(null, 0);
  15978   ck_assert_ptr_ne(self->f->injectSmallBytes(self, 0, toInject), NULL);
  15979   finishO(toInject);
  15980   s = toStringO(r);
  15981   ck_assert_str_eq(s, "[[]]");
  15982   free(s);
  15983   emptyO(self);
  15984   toInject = allocSmallBytes(null, 0);
  15985   ck_assert_ptr_ne(self->f->injectSmallBytes(self, -1, toInject), NULL);
  15986   finishO(toInject);
  15987   s = toStringO(r);
  15988   ck_assert_str_eq(s, "[[]]");
  15989   free(s);
  15990   // non smallBytes object
  15991   toInject = (smallBytest*) allocSmallInt(2);
  15992   r = self->f->injectSmallBytes(self, 0, toInject);
  15993   ck_assert_ptr_eq(r, null);
  15994   terminateO(toInject);
  15995   // null toInsert
  15996   ck_assert_ptr_eq(self->f->injectSmallBytes(self, 0, NULL), NULL);
  15997   terminateO(self);
  15998 
  15999 }
  16000 
  16001 
  16002 void injectSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  16003 
  16004   smallJsont* r;
  16005   smallJsont *self = allocSmallJson();
  16006   smallDoublet *toInject;
  16007 
  16008   // add elements to self
  16009   r = self->f->pushInt(self, 1);
  16010   ck_assert_ptr_ne(r, null);
  16011   r = self->f->pushInt(self, 2);
  16012   ck_assert_ptr_ne(r, null);
  16013   r = self->f->pushInt(self, 3);
  16014   ck_assert_ptr_ne(r, null);
  16015   r = self->f->pushInt(self, 4);
  16016   ck_assert_ptr_ne(r, null);
  16017 
  16018   // positive index
  16019   toInject = allocSmallDouble(2);
  16020   r        = self->f->injectSmallDouble(self, 1, toInject);
  16021   ck_assert_ptr_ne(r, null);
  16022   finishO(toInject);
  16023   char *s  = toStringO(r);
  16024   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4]");
  16025   free(s);
  16026   // negative index
  16027   toInject = allocSmallDouble(3);
  16028   r = self->f->injectSmallDouble(self,-1, toInject);
  16029   ck_assert_ptr_ne(r, null);
  16030   finishO(toInject);
  16031   s = toStringO(r);
  16032   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4,3.000000e+00]");
  16033   free(s);
  16034   // index 0
  16035   toInject = allocSmallDouble(1);
  16036   r = self->f->injectSmallDouble(self,0, toInject);
  16037   ck_assert_ptr_ne(r, null);
  16038   finishO(toInject);
  16039   s = toStringO(r);
  16040   ck_assert_str_eq(s, "[1.000000e+00,1,2.000000e+00,2,3,4,3.000000e+00]");
  16041   free(s);
  16042   // index outside
  16043   toInject = allocSmallDouble(1);
  16044   ck_assert_ptr_eq(self->f->injectSmallDouble(self, 20, toInject), NULL);
  16045   ck_assert_ptr_eq(self->f->injectSmallDouble(self, -9, toInject), NULL);
  16046   terminateO(toInject);
  16047   // empty object
  16048   emptyO(self);
  16049   toInject = allocSmallDouble(1);
  16050   freeO(toInject);
  16051   ck_assert_ptr_ne(self->f->injectSmallDouble(self, 0, toInject), NULL);
  16052   finishO(toInject);
  16053   s = toStringO(r);
  16054   ck_assert_str_eq(s, "[0.000000e+00]");
  16055   free(s);
  16056   // empty list
  16057   emptyO(self);
  16058   toInject = allocSmallDouble(1);
  16059   ck_assert_ptr_ne(self->f->injectSmallDouble(self, 0, toInject), NULL);
  16060   finishO(toInject);
  16061   s = toStringO(r);
  16062   ck_assert_str_eq(s, "[1.000000e+00]");
  16063   free(s);
  16064   emptyO(self);
  16065   toInject = allocSmallDouble(1);
  16066   ck_assert_ptr_ne(self->f->injectSmallDouble(self, -1, toInject), NULL);
  16067   finishO(toInject);
  16068   s = toStringO(r);
  16069   ck_assert_str_eq(s, "[1.000000e+00]");
  16070   free(s);
  16071   // non smallDouble object
  16072   toInject = (smallDoublet*) allocSmallInt(2);
  16073   r = self->f->injectSmallDouble(self, 0, toInject);
  16074   ck_assert_ptr_eq(r, null);
  16075   terminateO(toInject);
  16076   // null toInsert
  16077   ck_assert_ptr_eq(self->f->injectSmallDouble(self, 0, NULL), NULL);
  16078   terminateO(self);
  16079 
  16080 }
  16081 
  16082 
  16083 void injectSmallIntSmallJsonT(CuTest *tc UNUSED) {
  16084 
  16085   smallJsont* r;
  16086   smallJsont *self = allocSmallJson();
  16087   smallIntt *toInject;
  16088 
  16089   // add elements to self
  16090   r = self->f->pushInt(self, 1);
  16091   ck_assert_ptr_ne(r, null);
  16092   r = self->f->pushInt(self, 2);
  16093   ck_assert_ptr_ne(r, null);
  16094   r = self->f->pushInt(self, 3);
  16095   ck_assert_ptr_ne(r, null);
  16096   r = self->f->pushInt(self, 4);
  16097   ck_assert_ptr_ne(r, null);
  16098 
  16099   // positive index
  16100   toInject = allocSmallInt(10);
  16101   r        = self->f->injectSmallInt(self, 1, toInject);
  16102   ck_assert_ptr_ne(r, null);
  16103   finishO(toInject);
  16104   char *s  = toStringO(r);
  16105   ck_assert_str_eq(s, "[1,10,2,3,4]");
  16106   free(s);
  16107   // negative index
  16108   toInject = allocSmallInt(11);
  16109   r = self->f->injectSmallInt(self,-1, toInject);
  16110   ck_assert_ptr_ne(r, null);
  16111   finishO(toInject);
  16112   s = toStringO(r);
  16113   ck_assert_str_eq(s, "[1,10,2,3,4,11]");
  16114   free(s);
  16115   // index 0
  16116   toInject = allocSmallInt(12);
  16117   r = self->f->injectSmallInt(self,0, toInject);
  16118   ck_assert_ptr_ne(r, null);
  16119   finishO(toInject);
  16120   s = toStringO(r);
  16121   ck_assert_str_eq(s, "[12,1,10,2,3,4,11]");
  16122   free(s);
  16123   // index outside
  16124   toInject = allocSmallInt(10);
  16125   ck_assert_ptr_eq(self->f->injectSmallInt(self, 20, toInject), NULL);
  16126   ck_assert_ptr_eq(self->f->injectSmallInt(self, -9, toInject), NULL);
  16127   terminateO(toInject);
  16128   // empty object
  16129   emptyO(self);
  16130   toInject = allocSmallInt(10);
  16131   freeO(toInject);
  16132   ck_assert_ptr_ne(self->f->injectSmallInt(self, 0, toInject), NULL);
  16133   finishO(toInject);
  16134   s = toStringO(r);
  16135   ck_assert_str_eq(s, "[0]");
  16136   free(s);
  16137   // empty list
  16138   emptyO(self);
  16139   toInject = allocSmallInt(10);
  16140   ck_assert_ptr_ne(self->f->injectSmallInt(self, 0, toInject), NULL);
  16141   finishO(toInject);
  16142   s = toStringO(r);
  16143   ck_assert_str_eq(s, "[10]");
  16144   free(s);
  16145   emptyO(self);
  16146   toInject = allocSmallInt(10);
  16147   ck_assert_ptr_ne(self->f->injectSmallInt(self, -1, toInject), NULL);
  16148   finishO(toInject);
  16149   s = toStringO(r);
  16150   ck_assert_str_eq(s, "[10]");
  16151   free(s);
  16152   // non smallInt object
  16153   toInject = (smallIntt*) allocSmallBool(true);
  16154   r = self->f->injectSmallInt(self, 0, toInject);
  16155   ck_assert_ptr_eq(r, null);
  16156   terminateO(toInject);
  16157   // null toInsert
  16158   ck_assert_ptr_eq(self->f->injectSmallInt(self, 0, NULL), NULL);
  16159   terminateO(self);
  16160 
  16161 }
  16162 
  16163 
  16164 void injectSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  16165 
  16166   smallJsont* r;
  16167   smallJsont *self = allocSmallJson();
  16168   smallJsont *toInject;
  16169 
  16170   // add elements to self
  16171   r = self->f->pushInt(self, 1);
  16172   ck_assert_ptr_ne(r, null);
  16173   r = self->f->pushInt(self, 2);
  16174   ck_assert_ptr_ne(r, null);
  16175   r = self->f->pushInt(self, 3);
  16176   ck_assert_ptr_ne(r, null);
  16177   r = self->f->pushInt(self, 4);
  16178   ck_assert_ptr_ne(r, null);
  16179 
  16180   // positive index
  16181   toInject = allocSmallJson();
  16182   r        = self->f->injectSmallJson(self, 1, toInject);
  16183   ck_assert_ptr_ne(r, null);
  16184   finishO(toInject);
  16185   char *s  = toStringO(r);
  16186   ck_assert_str_eq(s, "[1,{},2,3,4]");
  16187   free(s);
  16188   // negative index
  16189   toInject = allocSmallJson();
  16190   r = self->f->injectSmallJson(self,-1, toInject);
  16191   ck_assert_ptr_ne(r, null);
  16192   finishO(toInject);
  16193   s = toStringO(r);
  16194   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  16195   free(s);
  16196   // index 0
  16197   toInject = allocSmallJson();
  16198   toInject->f->setS(toInject, "key", "value");
  16199   r = self->f->injectSmallJson(self,0, toInject);
  16200   ck_assert_ptr_ne(r, null);
  16201   finishO(toInject);
  16202   s = toStringO(r);
  16203   ck_assert_str_eq(s, "[{\"key\":\"value\"},1,{},2,3,4,{}]");
  16204   free(s);
  16205   // index outside
  16206   toInject = allocSmallJson();
  16207   ck_assert_ptr_eq(self->f->injectSmallJson(self, 20, toInject), NULL);
  16208   ck_assert_ptr_eq(self->f->injectSmallJson(self, -9, toInject), NULL);
  16209   terminateO(toInject);
  16210   // empty object
  16211   emptyO(self);
  16212   toInject = allocSmallJson();
  16213   freeO(toInject);
  16214   ck_assert_ptr_ne(self->f->injectSmallJson(self, 0, toInject), NULL);
  16215   finishO(toInject);
  16216   s = toStringO(r);
  16217   ck_assert_str_eq(s, "[{}]");
  16218   free(s);
  16219   // empty list
  16220   emptyO(self);
  16221   toInject = allocSmallJson();
  16222   ck_assert_ptr_ne(self->f->injectSmallJson(self, 0, toInject), NULL);
  16223   finishO(toInject);
  16224   s = toStringO(r);
  16225   ck_assert_str_eq(s, "[{}]");
  16226   free(s);
  16227   emptyO(self);
  16228   toInject = allocSmallJson();
  16229   ck_assert_ptr_ne(self->f->injectSmallJson(self, -1, toInject), NULL);
  16230   finishO(toInject);
  16231   s = toStringO(r);
  16232   ck_assert_str_eq(s, "[{}]");
  16233   free(s);
  16234   // non smallJson object
  16235   toInject = (smallJsont*) allocSmallInt(2);
  16236   r = self->f->injectSmallJson(self, 0, toInject);
  16237   ck_assert_ptr_eq(r, null);
  16238   terminateO(toInject);
  16239   // null toInsert
  16240   ck_assert_ptr_eq(self->f->injectSmallJson(self, 0, NULL), NULL);
  16241   terminateO(self);
  16242 
  16243 }
  16244 
  16245 
  16246 void injectSmallStringSmallJsonT(CuTest *tc UNUSED) {
  16247 
  16248   smallJsont* r;
  16249   smallJsont *self = allocSmallJson();
  16250   smallStringt *toInject;
  16251 
  16252   // add elements to self
  16253   r = self->f->pushInt(self, 1);
  16254   ck_assert_ptr_ne(r, null);
  16255   r = self->f->pushInt(self, 2);
  16256   ck_assert_ptr_ne(r, null);
  16257   r = self->f->pushInt(self, 3);
  16258   ck_assert_ptr_ne(r, null);
  16259   r = self->f->pushInt(self, 4);
  16260   ck_assert_ptr_ne(r, null);
  16261 
  16262   // positive index
  16263   toInject = allocSmallString("1");
  16264   r        = self->f->injectSmallString(self, 1, toInject);
  16265   ck_assert_ptr_ne(r, null);
  16266   finishO(toInject);
  16267   char *s  = toStringO(r);
  16268   ck_assert_str_eq(s, "[1,\"1\",2,3,4]");
  16269   free(s);
  16270   // negative index
  16271   toInject = allocSmallString("2");
  16272   r = self->f->injectSmallString(self,-1, toInject);
  16273   ck_assert_ptr_ne(r, null);
  16274   finishO(toInject);
  16275   s = toStringO(r);
  16276   ck_assert_str_eq(s, "[1,\"1\",2,3,4,\"2\"]");
  16277   free(s);
  16278   // index 0
  16279   toInject = allocSmallString("3");
  16280   r = self->f->injectSmallString(self,0, toInject);
  16281   ck_assert_ptr_ne(r, null);
  16282   finishO(toInject);
  16283   s = toStringO(r);
  16284   ck_assert_str_eq(s, "[\"3\",1,\"1\",2,3,4,\"2\"]");
  16285   free(s);
  16286   // index outside
  16287   toInject = allocSmallString("1");
  16288   ck_assert_ptr_eq(self->f->injectSmallString(self, 20, toInject), NULL);
  16289   ck_assert_ptr_eq(self->f->injectSmallString(self, -9, toInject), NULL);
  16290   terminateO(toInject);
  16291   // empty object
  16292   emptyO(self);
  16293   toInject = allocSmallString("1");
  16294   freeO(toInject);
  16295   r = self->f->injectSmallString(self, 0, toInject);
  16296   ck_assert_ptr_ne(r, NULL);
  16297   finishO(toInject);
  16298   s = toStringO(r);
  16299   ck_assert_str_eq(s, "[\"\"]");
  16300   free(s);
  16301   // empty list
  16302   emptyO(self);
  16303   toInject = allocSmallString("1");
  16304   r = self->f->injectSmallString(self, 0, toInject);
  16305   ck_assert_ptr_ne(r, NULL);
  16306   finishO(toInject);
  16307   s = toStringO(r);
  16308   ck_assert_str_eq(s, "[\"1\"]");
  16309   free(s);
  16310   emptyO(self);
  16311   toInject = allocSmallString("1");
  16312   r = self->f->injectSmallString(self, -1, toInject);
  16313   ck_assert_ptr_ne(r, NULL);
  16314   finishO(toInject);
  16315   s = toStringO(r);
  16316   ck_assert_str_eq(s, "[\"1\"]");
  16317   free(s);
  16318   // non smallString object
  16319   toInject = (smallStringt*) allocSmallInt(2);
  16320   r = self->f->injectSmallString(self, 0, toInject);
  16321   ck_assert_ptr_eq(r, null);
  16322   terminateO(toInject);
  16323   // null toInsert
  16324   ck_assert_ptr_eq(self->f->injectSmallString(self, 0, NULL), NULL);
  16325   terminateO(self);
  16326   // json string
  16327   self = allocSmallJson();
  16328   setTopSO(self, "s");
  16329   toInject = allocSmallString("heepy");
  16330   r = self->f->injectSmallString(self, 1, toInject);
  16331   ck_assert_ptr_ne(r, NULL);
  16332   terminateO(toInject);
  16333   s = toStringO(r);
  16334   ck_assert_str_eq(s, "sheepy");
  16335   free(s);
  16336   terminateO(self);
  16337 
  16338 
  16339 }
  16340 
  16341 
  16342 void injectSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  16343 
  16344   smallJsont* r;
  16345   smallJsont *self = allocSmallJson();
  16346   smallContainert *toInject;
  16347 
  16348   // add elements to self
  16349   r = self->f->pushInt(self, 1);
  16350   ck_assert_ptr_ne(r, null);
  16351   r = self->f->pushInt(self, 2);
  16352   ck_assert_ptr_ne(r, null);
  16353   r = self->f->pushInt(self, 3);
  16354   ck_assert_ptr_ne(r, null);
  16355   r = self->f->pushInt(self, 4);
  16356   ck_assert_ptr_ne(r, null);
  16357 
  16358   // positive index
  16359   toInject = allocSmallContainer(NULL);
  16360   r        = self->f->injectSmallContainer(self, 1, toInject);
  16361   ck_assert_ptr_ne(r, null);
  16362   finishO(toInject);
  16363   char *s  = toStringO(r);
  16364   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4]");
  16365   free(s);
  16366   // negative index
  16367   toInject = allocSmallContainer(NULL);
  16368   r = self->f->injectSmallContainer(self,-1, toInject);
  16369   ck_assert_ptr_ne(r, null);
  16370   finishO(toInject);
  16371   s = toStringO(r);
  16372   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4,\"<data container>\"]");
  16373   free(s);
  16374   // index 0
  16375   toInject = allocSmallContainer(NULL);
  16376   r = self->f->injectSmallContainer(self,0, toInject);
  16377   ck_assert_ptr_ne(r, null);
  16378   finishO(toInject);
  16379   s = toStringO(r);
  16380   ck_assert_str_eq(s, "[\"<data container>\",1,\"<data container>\",2,3,4,\"<data container>\"]");
  16381   free(s);
  16382   // index outside
  16383   toInject = allocSmallContainer(NULL);
  16384   ck_assert_ptr_eq(self->f->injectSmallContainer(self, 20, toInject), NULL);
  16385   ck_assert_ptr_eq(self->f->injectSmallContainer(self, -9, toInject), NULL);
  16386   terminateO(toInject);
  16387   // empty object
  16388   emptyO(self);
  16389   toInject = allocSmallContainer(NULL);
  16390   freeO(toInject);
  16391   ck_assert_ptr_ne(self->f->injectSmallContainer(self, 0, toInject), NULL);
  16392   finishO(toInject);
  16393   s = toStringO(r);
  16394   ck_assert_str_eq(s, "[\"<data container>\"]");
  16395   free(s);
  16396   // empty list
  16397   emptyO(self);
  16398   toInject = allocSmallContainer(NULL);
  16399   ck_assert_ptr_ne(self->f->injectSmallContainer(self, 0, toInject), NULL);
  16400   finishO(toInject);
  16401   s = toStringO(r);
  16402   ck_assert_str_eq(s, "[\"<data container>\"]");
  16403   free(s);
  16404   emptyO(self);
  16405   toInject = allocSmallContainer(NULL);
  16406   ck_assert_ptr_ne(self->f->injectSmallContainer(self, -1, toInject), NULL);
  16407   finishO(toInject);
  16408   s = toStringO(r);
  16409   ck_assert_str_eq(s, "[\"<data container>\"]");
  16410   free(s);
  16411   // non smallContainer object
  16412   toInject = (smallContainert*) allocSmallInt(2);
  16413   r = self->f->injectSmallContainer(self, 0, toInject);
  16414   ck_assert_ptr_eq(r, null);
  16415   terminateO(toInject);
  16416   // null toInsert
  16417   ck_assert_ptr_eq(self->f->injectSmallContainer(self, 0, NULL), NULL);
  16418   terminateO(self);
  16419 
  16420 }
  16421 
  16422 
  16423 void injectNFreeSmallJsonT(CuTest *tc UNUSED) {
  16424 
  16425   smallJsont* r;
  16426   smallJsont *self = allocSmallJson();
  16427   baset *toInject;
  16428 
  16429   // add elements to self
  16430   r = self->f->pushInt(self, 1);
  16431   ck_assert_ptr_ne(r, null);
  16432   r = self->f->pushInt(self, 2);
  16433   ck_assert_ptr_ne(r, null);
  16434   r = self->f->pushInt(self, 3);
  16435   ck_assert_ptr_ne(r, null);
  16436   r = self->f->pushInt(self, 4);
  16437   ck_assert_ptr_ne(r, null);
  16438 
  16439   // positive index
  16440   toInject = (baset*) allocSmallInt(8);
  16441   r        = self->f->injectNFree(self, 1, toInject);
  16442   ck_assert_ptr_ne(r, null);
  16443   char *s  = toStringO(r);
  16444   ck_assert_str_eq(s, "[1,8,2,3,4]");
  16445   free(s);
  16446   // negative index
  16447   toInject = (baset*) allocSmallInt(9);
  16448   r = self->f->injectNFree(self,-1, toInject);
  16449   ck_assert_ptr_ne(r, null);
  16450   s = toStringO(r);
  16451   ck_assert_str_eq(s, "[1,8,2,3,4,9]");
  16452   free(s);
  16453   // index 0
  16454   toInject = (baset*) allocSmallInt(6);
  16455   r = self->f->injectNFree(self,0, toInject);
  16456   ck_assert_ptr_ne(r, null);
  16457   s = toStringO(r);
  16458   ck_assert_str_eq(s, "[6,1,8,2,3,4,9]");
  16459   free(s);
  16460   // index outside
  16461   toInject = (baset*) allocSmallInt(7);
  16462   ck_assert_ptr_eq(self->f->injectNFree(self, 20, toInject), NULL);
  16463   ck_assert_ptr_eq(self->f->injectNFree(self, -9, toInject), NULL);
  16464   terminateO(toInject);
  16465   // empty list
  16466   emptyO(self);
  16467   toInject = (baset*) allocSmallInt(7);
  16468   ck_assert_ptr_ne(self->f->injectNFree(self, 0, toInject), NULL);
  16469   s = toStringO(r);
  16470   ck_assert_str_eq(s, "[7]");
  16471   free(s);
  16472   emptyO(self);
  16473   toInject = (baset*) allocSmallInt(7);
  16474   ck_assert_ptr_ne(self->f->injectNFree(self, -1, toInject), NULL);
  16475   s = toStringO(r);
  16476   ck_assert_str_eq(s, "[7]");
  16477   free(s);
  16478   // null toInsert
  16479   ck_assert_ptr_eq(self->f->injectNFree(self, 0, NULL), NULL);
  16480   // non json array
  16481   freeO(self);
  16482   setTypeBoolO(self);
  16483   toInject = (baset*) allocSmallInt(7);
  16484   ck_assert_ptr_eq(self->f->injectNFree(self, 0, toInject), NULL);
  16485   terminateO(toInject);
  16486   terminateO(self);
  16487 
  16488 }
  16489 
  16490 
  16491 void injectNFreeUndefinedSmallJsonT(CuTest *tc UNUSED) {
  16492 
  16493   smallJsont* r;
  16494   smallJsont *self = allocSmallJson();
  16495   undefinedt *value = NULL;
  16496 
  16497 
  16498   // add elements to self
  16499   r = self->f->pushInt(self, 1);
  16500   ck_assert_ptr_ne(r, null);
  16501   r = self->f->pushInt(self, 2);
  16502   ck_assert_ptr_ne(r, null);
  16503   r = self->f->pushInt(self, 3);
  16504   ck_assert_ptr_ne(r, null);
  16505   r = self->f->pushInt(self, 4);
  16506   ck_assert_ptr_ne(r, null);
  16507 
  16508   // positive index
  16509   value = allocUndefined();
  16510   r        = self->f->injectNFreeUndefined(self, 1, value);
  16511   ck_assert_ptr_ne(r, null);
  16512   char *s  = toStringO(r);
  16513   ck_assert_str_eq(s, "[1,null,2,3,4]");
  16514   free(s);
  16515   // negative index
  16516   value = allocUndefined();
  16517   r = self->f->injectNFreeUndefined(self,-1, value);
  16518   ck_assert_ptr_ne(r, null);
  16519   s = toStringO(r);
  16520   ck_assert_str_eq(s, "[1,null,2,3,4,null]");
  16521   free(s);
  16522   // index 0
  16523   value = allocUndefined();
  16524   r = self->f->injectNFreeUndefined(self,0, value);
  16525   ck_assert_ptr_ne(r, null);
  16526   s = toStringO(r);
  16527   ck_assert_str_eq(s, "[null,1,null,2,3,4,null]");
  16528   free(s);
  16529   // index outside
  16530   value = allocUndefined();
  16531   ck_assert_ptr_eq(self->f->injectNFreeUndefined(self, 20, value), NULL);
  16532   terminateO(value);
  16533 
  16534   value = allocUndefined();
  16535   ck_assert_ptr_eq(self->f->injectNFreeUndefined(self, -9, value), NULL);
  16536   terminateO(value);
  16537 
  16538   // empty list
  16539   emptyO(self);
  16540   value = allocUndefined();
  16541   ck_assert_ptr_ne(self->f->injectNFreeUndefined(self, 0, value), NULL);
  16542   s = toStringO(r);
  16543   ck_assert_str_eq(s, "[null]");
  16544   free(s);
  16545   emptyO(self);
  16546   value = allocUndefined();
  16547   ck_assert_ptr_ne(self->f->injectNFreeUndefined(self, -1, value), NULL);
  16548   s = toStringO(r);
  16549   ck_assert_str_eq(s, "[null]");
  16550   free(s);
  16551   terminateO(self);
  16552 
  16553 }
  16554 
  16555 
  16556 void injectNFreeSSmallJsonT(CuTest *tc UNUSED) {
  16557 
  16558   smallJsont* r;
  16559   smallJsont *self = allocSmallJson();
  16560 
  16561   // add elements to self
  16562   r = self->f->pushInt(self, 1);
  16563   ck_assert_ptr_ne(r, null);
  16564   r = self->f->pushInt(self, 2);
  16565   ck_assert_ptr_ne(r, null);
  16566   r = self->f->pushInt(self, 3);
  16567   ck_assert_ptr_ne(r, null);
  16568   r = self->f->pushInt(self, 4);
  16569   ck_assert_ptr_ne(r, null);
  16570 
  16571   // positive index
  16572   r        = self->f->injectNFreeS(self, 1, strdup("5"));
  16573   ck_assert_ptr_ne(r, null);
  16574   char *s  = toStringO(r);
  16575   ck_assert_str_eq(s, "[1,\"5\",2,3,4]");
  16576   free(s);
  16577   // negative index
  16578   r = self->f->injectNFreeS(self,-1, strdup("6"));
  16579   ck_assert_ptr_ne(r, null);
  16580   s = toStringO(r);
  16581   ck_assert_str_eq(s, "[1,\"5\",2,3,4,\"6\"]");
  16582   free(s);
  16583   // index 0
  16584   r = self->f->injectNFreeS(self,0, strdup("7"));
  16585   ck_assert_ptr_ne(r, null);
  16586   s = toStringO(r);
  16587   ck_assert_str_eq(s, "[\"7\",1,\"5\",2,3,4,\"6\"]");
  16588   free(s);
  16589   // index outside
  16590   ck_assert_ptr_eq(self->f->injectNFreeS(self, 20, ""), NULL);
  16591   ck_assert_ptr_eq(self->f->injectNFreeS(self, -9, ""), NULL);
  16592   // empty list
  16593   emptyO(self);
  16594   r = self->f->injectNFreeS(self, 0, strdup("7"));
  16595   ck_assert_ptr_ne(r, NULL);
  16596   s = toStringO(r);
  16597   ck_assert_str_eq(s, "[\"7\"]");
  16598   free(s);
  16599   emptyO(self);
  16600   r = self->f->injectNFreeS(self, -1, strdup("7"));
  16601   ck_assert_ptr_ne(r, NULL);
  16602   s = toStringO(r);
  16603   ck_assert_str_eq(s, "[\"7\"]");
  16604   free(s);
  16605   // null
  16606   ck_assert_ptr_eq(self->f->injectNFreeS(self, -1, null), NULL);
  16607   terminateO(self);
  16608 
  16609 }
  16610 
  16611 
  16612 void injectNFreeDictSmallJsonT(CuTest *tc UNUSED) {
  16613 
  16614   smallJsont* r;
  16615   smallJsont *self = allocSmallJson();
  16616   smallDictt *toInject;
  16617 
  16618   // add elements to self
  16619   r = self->f->pushInt(self, 1);
  16620   ck_assert_ptr_ne(r, null);
  16621   r = self->f->pushInt(self, 2);
  16622   ck_assert_ptr_ne(r, null);
  16623   r = self->f->pushInt(self, 3);
  16624   ck_assert_ptr_ne(r, null);
  16625   r = self->f->pushInt(self, 4);
  16626   ck_assert_ptr_ne(r, null);
  16627 
  16628   // positive index
  16629   toInject = allocSmallDict();
  16630   r        = self->f->injectNFreeDict(self, 1, toInject);
  16631   ck_assert_ptr_ne(r, null);
  16632   char *s  = toStringO(r);
  16633   ck_assert_str_eq(s, "[1,{},2,3,4]");
  16634   free(s);
  16635   // negative index
  16636   toInject = allocSmallDict();
  16637   r = self->f->injectNFreeDict(self,-1, toInject);
  16638   ck_assert_ptr_ne(r, null);
  16639   s = toStringO(r);
  16640   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  16641   free(s);
  16642   // index 0
  16643   toInject = allocSmallDict();
  16644   r = self->f->injectNFreeDict(self,0, toInject);
  16645   ck_assert_ptr_ne(r, null);
  16646   s = toStringO(r);
  16647   ck_assert_str_eq(s, "[{},1,{},2,3,4,{}]");
  16648   free(s);
  16649   // index outside
  16650   toInject = allocSmallDict();
  16651   ck_assert_ptr_eq(self->f->injectNFreeDict(self, 20, toInject), NULL);
  16652   ck_assert_ptr_eq(self->f->injectNFreeDict(self, -9, toInject), NULL);
  16653   terminateO(toInject);
  16654   // empty list
  16655   emptyO(self);
  16656   toInject = allocSmallDict();
  16657   ck_assert_ptr_ne(self->f->injectNFreeDict(self, 0, toInject), NULL);
  16658   s = toStringO(r);
  16659   ck_assert_str_eq(s, "[{}]");
  16660   free(s);
  16661   emptyO(self);
  16662   toInject = allocSmallDict();
  16663   ck_assert_ptr_ne(self->f->injectNFreeDict(self, -1, toInject), NULL);
  16664   s = toStringO(r);
  16665   ck_assert_str_eq(s, "[{}]");
  16666   free(s);
  16667   // null toInsert
  16668   ck_assert_ptr_eq(self->f->injectNFreeDict(self, 0, NULL), NULL);
  16669   terminateO(self);
  16670 
  16671 }
  16672 
  16673 
  16674 void injectNFreeArraySmallJsonT(CuTest *tc UNUSED) {
  16675 
  16676   smallJsont* r;
  16677   smallJsont *self = allocSmallJson();
  16678   smallArrayt *toInject;
  16679 
  16680   // add elements to self
  16681   r = self->f->pushInt(self, 1);
  16682   ck_assert_ptr_ne(r, null);
  16683   r = self->f->pushInt(self, 2);
  16684   ck_assert_ptr_ne(r, null);
  16685   r = self->f->pushInt(self, 3);
  16686   ck_assert_ptr_ne(r, null);
  16687   r = self->f->pushInt(self, 4);
  16688   ck_assert_ptr_ne(r, null);
  16689 
  16690   // positive index
  16691   toInject = allocSmallArray();
  16692   r        = self->f->injectNFreeArray(self, 1, toInject);
  16693   ck_assert_ptr_ne(r, null);
  16694   char *s  = toStringO(r);
  16695   ck_assert_str_eq(s, "[1,[],2,3,4]");
  16696   free(s);
  16697   // negative index
  16698   toInject = allocSmallArray();
  16699   r = self->f->injectNFreeArray(self,-1, toInject);
  16700   ck_assert_ptr_ne(r, null);
  16701   s = toStringO(r);
  16702   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  16703   free(s);
  16704   // index 0
  16705   toInject = allocSmallArray();
  16706   r = self->f->injectNFreeArray(self,0, toInject);
  16707   ck_assert_ptr_ne(r, null);
  16708   s = toStringO(r);
  16709   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  16710   free(s);
  16711   // index outside
  16712   toInject = allocSmallArray();
  16713   ck_assert_ptr_eq(self->f->injectNFreeArray(self, 20, toInject), NULL);
  16714   ck_assert_ptr_eq(self->f->injectNFreeArray(self, -9, toInject), NULL);
  16715   terminateO(toInject);
  16716   // empty list
  16717   emptyO(self);
  16718   toInject = allocSmallArray();
  16719   ck_assert_ptr_ne(self->f->injectNFreeArray(self, 0, toInject), NULL);
  16720   s = toStringO(r);
  16721   ck_assert_str_eq(s, "[[]]");
  16722   free(s);
  16723   emptyO(self);
  16724   toInject = allocSmallArray();
  16725   ck_assert_ptr_ne(self->f->injectNFreeArray(self, -1, toInject), NULL);
  16726   s = toStringO(r);
  16727   ck_assert_str_eq(s, "[[]]");
  16728   free(s);
  16729   // null toInsert
  16730   ck_assert_ptr_eq(self->f->injectNFreeArray(self, 0, NULL), NULL);
  16731   terminateO(self);
  16732 
  16733 }
  16734 
  16735 
  16736 void injectNFreeArraycSmallJsonT(CuTest *tc UNUSED) {
  16737 
  16738   smallJsont* r;
  16739   smallJsont *self = allocSmallJson();
  16740   char **toInject;
  16741 
  16742   // add elements to self
  16743   r = self->f->pushInt(self, 1);
  16744   ck_assert_ptr_ne(r, null);
  16745   r = self->f->pushInt(self, 2);
  16746   ck_assert_ptr_ne(r, null);
  16747   r = self->f->pushInt(self, 3);
  16748   ck_assert_ptr_ne(r, null);
  16749   r = self->f->pushInt(self, 4);
  16750   ck_assert_ptr_ne(r, null);
  16751 
  16752   // positive index
  16753   toInject = listCreateS("a","b");
  16754   r        = self->f->injectNFreeArrayc(self, 1, toInject);
  16755   ck_assert_ptr_ne(r, null);
  16756   char *s  = toStringO(r);
  16757   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4]");
  16758   free(s);
  16759   // negative index
  16760   toInject = listCreateS("c","d");
  16761   r = self->f->injectNFreeArrayc(self,-1, toInject);
  16762   ck_assert_ptr_ne(r, null);
  16763   s = toStringO(r);
  16764   ck_assert_str_eq(s, "[1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  16765   free(s);
  16766   // index 0
  16767   toInject = listCreateS("e","ff");
  16768   r = self->f->injectNFreeArrayc(self,0, toInject);
  16769   ck_assert_ptr_ne(r, null);
  16770   s = toStringO(r);
  16771   ck_assert_str_eq(s, "[[\"e\",\"ff\"],1,[\"a\",\"b\"],2,3,4,[\"c\",\"d\"]]");
  16772   free(s);
  16773   // index outside
  16774   toInject = listCreateS("a","b");
  16775   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, 20, toInject), NULL);
  16776   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, -9, toInject), NULL);
  16777   listFreeS(toInject);
  16778   // empty list
  16779   emptyO(self);
  16780   toInject = listCreateS("a","b");
  16781   ck_assert_ptr_ne(self->f->injectNFreeArrayc(self, 0, toInject), NULL);
  16782   s = toStringO(r);
  16783   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  16784   free(s);
  16785   emptyO(self);
  16786   toInject = listCreateS("a","b");
  16787   ck_assert_ptr_ne(self->f->injectNFreeArrayc(self, -1, toInject), NULL);
  16788   s = toStringO(r);
  16789   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  16790   free(s);
  16791   // null toInsert
  16792   ck_assert_ptr_eq(self->f->injectNFreeArrayc(self, 0, NULL), NULL);
  16793   terminateO(self);
  16794 
  16795 }
  16796 
  16797 
  16798 void injectNFreeSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  16799 
  16800   smallJsont* r;
  16801   smallJsont *self = allocSmallJson();
  16802   smallBoolt *toInject;
  16803 
  16804   // add elements to self
  16805   r = self->f->pushInt(self, 1);
  16806   ck_assert_ptr_ne(r, null);
  16807   r = self->f->pushInt(self, 2);
  16808   ck_assert_ptr_ne(r, null);
  16809   r = self->f->pushInt(self, 3);
  16810   ck_assert_ptr_ne(r, null);
  16811   r = self->f->pushInt(self, 4);
  16812   ck_assert_ptr_ne(r, null);
  16813 
  16814   // positive index
  16815   toInject = allocSmallBool(true);
  16816   r        = self->f->injectNFreeSmallBool(self, 1, toInject);
  16817   ck_assert_ptr_ne(r, null);
  16818   char *s  = toStringO(r);
  16819   ck_assert_str_eq(s, "[1,true,2,3,4]");
  16820   free(s);
  16821   // negative index
  16822   toInject = allocSmallBool(true);
  16823   r = self->f->injectNFreeSmallBool(self,-1, toInject);
  16824   ck_assert_ptr_ne(r, null);
  16825   s = toStringO(r);
  16826   ck_assert_str_eq(s, "[1,true,2,3,4,true]");
  16827   free(s);
  16828   // index 0
  16829   toInject = allocSmallBool(true);
  16830   r = self->f->injectNFreeSmallBool(self,0, toInject);
  16831   ck_assert_ptr_ne(r, null);
  16832   s = toStringO(r);
  16833   ck_assert_str_eq(s, "[true,1,true,2,3,4,true]");
  16834   free(s);
  16835   // index outside
  16836   toInject = allocSmallBool(true);
  16837   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, 20, toInject), NULL);
  16838   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, -9, toInject), NULL);
  16839   terminateO(toInject);
  16840   // empty object
  16841   emptyO(self);
  16842   toInject = allocSmallBool(true);
  16843   freeO(toInject);
  16844   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, 0, toInject), NULL);
  16845   s = toStringO(r);
  16846   ck_assert_str_eq(s, "[false]");
  16847   free(s);
  16848   // empty list
  16849   emptyO(self);
  16850   toInject = allocSmallBool(true);
  16851   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, 0, toInject), NULL);
  16852   s = toStringO(r);
  16853   ck_assert_str_eq(s, "[true]");
  16854   free(s);
  16855   emptyO(self);
  16856   toInject = allocSmallBool(true);
  16857   ck_assert_ptr_ne(self->f->injectNFreeSmallBool(self, -1, toInject), NULL);
  16858   s = toStringO(r);
  16859   ck_assert_str_eq(s, "[true]");
  16860   free(s);
  16861   // null toInsert
  16862   ck_assert_ptr_eq(self->f->injectNFreeSmallBool(self, 0, NULL), NULL);
  16863   terminateO(self);
  16864 
  16865 }
  16866 
  16867 
  16868 void injectNFreeSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  16869 
  16870   smallJsont* r;
  16871   smallJsont *self = allocSmallJson();
  16872   smallBytest *toInject;
  16873 
  16874   // add elements to self
  16875   r = self->f->pushInt(self, 1);
  16876   ck_assert_ptr_ne(r, null);
  16877   r = self->f->pushInt(self, 2);
  16878   ck_assert_ptr_ne(r, null);
  16879   r = self->f->pushInt(self, 3);
  16880   ck_assert_ptr_ne(r, null);
  16881   r = self->f->pushInt(self, 4);
  16882   ck_assert_ptr_ne(r, null);
  16883 
  16884   // positive index
  16885   toInject = allocSmallBytes(null, 0);
  16886   r        = self->f->injectNFreeSmallBytes(self, 1, toInject);
  16887   ck_assert_ptr_ne(r, null);
  16888   char *s  = toStringO(r);
  16889   ck_assert_str_eq(s, "[1,[],2,3,4]");
  16890   free(s);
  16891   // negative index
  16892   toInject = allocSmallBytes(null, 0);
  16893   r = self->f->injectNFreeSmallBytes(self,-1, toInject);
  16894   ck_assert_ptr_ne(r, null);
  16895   s = toStringO(r);
  16896   ck_assert_str_eq(s, "[1,[],2,3,4,[]]");
  16897   free(s);
  16898   // index 0
  16899   toInject = allocSmallBytes(null, 0);
  16900   r = self->f->injectNFreeSmallBytes(self,0, toInject);
  16901   ck_assert_ptr_ne(r, null);
  16902   s = toStringO(r);
  16903   ck_assert_str_eq(s, "[[],1,[],2,3,4,[]]");
  16904   free(s);
  16905   // index outside
  16906   toInject = allocSmallBytes(null, 0);
  16907   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, 20, toInject), NULL);
  16908   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, -9, toInject), NULL);
  16909   terminateO(toInject);
  16910   // empty object
  16911   emptyO(self);
  16912   toInject = allocSmallBytes(null, 0);
  16913   freeO(toInject);
  16914   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, 0, toInject), NULL);
  16915   s = toStringO(r);
  16916   ck_assert_str_eq(s, "[[]]");
  16917   free(s);
  16918   // empty list
  16919   emptyO(self);
  16920   toInject = allocSmallBytes(null, 0);
  16921   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, 0, toInject), NULL);
  16922   s = toStringO(r);
  16923   ck_assert_str_eq(s, "[[]]");
  16924   free(s);
  16925   emptyO(self);
  16926   toInject = allocSmallBytes(null, 0);
  16927   ck_assert_ptr_ne(self->f->injectNFreeSmallBytes(self, -1, toInject), NULL);
  16928   s = toStringO(r);
  16929   ck_assert_str_eq(s, "[[]]");
  16930   free(s);
  16931   // null toInsert
  16932   ck_assert_ptr_eq(self->f->injectNFreeSmallBytes(self, 0, NULL), NULL);
  16933   terminateO(self);
  16934 
  16935 }
  16936 
  16937 
  16938 void injectNFreeSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  16939 
  16940   smallJsont* r;
  16941   smallJsont *self = allocSmallJson();
  16942   smallDoublet *toInject;
  16943 
  16944   // add elements to self
  16945   r = self->f->pushInt(self, 1);
  16946   ck_assert_ptr_ne(r, null);
  16947   r = self->f->pushInt(self, 2);
  16948   ck_assert_ptr_ne(r, null);
  16949   r = self->f->pushInt(self, 3);
  16950   ck_assert_ptr_ne(r, null);
  16951   r = self->f->pushInt(self, 4);
  16952   ck_assert_ptr_ne(r, null);
  16953 
  16954   // positive index
  16955   toInject = allocSmallDouble(2);
  16956   r        = self->f->injectNFreeSmallDouble(self, 1, toInject);
  16957   ck_assert_ptr_ne(r, null);
  16958   char *s  = toStringO(r);
  16959   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4]");
  16960   free(s);
  16961   // negative index
  16962   toInject = allocSmallDouble(3);
  16963   r = self->f->injectNFreeSmallDouble(self,-1, toInject);
  16964   ck_assert_ptr_ne(r, null);
  16965   s = toStringO(r);
  16966   ck_assert_str_eq(s, "[1,2.000000e+00,2,3,4,3.000000e+00]");
  16967   free(s);
  16968   // index 0
  16969   toInject = allocSmallDouble(1);
  16970   r = self->f->injectNFreeSmallDouble(self,0, toInject);
  16971   ck_assert_ptr_ne(r, null);
  16972   s = toStringO(r);
  16973   ck_assert_str_eq(s, "[1.000000e+00,1,2.000000e+00,2,3,4,3.000000e+00]");
  16974   free(s);
  16975   // index outside
  16976   toInject = allocSmallDouble(1);
  16977   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, 20, toInject), NULL);
  16978   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, -9, toInject), NULL);
  16979   terminateO(toInject);
  16980   // empty object
  16981   emptyO(self);
  16982   toInject = allocSmallDouble(1);
  16983   freeO(toInject);
  16984   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, 0, toInject), NULL);
  16985   s = toStringO(r);
  16986   ck_assert_str_eq(s, "[0.000000e+00]");
  16987   free(s);
  16988   // empty list
  16989   emptyO(self);
  16990   toInject = allocSmallDouble(1);
  16991   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, 0, toInject), NULL);
  16992   s = toStringO(r);
  16993   ck_assert_str_eq(s, "[1.000000e+00]");
  16994   free(s);
  16995   emptyO(self);
  16996   toInject = allocSmallDouble(1);
  16997   ck_assert_ptr_ne(self->f->injectNFreeSmallDouble(self, -1, toInject), NULL);
  16998   s = toStringO(r);
  16999   ck_assert_str_eq(s, "[1.000000e+00]");
  17000   free(s);
  17001   // null toInsert
  17002   ck_assert_ptr_eq(self->f->injectNFreeSmallDouble(self, 0, NULL), NULL);
  17003   terminateO(self);
  17004 
  17005 }
  17006 
  17007 
  17008 void injectNFreeSmallIntSmallJsonT(CuTest *tc UNUSED) {
  17009 
  17010   smallJsont* r;
  17011   smallJsont *self = allocSmallJson();
  17012   smallIntt *toInject;
  17013 
  17014   // add elements to self
  17015   r = self->f->pushInt(self, 1);
  17016   ck_assert_ptr_ne(r, null);
  17017   r = self->f->pushInt(self, 2);
  17018   ck_assert_ptr_ne(r, null);
  17019   r = self->f->pushInt(self, 3);
  17020   ck_assert_ptr_ne(r, null);
  17021   r = self->f->pushInt(self, 4);
  17022   ck_assert_ptr_ne(r, null);
  17023 
  17024   // positive index
  17025   toInject = allocSmallInt(10);
  17026   r        = self->f->injectNFreeSmallInt(self, 1, toInject);
  17027   ck_assert_ptr_ne(r, null);
  17028   char *s  = toStringO(r);
  17029   ck_assert_str_eq(s, "[1,10,2,3,4]");
  17030   free(s);
  17031   // negative index
  17032   toInject = allocSmallInt(11);
  17033   r = self->f->injectNFreeSmallInt(self,-1, toInject);
  17034   ck_assert_ptr_ne(r, null);
  17035   s = toStringO(r);
  17036   ck_assert_str_eq(s, "[1,10,2,3,4,11]");
  17037   free(s);
  17038   // index 0
  17039   toInject = allocSmallInt(12);
  17040   r = self->f->injectNFreeSmallInt(self,0, toInject);
  17041   ck_assert_ptr_ne(r, null);
  17042   s = toStringO(r);
  17043   ck_assert_str_eq(s, "[12,1,10,2,3,4,11]");
  17044   free(s);
  17045   // index outside
  17046   toInject = allocSmallInt(10);
  17047   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, 20, toInject), NULL);
  17048   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, -9, toInject), NULL);
  17049   terminateO(toInject);
  17050   // empty object
  17051   emptyO(self);
  17052   toInject = allocSmallInt(10);
  17053   freeO(toInject);
  17054   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, 0, toInject), NULL);
  17055   s = toStringO(r);
  17056   ck_assert_str_eq(s, "[0]");
  17057   free(s);
  17058   // empty list
  17059   emptyO(self);
  17060   toInject = allocSmallInt(10);
  17061   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, 0, toInject), NULL);
  17062   s = toStringO(r);
  17063   ck_assert_str_eq(s, "[10]");
  17064   free(s);
  17065   emptyO(self);
  17066   toInject = allocSmallInt(10);
  17067   ck_assert_ptr_ne(self->f->injectNFreeSmallInt(self, -1, toInject), NULL);
  17068   s = toStringO(r);
  17069   ck_assert_str_eq(s, "[10]");
  17070   free(s);
  17071   // null toInsert
  17072   ck_assert_ptr_eq(self->f->injectNFreeSmallInt(self, 0, NULL), NULL);
  17073   terminateO(self);
  17074 
  17075 }
  17076 
  17077 
  17078 void injectNFreeSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  17079 
  17080   smallJsont* r;
  17081   smallJsont *self = allocSmallJson();
  17082   smallJsont *toInject;
  17083 
  17084   // add elements to self
  17085   r = self->f->pushInt(self, 1);
  17086   ck_assert_ptr_ne(r, null);
  17087   r = self->f->pushInt(self, 2);
  17088   ck_assert_ptr_ne(r, null);
  17089   r = self->f->pushInt(self, 3);
  17090   ck_assert_ptr_ne(r, null);
  17091   r = self->f->pushInt(self, 4);
  17092   ck_assert_ptr_ne(r, null);
  17093 
  17094   // positive index
  17095   toInject = allocSmallJson();
  17096   r        = self->f->injectNFreeSmallJson(self, 1, toInject);
  17097   ck_assert_ptr_ne(r, null);
  17098   char *s  = toStringO(r);
  17099   ck_assert_str_eq(s, "[1,{},2,3,4]");
  17100   free(s);
  17101   // negative index
  17102   toInject = allocSmallJson();
  17103   r = self->f->injectNFreeSmallJson(self,-1, toInject);
  17104   ck_assert_ptr_ne(r, null);
  17105   s = toStringO(r);
  17106   ck_assert_str_eq(s, "[1,{},2,3,4,{}]");
  17107   free(s);
  17108   // index 0
  17109   toInject = allocSmallJson();
  17110   toInject->f->setS(toInject, "key", "value");
  17111   r = self->f->injectNFreeSmallJson(self,0, toInject);
  17112   ck_assert_ptr_ne(r, null);
  17113   s = toStringO(r);
  17114   ck_assert_str_eq(s, "[{\"key\":\"value\"},1,{},2,3,4,{}]");
  17115   free(s);
  17116   // index outside
  17117   toInject = allocSmallJson();
  17118   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, 20, toInject), NULL);
  17119   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, -9, toInject), NULL);
  17120   terminateO(toInject);
  17121   // empty object
  17122   emptyO(self);
  17123   toInject = allocSmallJson();
  17124   freeO(toInject);
  17125   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, 0, toInject), NULL);
  17126   s = toStringO(r);
  17127   ck_assert_str_eq(s, "[{}]");
  17128   free(s);
  17129   // empty list
  17130   emptyO(self);
  17131   toInject = allocSmallJson();
  17132   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, 0, toInject), NULL);
  17133   s = toStringO(r);
  17134   ck_assert_str_eq(s, "[{}]");
  17135   free(s);
  17136   emptyO(self);
  17137   toInject = allocSmallJson();
  17138   ck_assert_ptr_ne(self->f->injectNFreeSmallJson(self, -1, toInject), NULL);
  17139   s = toStringO(r);
  17140   ck_assert_str_eq(s, "[{}]");
  17141   free(s);
  17142   // null toInsert
  17143   ck_assert_ptr_eq(self->f->injectNFreeSmallJson(self, 0, NULL), NULL);
  17144   terminateO(self);
  17145 
  17146 }
  17147 
  17148 
  17149 void injectNFreeSmallStringSmallJsonT(CuTest *tc UNUSED) {
  17150 
  17151   smallJsont* r;
  17152   smallJsont *self = allocSmallJson();
  17153   smallStringt *toInject;
  17154 
  17155   // add elements to self
  17156   r = self->f->pushInt(self, 1);
  17157   ck_assert_ptr_ne(r, null);
  17158   r = self->f->pushInt(self, 2);
  17159   ck_assert_ptr_ne(r, null);
  17160   r = self->f->pushInt(self, 3);
  17161   ck_assert_ptr_ne(r, null);
  17162   r = self->f->pushInt(self, 4);
  17163   ck_assert_ptr_ne(r, null);
  17164 
  17165   // positive index
  17166   toInject = allocSmallString("1");
  17167   r        = self->f->injectNFreeSmallString(self, 1, toInject);
  17168   ck_assert_ptr_ne(r, null);
  17169   char *s  = toStringO(r);
  17170   ck_assert_str_eq(s, "[1,\"1\",2,3,4]");
  17171   free(s);
  17172   // negative index
  17173   toInject = allocSmallString("2");
  17174   r = self->f->injectNFreeSmallString(self,-1, toInject);
  17175   ck_assert_ptr_ne(r, null);
  17176   s = toStringO(r);
  17177   ck_assert_str_eq(s, "[1,\"1\",2,3,4,\"2\"]");
  17178   free(s);
  17179   // index 0
  17180   toInject = allocSmallString("3");
  17181   r = self->f->injectNFreeSmallString(self,0, toInject);
  17182   ck_assert_ptr_ne(r, null);
  17183   s = toStringO(r);
  17184   ck_assert_str_eq(s, "[\"3\",1,\"1\",2,3,4,\"2\"]");
  17185   free(s);
  17186   // index outside
  17187   toInject = allocSmallString("1");
  17188   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, 20, toInject), NULL);
  17189   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, -9, toInject), NULL);
  17190   terminateO(toInject);
  17191   // empty object
  17192   emptyO(self);
  17193   toInject = allocSmallString("1");
  17194   freeO(toInject);
  17195   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, 0, toInject), NULL);
  17196   s = toStringO(r);
  17197   ck_assert_str_eq(s, "[\"\"]");
  17198   free(s);
  17199   // empty list
  17200   emptyO(self);
  17201   toInject = allocSmallString("1");
  17202   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, 0, toInject), NULL);
  17203   s = toStringO(r);
  17204   ck_assert_str_eq(s, "[\"1\"]");
  17205   free(s);
  17206   emptyO(self);
  17207   toInject = allocSmallString("1");
  17208   ck_assert_ptr_ne(self->f->injectNFreeSmallString(self, -1, toInject), NULL);
  17209   s = toStringO(r);
  17210   ck_assert_str_eq(s, "[\"1\"]");
  17211   free(s);
  17212   // null toInsert
  17213   ck_assert_ptr_eq(self->f->injectNFreeSmallString(self, 0, NULL), NULL);
  17214   terminateO(self);
  17215 
  17216 }
  17217 
  17218 
  17219 void injectNFreeSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  17220 
  17221   smallJsont* r;
  17222   smallJsont *self = allocSmallJson();
  17223   smallContainert *toInject;
  17224 
  17225   // add elements to self
  17226   r = self->f->pushInt(self, 1);
  17227   ck_assert_ptr_ne(r, null);
  17228   r = self->f->pushInt(self, 2);
  17229   ck_assert_ptr_ne(r, null);
  17230   r = self->f->pushInt(self, 3);
  17231   ck_assert_ptr_ne(r, null);
  17232   r = self->f->pushInt(self, 4);
  17233   ck_assert_ptr_ne(r, null);
  17234 
  17235   // positive index
  17236   toInject = allocSmallContainer(NULL);
  17237   r        = self->f->injectNFreeSmallContainer(self, 1, toInject);
  17238   ck_assert_ptr_ne(r, null);
  17239   char *s  = toStringO(r);
  17240   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4]");
  17241   free(s);
  17242   // negative index
  17243   toInject = allocSmallContainer(NULL);
  17244   r = self->f->injectNFreeSmallContainer(self,-1, toInject);
  17245   ck_assert_ptr_ne(r, null);
  17246   s = toStringO(r);
  17247   ck_assert_str_eq(s, "[1,\"<data container>\",2,3,4,\"<data container>\"]");
  17248   free(s);
  17249   // index 0
  17250   toInject = allocSmallContainer(NULL);
  17251   r = self->f->injectNFreeSmallContainer(self,0, toInject);
  17252   ck_assert_ptr_ne(r, null);
  17253   s = toStringO(r);
  17254   ck_assert_str_eq(s, "[\"<data container>\",1,\"<data container>\",2,3,4,\"<data container>\"]");
  17255   free(s);
  17256   // index outside
  17257   toInject = allocSmallContainer(NULL);
  17258   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, 20, toInject), NULL);
  17259   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, -9, toInject), NULL);
  17260   terminateO(toInject);
  17261   // empty object
  17262   emptyO(self);
  17263   toInject = allocSmallContainer(NULL);
  17264   freeO(toInject);
  17265   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, 0, toInject), NULL);
  17266   s = toStringO(r);
  17267   ck_assert_str_eq(s, "[\"<data container>\"]");
  17268   free(s);
  17269   // empty list
  17270   emptyO(self);
  17271   toInject = allocSmallContainer(NULL);
  17272   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, 0, toInject), NULL);
  17273   s = toStringO(r);
  17274   ck_assert_str_eq(s, "[\"<data container>\"]");
  17275   free(s);
  17276   emptyO(self);
  17277   toInject = allocSmallContainer(NULL);
  17278   ck_assert_ptr_ne(self->f->injectNFreeSmallContainer(self, -1, toInject), NULL);
  17279   s = toStringO(r);
  17280   ck_assert_str_eq(s, "[\"<data container>\"]");
  17281   free(s);
  17282   // null toInsert
  17283   ck_assert_ptr_eq(self->f->injectNFreeSmallContainer(self, 0, NULL), NULL);
  17284   terminateO(self);
  17285 
  17286 }
  17287 
  17288 
  17289 void uniqSmallJsonT(CuTest *tc UNUSED) {
  17290 
  17291   smallJsont* r;
  17292   smallJsont *self = allocSmallJson();
  17293 
  17294   // empty array
  17295   r       = self->f->uniq(self);
  17296   ck_assert_ptr_eq(r, NULL);
  17297   setTypeArrayO(self);
  17298   r       = self->f->uniq(self);
  17299   ck_assert_ptr_eq(r, NULL);
  17300   // one element
  17301   self->f->pushUndefined(self);
  17302   r       = self->f->uniq(self);
  17303   ck_assert_ptr_eq(r, self);
  17304   // uniq elements
  17305   self->f->pushUndefined(self);
  17306   self->f->pushBool(self, true);
  17307   self->f->pushNFreeDict(self, allocSmallDict());
  17308   self->f->pushDouble(self, 1);
  17309   self->f->pushInt(self, 2);
  17310   self->f->pushS(self, "");
  17311   self->f->pushNFreeArray(self, allocSmallArray());
  17312   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17313   self->f->pushUndefined(self);
  17314   self->f->pushBool(self, true);
  17315   self->f->pushNFreeDict(self, allocSmallDict());
  17316   self->f->pushDouble(self, 1);
  17317   self->f->pushInt(self, 2);
  17318   self->f->pushS(self, "");
  17319   self->f->pushNFreeArray(self, allocSmallArray());
  17320   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17321   r       = self->f->uniq(self);
  17322   ck_assert_ptr_ne(r, NULL);
  17323   char *s = toStringO(r);
  17324   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"\",[],[0x71,0x77,0x65,0x00]]");
  17325   free(s);
  17326   terminateO(self);
  17327 
  17328 }
  17329 
  17330 
  17331 void sortSmallJsonT(CuTest *tc UNUSED) {
  17332 
  17333   smallJsont* r;
  17334   smallJsont *self = allocSmallJson();
  17335 
  17336   // sort undefined
  17337   self->f->pushInt(self, 0);
  17338   self->f->pushUndefined(self);
  17339   self->f->pushUndefined(self);
  17340   self->f->pushUndefined(self);
  17341   self->f->pushUndefined(self);
  17342   r = sortO(self);
  17343   ck_assert_ptr_ne(r, null);
  17344   char *s = toStringO(r);
  17345   ck_assert_str_eq(s, "[null,null,null,null,0]");
  17346   free(s);
  17347   // sort bool
  17348   emptyO(self);
  17349   self->f->pushBool(self, false);
  17350   self->f->pushBool(self, true);
  17351   r = sortO(self);
  17352   ck_assert_ptr_ne(r, null);
  17353   s = toStringO(r);
  17354   ck_assert_str_eq(s, "[false,true]");
  17355   free(s);
  17356   // sort container
  17357   emptyO(self);
  17358   pushVoidSmallJsonG(self, &r);
  17359   pushVoidSmallJsonG(self, &r);
  17360   r = sortO(self);
  17361   ck_assert_ptr_ne(r, null);
  17362   s = toStringO(r);
  17363   ck_assert_str_eq(s, "[\"<data container>\",\"<data container>\"]");
  17364   free(s);
  17365   // sort dict
  17366   emptyO(self);
  17367   smallDictt *d[4];
  17368   arange(i,d) d[i] = allocSmallDict();
  17369   d[0]->f->setInt(d[0], "a", 1);
  17370   d[1]->f->setInt(d[1], "a", 0);
  17371   d[3]->f->setInt(d[3], "a", 0);
  17372   d[3]->f->setInt(d[3], "b", 0);
  17373   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17374   r = sortO(self);
  17375   ck_assert_ptr_ne(r, null);
  17376   s = toStringO(r);
  17377   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17378   free(s);
  17379   // sort double
  17380   emptyO(self);
  17381   self->f->pushDouble(self, 0);
  17382   self->f->pushDouble(self, 0);
  17383   self->f->pushDouble(self, 1);
  17384   self->f->pushDouble(self, -1);
  17385   r = sortO(self);
  17386   ck_assert_ptr_ne(r, null);
  17387   s = toStringO(r);
  17388   ck_assert_str_eq(s, "[-1.000000e+00,0.000000e+00,0.000000e+00,1.000000e+00]");
  17389   free(s);
  17390   // sort Int
  17391   emptyO(self);
  17392   self->f->pushInt(self, 0);
  17393   self->f->pushInt(self, 0);
  17394   self->f->pushInt(self, 1);
  17395   self->f->pushInt(self, -1);
  17396   r = sortO(self);
  17397   ck_assert_ptr_ne(r, null);
  17398   s = toStringO(r);
  17399   ck_assert_str_eq(s, "[-1,0,0,1]");
  17400   free(s);
  17401   // sort strings
  17402   emptyO(self);
  17403   self->f->pushS(self, "bb");
  17404   self->f->pushS(self, "a");
  17405   r = sortO(self);
  17406   ck_assert_ptr_ne(r, null);
  17407   s = toStringO(r);
  17408   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  17409   free(s);
  17410   // sort Array
  17411   emptyO(self);
  17412   smallArrayt *a[4];
  17413   arange(i,a) a[i] = allocSmallArray();
  17414   a[0]->f->pushInt(a[0], 1);
  17415   a[1]->f->pushInt(a[1], 0);
  17416   a[3]->f->pushInt(a[3], 0);
  17417   a[3]->f->pushInt(a[3], 0);
  17418   arange(i,a) self->f->pushNFreeArray(self, a[i]);
  17419   r = sortO(self);
  17420   ck_assert_ptr_ne(r, null);
  17421   s = toStringO(r);
  17422   ck_assert_str_eq(s, "[[],[0],[1],[0,0]]");
  17423   free(s);
  17424   // sort bytes
  17425   emptyO(self);
  17426   smallBytest *B[4];
  17427   range(i,3) B[i] = allocSmallBytes("12345678", i);
  17428   B[3] = allocSmallBytes("0", 1);
  17429   arange(i,B) self->f->pushNFreeSmallBytes(self, B[i]);
  17430   r = sortO(self);
  17431   ck_assert_ptr_ne(r, null);
  17432   s = toStringO(r);
  17433   ck_assert_str_eq(s, "[[],[0x30],[0x31],[0x31,0x32]]");
  17434   free(s);
  17435   // TODO add element and remove some elements
  17436   emptyO(self);
  17437   self->f->pushInt(self, 0);
  17438   self->f->pushInt(self, 0);
  17439   self->f->pushInt(self, 1);
  17440   self->f->pushInt(self, -1);
  17441   smallIntt *i1 = self->f->getAtSmallInt(self, 1);
  17442   smallIntt *i2 = self->f->getAtSmallInt(self, 2);
  17443   removeO(self, 1, 3);
  17444   terminateO(i1);
  17445   terminateO(i2);
  17446   r = sortO(self);
  17447   ck_assert_ptr_ne(r, null);
  17448   s = toStringO(r);
  17449   ck_assert_str_eq(s, "[-1,0]");
  17450   free(s);
  17451   // length 0
  17452   emptyO(self);
  17453   r = sortO(self);
  17454   ck_assert_ptr_eq(r, null);
  17455   // non json array
  17456   freeO(self);
  17457   setTypeBoolO(self);
  17458   ck_assert_ptr_eq(sortO(self), NULL);
  17459   terminateO(self);
  17460 
  17461 }
  17462 
  17463 
  17464 void icSortSmallJsonT(CuTest *tc UNUSED) {
  17465 
  17466   smallJsont* r;
  17467   smallJsont *self = allocSmallJson();
  17468 
  17469   // sort undefined
  17470   self->f->pushInt(self, 0);
  17471   self->f->pushUndefined(self);
  17472   self->f->pushUndefined(self);
  17473   self->f->pushUndefined(self);
  17474   self->f->pushUndefined(self);
  17475   r = icSortO(self);
  17476   ck_assert_ptr_ne(r, null);
  17477   char *s = toStringO(r);
  17478   ck_assert_str_eq(s, "[null,null,null,null,0]");
  17479   free(s);
  17480   // sort bool
  17481   emptyO(self);
  17482   self->f->pushBool(self, false);
  17483   self->f->pushBool(self, true);
  17484   r = icSortO(self);
  17485   ck_assert_ptr_ne(r, null);
  17486   s = toStringO(r);
  17487   ck_assert_str_eq(s, "[false,true]");
  17488   free(s);
  17489   // sort container
  17490   emptyO(self);
  17491   pushVoidSmallJsonG(self, &r);
  17492   pushVoidSmallJsonG(self, &r);
  17493   r = icSortO(self);
  17494   ck_assert_ptr_ne(r, null);
  17495   s = toStringO(r);
  17496   ck_assert_str_eq(s, "[\"<data container>\",\"<data container>\"]");
  17497   free(s);
  17498   // sort dict
  17499   emptyO(self);
  17500   smallDictt *d[4];
  17501   arange(i,d) d[i] = allocSmallDict();
  17502   d[0]->f->setInt(d[0], "a", 1);
  17503   d[1]->f->setInt(d[1], "A", 0);
  17504   d[3]->f->setInt(d[3], "a", 0);
  17505   d[3]->f->setInt(d[3], "b", 0);
  17506   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17507   r = icSortO(self);
  17508   ck_assert_ptr_ne(r, null);
  17509   s = toStringO(r);
  17510   ck_assert_str_eq(s, "[{},{\"A\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17511   free(s);
  17512   // sort double
  17513   emptyO(self);
  17514   self->f->pushDouble(self, 0);
  17515   self->f->pushDouble(self, 0);
  17516   self->f->pushDouble(self, 1);
  17517   self->f->pushDouble(self, -1);
  17518   r = icSortO(self);
  17519   ck_assert_ptr_ne(r, null);
  17520   s = toStringO(r);
  17521   ck_assert_str_eq(s, "[-1.000000e+00,0.000000e+00,0.000000e+00,1.000000e+00]");
  17522   free(s);
  17523   // sort Int
  17524   emptyO(self);
  17525   self->f->pushInt(self, 0);
  17526   self->f->pushInt(self, 0);
  17527   self->f->pushInt(self, 1);
  17528   self->f->pushInt(self, -1);
  17529   r = icSortO(self);
  17530   ck_assert_ptr_ne(r, null);
  17531   s = toStringO(r);
  17532   ck_assert_str_eq(s, "[-1,0,0,1]");
  17533   free(s);
  17534   // sort strings
  17535   emptyO(self);
  17536   self->f->pushS(self, "bb");
  17537   self->f->pushS(self, "B");
  17538   r = icSortO(self);
  17539   ck_assert_ptr_ne(r, null);
  17540   s = toStringO(r);
  17541   ck_assert_str_eq(s, "[\"B\",\"bb\"]");
  17542   free(s);
  17543   // sort Array
  17544   emptyO(self);
  17545   smallArrayt *a[4];
  17546   arange(i,a) a[i] = allocSmallArray();
  17547   a[0]->f->pushInt(a[0], 1);
  17548   a[1]->f->pushInt(a[1], 0);
  17549   a[3]->f->pushInt(a[3], 0);
  17550   a[3]->f->pushInt(a[3], 0);
  17551   arange(i,a) self->f->pushNFreeArray(self, a[i]);
  17552   r = icSortO(self);
  17553   ck_assert_ptr_ne(r, null);
  17554   s = toStringO(r);
  17555   ck_assert_str_eq(s, "[[],[0],[1],[0,0]]");
  17556   free(s);
  17557   // sort bytes
  17558   emptyO(self);
  17559   smallBytest *B[4];
  17560   range(i,3) B[i] = allocSmallBytes("12345678", i);
  17561   B[3] = allocSmallBytes("0", 1);
  17562   arange(i,B) self->f->pushNFreeSmallBytes(self, B[i]);
  17563   r = icSortO(self);
  17564   ck_assert_ptr_ne(r, null);
  17565   s = toStringO(r);
  17566   ck_assert_str_eq(s, "[[],[0x30],[0x31],[0x31,0x32]]");
  17567   free(s);
  17568   // TODO add element and remove some elements
  17569   emptyO(self);
  17570   self->f->pushInt(self, 0);
  17571   self->f->pushInt(self, 0);
  17572   self->f->pushInt(self, 1);
  17573   self->f->pushInt(self, -1);
  17574   smallIntt *i1 = self->f->getAtSmallInt(self, 1);
  17575   smallIntt *i2 = self->f->getAtSmallInt(self, 2);
  17576   removeO(self, 1, 3);
  17577   terminateO(i1);
  17578   terminateO(i2);
  17579   r = icSortO(self);
  17580   ck_assert_ptr_ne(r, null);
  17581   s = toStringO(r);
  17582   ck_assert_str_eq(s, "[-1,0]");
  17583   free(s);
  17584   // length 0
  17585   emptyO(self);
  17586   r = icSortO(self);
  17587   ck_assert_ptr_eq(r, null);
  17588   // non json array
  17589   freeO(self);
  17590   setTypeBoolO(self);
  17591   ck_assert_ptr_eq(icSortO(self), NULL);
  17592   terminateO(self);
  17593 
  17594 }
  17595 
  17596 
  17597 int sortFOCmp(const void *A, const void *B) {
  17598   cast(smallDictt*, a, A);
  17599   cast(smallDictt*, b, B);
  17600 
  17601   if (lenO(a) < lenO(b))
  17602     return -1;
  17603   else if (lenO(a) == lenO(b)) {
  17604     var As = toStringO(a);
  17605     var Bs = toStringO(b);
  17606     int r = strcmp(As,Bs);
  17607     freeManyS(As,Bs);
  17608     return r;
  17609   }
  17610   else
  17611     return 1;
  17612 }
  17613 
  17614 void sortFSmallJsonT(CuTest *tc UNUSED) {
  17615 
  17616   smallJsont* r;
  17617   smallJsont *self = allocSmallJson();
  17618 
  17619   // sort dict
  17620   smallDictt *d[4];
  17621   arange(i,d) d[i] = allocSmallDict();
  17622   d[0]->f->setInt(d[0], "a", 1);
  17623   d[1]->f->setInt(d[1], "a", 0);
  17624   d[3]->f->setInt(d[3], "a", 0);
  17625   d[3]->f->setInt(d[3], "b", 0);
  17626   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  17627   r = sortFO(self, sortFOCmp);
  17628   ck_assert_ptr_ne(r, null);
  17629   char *s = toStringO(r);
  17630   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  17631   free(s);
  17632   // no compare function
  17633   r = sortFO(self, NULL);
  17634   ck_assert_ptr_eq(r, null);
  17635   // empty array
  17636   emptyO(self);
  17637   r = sortFO(self, sortFOCmp);
  17638   ck_assert_ptr_eq(r, null);
  17639   // non json array
  17640   freeO(self);
  17641   setTypeBoolO(self);
  17642   ck_assert_ptr_eq(sortFO(self, sortFOCmp), NULL);
  17643   terminateO(self);
  17644 
  17645 }
  17646 
  17647 
  17648 void icUniqSmallJsonT(CuTest *tc UNUSED) {
  17649 
  17650   smallJsont* r;
  17651   smallJsont *self = allocSmallJson();
  17652 
  17653   // empty array
  17654   r       = self->f->icUniq(self);
  17655   ck_assert_ptr_eq(r, NULL);
  17656   setTypeArrayO(self);
  17657   r       = self->f->icUniq(self);
  17658   ck_assert_ptr_eq(r, NULL);
  17659   // one element
  17660   self->f->pushUndefined(self);
  17661   r       = self->f->icUniq(self);
  17662   ck_assert_ptr_eq(r, self);
  17663   // uniq elements
  17664   self->f->pushUndefined(self);
  17665   self->f->pushBool(self, true);
  17666   self->f->pushNFreeDict(self, allocSmallDict());
  17667   self->f->pushDouble(self, 1);
  17668   self->f->pushInt(self, 2);
  17669   self->f->pushS(self, "ASD");
  17670   self->f->pushNFreeArray(self, allocSmallArray());
  17671   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17672   self->f->pushUndefined(self);
  17673   self->f->pushBool(self, true);
  17674   self->f->pushNFreeDict(self, allocSmallDict());
  17675   self->f->pushDouble(self, 1);
  17676   self->f->pushInt(self, 2);
  17677   self->f->pushS(self, "asd");
  17678   self->f->pushNFreeArray(self, allocSmallArray());
  17679   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  17680   r       = self->f->icUniq(self);
  17681   ck_assert_ptr_ne(r, NULL);
  17682   char *s = toStringO(r);
  17683   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"ASD\",[],[0x71,0x77,0x65,0x00]]");
  17684   free(s);
  17685   terminateO(self);
  17686 
  17687 }
  17688 
  17689 
  17690 void uniqCharSmallJsonT(CuTest *tc UNUSED) {
  17691 
  17692   smallJsont* r;
  17693   smallJsont *self = allocSmallJson();
  17694   setTopSO(self, "");
  17695 
  17696   // uniquify
  17697   freeO(self);
  17698   setTopSO(self, "/qwd///");
  17699   r = uniqCharO(self, '/');
  17700   ck_assert_ptr_ne(r, null);
  17701   char *s = toStringO(r);
  17702   ck_assert_str_eq(s, "/qwd/");
  17703   free(s);
  17704   // short string
  17705   freeO(self);
  17706   setTopSO(self, "?");
  17707   r = uniqCharO(self, '/');
  17708   ck_assert_ptr_ne(r, null);
  17709   s = toStringO(r);
  17710   ck_assert_str_eq(s, "?");
  17711   free(s);
  17712   // NULL
  17713   freeO(self);
  17714   ck_assert_ptr_eq(uniqCharO(self, '/'), NULL);
  17715   terminateO(self);
  17716 
  17717 }
  17718 
  17719 
  17720 void icUniqCharSmallJsonT(CuTest *tc UNUSED) {
  17721 
  17722   smallJsont* r;
  17723   smallJsont *self = allocSmallJson();
  17724   setTopSO(self, "");
  17725 
  17726   // uniquify
  17727   freeO(self);
  17728   setTopSO(self, "/qQwd///");
  17729   r = icUniqCharO(self, 'q');
  17730   ck_assert_ptr_ne(r, null);
  17731   char *s = toStringO(r);
  17732   ck_assert_str_eq(s, "/qwd///");
  17733   free(s);
  17734   // short string
  17735   freeO(self);
  17736   setTopSO(self, "?");
  17737   r = icUniqCharO(self, '/');
  17738   ck_assert_ptr_ne(r, null);
  17739   s = toStringO(r);
  17740   ck_assert_str_eq(s, "?");
  17741   free(s);
  17742   // NULL
  17743   freeO(self);
  17744   ck_assert_ptr_eq(icUniqCharO(self, '/'), NULL);
  17745   terminateO(self);
  17746 
  17747 }
  17748 
  17749 
  17750 void hasSmallJsonT(CuTest *tc UNUSED) {
  17751 
  17752   bool r;
  17753   smallJsont *self = allocSmallJson();
  17754   baset *value = (baset*)allocSmallInt(1);
  17755 
  17756   // has
  17757   self->f->pushInt(self, 1);
  17758   r = hasO(self, value);
  17759   ck_assert(r);
  17760   // not has
  17761   emptyO(self);
  17762   r = hasO(self, value);
  17763   ck_assert(!r);
  17764   // NULL value
  17765   r = hasO(self, NULL);
  17766   ck_assert(!r);
  17767   terminateO(self);
  17768   terminateO(value);
  17769 
  17770 }
  17771 
  17772 
  17773 void hasUndefinedSmallJsonT(CuTest *tc UNUSED) {
  17774 
  17775   bool r;
  17776   smallJsont *self = allocSmallJson();
  17777   undefinedt *value = allocUndefined();
  17778 
  17779   // has
  17780   self->f->pushUndefined(self);
  17781   r = hasUndefinedO(self, value);
  17782   ck_assert(r);
  17783   // not has
  17784   emptyO(self);
  17785   r = hasUndefinedO(self, value);
  17786   ck_assert(!r);
  17787   // non undefined object
  17788   terminateO(value);
  17789   value = (undefinedt*) allocSmallInt(2);
  17790   r = hasUndefinedO(self, value);
  17791   ck_assert(!r);
  17792   // NULL value
  17793   r = hasUndefinedO(self, NULL);
  17794   ck_assert(!r);
  17795   terminateO(self);
  17796   terminateO(value);
  17797 
  17798 }
  17799 
  17800 
  17801 void hasBoolSmallJsonT(CuTest *tc UNUSED) {
  17802 
  17803   bool r;
  17804   smallJsont *self = allocSmallJson();
  17805   bool value = true;
  17806 
  17807   // has
  17808   self->f->pushBool(self, true);
  17809   r = hasBoolO(self, value);
  17810   ck_assert(r);
  17811   // not has
  17812   emptyO(self);
  17813   r = hasBoolO(self, value);
  17814   ck_assert(!r);
  17815   terminateO(self);
  17816 
  17817 }
  17818 
  17819 
  17820 void hasDoubleSmallJsonT(CuTest *tc UNUSED) {
  17821 
  17822   bool r;
  17823   smallJsont *self = allocSmallJson();
  17824   double value = 2;
  17825 
  17826   // has
  17827   self->f->pushDouble(self, 2);
  17828   r = hasDoubleO(self, value);
  17829   ck_assert(r);
  17830   // not has
  17831   emptyO(self);
  17832   r = hasDoubleO(self, value);
  17833   ck_assert(!r);
  17834   terminateO(self);
  17835 
  17836 }
  17837 
  17838 
  17839 void hasIntSmallJsonT(CuTest *tc UNUSED) {
  17840 
  17841   bool r;
  17842   smallJsont *self = allocSmallJson();
  17843   int64_t value = 1000;
  17844 
  17845   // has
  17846   self->f->pushInt(self, 1000);
  17847   r = hasIntO(self, value);
  17848   ck_assert(r);
  17849   // not has
  17850   emptyO(self);
  17851   r = hasIntO(self, value);
  17852   ck_assert(!r);
  17853   terminateO(self);
  17854 
  17855 }
  17856 
  17857 
  17858 void hasSSmallJsonT(CuTest *tc UNUSED) {
  17859 
  17860   bool r;
  17861   smallJsont *self = allocSmallJson();
  17862   const char *value = "asd";
  17863 
  17864   // has
  17865   self->f->pushS(self, "asd");
  17866   r = hasSO(self, value);
  17867   ck_assert(r);
  17868   // not has
  17869   emptyO(self);
  17870   r = hasSO(self, value);
  17871   ck_assert(!r);
  17872   // NULL value
  17873   r = hasSO(self, NULL);
  17874   ck_assert(!r);
  17875   terminateO(self);
  17876   // json dict
  17877   self = allocSmallJson();
  17878   self->f->setInt(self, "u", 0);
  17879   ck_assert(!hasSO(self, "qwe"));
  17880   ck_assert(hasSO(self, "u"));
  17881   terminateO(self);
  17882 
  17883 }
  17884 
  17885 
  17886 void hasCharSmallJsonT(CuTest *tc UNUSED) {
  17887 
  17888   bool r;
  17889   smallJsont *self = allocSmallJson();
  17890   char value = 'a';
  17891 
  17892   // has
  17893   self->f->pushS(self, "a");
  17894   r = hasCharO(self, value);
  17895   ck_assert(r);
  17896   // not has
  17897   emptyO(self);
  17898   r = hasCharO(self, value);
  17899   ck_assert(!r);
  17900   terminateO(self);
  17901 
  17902 }
  17903 
  17904 
  17905 void hasDictSmallJsonT(CuTest *tc UNUSED) {
  17906 
  17907   bool r;
  17908   smallJsont *self = allocSmallJson();
  17909   smallDictt *value = allocSmallDict();
  17910 
  17911   // has
  17912   self->f->pushNFreeDict(self, allocSmallDict());
  17913   r = hasDictO(self, value);
  17914   ck_assert(r);
  17915   // not has
  17916   emptyO(self);
  17917   r = hasDictO(self, value);
  17918   ck_assert(!r);
  17919   // non smallDict object
  17920   terminateO(value);
  17921   value = (smallDictt*) allocSmallInt(2);
  17922   r = hasDictO(self, value);
  17923   ck_assert(!r);
  17924   // NULL value
  17925   r = hasDictO(self, NULL);
  17926   ck_assert(!r);
  17927   terminateO(self);
  17928   terminateO(value);
  17929 
  17930 }
  17931 
  17932 
  17933 void hasArraySmallJsonT(CuTest *tc UNUSED) {
  17934 
  17935   bool r;
  17936   smallJsont *self = allocSmallJson();
  17937   smallArrayt *value = allocSmallArray();
  17938 
  17939   // has
  17940   self->f->pushNFreeArray(self, allocSmallArray());
  17941   r = hasArrayO(self, value);
  17942   ck_assert(r);
  17943   // not has
  17944   emptyO(self);
  17945   r = hasArrayO(self, value);
  17946   ck_assert(!r);
  17947   // non smallArray object
  17948   terminateO(value);
  17949   value = (smallArrayt*) allocSmallInt(2);
  17950   r = hasArrayO(self, value);
  17951   ck_assert(!r);
  17952   // NULL value
  17953   r = hasArrayO(self, NULL);
  17954   ck_assert(!r);
  17955   terminateO(self);
  17956   terminateO(value);
  17957 
  17958 }
  17959 
  17960 
  17961 void hasArraycSmallJsonT(CuTest *tc UNUSED) {
  17962 
  17963   bool r;
  17964   smallJsont *self = allocSmallJson();
  17965   char **value = listCreateS("a","bb");
  17966 
  17967   // has
  17968   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  17969   r = hasArraycO(self, value);
  17970   ck_assert(r);
  17971   // not has
  17972   emptyO(self);
  17973   r = hasArraycO(self, value);
  17974   ck_assert(!r);
  17975   // NULL value
  17976   r = hasArraycO(self, NULL);
  17977   ck_assert(!r);
  17978   terminateO(self);
  17979   listFreeS(value);
  17980 
  17981 }
  17982 
  17983 
  17984 void hasSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  17985 
  17986   bool r;
  17987   smallJsont *self = allocSmallJson();
  17988   smallBoolt *value = allocSmallBool(true);
  17989 
  17990   // has
  17991   self->f->pushBool(self, true);
  17992   r = hasSmallBoolO(self, value);
  17993   ck_assert(r);
  17994   // not has
  17995   emptyO(self);
  17996   r = hasSmallBoolO(self, value);
  17997   ck_assert(!r);
  17998   // non smallBool object
  17999   terminateO(value);
  18000   value = (smallBoolt*) allocSmallInt(2);
  18001   r = hasSmallBoolO(self, value);
  18002   ck_assert(!r);
  18003   // NULL value
  18004   r = hasSmallBoolO(self, NULL);
  18005   ck_assert(!r);
  18006   terminateO(self);
  18007   terminateO(value);
  18008 
  18009 }
  18010 
  18011 
  18012 void hasSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  18013 
  18014   bool r;
  18015   smallJsont *self  = allocSmallJson();
  18016   createAllocateSmallBytes(value);
  18017   pushBufferO(value, &self, 8);
  18018 
  18019   // has
  18020   createAllocateSmallBytes(elem);
  18021   pushBufferO(elem, &self, 8);
  18022   self->f->pushNFreeSmallBytes(self, elem);
  18023   r = hasSmallBytesO(self, value);
  18024   ck_assert(r);
  18025   // not has
  18026   emptyO(self);
  18027   r = hasSmallBytesO(self, value);
  18028   ck_assert(!r);
  18029   // non smallBytes object
  18030   terminateO(value);
  18031   value = (smallBytest*) allocSmallInt(2);
  18032   r = hasSmallBytesO(self, value);
  18033   ck_assert(!r);
  18034   // NULL value
  18035   r = hasSmallBytesO(self, NULL);
  18036   ck_assert(!r);
  18037   terminateO(self);
  18038   terminateO(value);
  18039 
  18040 }
  18041 
  18042 
  18043 void hasSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  18044 
  18045   bool r;
  18046   smallJsont *self   = allocSmallJson();
  18047   smallDoublet *value = allocSmallDouble(2);
  18048 
  18049   // has
  18050   self->f->pushDouble(self, 2);
  18051   r = hasSmallDoubleO(self, value);
  18052   ck_assert(r);
  18053   // not has
  18054   emptyO(self);
  18055   r = hasSmallDoubleO(self, value);
  18056   ck_assert(!r);
  18057   // non smallDouble object
  18058   terminateO(value);
  18059   value = (smallDoublet*) allocSmallInt(2);
  18060   r = hasSmallDoubleO(self, value);
  18061   ck_assert(!r);
  18062   // NULL value
  18063   r = hasSmallDoubleO(self, NULL);
  18064   ck_assert(!r);
  18065   terminateO(self);
  18066   terminateO(value);
  18067 
  18068 }
  18069 
  18070 
  18071 void hasSmallIntSmallJsonT(CuTest *tc UNUSED) {
  18072 
  18073   bool r;
  18074   smallJsont *self = allocSmallJson();
  18075   smallIntt *value  = allocSmallInt(12);
  18076 
  18077   // has
  18078   self->f->pushInt(self, 12);
  18079   r = hasSmallIntO(self, value);
  18080   ck_assert(r);
  18081   // not has
  18082   emptyO(self);
  18083   r = hasSmallIntO(self, value);
  18084   ck_assert(!r);
  18085   // non smallInt object
  18086   terminateO(value);
  18087   value = (smallIntt*) allocSmallBool(true);
  18088   r = hasSmallIntO(self, value);
  18089   ck_assert(!r);
  18090   // NULL value
  18091   r = hasSmallIntO(self, NULL);
  18092   ck_assert(!r);
  18093   terminateO(self);
  18094   terminateO(value);
  18095 
  18096 }
  18097 
  18098 
  18099 void hasSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  18100 
  18101   bool r;
  18102   smallJsont *self = allocSmallJson();
  18103   smallJsont *value = allocSmallJson();
  18104   value->f->pushInt(value, 1);
  18105 
  18106   // has
  18107   createAllocateSmallJson(elem);
  18108   elem->f->pushInt(elem, 1);
  18109   self->f->pushNFreeSmallJson(self, elem);
  18110   r = self->f->hasSmallJson(self, value);
  18111   ck_assert(r);
  18112   // not has
  18113   emptyO(self);
  18114   r = self->f->hasSmallJson(self, value);
  18115   ck_assert(!r);
  18116   // non smallJson object
  18117   terminateO(value);
  18118   value = (smallJsont*) allocSmallInt(2);
  18119   r = self->f->hasSmallJson(self, value);
  18120   ck_assert(!r);
  18121   // NULL value
  18122   r = self->f->hasSmallJson(self, NULL);
  18123   ck_assert(!r);
  18124   terminateO(self);
  18125   terminateO(value);
  18126 
  18127 }
  18128 
  18129 
  18130 void hasSmallStringSmallJsonT(CuTest *tc UNUSED) {
  18131 
  18132   bool r;
  18133   smallJsont *self   = allocSmallJson();
  18134   smallStringt *value = allocSmallString("qwe");
  18135 
  18136   // has
  18137   self->f->pushS(self, "qwe");
  18138   r = self->f->hasSmallString(self, value);
  18139   ck_assert(r);
  18140   // not has
  18141   emptyO(self);
  18142   r = self->f->hasSmallString(self, value);
  18143   ck_assert(!r);
  18144   // non smallString object
  18145   terminateO(value);
  18146   value = (smallStringt*) allocSmallInt(2);
  18147   r = self->f->hasSmallString(self, value);
  18148   ck_assert(!r);
  18149   // NULL value
  18150   r = self->f->hasSmallString(self, NULL);
  18151   ck_assert(!r);
  18152   terminateO(self);
  18153   terminateO(value);
  18154 
  18155 }
  18156 
  18157 
  18158 void hasSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  18159 
  18160   bool r;
  18161   smallJsont *self = allocSmallJson();
  18162   createAllocateSmallContainer(value);
  18163 
  18164   // has
  18165   createAllocateSmallContainer(elem);
  18166   self->f->pushNFreeSmallContainer(self, elem);
  18167   r = hasSmallContainerO(self, value);
  18168   ck_assert(!r);
  18169   // not has
  18170   emptyO(self);
  18171   r = hasSmallContainerO(self, value);
  18172   ck_assert(!r);
  18173   // non smallContainer object
  18174   terminateO(value);
  18175   value = (smallContainert*) allocSmallInt(2);
  18176   r = self->f->hasSmallContainer(self, value);
  18177   ck_assert(!r);
  18178   // NULL value
  18179   r = hasSmallContainerO(self, NULL);
  18180   ck_assert(!r);
  18181   terminateO(self);
  18182   terminateO(value);
  18183 
  18184 }
  18185 
  18186 
  18187 void findSmallJsonT(CuTest *tc UNUSED) {
  18188 
  18189   smallJsont* r;
  18190   smallJsont *self = allocSmallJson();
  18191   setTopSO(self, "");
  18192 
  18193   // find string in the middle
  18194   freeO(self);
  18195   setTopSO(self, "sheepy");
  18196   r =  findO(self, "ee");
  18197   ck_assert_ptr_ne(r, null);
  18198   ck_assert_str_eq(sjGet(r), "eepy");
  18199   terminateO(r);
  18200   // find non existing string
  18201   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18202   // find NULL
  18203   ck_assert_ptr_eq(findO(self, NULL), NULL);
  18204   // empty string
  18205   freeO(self);
  18206   setTopSO(self, "");
  18207   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18208   // NULL string
  18209   freeO(self);
  18210   ck_assert_ptr_eq(findO(self, "$"), NULL);
  18211   terminateO(self);
  18212 
  18213 }
  18214 
  18215 
  18216 void findCharSmallJsonT(CuTest *tc UNUSED) {
  18217 
  18218   smallJsont* r;
  18219   smallJsont *self = allocSmallJson();
  18220   setTopSO(self, "");
  18221 
  18222   // find string in the middle
  18223   freeO(self);
  18224   setTopSO(self, "sheepy");
  18225   r = findCharO(self, 'e');
  18226   ck_assert_ptr_ne(r, null);
  18227   ck_assert_str_eq(sjGet(r), "eepy");
  18228   terminateO(r);
  18229   // find non existing string
  18230   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18231   // find 0
  18232   r = findCharO(self, 0);
  18233   ck_assert_ptr_ne(r, null);
  18234   ck_assert_str_eq(sjGet(r), "");
  18235   terminateO(r);
  18236   // empty string
  18237   freeO(self);
  18238   setTopSO(self, "");
  18239   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18240   // NULL string
  18241   freeO(self);
  18242   ck_assert_ptr_eq(findCharO(self, '$'), NULL);
  18243   terminateO(self);
  18244 
  18245 }
  18246 
  18247 
  18248 void findSmallStringSmallJsonT(CuTest *tc UNUSED) {
  18249 
  18250   smallJsont* r;
  18251   smallJsont *self = allocSmallJson();
  18252   setTopSO(self, "");
  18253   smallStringt *needle = allocSmallString("ee");
  18254 
  18255   // find string in the middle
  18256   freeO(self);
  18257   setTopSO(self, "sheepy");
  18258   r = self->f->findSmallString(self, needle);
  18259   ck_assert_ptr_ne(r, null);
  18260   ck_assert_str_eq(sjGet(r), "eepy");
  18261   terminateO(r);
  18262   // find non existing string
  18263   setValO(needle, "$");
  18264   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18265   // non smallString object
  18266   terminateO(needle);
  18267   needle = (smallStringt*) allocSmallInt(1);
  18268   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18269   terminateO(needle);
  18270   // find NULL
  18271   ck_assert_ptr_eq(self->f->findSmallString(self, NULL), NULL);
  18272   // empty string
  18273   freeO(self);
  18274   setTopSO(self, "");
  18275   needle = allocSmallString("$");
  18276   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18277   // NULL string
  18278   freeO(self);
  18279   ck_assert_ptr_eq(self->f->findSmallString(self, needle), NULL);
  18280   terminateO(needle);
  18281   terminateO(self);
  18282 
  18283 }
  18284 
  18285 
  18286 void findJsonSmallJsonT(CuTest *tc UNUSED) {
  18287 
  18288   smallJsont* r;
  18289   smallJsont *self = allocSmallJson();
  18290   setTopSO(self, "");
  18291   smallJsont *needle = allocSmallJson();
  18292 
  18293   // find string in the middle
  18294   freeO(self);
  18295   setTopSO(self, "sheepy");
  18296   setTopSO(needle, "ee");
  18297   r = self->f->findJson(self, needle);
  18298   ck_assert_ptr_ne(r, null);
  18299   ck_assert_str_eq(sjGet(r), "eepy");
  18300   terminateO(r);
  18301   // find non existing string
  18302   freeO(needle);
  18303   setTopSO(needle, "$");
  18304   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18305   // non json string
  18306   freeO(needle);
  18307   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18308   // non json object
  18309   terminateO(needle);
  18310   needle = (smallJsont*) allocSmallInt(1);
  18311   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18312   terminateO(needle);
  18313   // find NULL
  18314   ck_assert_ptr_eq(self->f->findJson(self, NULL), NULL);
  18315   // empty string
  18316   freeO(self);
  18317   setTopSO(self, "");
  18318   needle = allocSmallJson();
  18319   setTopSO(needle, "$");
  18320   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18321   // NULL string
  18322   freeO(self);
  18323   ck_assert_ptr_eq(self->f->findJson(self, needle), NULL);
  18324   terminateO(needle);
  18325   terminateO(self);
  18326 
  18327 }
  18328 
  18329 
  18330 void indexOfSmallJsonT(CuTest *tc UNUSED) {
  18331 
  18332   ssize_t r;
  18333   smallJsont *self = allocSmallJson();
  18334   baset *value = (baset*)allocSmallInt(1);
  18335 
  18336   // index
  18337   self->f->pushInt(self, 2);
  18338   self->f->pushInt(self, 0);
  18339   delElemIndexO(self, 1);
  18340   self->f->pushInt(self, 1);
  18341   r = indexOfO(self, value);
  18342   ck_assert_int_eq(r, 2);
  18343   // not index
  18344   smallIntt *v = (smallIntt*) value;
  18345   setValO(v, 0);
  18346   r = indexOfO(self, value);
  18347   ck_assert_int_eq(r, -1);
  18348   // NULL value
  18349   r = indexOfO(self, NULL);
  18350   ck_assert_int_eq(r, -1);
  18351   terminateO(self);
  18352   terminateO(value);
  18353 
  18354 }
  18355 
  18356 
  18357 void indexOfUndefinedSmallJsonT(CuTest *tc UNUSED) {
  18358 
  18359   ssize_t r;
  18360   smallJsont *self = allocSmallJson();
  18361   undefinedt *value = allocUndefined();
  18362 
  18363   // indexOf
  18364   self->f->pushInt(self, 1);
  18365   self->f->pushUndefined(self);
  18366   delElemIndexO(self, 1);
  18367   self->f->pushUndefined(self);
  18368   r = indexOfUndefinedO(self, value);
  18369   ck_assert_int_eq(r, 2);
  18370   // not indexOf
  18371   delElemIndexO(self, 2);
  18372   r = indexOfUndefinedO(self, value);
  18373   ck_assert_int_eq(r, -1);
  18374   // non undefined object
  18375   terminateO(value);
  18376   value = (undefinedt*) allocSmallInt(2);
  18377   r = indexOfUndefinedO(self, value);
  18378   ck_assert_int_eq(r, -1);
  18379   // NULL value
  18380   r = indexOfUndefinedO(self, NULL);
  18381   ck_assert_int_eq(r, -1);
  18382   terminateO(self);
  18383   terminateO(value);
  18384 
  18385 }
  18386 
  18387 
  18388 void indexOfBoolSmallJsonT(CuTest *tc UNUSED) {
  18389 
  18390   ssize_t r;
  18391   smallJsont *self = allocSmallJson();
  18392   bool value = true;
  18393 
  18394   // indexOf
  18395   self->f->pushInt(self, 1);
  18396   self->f->pushUndefined(self);
  18397   delElemIndexO(self, 1);
  18398   self->f->pushBool(self, true);
  18399   r = indexOfBoolO(self, value);
  18400   ck_assert_int_eq(r, 2);
  18401   // not indexOf
  18402   delElemIndexO(self, 2);
  18403   r = indexOfBoolO(self, value);
  18404   ck_assert_int_eq(r, -1);
  18405   terminateO(self);
  18406 
  18407 }
  18408 
  18409 
  18410 void indexOfDoubleSmallJsonT(CuTest *tc UNUSED) {
  18411 
  18412   ssize_t r;
  18413   smallJsont *self = allocSmallJson();
  18414   double value = 2;
  18415 
  18416   // indexOf
  18417   self->f->pushInt(self, 1);
  18418   self->f->pushUndefined(self);
  18419   delElemIndexO(self, 1);
  18420   self->f->pushDouble(self, 2);
  18421   r = indexOfDoubleO(self, value);
  18422   ck_assert_int_eq(r, 2);
  18423   // not indexOf
  18424   delElemIndexO(self, 2);
  18425   r = indexOfDoubleO(self, value);
  18426   ck_assert_int_eq(r, -1);
  18427   terminateO(self);
  18428 
  18429 }
  18430 
  18431 
  18432 void indexOfIntSmallJsonT(CuTest *tc UNUSED) {
  18433 
  18434   ssize_t r;
  18435   smallJsont *self = allocSmallJson();
  18436   int64_t value = 1000;
  18437 
  18438   // indexOf
  18439   self->f->pushUndefined(self);
  18440   self->f->pushUndefined(self);
  18441   delElemIndexO(self, 1);
  18442   self->f->pushInt(self, 1000);
  18443   r = indexOfIntO(self, value);
  18444   ck_assert_int_eq(r, 2);
  18445   // not indexOf
  18446   delElemIndexO(self, 2);
  18447   r = indexOfIntO(self, value);
  18448   ck_assert_int_eq(r, -1);
  18449   terminateO(self);
  18450 
  18451 }
  18452 
  18453 
  18454 void indexOfSSmallJsonT(CuTest *tc UNUSED) {
  18455 
  18456   ssize_t r;
  18457   smallJsont *self = allocSmallJson();
  18458   const char *value = "asd";
  18459 
  18460   // indexOf
  18461   self->f->pushUndefined(self);
  18462   self->f->pushUndefined(self);
  18463   delElemIndexO(self, 1);
  18464   self->f->pushS(self, "asd");
  18465   r = indexOfSO(self, value);
  18466   ck_assert_int_eq(r, 2);
  18467   // not indexOf
  18468   delElemIndexO(self, 2);
  18469   r = indexOfSO(self, value);
  18470   ck_assert_int_eq(r, -1);
  18471   // NULL value
  18472   r = indexOfSO(self, NULL);
  18473   ck_assert_int_eq(r, -1);
  18474   terminateO(self);
  18475   // json string
  18476   self = allocSmallJson();
  18477   // indexOf string in the middle
  18478   setTopSO(self, "sheepy");
  18479   ck_assert_int_eq(indexOfSO(self, "ee"), 2);
  18480   // indexOf non existing string
  18481   ck_assert_int_eq(indexOfSO(self, "$"), -1);
  18482   terminateO(self);
  18483 
  18484 }
  18485 
  18486 
  18487 void indexOfCharSmallJsonT(CuTest *tc UNUSED) {
  18488 
  18489   ssize_t r;
  18490   smallJsont *self = allocSmallJson();
  18491   char value = 'a';
  18492 
  18493   // indexOf
  18494   self->f->pushUndefined(self);
  18495   self->f->pushUndefined(self);
  18496   delElemIndexO(self, 1);
  18497   self->f->pushS(self, "a");
  18498   r = indexOfCharO(self, value);
  18499   ck_assert_int_eq(r, 2);
  18500   // not indexOf
  18501   delElemIndexO(self, 2);
  18502   r = indexOfCharO(self, value);
  18503   ck_assert_int_eq(r, -1);
  18504   terminateO(self);
  18505 
  18506 }
  18507 
  18508 
  18509 void indexOfDictSmallJsonT(CuTest *tc UNUSED) {
  18510 
  18511   ssize_t r;
  18512   smallJsont *self = allocSmallJson();
  18513   smallDictt *value = allocSmallDict();
  18514 
  18515   // indexOf
  18516   createAllocateSmallDict(elem);
  18517   elem->f->setInt(elem, "a", 1);
  18518   self->f->pushNFreeDict(self, elem);
  18519   self->f->pushUndefined(self);
  18520   delElemIndexO(self, 1);
  18521   self->f->pushNFreeDict(self, allocSmallDict());
  18522   r = indexOfDictO(self, value);
  18523   ck_assert_int_eq(r, 2);
  18524   // not indexOf
  18525   delElemIndexO(self, 2);
  18526   r = indexOfDictO(self, value);
  18527   ck_assert_int_eq(r, -1);
  18528   // non smallDict object
  18529   terminateO(value);
  18530   value = (smallDictt*) allocSmallInt(2);
  18531   r = indexOfDictO(self, value);
  18532   ck_assert_int_eq(r, -1);
  18533   // NULL value
  18534   r = indexOfDictO(self, NULL);
  18535   ck_assert_int_eq(r, -1);
  18536   terminateO(self);
  18537   terminateO(value);
  18538 
  18539 }
  18540 
  18541 
  18542 void indexOfArraySmallJsonT(CuTest *tc UNUSED) {
  18543 
  18544   ssize_t r;
  18545   smallJsont *self = allocSmallJson();
  18546   smallArrayt *value = allocSmallArray();
  18547 
  18548   // indexOf
  18549   createAllocateSmallArray(elem);
  18550   elem->f->pushInt(elem, 1);
  18551   self->f->pushNFreeArray(self, elem);
  18552   self->f->pushUndefined(self);
  18553   delElemIndexO(self, 1);
  18554   self->f->pushNFreeArray(self, allocSmallArray());
  18555   r = indexOfArrayO(self, value);
  18556   ck_assert_int_eq(r, 2);
  18557   // non smallArray object
  18558   terminateO(value);
  18559   value = (smallArrayt*) allocSmallInt(2);
  18560   r = indexOfArrayO(self, value);
  18561   ck_assert_int_eq(r, -1);
  18562   // not indexOf
  18563   emptyO(self);
  18564   r = indexOfArrayO(self, value);
  18565   ck_assert_int_eq(r, -1);
  18566   // NULL value
  18567   r = indexOfArrayO(self, NULL);
  18568   ck_assert_int_eq(r, -1);
  18569   terminateO(self);
  18570   terminateO(value);
  18571 
  18572 }
  18573 
  18574 
  18575 void indexOfArraycSmallJsonT(CuTest *tc UNUSED) {
  18576 
  18577   ssize_t r;
  18578   smallJsont *self = allocSmallJson();
  18579   char **value = listCreateS("a","bb");
  18580 
  18581   // indexOf
  18582   char **elem = listCreateS("!!","@@@");
  18583   self->f->pushNFreeArrayc(self, elem);
  18584   self->f->pushUndefined(self);
  18585   delElemIndexO(self, 1);
  18586   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  18587   r = indexOfArraycO(self, value);
  18588   ck_assert_int_eq(r, 2);
  18589   // not indexOf
  18590   delElemIndexO(self, 2);
  18591   r = indexOfArraycO(self, value);
  18592   ck_assert_int_eq(r, -1);
  18593   // NULL value
  18594   r = indexOfArraycO(self, NULL);
  18595   ck_assert_int_eq(r, -1);
  18596   terminateO(self);
  18597   listFreeS(value);
  18598 
  18599 }
  18600 
  18601 
  18602 void indexOfSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  18603 
  18604   ssize_t r;
  18605   smallJsont *self = allocSmallJson();
  18606   smallBoolt *value = allocSmallBool(true);
  18607 
  18608   // indexOf
  18609   self->f->pushUndefined(self);
  18610   self->f->pushUndefined(self);
  18611   delElemIndexO(self, 1);
  18612   self->f->pushBool(self, true);
  18613   r = indexOfSmallBoolO(self, value);
  18614   ck_assert_int_eq(r, 2);
  18615   // not indexOf
  18616   delElemIndexO(self, 2);
  18617   r = indexOfSmallBoolO(self, value);
  18618   ck_assert_int_eq(r, -1);
  18619   // non smallBool object
  18620   terminateO(value);
  18621   value = (smallBoolt*) allocSmallInt(2);
  18622   r = indexOfSmallBoolO(self, value);
  18623   ck_assert_int_eq(r, -1);
  18624   // NULL value
  18625   r = indexOfSmallBoolO(self, NULL);
  18626   ck_assert_int_eq(r, -1);
  18627   terminateO(self);
  18628   terminateO(value);
  18629 
  18630 }
  18631 
  18632 
  18633 void indexOfSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  18634 
  18635   ssize_t r;
  18636   smallJsont *self = allocSmallJson();
  18637   createAllocateSmallBytes(value);
  18638   pushBufferO(value, &self, 8);
  18639 
  18640   // indexOf
  18641   self->f->pushUndefined(self);
  18642   self->f->pushUndefined(self);
  18643   delElemIndexO(self, 1);
  18644   createAllocateSmallBytes(elem);
  18645   pushBufferO(elem, &self, 8);
  18646   self->f->pushNFreeSmallBytes(self, elem);
  18647   r = indexOfSmallBytesO(self, value);
  18648   ck_assert_int_eq(r, 2);
  18649   // not indexOf
  18650   delElemIndexO(self, 2);
  18651   r = indexOfSmallBytesO(self, value);
  18652   ck_assert_int_eq(r, -1);
  18653   // non smallBytes object
  18654   terminateO(value);
  18655   value = (smallBytest*) allocSmallInt(2);
  18656   r = indexOfSmallBytesO(self, value);
  18657   ck_assert_int_eq(r, -1);
  18658   // NULL value
  18659   r = indexOfSmallBytesO(self, NULL);
  18660   ck_assert_int_eq(r, -1);
  18661   terminateO(self);
  18662   terminateO(value);
  18663 
  18664 }
  18665 
  18666 
  18667 void indexOfSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  18668 
  18669   ssize_t r;
  18670   smallJsont *self = allocSmallJson();
  18671   smallDoublet *value = allocSmallDouble(2);
  18672 
  18673   // indexOf
  18674   self->f->pushUndefined(self);
  18675   self->f->pushUndefined(self);
  18676   delElemIndexO(self, 1);
  18677   self->f->pushDouble(self, 2);
  18678   r = indexOfSmallDoubleO(self, value);
  18679   ck_assert_int_eq(r, 2);
  18680   // not indexOf
  18681   delElemIndexO(self, 2);
  18682   r = indexOfSmallDoubleO(self, value);
  18683   ck_assert_int_eq(r, -1);
  18684   // non smallDouble object
  18685   terminateO(value);
  18686   value = (smallDoublet*) allocSmallInt(2);
  18687   r = indexOfSmallDoubleO(self, value);
  18688   ck_assert_int_eq(r, -1);
  18689   // NULL value
  18690   r = indexOfSmallDoubleO(self, NULL);
  18691   ck_assert_int_eq(r, -1);
  18692   terminateO(self);
  18693   terminateO(value);
  18694 
  18695 }
  18696 
  18697 
  18698 void indexOfSmallIntSmallJsonT(CuTest *tc UNUSED) {
  18699 
  18700   ssize_t r;
  18701   smallJsont *self = allocSmallJson();
  18702   smallIntt *value  = allocSmallInt(12);
  18703 
  18704   // indexOf
  18705   self->f->pushUndefined(self);
  18706   self->f->pushUndefined(self);
  18707   delElemIndexO(self, 1);
  18708   self->f->pushInt(self, 12);
  18709   r = indexOfSmallIntO(self, value);
  18710   ck_assert_int_eq(r, 2);
  18711   // not indexOf
  18712   delElemIndexO(self, 2);
  18713   r = indexOfSmallIntO(self, value);
  18714   ck_assert_int_eq(r, -1);
  18715   // non smallInt object
  18716   terminateO(value);
  18717   value = (smallIntt*) allocSmallBool(true);
  18718   r = indexOfSmallIntO(self, value);
  18719   ck_assert_int_eq(r, -1);
  18720   // NULL value
  18721   r = indexOfSmallIntO(self, NULL);
  18722   ck_assert_int_eq(r, -1);
  18723   terminateO(self);
  18724   terminateO(value);
  18725 
  18726 }
  18727 
  18728 
  18729 void indexOfSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  18730 
  18731   ssize_t r;
  18732   smallJsont *self = allocSmallJson();
  18733   smallJsont *value = allocSmallJson();
  18734 
  18735   // indexOf json undefined
  18736   createUndefined(u);
  18737   setTopO(value, (baset*)&u);
  18738   self->f->pushUndefined(self);
  18739   r = self->f->indexOfSmallJson(self, value);
  18740   ck_assert_int_eq(r, 0);
  18741   freeO(value);
  18742   // indexOf json bool
  18743   smallBoolt *b = allocSmallBool(true);
  18744   setTopNFreeSmallBoolO(value, b);
  18745   self->f->pushBool(self, true);
  18746   r = self->f->indexOfSmallJson(self, value);
  18747   ck_assert_int_eq(r, 1);
  18748   freeO(value);
  18749   // indexOf json double
  18750   smallDoublet *d = allocSmallDouble(1);
  18751   setTopNFreeSmallDoubleO(value, d);
  18752   self->f->pushDouble(self, 1);
  18753   r = self->f->indexOfSmallJson(self, value);
  18754   ck_assert_int_eq(r, 2);
  18755   freeO(value);
  18756   // indexOf json int
  18757   smallIntt *i = allocSmallInt(1);
  18758   setTopNFreeSmallIntO(value, i);
  18759   self->f->pushInt(self, 1);
  18760   r = self->f->indexOfSmallJson(self, value);
  18761   ck_assert_int_eq(r, 3);
  18762   freeO(value);
  18763   // indexOf json string
  18764   smallStringt *s = allocSmallString("asd");
  18765   setTopNFreeSmallStringO(value, s);
  18766   self->f->pushS(self, "asd");
  18767   r = self->f->indexOfSmallJson(self, value);
  18768   ck_assert_int_eq(r, 4);
  18769   freeO(value);
  18770   // indexOf json dict
  18771   smallDictt *D = allocSmallDict();
  18772   setTopNFreeDictO(value, D);
  18773   self->f->pushNFreeDict(self, allocSmallDict());
  18774   r = self->f->indexOfSmallJson(self, value);
  18775   ck_assert_int_eq(r, 5);
  18776   freeO(value);
  18777   // indexOf json array
  18778   value->f->pushInt(value, 1);
  18779   delElemIndexO(self, 1);
  18780   createAllocateSmallJson(elem);
  18781   elem->f->pushInt(elem, 1);
  18782   self->f->pushNFreeSmallJson(self, elem);
  18783   r = self->f->indexOfSmallJson(self, value);
  18784   ck_assert_int_eq(r, 6);
  18785   // not indexOf
  18786   delElemIndexO(self, 6);
  18787   r = self->f->indexOfSmallJson(self, value);
  18788   ck_assert_int_eq(r, -1);
  18789   // empty json object
  18790   freeO(value);
  18791   r = self->f->indexOfSmallJson(self, value);
  18792   ck_assert_int_eq(r, -1);
  18793   // non smallJson object
  18794   terminateO(value);
  18795   value = (smallJsont*) allocSmallInt(2);
  18796   r = self->f->indexOfSmallJson(self, value);
  18797   ck_assert_int_eq(r, -1);
  18798   // NULL value
  18799   r = self->f->indexOfSmallJson(self, NULL);
  18800   ck_assert_int_eq(r, -1);
  18801   terminateO(self);
  18802   terminateO(value);
  18803 
  18804 }
  18805 
  18806 
  18807 void indexOfSmallStringSmallJsonT(CuTest *tc UNUSED) {
  18808 
  18809   ssize_t r;
  18810   smallJsont *self = allocSmallJson();
  18811   smallStringt *value = allocSmallString("qwe");
  18812 
  18813   // indexOf
  18814   self->f->pushUndefined(self);
  18815   self->f->pushUndefined(self);
  18816   delElemIndexO(self, 1);
  18817   self->f->pushS(self, "qwe");
  18818   r = self->f->indexOfSmallString(self, value);
  18819   ck_assert_int_eq(r, 2);
  18820   // not indexOf
  18821   delElemIndexO(self, 2);
  18822   r = self->f->indexOfSmallString(self, value);
  18823   ck_assert_int_eq(r, -1);
  18824   // empty string
  18825   freeO(value);
  18826   r = self->f->indexOfSmallString(self, value);
  18827   ck_assert_int_eq(r, -1);
  18828   // non smallString object
  18829   terminateO(value);
  18830   value = (smallStringt*) allocSmallInt(2);
  18831   r = self->f->indexOfSmallString(self, value);
  18832   ck_assert_int_eq(r, -1);
  18833   // NULL value
  18834   r = self->f->indexOfSmallString(self, NULL);
  18835   ck_assert_int_eq(r, -1);
  18836   terminateO(self);
  18837   terminateO(value);
  18838   // json string
  18839   self = allocSmallJson();
  18840   smallStringt *needle = allocSmallString("ee");
  18841   // indexOf string in the middle
  18842   setTopSO(self, "sheepy");
  18843   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), 2);
  18844   // indexOf non existing string
  18845   setValO(needle, "$");
  18846   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18847   // non smallString object
  18848   terminateO(needle);
  18849   needle = (smallStringt*) allocSmallInt(1);
  18850   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18851   terminateO(needle);
  18852   // indexOf NULL
  18853   ck_assert_int_eq(self->f->indexOfSmallString(self, NULL), -1);
  18854   // empty string
  18855   freeO(self);
  18856   setTopSO(self, "");
  18857   needle = allocSmallString("$");
  18858   ck_assert_int_eq(self->f->indexOfSmallString(self, needle), -1);
  18859   terminateO(needle);
  18860   terminateO(self);
  18861 
  18862 }
  18863 
  18864 
  18865 void indexOfSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  18866 
  18867   ssize_t r;
  18868   smallJsont *self = allocSmallJson();
  18869   createAllocateSmallContainer(value);
  18870 
  18871   // indexOf
  18872   self->f->pushUndefined(self);
  18873   self->f->pushUndefined(self);
  18874   delElemIndexO(self, 1);
  18875   createAllocateSmallContainer(elem);
  18876   self->f->pushNFreeSmallContainer(self, elem);
  18877   r = self->f->indexOfSmallContainer(self, value);
  18878   ck_assert_int_eq(r, -1);
  18879   // not indexOf
  18880   delElemIndexO(self, 2);
  18881   r = self->f->indexOfSmallContainer(self, value);
  18882   ck_assert_int_eq(r, -1);
  18883   // non smallContainer object
  18884   terminateO(value);
  18885   value = (smallContainert*) allocSmallInt(2);
  18886   r = self->f->indexOfSmallContainer(self, value);
  18887   ck_assert_int_eq(r, -1);
  18888   // NULL value
  18889   r = self->f->indexOfSmallContainer(self, NULL);
  18890   ck_assert_int_eq(r, -1);
  18891   terminateO(self);
  18892   terminateO(value);
  18893 
  18894 }
  18895 
  18896 
  18897 void binarySearchSmallJsonT(CuTest *tc UNUSED) {
  18898 
  18899   ssize_t r;
  18900   smallJsont *self = allocSmallJson();
  18901   baset *value = (baset*)allocSmallString("4");
  18902 
  18903   // index not trimmed (an element is NULL)
  18904   self->f->pushS(self, "0");
  18905   self->f->pushS(self, "1");
  18906   self->f->pushS(self, "2");
  18907   delElemIndexO(self, 2);
  18908   self->f->pushS(self, "3");
  18909   self->f->pushS(self, "4");
  18910   self->f->pushS(self, "5");
  18911   r = binarySearchO(self, value);
  18912   ck_assert_int_eq(r, -1);
  18913   // index
  18914   trimO(self);
  18915   r = binarySearchO(self, value);
  18916   ck_assert_int_eq(r, 3);
  18917   smallStringt *v = (smallStringt*) value;
  18918   // index in the lower half of the array
  18919   setValO(v, "1");
  18920   r = binarySearchO(self, value);
  18921   ck_assert_int_eq(r, 1);
  18922   // not index
  18923   setValO(v, "asd");
  18924   r = binarySearchO(self, value);
  18925   ck_assert_int_eq(r, -1);
  18926   // NULL value
  18927   r = binarySearchO(self, NULL);
  18928   ck_assert_int_eq(r, -1);
  18929   // empty array
  18930   emptyO(self);
  18931   r = binarySearchO(self, value);
  18932   ck_assert_int_eq(r, -1);
  18933   terminateO(self);
  18934   terminateO(value);
  18935 
  18936 }
  18937 
  18938 
  18939 void binarySearchUndefinedSmallJsonT(CuTest *tc UNUSED) {
  18940 
  18941   ssize_t r;
  18942   smallJsont *self = allocSmallJson();
  18943   undefinedt *undefined = (undefinedt*) 1234;
  18944 
  18945   r = binarySearchUndefinedO(self, undefined);
  18946   ck_assert_int_eq(r, -1);
  18947   terminateO(self);
  18948 
  18949 }
  18950 
  18951 
  18952 void binarySearchBoolSmallJsonT(CuTest *tc UNUSED) {
  18953 
  18954   ssize_t r;
  18955   smallJsont *self = allocSmallJson();
  18956   bool value = true;
  18957 
  18958   // index not trimmed (an element is NULL)
  18959   self->f->pushUndefined(self);
  18960   self->f->pushBool(self, false);
  18961   self->f->pushUndefined(self);
  18962   delElemIndexO(self, 2);
  18963   self->f->pushBool(self, true);
  18964   self->f->pushS(self, "4");
  18965   self->f->pushS(self, "5");
  18966   r = binarySearchBoolO(self, value);
  18967   ck_assert_int_eq(r, -1);
  18968   // index
  18969   trimO(self);
  18970   r = binarySearchBoolO(self, value);
  18971   ck_assert_int_eq(r, 2);
  18972   // index in the lower half of the array
  18973   value = false;
  18974   r = binarySearchBoolO(self, value);
  18975   ck_assert_int_eq(r, 1);
  18976   // not index
  18977   delElemIndexO(self, 1);
  18978   trimO(self);
  18979   r = binarySearchBoolO(self, value);
  18980   ck_assert_int_eq(r, -1);
  18981   // empty array
  18982   emptyO(self);
  18983   r = binarySearchBoolO(self, value);
  18984   ck_assert_int_eq(r, -1);
  18985   terminateO(self);
  18986 
  18987 }
  18988 
  18989 
  18990 void binarySearchDoubleSmallJsonT(CuTest *tc UNUSED) {
  18991 
  18992   ssize_t r;
  18993   smallJsont *self = allocSmallJson();
  18994   double value = 2;
  18995 
  18996   // index not trimmed (an element is NULL)
  18997   self->f->pushUndefined(self);
  18998   self->f->pushDouble(self, 1);
  18999   self->f->pushUndefined(self);
  19000   delElemIndexO(self, 2);
  19001   self->f->pushDouble(self, 2);
  19002   self->f->pushS(self, "4");
  19003   self->f->pushS(self, "5");
  19004   r = binarySearchDoubleO(self, value);
  19005   ck_assert_int_eq(r, -1);
  19006   // index
  19007   trimO(self);
  19008   r = binarySearchDoubleO(self, value);
  19009   ck_assert_int_eq(r, 2);
  19010   // index in the lower half of the array
  19011   value = 1;
  19012   r = binarySearchDoubleO(self, value);
  19013   ck_assert_int_eq(r, 1);
  19014   // not index
  19015   delElemIndexO(self, 1);
  19016   trimO(self);
  19017   r = binarySearchDoubleO(self, value);
  19018   ck_assert_int_eq(r, -1);
  19019   // empty array
  19020   emptyO(self);
  19021   r = binarySearchDoubleO(self, value);
  19022   ck_assert_int_eq(r, -1);
  19023   terminateO(self);
  19024 
  19025 }
  19026 
  19027 
  19028 void binarySearchIntSmallJsonT(CuTest *tc UNUSED) {
  19029 
  19030   ssize_t r;
  19031   smallJsont *self = allocSmallJson();
  19032   int64_t value = 2;
  19033 
  19034   // index not trimmed (an element is NULL)
  19035   self->f->pushUndefined(self);
  19036   self->f->pushInt(self, 1);
  19037   self->f->pushUndefined(self);
  19038   delElemIndexO(self, 2);
  19039   self->f->pushInt(self, 2);
  19040   self->f->pushS(self, "4");
  19041   self->f->pushS(self, "5");
  19042   r = binarySearchIntO(self, value);
  19043   ck_assert_int_eq(r, -1);
  19044   // index
  19045   trimO(self);
  19046   r = binarySearchIntO(self, value);
  19047   ck_assert_int_eq(r, 2);
  19048   // index in the lower half of the array
  19049   value = 1;
  19050   r = binarySearchIntO(self, value);
  19051   ck_assert_int_eq(r, 1);
  19052   // not index
  19053   delElemIndexO(self, 1);
  19054   trimO(self);
  19055   r = binarySearchIntO(self, value);
  19056   ck_assert_int_eq(r, -1);
  19057   // empty array
  19058   emptyO(self);
  19059   r = binarySearchIntO(self, value);
  19060   ck_assert_int_eq(r, -1);
  19061   terminateO(self);
  19062 
  19063 }
  19064 
  19065 
  19066 void binarySearchSSmallJsonT(CuTest *tc UNUSED) {
  19067 
  19068   ssize_t r;
  19069   smallJsont *self = allocSmallJson();
  19070   const char *value = "4";
  19071 
  19072   // index not trimmed (an element is NULL)
  19073   self->f->pushS(self, "0");
  19074   self->f->pushS(self, "1");
  19075   self->f->pushS(self, "2");
  19076   delElemIndexO(self, 2);
  19077   self->f->pushS(self, "3");
  19078   self->f->pushS(self, "4");
  19079   self->f->pushS(self, "5");
  19080   r = binarySearchSO(self, value);
  19081   ck_assert_int_eq(r, -1);
  19082   // index
  19083   trimO(self);
  19084   r = binarySearchSO(self, value);
  19085   ck_assert_int_eq(r, 3);
  19086   // index in the lower half of the array
  19087   value = "1";
  19088   r = binarySearchSO(self, value);
  19089   ck_assert_int_eq(r, 1);
  19090   // not index
  19091   value = "asd";
  19092   r = binarySearchSO(self, value);
  19093   ck_assert_int_eq(r, -1);
  19094   // NULL value
  19095   r = binarySearchSO(self, NULL);
  19096   ck_assert_int_eq(r, -1);
  19097   // empty array
  19098   emptyO(self);
  19099   r = binarySearchSO(self, value);
  19100   ck_assert_int_eq(r, -1);
  19101   terminateO(self);
  19102 
  19103 }
  19104 
  19105 
  19106 void binarySearchCharSmallJsonT(CuTest *tc UNUSED) {
  19107 
  19108   ssize_t r;
  19109   smallJsont *self = allocSmallJson();
  19110   char value = '4';
  19111 
  19112   // index not trimmed (an element is NULL)
  19113   self->f->pushS(self, "0");
  19114   self->f->pushS(self, "1");
  19115   self->f->pushS(self, "2");
  19116   delElemIndexO(self, 2);
  19117   self->f->pushS(self, "3");
  19118   self->f->pushS(self, "4");
  19119   self->f->pushS(self, "5");
  19120   r = binarySearchCharO(self, value);
  19121   ck_assert_int_eq(r, -1);
  19122   // index
  19123   trimO(self);
  19124   r = binarySearchCharO(self, value);
  19125   ck_assert_int_eq(r, 3);
  19126   // index in the lower half of the array
  19127   value = '1';
  19128   r = binarySearchCharO(self, value);
  19129   ck_assert_int_eq(r, 1);
  19130   // not index
  19131   value = 'a';
  19132   r = binarySearchCharO(self, value);
  19133   ck_assert_int_eq(r, -1);
  19134   // empty array
  19135   emptyO(self);
  19136   r = binarySearchCharO(self, value);
  19137   ck_assert_int_eq(r, -1);
  19138   terminateO(self);
  19139 
  19140 }
  19141 
  19142 
  19143 void binarySearchDictSmallJsonT(CuTest *tc UNUSED) {
  19144 
  19145   ssize_t r;
  19146   smallJsont *self = allocSmallJson();
  19147   smallDictt *value = allocSmallDict();
  19148   value->f->setInt(value, "b", 2);
  19149 
  19150   // index not trimmed (an element is NULL)
  19151   createAllocateSmallDict(elem);
  19152   elem->f->setInt(elem, "a", 1);
  19153   self->f->pushUndefined(self);
  19154   self->f->pushDict(self, elem);
  19155   resetO(elem);
  19156   self->f->pushUndefined(self);
  19157   delElemIndexO(self, 2);
  19158   elem->f->setInt(elem, "b", 2);
  19159   self->f->pushNFreeDict(self, elem);
  19160   self->f->pushS(self, "4");
  19161   self->f->pushS(self, "5");
  19162   r = binarySearchDictO(self, value);
  19163   ck_assert_int_eq(r, -1);
  19164   // index
  19165   trimO(self);
  19166   r = binarySearchDictO(self, value);
  19167   ck_assert_int_eq(r, 2);
  19168   // index in the lower half of the array
  19169   freeO(value);
  19170   value->f->setInt(value, "a", 1);
  19171   r = binarySearchDictO(self, value);
  19172   ck_assert_int_eq(r, 1);
  19173   // not index
  19174   freeO(value);
  19175   r = binarySearchDictO(self, value);
  19176   ck_assert_int_eq(r, -1);
  19177   // non smallDict object
  19178   terminateO(value);
  19179   value = (smallDictt*) allocSmallInt(2);
  19180   r = binarySearchDictO(self, value);
  19181   ck_assert_int_eq(r, -1);
  19182   // NULL value
  19183   r = binarySearchDictO(self, NULL);
  19184   ck_assert_int_eq(r, -1);
  19185   // empty array
  19186   emptyO(self);
  19187   r = binarySearchDictO(self, value);
  19188   ck_assert_int_eq(r, -1);
  19189   terminateO(self);
  19190   terminateO(value);
  19191 
  19192 }
  19193 
  19194 
  19195 void binarySearchArraySmallJsonT(CuTest *tc UNUSED) {
  19196 
  19197   ssize_t r;
  19198   smallJsont *self  = allocSmallJson();
  19199   smallArrayt *value = allocSmallArray();
  19200   value->f->pushInt(value, 2);
  19201 
  19202   // index not trimmed (an element is NULL)
  19203   createAllocateSmallArray(elem);
  19204   elem->f->pushInt(elem, 1);
  19205   self->f->pushUndefined(self);
  19206   self->f->pushArray(self, elem);
  19207   resetO(elem);
  19208   self->f->pushUndefined(self);
  19209   delElemIndexO(self, 2);
  19210   elem->f->pushInt(elem, 2);
  19211   self->f->pushNFreeArray(self, elem);
  19212   self->f->pushS(self, "4");
  19213   self->f->pushS(self, "5");
  19214   r = binarySearchArrayO(self, value);
  19215   ck_assert_int_eq(r, -1);
  19216   // index
  19217   trimO(self);
  19218   r = binarySearchArrayO(self, value);
  19219   ck_assert_int_eq(r, 2);
  19220   // index in the lower half of the array
  19221   freeO(value);
  19222   value->f->pushInt(value, 1);
  19223   r = binarySearchArrayO(self, value);
  19224   ck_assert_int_eq(r, 1);
  19225   // not index
  19226   freeO(value);
  19227   r = binarySearchArrayO(self, value);
  19228   ck_assert_int_eq(r, -1);
  19229   // non smallArray object
  19230   terminateO(value);
  19231   value = (smallArrayt*) allocSmallInt(2);
  19232   r = binarySearchArrayO(self, value);
  19233   ck_assert_int_eq(r, -1);
  19234   // NULL value
  19235   r = binarySearchArrayO(self, NULL);
  19236   ck_assert_int_eq(r, -1);
  19237   // empty array
  19238   emptyO(self);
  19239   r = binarySearchArrayO(self, value);
  19240   ck_assert_int_eq(r, -1);
  19241   terminateO(self);
  19242   terminateO(value);
  19243 
  19244 }
  19245 
  19246 
  19247 void binarySearchArraycSmallJsonT(CuTest *tc UNUSED) {
  19248 
  19249   ssize_t r;
  19250   smallJsont *self = allocSmallJson();
  19251   char **value      = listCreateS("b");
  19252 
  19253   // index not trimmed (an element is NULL)
  19254   char **elem = listCreateS("a");
  19255   self->f->pushUndefined(self);
  19256   self->f->pushNFreeArrayc(self, elem);
  19257   self->f->pushUndefined(self);
  19258   delElemIndexO(self, 2);
  19259   elem = listCreateS("b");
  19260   self->f->pushNFreeArrayc(self, elem);
  19261   self->f->pushS(self, "4");
  19262   self->f->pushS(self, "5");
  19263   r = binarySearchArraycO(self, value);
  19264   ck_assert_int_eq(r, -1);
  19265   // index
  19266   trimO(self);
  19267   r = binarySearchArraycO(self, value);
  19268   ck_assert_int_eq(r, 2);
  19269   // index in the lower half of the array
  19270   free(value[0]);
  19271   value[0] = strdup("a");
  19272   r = binarySearchArraycO(self, value);
  19273   ck_assert_int_eq(r, 1);
  19274   // not index
  19275   free(value[0]);
  19276   value[0] = strdup("asd");
  19277   r = binarySearchArraycO(self, value);
  19278   ck_assert_int_eq(r, -1);
  19279   // NULL value
  19280   r = binarySearchArraycO(self, NULL);
  19281   ck_assert_int_eq(r, -1);
  19282   // empty array
  19283   emptyO(self);
  19284   r = binarySearchArraycO(self, value);
  19285   ck_assert_int_eq(r, -1);
  19286   terminateO(self);
  19287   listFreeS(value);
  19288 
  19289 }
  19290 
  19291 
  19292 void binarySearchSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  19293 
  19294   ssize_t r;
  19295   smallJsont *self = allocSmallJson();
  19296   smallBoolt *value = allocSmallBool(true);
  19297 
  19298   // index not trimmed (an element is NULL)
  19299   self->f->pushUndefined(self);
  19300   self->f->pushBool(self, false);
  19301   self->f->pushUndefined(self);
  19302   delElemIndexO(self, 2);
  19303   self->f->pushBool(self, true);
  19304   self->f->pushS(self, "4");
  19305   self->f->pushS(self, "5");
  19306   r = binarySearchSmallBoolO(self, value);
  19307   ck_assert_int_eq(r, -1);
  19308   // index
  19309   trimO(self);
  19310   r = binarySearchSmallBoolO(self, value);
  19311   ck_assert_int_eq(r, 2);
  19312   // index in the lower half of the array
  19313   setValO(value, false);
  19314   r = binarySearchSmallBoolO(self, value);
  19315   ck_assert_int_eq(r, 1);
  19316   // not index
  19317   delElemIndexO(self, 1);
  19318   trimO(self);
  19319   r = binarySearchSmallBoolO(self, value);
  19320   ck_assert_int_eq(r, -1);
  19321   // non smallBool object
  19322   terminateO(value);
  19323   value = (smallBoolt*) allocSmallInt(2);
  19324   r = binarySearchSmallBoolO(self, value);
  19325   ck_assert_int_eq(r, -1);
  19326   // NULL value
  19327   r = binarySearchArraycO(self, NULL);
  19328   ck_assert_int_eq(r, -1);
  19329   // empty array
  19330   emptyO(self);
  19331   r = binarySearchSmallBoolO(self, value);
  19332   ck_assert_int_eq(r, -1);
  19333   terminateO(self);
  19334   terminateO(value);
  19335 
  19336 }
  19337 
  19338 
  19339 void binarySearchSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  19340 
  19341   ssize_t r;
  19342   smallJsont *self = allocSmallJson();
  19343   createAllocateSmallBytes(value);
  19344   pushBufferO(value, "bbc", 4);
  19345 
  19346   // index not trimmed (an element is NULL)
  19347   createAllocateSmallBytes(elem);
  19348   pushBufferO(elem, "abc", 4);
  19349   self->f->pushUndefined(self);
  19350   self->f->pushNFreeSmallBytes(self, elem);
  19351   self->f->pushUndefined(self);
  19352   delElemIndexO(self, 2);
  19353   elem = allocSmallBytes("bbc", 4);
  19354   self->f->pushNFreeSmallBytes(self, elem);
  19355   self->f->pushS(self, "4");
  19356   self->f->pushS(self, "5");
  19357   r = binarySearchSmallBytesO(self, value);
  19358   ck_assert_int_eq(r, -1);
  19359   // index
  19360   trimO(self);
  19361   r = binarySearchSmallBytesO(self, value);
  19362   ck_assert_int_eq(r, 2);
  19363   // index in the lower half of the array
  19364   freeO(value);
  19365   pushBufferO(value, "abc", 4);
  19366   r = binarySearchSmallBytesO(self, value);
  19367   ck_assert_int_eq(r, 1);
  19368   // not index
  19369   freeO(value);
  19370   pushBufferO(value, "###", 4);
  19371   r = binarySearchSmallBytesO(self, value);
  19372   ck_assert_int_eq(r, -1);
  19373   // non smallBytes object
  19374   terminateO(value);
  19375   value = (smallBytest*) allocSmallInt(2);
  19376   r = binarySearchSmallBytesO(self, value);
  19377   ck_assert_int_eq(r, -1);
  19378   // NULL value
  19379   r = binarySearchSmallBytesO(self, NULL);
  19380   ck_assert_int_eq(r, -1);
  19381   // empty array
  19382   emptyO(self);
  19383   r = binarySearchSmallBytesO(self, value);
  19384   ck_assert_int_eq(r, -1);
  19385   terminateO(self);
  19386   terminateO(value);
  19387 
  19388 }
  19389 
  19390 
  19391 void binarySearchSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  19392 
  19393   ssize_t r;
  19394   smallJsont *self   = allocSmallJson();
  19395   smallDoublet *value = allocSmallDouble(2);
  19396 
  19397   // index not trimmed (an element is NULL)
  19398   self->f->pushUndefined(self);
  19399   self->f->pushDouble(self, 1);
  19400   self->f->pushUndefined(self);
  19401   delElemIndexO(self, 2);
  19402   self->f->pushDouble(self, 2);
  19403   self->f->pushS(self, "4");
  19404   self->f->pushS(self, "5");
  19405   r = binarySearchSmallDoubleO(self, value);
  19406   ck_assert_int_eq(r, -1);
  19407   // index
  19408   trimO(self);
  19409   r = binarySearchSmallDoubleO(self, value);
  19410   ck_assert_int_eq(r, 2);
  19411   // index in the lower half of the array
  19412   setValO(value, 1);
  19413   r = binarySearchSmallDoubleO(self, value);
  19414   ck_assert_int_eq(r, 1);
  19415   // not index
  19416   delElemIndexO(self, 1);
  19417   trimO(self);
  19418   r = binarySearchSmallDoubleO(self, value);
  19419   ck_assert_int_eq(r, -1);
  19420   // non smallDouble object
  19421   terminateO(value);
  19422   value = (smallDoublet*) allocSmallInt(2);
  19423   r = binarySearchSmallDoubleO(self, value);
  19424   ck_assert_int_eq(r, -1);
  19425   // NULL value
  19426   r = binarySearchArraycO(self, NULL);
  19427   ck_assert_int_eq(r, -1);
  19428   // empty array
  19429   emptyO(self);
  19430   r = binarySearchSmallDoubleO(self, value);
  19431   ck_assert_int_eq(r, -1);
  19432   terminateO(self);
  19433   terminateO(value);
  19434 
  19435 }
  19436 
  19437 
  19438 void binarySearchSmallIntSmallJsonT(CuTest *tc UNUSED) {
  19439 
  19440   ssize_t r;
  19441   smallJsont *self = allocSmallJson();
  19442   smallIntt *value  = allocSmallInt(2);
  19443 
  19444   // index not trimmed (an element is NULL)
  19445   self->f->pushUndefined(self);
  19446   self->f->pushInt(self, 1);
  19447   self->f->pushUndefined(self);
  19448   delElemIndexO(self, 2);
  19449   self->f->pushInt(self, 2);
  19450   self->f->pushS(self, "4");
  19451   self->f->pushS(self, "5");
  19452   r = binarySearchSmallIntO(self, value);
  19453   ck_assert_int_eq(r, -1);
  19454   // index
  19455   trimO(self);
  19456   r = binarySearchSmallIntO(self, value);
  19457   ck_assert_int_eq(r, 2);
  19458   // index in the lower half of the array
  19459   setValO(value, 1);
  19460   r = binarySearchSmallIntO(self, value);
  19461   ck_assert_int_eq(r, 1);
  19462   // not index
  19463   delElemIndexO(self, 1);
  19464   trimO(self);
  19465   r = binarySearchSmallIntO(self, value);
  19466   ck_assert_int_eq(r, -1);
  19467   // non smallInt object
  19468   terminateO(value);
  19469   value = (smallIntt*) allocSmallBool(true);
  19470   r = binarySearchSmallIntO(self, value);
  19471   ck_assert_int_eq(r, -1);
  19472   // NULL value
  19473   r = binarySearchArraycO(self, NULL);
  19474   ck_assert_int_eq(r, -1);
  19475   // empty array
  19476   emptyO(self);
  19477   r = binarySearchSmallIntO(self, value);
  19478   ck_assert_int_eq(r, -1);
  19479   terminateO(self);
  19480   terminateO(value);
  19481 
  19482 }
  19483 
  19484 
  19485 void binarySearchSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  19486 
  19487   ssize_t r;
  19488   smallJsont *self = allocSmallJson();
  19489   smallJsont *value = allocSmallJson();
  19490   value->f->pushInt(value, 2);
  19491 
  19492   // index not trimmed (an element is NULL)
  19493   self->f->pushUndefined(self);
  19494   createAllocateSmallArray(elem);
  19495   elem->f->pushInt(elem, 1);
  19496   self->f->pushArray(self, elem);
  19497   resetO(elem);
  19498   self->f->pushUndefined(self);
  19499   delElemIndexO(self, 2);
  19500   elem->f->pushInt(elem, 2);
  19501   self->f->pushNFreeArray(self, elem);
  19502   self->f->pushS(self, "4");
  19503   self->f->pushS(self, "5");
  19504   r = self->f->binarySearchSmallJson(self, value);
  19505   ck_assert_int_eq(r, -1);
  19506   // index
  19507   trimO(self);
  19508   r = self->f->binarySearchSmallJson(self, value);
  19509   ck_assert_int_eq(r, 2);
  19510   // index in the lower half of the array
  19511   freeO(value);
  19512   value->f->pushInt(value, 1);
  19513   r = self->f->binarySearchSmallJson(self, value);
  19514   ck_assert_int_eq(r, 1);
  19515   // not index (json array)
  19516   delElemIndexO(self, 1);
  19517   trimO(self);
  19518   r = self->f->binarySearchSmallJson(self, value);
  19519   ck_assert_int_eq(r, -1);
  19520   // not index json undefined
  19521   createUndefined(u);
  19522   freeO(value);
  19523   setTopO(value, (baset*)&u);
  19524   r = self->f->binarySearchSmallJson(self, value);
  19525   ck_assert_int_eq(r, -1);
  19526   // not index json bool
  19527   createSmallBool(b);
  19528   freeO(value);
  19529   setTopO(value, (baset*)&b);
  19530   r = self->f->binarySearchSmallJson(self, value);
  19531   ck_assert_int_eq(r, -1);
  19532   // not index json double
  19533   createSmallDouble(d);
  19534   freeO(value);
  19535   setTopO(value, (baset*)&d);
  19536   r = self->f->binarySearchSmallJson(self, value);
  19537   ck_assert_int_eq(r, -1);
  19538   // not index json int
  19539   createSmallInt(i);
  19540   freeO(value);
  19541   setTopO(value, (baset*)&i);
  19542   r = self->f->binarySearchSmallJson(self, value);
  19543   ck_assert_int_eq(r, -1);
  19544   // not index json string
  19545   createSmallString(s);
  19546   freeO(value);
  19547   setTopO(value, (baset*)&s);
  19548   r = self->f->binarySearchSmallJson(self, value);
  19549   ck_assert_int_eq(r, -1);
  19550   // not index json dict
  19551   createSmallDict(D);
  19552   freeO(value);
  19553   setTopO(value, (baset*)&D);
  19554   r = self->f->binarySearchSmallJson(self, value);
  19555   ck_assert_int_eq(r, -1);
  19556   // empty json object
  19557   freeO(value);
  19558   r = self->f->binarySearchSmallJson(self, value);
  19559   ck_assert_int_eq(r, -1);
  19560   // non smallJson object
  19561   terminateO(value);
  19562   value = (smallJsont*) allocSmallInt(2);
  19563   r = self->f->binarySearchSmallJson(self, value);
  19564   ck_assert_int_eq(r, -1);
  19565   // NULL value
  19566   r = self->f->binarySearchSmallJson(self, NULL);
  19567   ck_assert_int_eq(r, -1);
  19568   // empty array
  19569   emptyO(self);
  19570   r = self->f->binarySearchSmallJson(self, value);
  19571   ck_assert_int_eq(r, -1);
  19572   terminateO(self);
  19573   terminateO(value);
  19574 
  19575 }
  19576 
  19577 
  19578 void binarySearchSmallStringSmallJsonT(CuTest *tc UNUSED) {
  19579 
  19580   ssize_t r;
  19581   smallJsont *self   = allocSmallJson();
  19582   smallStringt *value = allocSmallString("4");
  19583 
  19584   // index not trimmed (an element is NULL)
  19585   self->f->pushS(self, "0");
  19586   self->f->pushS(self, "1");
  19587   self->f->pushS(self, "2");
  19588   delElemIndexO(self, 2);
  19589   self->f->pushS(self, "3");
  19590   self->f->pushS(self, "4");
  19591   self->f->pushS(self, "5");
  19592   r = binarySearchSmallStringO(self, value);
  19593   ck_assert_int_eq(r, -1);
  19594   // index
  19595   trimO(self);
  19596   r = binarySearchSmallStringO(self, value);
  19597   ck_assert_int_eq(r, 3);
  19598   // index in the lower half of the array
  19599   setValO(value, "1");
  19600   r = binarySearchSmallStringO(self, value);
  19601   ck_assert_int_eq(r, 1);
  19602   // not index
  19603   setValO(value, "asd");
  19604   r = binarySearchSmallStringO(self, value);
  19605   ck_assert_int_eq(r, -1);
  19606   // non smallString object
  19607   terminateO(value);
  19608   value = (smallStringt*) allocSmallInt(2);
  19609   r = binarySearchSmallStringO(self, value);
  19610   ck_assert_int_eq(r, -1);
  19611   // NULL value
  19612   r = binarySearchSmallStringO(self, NULL);
  19613   ck_assert_int_eq(r, -1);
  19614   // empty array
  19615   emptyO(self);
  19616   r = binarySearchSmallStringO(self, value);
  19617   ck_assert_int_eq(r, -1);
  19618   terminateO(self);
  19619   terminateO(value);
  19620 
  19621 }
  19622 
  19623 
  19624 void binarySearchSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  19625 
  19626   ssize_t r;
  19627   smallJsont *self = allocSmallJson();
  19628   createAllocateSmallContainer(value);
  19629 
  19630   r = self->f->binarySearchSmallContainer(self, value);
  19631   ck_assert_int_eq(r, -1);
  19632   terminateO(self);
  19633   terminateO(value);
  19634 
  19635 }
  19636 
  19637 
  19638 void icHasSmallJsonT(CuTest *tc UNUSED) {
  19639 
  19640   bool r;
  19641   smallJsont *self = allocSmallJson();
  19642   baset *value = (baset*)allocSmallString("a");
  19643 
  19644   // has
  19645   self->f->pushS(self, "A");
  19646   r = icHasO(self, value);
  19647   ck_assert(r);
  19648   // not has
  19649   emptyO(self);
  19650   r = icHasO(self, value);
  19651   ck_assert(!r);
  19652   // NULL value
  19653   r = icHasO(self, NULL);
  19654   ck_assert(!r);
  19655   terminateO(self);
  19656   terminateO(value);
  19657 
  19658 }
  19659 
  19660 
  19661 void icHasSSmallJsonT(CuTest *tc UNUSED) {
  19662 
  19663   bool r;
  19664   smallJsont *self = allocSmallJson();
  19665   const char *value = "ASD";
  19666 
  19667   // has
  19668   self->f->pushS(self, "asd");
  19669   r = icHasSO(self, value);
  19670   ck_assert(r);
  19671   // not has
  19672   emptyO(self);
  19673   r = icHasSO(self, value);
  19674   ck_assert(!r);
  19675   // NULL value
  19676   r = icHasSO(self, NULL);
  19677   ck_assert(!r);
  19678   terminateO(self);
  19679   // json dict
  19680   self = allocSmallJson();
  19681   self->f->setInt(self, "u", 0);
  19682   ck_assert(!icHasSO(self, "U"));
  19683   ck_assert(icHasSO(self, "u"));
  19684   terminateO(self);
  19685 
  19686 }
  19687 
  19688 
  19689 void icHasCharSmallJsonT(CuTest *tc UNUSED) {
  19690 
  19691   bool r;
  19692   smallJsont *self = allocSmallJson();
  19693   char value = 'A';
  19694 
  19695   // has
  19696   self->f->pushS(self, "a");
  19697   r = icHasCharO(self, value);
  19698   ck_assert(r);
  19699   // not has
  19700   emptyO(self);
  19701   r = icHasCharO(self, value);
  19702   ck_assert(!r);
  19703   terminateO(self);
  19704 
  19705 }
  19706 
  19707 
  19708 void icHasDictSmallJsonT(CuTest *tc UNUSED) {
  19709 
  19710   bool r;
  19711   smallJsont *self = allocSmallJson();
  19712   smallDictt *value = allocSmallDict();
  19713   value->f->setInt(value, "A", 1);
  19714 
  19715   // has
  19716   createAllocateSmallDict(d);
  19717   d->f->setInt(d, "a", 1);
  19718   self->f->pushNFreeDict(self, d);
  19719   r = icHasDictO(self, value);
  19720   ck_assert(r);
  19721   // not has
  19722   emptyO(self);
  19723   r = icHasDictO(self, value);
  19724   ck_assert(!r);
  19725   // NULL value
  19726   r = icHasDictO(self, NULL);
  19727   ck_assert(!r);
  19728   terminateO(self);
  19729   terminateO(value);
  19730 
  19731 }
  19732 
  19733 
  19734 void icHasArraySmallJsonT(CuTest *tc UNUSED) {
  19735 
  19736   bool r;
  19737   smallJsont *self = allocSmallJson();
  19738   smallArrayt *value = allocSmallArray();
  19739   value->f->pushS(value, "A");
  19740 
  19741   // has
  19742   createAllocateSmallArray(a);
  19743   a->f->pushS(a, "a");
  19744   self->f->pushNFreeArray(self, a);
  19745   r = icHasArrayO(self, value);
  19746   ck_assert(r);
  19747   // not has
  19748   emptyO(self);
  19749   r = icHasArrayO(self, value);
  19750   ck_assert(!r);
  19751   // NULL value
  19752   r = icHasArrayO(self, NULL);
  19753   ck_assert(!r);
  19754   terminateO(self);
  19755   terminateO(value);
  19756 
  19757 }
  19758 
  19759 
  19760 void icHasArraycSmallJsonT(CuTest *tc UNUSED) {
  19761 
  19762   bool r;
  19763   smallJsont *self = allocSmallJson();
  19764   char **value = listCreateS("A","BB");
  19765 
  19766   // has
  19767   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  19768   r = icHasArraycO(self, value);
  19769   ck_assert(r);
  19770   // not has
  19771   emptyO(self);
  19772   r = icHasArraycO(self, value);
  19773   ck_assert(!r);
  19774   // NULL value
  19775   r = icHasArraycO(self, NULL);
  19776   ck_assert(!r);
  19777   terminateO(self);
  19778   listFreeS(value);
  19779 
  19780 }
  19781 
  19782 
  19783 void icHasSmallStringSmallJsonT(CuTest *tc UNUSED) {
  19784 
  19785   bool r;
  19786   smallJsont *self   = allocSmallJson();
  19787   smallStringt *value = allocSmallString("QWE");
  19788 
  19789   // has
  19790   self->f->pushS(self, "qwe");
  19791   r = self->f->icHasSmallString(self, value);
  19792   ck_assert(r);
  19793   // not has
  19794   emptyO(self);
  19795   r = self->f->icHasSmallString(self, value);
  19796   ck_assert(!r);
  19797   // NULL value
  19798   r = self->f->icHasSmallString(self, NULL);
  19799   ck_assert(!r);
  19800   terminateO(self);
  19801   terminateO(value);
  19802 
  19803 }
  19804 
  19805 
  19806 void icFindSmallJsonT(CuTest *tc UNUSED) {
  19807 
  19808   smallJsont* r;
  19809   smallJsont *self = allocSmallJson();
  19810   setTopSO(self, "");
  19811 
  19812   // icFind string in the middle
  19813   freeO(self);
  19814   setTopSO(self, "sheepy");
  19815   r =  icFindO(self, "EE");
  19816   ck_assert_ptr_ne(r, null);
  19817   ck_assert_str_eq(sjGet(r), "eepy");
  19818   terminateO(r);
  19819   // find non existing string
  19820   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19821   // find NULL
  19822   ck_assert_ptr_eq(icFindO(self, NULL), NULL);
  19823   // empty string
  19824   freeO(self);
  19825   setTopSO(self, "");
  19826   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19827   // NULL string
  19828   freeO(self);
  19829   ck_assert_ptr_eq(icFindO(self, "$"), NULL);
  19830   terminateO(self);
  19831 
  19832 }
  19833 
  19834 
  19835 void icFindCharSmallJsonT(CuTest *tc UNUSED) {
  19836 
  19837   smallJsont* r;
  19838   smallJsont *self = allocSmallJson();
  19839   setTopSO(self, "");
  19840 
  19841   // find string in the middle
  19842   freeO(self);
  19843   setTopSO(self, "sheepy");
  19844   r = icFindCharO(self, 'E');
  19845   ck_assert_ptr_ne(r, null);
  19846   ck_assert_str_eq(sjGet(r), "eepy");
  19847   terminateO(r);
  19848   // find non existing string
  19849   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19850   // find 0
  19851   r = icFindCharO(self, 0);
  19852   ck_assert_ptr_ne(r, null);
  19853   ck_assert_str_eq(sjGet(r), "");
  19854   terminateO(r);
  19855   // empty string
  19856   freeO(self);
  19857   setTopSO(self, "");
  19858   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19859   ck_assert_ptr_eq(icFindCharO(self, 0), NULL);
  19860   // NULL string
  19861   freeO(self);
  19862   ck_assert_ptr_eq(icFindCharO(self, '$'), NULL);
  19863   ck_assert_ptr_eq(icFindCharO(self, 0), NULL);
  19864   terminateO(self);
  19865 
  19866 }
  19867 
  19868 
  19869 void icFindSmallStringSmallJsonT(CuTest *tc UNUSED) {
  19870 
  19871   smallJsont* r;
  19872   smallJsont *self = allocSmallJson();
  19873   setTopSO(self, "");
  19874   smallStringt *needle = allocSmallString("EE");
  19875 
  19876   // find string in the middle
  19877   freeO(self);
  19878   setTopSO(self, "sheepy");
  19879   r = self->f->icFindSmallString(self, needle);
  19880   ck_assert_ptr_ne(r, null);
  19881   ck_assert_str_eq(sjGet(r), "eepy");
  19882   terminateO(r);
  19883   // find non existing string
  19884   setValO(needle, "$");
  19885   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19886   // non smallString object
  19887   terminateO(needle);
  19888   needle = (smallStringt*) allocSmallInt(1);
  19889   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19890   terminateO(needle);
  19891   // find NULL
  19892   ck_assert_ptr_eq(self->f->icFindSmallString(self, NULL), NULL);
  19893   // empty string
  19894   freeO(self);
  19895   setTopSO(self, "");
  19896   needle = allocSmallString("$");
  19897   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19898   // NULL string
  19899   freeO(self);
  19900   ck_assert_ptr_eq(self->f->icFindSmallString(self, needle), NULL);
  19901   terminateO(needle);
  19902   terminateO(self);
  19903 
  19904 }
  19905 
  19906 
  19907 void icFindJsonSmallJsonT(CuTest *tc UNUSED) {
  19908 
  19909   smallJsont* r;
  19910   smallJsont *self = allocSmallJson();
  19911   setTopSO(self, "");
  19912   smallJsont *needle = allocSmallJson();
  19913 
  19914   // find string in the middle
  19915   freeO(self);
  19916   setTopSO(self, "sheepy");
  19917   setTopSO(needle, "EE");
  19918   r = self->f->icFindJson(self, needle);
  19919   ck_assert_ptr_ne(r, null);
  19920   ck_assert_str_eq(sjGet(r), "eepy");
  19921   terminateO(r);
  19922   // find non existing string
  19923   freeO(needle);
  19924   setTopSO(needle, "$");
  19925   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19926   // non json string
  19927   freeO(needle);
  19928   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19929   // non json object
  19930   terminateO(needle);
  19931   needle = (smallJsont*) allocSmallInt(1);
  19932   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19933   terminateO(needle);
  19934   // find NULL
  19935   ck_assert_ptr_eq(self->f->icFindJson(self, NULL), NULL);
  19936   // empty string
  19937   freeO(self);
  19938   setTopSO(self, "");
  19939   needle = allocSmallJson();
  19940   setTopSO(needle, "$");
  19941   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19942   // NULL string
  19943   freeO(self);
  19944   ck_assert_ptr_eq(self->f->icFindJson(self, needle), NULL);
  19945   terminateO(needle);
  19946   terminateO(self);
  19947 
  19948 }
  19949 
  19950 
  19951 void icIndexOfSmallJsonT(CuTest *tc UNUSED) {
  19952 
  19953   ssize_t r;
  19954   smallJsont *self = allocSmallJson();
  19955   baset *value = (baset*)allocSmallString("A");
  19956 
  19957   // index
  19958   self->f->pushS(self, "2");
  19959   self->f->pushS(self, "3");
  19960   delElemIndexO(self, 1);
  19961   self->f->pushS(self, "a");
  19962   r = icIndexOfO(self, value);
  19963   ck_assert_int_eq(r, 2);
  19964   // not index
  19965   smallStringt *v = (smallStringt*) value;
  19966   setValO(v, "3");
  19967   r = icIndexOfO(self, value);
  19968   ck_assert_int_eq(r, -1);
  19969   // NULL value
  19970   r = icIndexOfO(self, NULL);
  19971   ck_assert_int_eq(r, -1);
  19972   terminateO(self);
  19973   terminateO(value);
  19974 
  19975 }
  19976 
  19977 
  19978 void icIndexOfSSmallJsonT(CuTest *tc UNUSED) {
  19979 
  19980   ssize_t r;
  19981   smallJsont *self = allocSmallJson();
  19982   const char *value = "ASD";
  19983 
  19984   // indexOf
  19985   self->f->pushUndefined(self);
  19986   self->f->pushUndefined(self);
  19987   delElemIndexO(self, 1);
  19988   self->f->pushS(self, "asd");
  19989   r = icIndexOfSO(self, value);
  19990   ck_assert_int_eq(r, 2);
  19991   // not indexOf
  19992   delElemIndexO(self, 2);
  19993   r = icIndexOfSO(self, value);
  19994   ck_assert_int_eq(r, -1);
  19995   // NULL value
  19996   r = icIndexOfSO(self, NULL);
  19997   ck_assert_int_eq(r, -1);
  19998   terminateO(self);
  19999   // json string
  20000   self = allocSmallJson();
  20001   // indexOf string in the middle
  20002   setTopSO(self, "sheepy");
  20003   ck_assert_int_eq(icIndexOfSO(self, "EE"), 2);
  20004   // indexOf non existing string
  20005   ck_assert_int_eq(icIndexOfSO(self, "$"), -1);
  20006   terminateO(self);
  20007 
  20008 }
  20009 
  20010 
  20011 void icIndexOfCharSmallJsonT(CuTest *tc UNUSED) {
  20012 
  20013   ssize_t r;
  20014   smallJsont *self = allocSmallJson();
  20015   char value = 'A';
  20016 
  20017   // indexOf
  20018   self->f->pushUndefined(self);
  20019   self->f->pushUndefined(self);
  20020   delElemIndexO(self, 1);
  20021   self->f->pushS(self, "a");
  20022   r = icIndexOfCharO(self, value);
  20023   ck_assert_int_eq(r, 2);
  20024   // not indexOf
  20025   delElemIndexO(self, 2);
  20026   r = icIndexOfCharO(self, value);
  20027   ck_assert_int_eq(r, -1);
  20028   terminateO(self);
  20029 
  20030 }
  20031 
  20032 
  20033 void icIndexOfDictSmallJsonT(CuTest *tc UNUSED) {
  20034 
  20035   ssize_t r;
  20036   smallJsont *self = allocSmallJson();
  20037   smallDictt *value = allocSmallDict();
  20038   value->f->setInt(value, "B", 1);
  20039 
  20040   // indexOf
  20041   createAllocateSmallDict(elem);
  20042   elem->f->setInt(elem, "a", 1);
  20043   self->f->pushDict(self, elem);
  20044   resetO(elem);
  20045   self->f->pushUndefined(self);
  20046   delElemIndexO(self, 1);
  20047   elem->f->setInt(elem, "b", 1);
  20048   self->f->pushNFreeDict(self, elem);
  20049   r = icIndexOfDictO(self, value);
  20050   ck_assert_int_eq(r, 2);
  20051   // not indexOf
  20052   delElemIndexO(self, 2);
  20053   r = icIndexOfDictO(self, value);
  20054   ck_assert_int_eq(r, -1);
  20055   // non smallDict object
  20056   terminateO(value);
  20057   value = (smallDictt*) allocSmallInt(2);
  20058   r = icIndexOfDictO(self, value);
  20059   ck_assert_int_eq(r, -1);
  20060   // NULL value
  20061   r = icIndexOfDictO(self, NULL);
  20062   ck_assert_int_eq(r, -1);
  20063   terminateO(self);
  20064   terminateO(value);
  20065 
  20066 }
  20067 
  20068 
  20069 void icIndexOfArraySmallJsonT(CuTest *tc UNUSED) {
  20070 
  20071   ssize_t r;
  20072   smallJsont *self = allocSmallJson();
  20073   smallArrayt *value = allocSmallArray();
  20074   value->f->pushS(value, "A");
  20075 
  20076   // indexOf
  20077   createAllocateSmallArray(elem);
  20078   elem->f->pushInt(elem, 1);
  20079   self->f->pushArray(self, elem);
  20080   resetO(elem);
  20081   self->f->pushUndefined(self);
  20082   delElemIndexO(self, 1);
  20083   elem->f->pushS(elem, "a");
  20084   self->f->pushNFreeArray(self, elem);
  20085   r = icIndexOfArrayO(self, value);
  20086   ck_assert_int_eq(r, 2);
  20087   // value not found
  20088   terminateO(value);
  20089   value = allocSmallArray();
  20090   r = icIndexOfArrayO(self, value);
  20091   ck_assert_int_eq(r, -1);
  20092   // non smallArray object
  20093   terminateO(value);
  20094   value = (smallArrayt*) allocSmallInt(2);
  20095   r = icIndexOfArrayO(self, value);
  20096   ck_assert_int_eq(r, -1);
  20097   // not indexOf
  20098   emptyO(self);
  20099   r = icIndexOfArrayO(self, value);
  20100   ck_assert_int_eq(r, -1);
  20101   // NULL value
  20102   r = icIndexOfArrayO(self, NULL);
  20103   ck_assert_int_eq(r, -1);
  20104   terminateO(self);
  20105   terminateO(value);
  20106 
  20107 }
  20108 
  20109 
  20110 void icIndexOfArraycSmallJsonT(CuTest *tc UNUSED) {
  20111 
  20112   ssize_t r;
  20113   smallJsont *self = allocSmallJson();
  20114   char **value = listCreateS("A","BB");
  20115 
  20116   // indexOf
  20117   char **elem = listCreateS("!!","@@@");
  20118   self->f->pushNFreeArrayc(self, elem);
  20119   self->f->pushUndefined(self);
  20120   delElemIndexO(self, 1);
  20121   self->f->pushNFreeArrayc(self, listCreateS("a","bb"));
  20122   r = icIndexOfArraycO(self, value);
  20123   ck_assert_int_eq(r, 2);
  20124   // not indexOf
  20125   delElemIndexO(self, 2);
  20126   r = icIndexOfArraycO(self, value);
  20127   ck_assert_int_eq(r, -1);
  20128   // NULL value
  20129   r = icIndexOfArraycO(self, NULL);
  20130   ck_assert_int_eq(r, -1);
  20131   terminateO(self);
  20132   listFreeS(value);
  20133 
  20134 }
  20135 
  20136 
  20137 void icIndexOfSmallStringSmallJsonT(CuTest *tc UNUSED) {
  20138 
  20139   ssize_t r;
  20140   smallJsont *self = allocSmallJson();
  20141   smallStringt *value = allocSmallString("QWE");
  20142 
  20143   // indexOf
  20144   self->f->pushUndefined(self);
  20145   self->f->pushUndefined(self);
  20146   delElemIndexO(self, 1);
  20147   self->f->pushS(self, "qwe");
  20148   r = self->f->icIndexOfSmallString(self, value);
  20149   ck_assert_int_eq(r, 2);
  20150   // not indexOf
  20151   delElemIndexO(self, 2);
  20152   r = self->f->icIndexOfSmallString(self, value);
  20153   ck_assert_int_eq(r, -1);
  20154   // empty string
  20155   freeO(value);
  20156   r = self->f->icIndexOfSmallString(self, value);
  20157   ck_assert_int_eq(r, -1);
  20158   // non smallString object
  20159   terminateO(value);
  20160   value = (smallStringt*) allocSmallInt(2);
  20161   r = self->f->icIndexOfSmallString(self, value);
  20162   ck_assert_int_eq(r, -1);
  20163   // NULL value
  20164   r = self->f->icIndexOfSmallString(self, NULL);
  20165   ck_assert_int_eq(r, -1);
  20166   terminateO(self);
  20167   terminateO(value);
  20168   // json string
  20169   self = allocSmallJson();
  20170   smallStringt *needle = allocSmallString("EE");
  20171   // indexOf string in the middle
  20172   setTopSO(self, "sheepy");
  20173   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), 2);
  20174   // indexOf non existing string
  20175   setValO(needle, "$");
  20176   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20177   // non smallString object
  20178   terminateO(needle);
  20179   needle = (smallStringt*) allocSmallInt(1);
  20180   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20181   terminateO(needle);
  20182   // empty string
  20183   freeO(self);
  20184   setTopSO(self, "");
  20185   needle = allocSmallString("$");
  20186   ck_assert_int_eq(self->f->icIndexOfSmallString(self, needle), -1);
  20187   terminateO(needle);
  20188   terminateO(self);
  20189 
  20190 }
  20191 
  20192 
  20193 void icBinarySearchSmallJsonT(CuTest *tc UNUSED) {
  20194 
  20195   ssize_t r;
  20196   smallJsont *self = allocSmallJson();
  20197   baset *value = (baset*)allocSmallString("E");
  20198 
  20199   // index not trimmed (an element is NULL)
  20200   self->f->pushS(self, "a");
  20201   self->f->pushS(self, "b");
  20202   self->f->pushS(self, "c");
  20203   delElemIndexO(self, 2);
  20204   self->f->pushS(self, "d");
  20205   self->f->pushS(self, "e");
  20206   self->f->pushS(self, "f");
  20207   r = icBinarySearchO(self, value);
  20208   ck_assert_int_eq(r, -1);
  20209   // index
  20210   trimO(self);
  20211   r = icBinarySearchO(self, value);
  20212   ck_assert_int_eq(r, 3);
  20213   smallStringt *v = (smallStringt*) value;
  20214   // index in the lower half of the array
  20215   setValO(v, "B");
  20216   r = icBinarySearchO(self, value);
  20217   ck_assert_int_eq(r, 1);
  20218   // not index
  20219   setValO(v, "asd");
  20220   r = icBinarySearchO(self, value);
  20221   ck_assert_int_eq(r, -1);
  20222   // NULL value
  20223   r = icBinarySearchO(self, NULL);
  20224   ck_assert_int_eq(r, -1);
  20225   // empty array
  20226   emptyO(self);
  20227   r = icBinarySearchO(self, value);
  20228   ck_assert_int_eq(r, -1);
  20229   terminateO(self);
  20230   terminateO(value);
  20231 
  20232 }
  20233 
  20234 
  20235 void icBinarySearchSSmallJsonT(CuTest *tc UNUSED) {
  20236 
  20237   ssize_t r;
  20238   smallJsont *self = allocSmallJson();
  20239   const char *value = "E";
  20240 
  20241   // index not trimmed (an element is NULL)
  20242   self->f->pushS(self, "a");
  20243   self->f->pushS(self, "b");
  20244   self->f->pushS(self, "c");
  20245   delElemIndexO(self, 2);
  20246   self->f->pushS(self, "d");
  20247   self->f->pushS(self, "e");
  20248   self->f->pushS(self, "f");
  20249   r = icBinarySearchSO(self, value);
  20250   ck_assert_int_eq(r, -1);
  20251   // index
  20252   trimO(self);
  20253   r = icBinarySearchSO(self, value);
  20254   ck_assert_int_eq(r, 3);
  20255   // index in the lower half of the array
  20256   value = "B";
  20257   r = icBinarySearchSO(self, value);
  20258   ck_assert_int_eq(r, 1);
  20259   // not index
  20260   value = "asd";
  20261   r = icBinarySearchSO(self, value);
  20262   ck_assert_int_eq(r, -1);
  20263   // NULL value
  20264   r = icBinarySearchSO(self, NULL);
  20265   ck_assert_int_eq(r, -1);
  20266   // empty array
  20267   emptyO(self);
  20268   r = icBinarySearchSO(self, value);
  20269   ck_assert_int_eq(r, -1);
  20270   terminateO(self);
  20271 
  20272 }
  20273 
  20274 
  20275 void icBinarySearchCharSmallJsonT(CuTest *tc UNUSED) {
  20276 
  20277   ssize_t r;
  20278   smallJsont *self = allocSmallJson();
  20279   char value = 'E';
  20280 
  20281   // index not trimmed (an element is NULL)
  20282   self->f->pushS(self, "a");
  20283   self->f->pushS(self, "b");
  20284   self->f->pushS(self, "c");
  20285   delElemIndexO(self, 2);
  20286   self->f->pushS(self, "d");
  20287   self->f->pushS(self, "e");
  20288   self->f->pushS(self, "f");
  20289   r = icBinarySearchCharO(self, value);
  20290   ck_assert_int_eq(r, -1);
  20291   // index
  20292   trimO(self);
  20293   r = icBinarySearchCharO(self, value);
  20294   ck_assert_int_eq(r, 3);
  20295   // index in the lower half of the array
  20296   value = 'B';
  20297   r = icBinarySearchCharO(self, value);
  20298   ck_assert_int_eq(r, 1);
  20299   // not index
  20300   value = '1';
  20301   r = icBinarySearchCharO(self, value);
  20302   ck_assert_int_eq(r, -1);
  20303   // empty array
  20304   emptyO(self);
  20305   r = icBinarySearchCharO(self, value);
  20306   ck_assert_int_eq(r, -1);
  20307   terminateO(self);
  20308 
  20309 }
  20310 
  20311 
  20312 void icBinarySearchDictSmallJsonT(CuTest *tc UNUSED) {
  20313 
  20314   ssize_t r;
  20315   smallJsont *self = allocSmallJson();
  20316   smallDictt *value = allocSmallDict();
  20317   value->f->setInt(value, "B", 2);
  20318 
  20319   // index not trimmed (an element is NULL)
  20320   createAllocateSmallDict(elem);
  20321   elem->f->setInt(elem, "a", 1);
  20322   self->f->pushUndefined(self);
  20323   self->f->pushDict(self, elem);
  20324   resetO(elem);
  20325   self->f->pushUndefined(self);
  20326   delElemIndexO(self, 2);
  20327   elem->f->setInt(elem, "b", 2);
  20328   self->f->pushNFreeDict(self, elem);
  20329   self->f->pushS(self, "4");
  20330   self->f->pushS(self, "5");
  20331   r = icBinarySearchDictO(self, value);
  20332   ck_assert_int_eq(r, -1);
  20333   // index
  20334   trimO(self);
  20335   r = icBinarySearchDictO(self, value);
  20336   ck_assert_int_eq(r, 2);
  20337   // index in the lower half of the array
  20338   freeO(value);
  20339   value->f->setInt(value, "A", 1);
  20340   r = icBinarySearchDictO(self, value);
  20341   ck_assert_int_eq(r, 1);
  20342   // not index
  20343   freeO(value);
  20344   r = icBinarySearchDictO(self, value);
  20345   ck_assert_int_eq(r, -1);
  20346   // non smallDict object
  20347   terminateO(value);
  20348   value = (smallDictt*) allocSmallInt(2);
  20349   r = icBinarySearchDictO(self, value);
  20350   ck_assert_int_eq(r, -1);
  20351   // NULL value
  20352   r = icBinarySearchDictO(self, NULL);
  20353   ck_assert_int_eq(r, -1);
  20354   // empty array
  20355   emptyO(self);
  20356   r = icBinarySearchDictO(self, value);
  20357   ck_assert_int_eq(r, -1);
  20358   terminateO(self);
  20359   terminateO(value);
  20360 
  20361 }
  20362 
  20363 
  20364 void icBinarySearchArraySmallJsonT(CuTest *tc UNUSED) {
  20365 
  20366   ssize_t r;
  20367   smallJsont *self  = allocSmallJson();
  20368   smallArrayt *value = allocSmallArray();
  20369   value->f->pushS(value, "B");
  20370 
  20371   // index not trimmed (an element is NULL)
  20372   createAllocateSmallArray(elem);
  20373   elem->f->pushS(elem, "a");
  20374   self->f->pushUndefined(self);
  20375   self->f->pushArray(self, elem);
  20376   resetO(elem);
  20377   self->f->pushUndefined(self);
  20378   delElemIndexO(self, 2);
  20379   elem->f->pushS(elem, "b");
  20380   self->f->pushNFreeArray(self, elem);
  20381   self->f->pushS(self, "4");
  20382   self->f->pushS(self, "5");
  20383   r = icBinarySearchArrayO(self, value);
  20384   ck_assert_int_eq(r, -1);
  20385   // index
  20386   trimO(self);
  20387   r = icBinarySearchArrayO(self, value);
  20388   ck_assert_int_eq(r, 2);
  20389   // index in the lower half of the array
  20390   freeO(value);
  20391   value->f->pushS(value, "A");
  20392   r = icBinarySearchArrayO(self, value);
  20393   ck_assert_int_eq(r, 1);
  20394   // not index
  20395   freeO(value);
  20396   r = icBinarySearchArrayO(self, value);
  20397   ck_assert_int_eq(r, -1);
  20398   // non smallArray object
  20399   terminateO(value);
  20400   value = (smallArrayt*) allocSmallInt(2);
  20401   r = icBinarySearchArrayO(self, value);
  20402   ck_assert_int_eq(r, -1);
  20403   // NULL value
  20404   r = icBinarySearchArrayO(self, NULL);
  20405   ck_assert_int_eq(r, -1);
  20406   // empty array
  20407   emptyO(self);
  20408   r = icBinarySearchArrayO(self, value);
  20409   ck_assert_int_eq(r, -1);
  20410   terminateO(self);
  20411   terminateO(value);
  20412 
  20413 }
  20414 
  20415 
  20416 void icBinarySearchArraycSmallJsonT(CuTest *tc UNUSED) {
  20417 
  20418   ssize_t r;
  20419   smallJsont *self = allocSmallJson();
  20420   char **value      = listCreateS("B");
  20421 
  20422   // index not trimmed (an element is NULL)
  20423   char **elem = listCreateS("a");
  20424   self->f->pushUndefined(self);
  20425   self->f->pushNFreeArrayc(self, elem);
  20426   self->f->pushUndefined(self);
  20427   delElemIndexO(self, 2);
  20428   elem = listCreateS("b");
  20429   self->f->pushNFreeArrayc(self, elem);
  20430   self->f->pushS(self, "4");
  20431   self->f->pushS(self, "5");
  20432   r = icBinarySearchArraycO(self, value);
  20433   ck_assert_int_eq(r, -1);
  20434   // index
  20435   trimO(self);
  20436   r = icBinarySearchArraycO(self, value);
  20437   ck_assert_int_eq(r, 2);
  20438   // index in the lower half of the array
  20439   free(value[0]);
  20440   value[0] = strdup("A");
  20441   r = icBinarySearchArraycO(self, value);
  20442   ck_assert_int_eq(r, 1);
  20443   // not index
  20444   free(value[0]);
  20445   value[0] = strdup("asd");
  20446   r = icBinarySearchArraycO(self, value);
  20447   ck_assert_int_eq(r, -1);
  20448   // NULL value
  20449   r = icBinarySearchArraycO(self, NULL);
  20450   ck_assert_int_eq(r, -1);
  20451   // empty array
  20452   emptyO(self);
  20453   r = icBinarySearchArraycO(self, value);
  20454   ck_assert_int_eq(r, -1);
  20455   terminateO(self);
  20456   listFreeS(value);
  20457 
  20458 }
  20459 
  20460 
  20461 void icBinarySearchSmallStringSmallJsonT(CuTest *tc UNUSED) {
  20462 
  20463   ssize_t r;
  20464   smallJsont *self   = allocSmallJson();
  20465   smallStringt *value = allocSmallString("E");
  20466 
  20467   // index not trimmed (an element is NULL)
  20468   self->f->pushS(self, "a");
  20469   self->f->pushS(self, "b");
  20470   self->f->pushS(self, "c");
  20471   delElemIndexO(self, 2);
  20472   self->f->pushS(self, "d");
  20473   self->f->pushS(self, "e");
  20474   self->f->pushS(self, "f");
  20475   r = icBinarySearchSmallStringO(self, value);
  20476   ck_assert_int_eq(r, -1);
  20477   // index
  20478   trimO(self);
  20479   r = icBinarySearchSmallStringO(self, value);
  20480   ck_assert_int_eq(r, 3);
  20481   // index in the lower half of the array
  20482   setValO(value, "B");
  20483   r = icBinarySearchSmallStringO(self, value);
  20484   ck_assert_int_eq(r, 1);
  20485   // not index
  20486   setValO(value, "asd");
  20487   r = icBinarySearchSmallStringO(self, value);
  20488   ck_assert_int_eq(r, -1);
  20489   // empty value
  20490   freeO(value);
  20491   r = icBinarySearchSmallStringO(self, value);
  20492   ck_assert_int_eq(r, -1);
  20493   // non smallString object
  20494   terminateO(value);
  20495   value = (smallStringt*) allocSmallInt(2);
  20496   r = icBinarySearchSmallStringO(self, value);
  20497   ck_assert_int_eq(r, -1);
  20498   // NULL value
  20499   r = icBinarySearchSmallStringO(self, NULL);
  20500   ck_assert_int_eq(r, -1);
  20501   // empty array
  20502   emptyO(self);
  20503   r = icBinarySearchSmallStringO(self, value);
  20504   ck_assert_int_eq(r, -1);
  20505   terminateO(self);
  20506   terminateO(value);
  20507 
  20508 }
  20509 
  20510 
  20511 void keyBySmallJsonT(CuTest *tc UNUSED) {
  20512 
  20513   char* r;
  20514   smallJsont *self = allocSmallJson();
  20515   baset *value;
  20516 
  20517   smallJsont *r2 = self->f->setInt(self, "1", 1);
  20518   ck_assert_ptr_ne(r2, null);
  20519   value = (baset*) allocSmallInt(1);
  20520   r = keyByO(self, value);
  20521   ck_assert_str_eq(r, "1");
  20522   // non existing object
  20523   smallIntt *i = allocSmallInt(2);
  20524   r = keyByO(self, (baset*)i);
  20525   terminateO(i);
  20526   ck_assert_ptr_eq(r, null);
  20527   // null value
  20528   r = keyByO(self, null);
  20529   ck_assert_ptr_eq(r, null);
  20530   // empty self
  20531   freeO(self);
  20532   r = keyByO(self, value);
  20533   ck_assert_ptr_eq(r, null);
  20534   terminateO(self);
  20535   terminateO(value);
  20536 
  20537 }
  20538 
  20539 
  20540 void keyByUndefinedSmallJsonT(CuTest *tc UNUSED) {
  20541 
  20542   char* r;
  20543   smallJsont *self = allocSmallJson();
  20544   undefinedt *value;
  20545 
  20546   smallJsont *r2 = self->f->setUndefined(self, "1");
  20547   ck_assert_ptr_ne(r2, null);
  20548   value = allocUndefined();
  20549   r = keyByUndefinedO(self, value);
  20550   ck_assert_str_eq(r, "1");
  20551   // non existing object
  20552   r2 = self->f->setInt(self, "1", 1);
  20553   ck_assert_ptr_ne(r2, null);
  20554   r = keyByUndefinedO(self, value);
  20555   ck_assert_ptr_eq(r, null);
  20556   // non undefined object
  20557   smallIntt *i = allocSmallInt(2);
  20558   r = keyByUndefinedO(self, (undefinedt*)i);
  20559   terminateO(i);
  20560   ck_assert_ptr_eq(r, null);
  20561   // null value
  20562   r = keyByUndefinedO(self, null);
  20563   ck_assert_ptr_eq(r, null);
  20564   // empty self
  20565   freeO(self);
  20566   r = keyByUndefinedO(self, value);
  20567   ck_assert_ptr_eq(r, null);
  20568   terminateO(self);
  20569   terminateO(value);
  20570 
  20571 }
  20572 
  20573 
  20574 void keyByBoolSmallJsonT(CuTest *tc UNUSED) {
  20575 
  20576   char* r;
  20577   smallJsont *self = allocSmallJson();
  20578 
  20579   smallJsont *r2 = self->f->setBool(self, "1", true);
  20580   ck_assert_ptr_ne(r2, null);
  20581   r = keyByBoolO(self, true);
  20582   ck_assert_str_eq(r, "1");
  20583   // non existing object
  20584   r2 = self->f->setInt(self, "1", 1);
  20585   ck_assert_ptr_ne(r2, null);
  20586   r = keyByBoolO(self, true);
  20587   ck_assert_ptr_eq(r, null);
  20588   // empty self
  20589   freeO(self);
  20590   r = keyByBoolO(self, true);
  20591   ck_assert_ptr_eq(r, null);
  20592   setTypeDictO(self);
  20593   r = keyByBoolO(self, true);
  20594   ck_assert_ptr_eq(r, null);
  20595   terminateO(self);
  20596 
  20597 }
  20598 
  20599 
  20600 void keyByDoubleSmallJsonT(CuTest *tc UNUSED) {
  20601 
  20602   char* r;
  20603   smallJsont *self = allocSmallJson();
  20604 
  20605   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  20606   ck_assert_ptr_ne(r2, null);
  20607   r = keyByDoubleO(self, 2.2);
  20608   ck_assert_str_eq(r, "1");
  20609   // non existing object
  20610   r2 = self->f->setInt(self, "1", 1);
  20611   ck_assert_ptr_ne(r2, null);
  20612   r = keyByDoubleO(self, 2.2);
  20613   ck_assert_ptr_eq(r, null);
  20614   // empty self
  20615   freeO(self);
  20616   r = keyByDoubleO(self, 2.2);
  20617   ck_assert_ptr_eq(r, null);
  20618   setTypeDictO(self);
  20619   r = keyByDoubleO(self, 2.2);
  20620   ck_assert_ptr_eq(r, null);
  20621   terminateO(self);
  20622 
  20623 }
  20624 
  20625 
  20626 void keyByIntSmallJsonT(CuTest *tc UNUSED) {
  20627 
  20628   char* r;
  20629   smallJsont *self = allocSmallJson();
  20630 
  20631   smallJsont *r2 = self->f->setInt(self, "1", 2);
  20632   ck_assert_ptr_ne(r2, null);
  20633   r = keyByIntO(self, 2);
  20634   ck_assert_str_eq(r, "1");
  20635   // non existing object
  20636   r2 = self->f->setInt(self, "1", 1);
  20637   ck_assert_ptr_ne(r2, null);
  20638   r = keyByIntO(self, 2);
  20639   ck_assert_ptr_eq(r, null);
  20640   // empty self
  20641   freeO(self);
  20642   r = keyByIntO(self, 2);
  20643   ck_assert_ptr_eq(r, null);
  20644   setTypeDictO(self);
  20645   r = keyByIntO(self, 0);
  20646   ck_assert_ptr_eq(r, null);
  20647   terminateO(self);
  20648 
  20649 }
  20650 
  20651 
  20652 void keyBySSmallJsonT(CuTest *tc UNUSED) {
  20653 
  20654   char* r;
  20655   smallJsont *self = allocSmallJson();
  20656 
  20657   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  20658   ck_assert_ptr_ne(r2, null);
  20659   r = keyBySO(self, "qwe");
  20660   ck_assert_str_eq(r, "1");
  20661   // non existing object
  20662   r2 = self->f->setInt(self, "1", 1);
  20663   ck_assert_ptr_ne(r2, null);
  20664   r = keyBySO(self, "qwe");
  20665   ck_assert_ptr_eq(r, null);
  20666   // null value
  20667   r = keyBySO(self, null);
  20668   ck_assert_ptr_eq(r, null);
  20669   // empty self
  20670   freeO(self);
  20671   r = keyBySO(self, "qwe");
  20672   ck_assert_ptr_eq(r, null);
  20673   setTypeDictO(self);
  20674   r = keyBySO(self, "");
  20675   ck_assert_ptr_eq(r, null);
  20676   terminateO(self);
  20677 
  20678 }
  20679 
  20680 
  20681 void keyByCharSmallJsonT(CuTest *tc UNUSED) {
  20682 
  20683   char* r;
  20684   smallJsont *self = allocSmallJson();
  20685 
  20686   smallJsont *r2 = self->f->setS(self, "1", "q");
  20687   ck_assert_ptr_ne(r2, null);
  20688   r = keyByCharO(self, 'q');
  20689   ck_assert_str_eq(r, "1");
  20690   // non existing object
  20691   r2 = self->f->setInt(self, "1", 1);
  20692   ck_assert_ptr_ne(r2, null);
  20693   r = keyByCharO(self, 'q');
  20694   ck_assert_ptr_eq(r, null);
  20695   // empty self
  20696   freeO(self);
  20697   r = keyByCharO(self, 'q');
  20698   ck_assert_ptr_eq(r, null);
  20699   setTypeDictO(self);
  20700   r = keyByCharO(self, 'a');
  20701   ck_assert_ptr_eq(r, null);
  20702   terminateO(self);
  20703 
  20704 }
  20705 
  20706 
  20707 void keyByDictSmallJsonT(CuTest *tc UNUSED) {
  20708 
  20709   char* r;
  20710   smallJsont *self = allocSmallJson();
  20711   smallDictt *dict = allocSmallDict();
  20712 
  20713   createAllocateSmallDict(d);
  20714   d->f->setS(d, "another", "dict");
  20715   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  20716   ck_assert_ptr_ne(r2, null);
  20717   r2 = self->f->setNFreeDict(self, "1", dict);
  20718   ck_assert_ptr_ne(r2, null);
  20719   dict = allocSmallDict();
  20720   r = keyByDictO(self, dict);
  20721   ck_assert_str_eq(r, "1");
  20722   // non existing object
  20723   r2 = self->f->setInt(self, "1", 1);
  20724   ck_assert_ptr_ne(r2, null);
  20725   r = keyByDictO(self, dict);
  20726   ck_assert_ptr_eq(r, null);
  20727   // non smallDict object
  20728   smallIntt *i = allocSmallInt(2);
  20729   r = keyByDictO(self, (smallDictt*)i);
  20730   terminateO(i);
  20731   ck_assert_ptr_eq(r, null);
  20732   // null value
  20733   r = keyByDictO(self, null);
  20734   ck_assert_ptr_eq(r, null);
  20735   // empty self
  20736   freeO(self);
  20737   r = keyByDictO(self, dict);
  20738   ck_assert_ptr_eq(r, null);
  20739   setTypeDictO(self);
  20740   r = keyByDictO(self, dict);
  20741   ck_assert_ptr_eq(r, null);
  20742   terminateO(self);
  20743   terminateO(dict);
  20744 
  20745 }
  20746 
  20747 
  20748 void keyByArraySmallJsonT(CuTest *tc UNUSED) {
  20749 
  20750   char* r;
  20751   smallJsont *self   = allocSmallJson();
  20752   smallArrayt *array = allocSmallArray();
  20753 
  20754   createAllocateSmallArray(d);
  20755   d->f->pushS(d, "another array");
  20756   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  20757   ck_assert_ptr_ne(r2, null);
  20758   r2 = self->f->setNFreeArray(self, "1", array);
  20759   ck_assert_ptr_ne(r2, null);
  20760   array = allocSmallArray();
  20761   r = keyByArrayO(self, array);
  20762   ck_assert_str_eq(r, "1");
  20763   // non existing object
  20764   r2 = self->f->setInt(self, "1", 1);
  20765   ck_assert_ptr_ne(r2, null);
  20766   r = keyByArrayO(self, array);
  20767   ck_assert_ptr_eq(r, null);
  20768   // non smallArray object
  20769   smallIntt *i = allocSmallInt(2);
  20770   r = keyByArrayO(self, (smallArrayt*)i);
  20771   terminateO(i);
  20772   ck_assert_ptr_eq(r, null);
  20773   // null value
  20774   r = keyByArrayO(self, null);
  20775   ck_assert_ptr_eq(r, null);
  20776   // empty self
  20777   freeO(self);
  20778   r = keyByArrayO(self, array);
  20779   ck_assert_ptr_eq(r, null);
  20780   setTypeDictO(self);
  20781   r = keyByArrayO(self, array);
  20782   ck_assert_ptr_eq(r, null);
  20783   terminateO(self);
  20784   terminateO(array);
  20785 
  20786 }
  20787 
  20788 
  20789 void keyByArraycSmallJsonT(CuTest *tc UNUSED) {
  20790 
  20791   char* r;
  20792   smallJsont *self = allocSmallJson();
  20793   char **array     = listCreateS("a","b");
  20794 
  20795   char **d = listCreateS("asd", "zxcv");
  20796   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  20797   ck_assert_ptr_ne(r2, null);
  20798   r2 = self->f->setArrayc(self, "1", array);
  20799   ck_assert_ptr_ne(r2, null);
  20800   r = keyByArraycO(self, array);
  20801   ck_assert_ptr_ne(r, NULL);
  20802   ck_assert_str_eq(r, "1");
  20803   // non existing object
  20804   r2 = self->f->setInt(self, "1", 1);
  20805   ck_assert_ptr_ne(r2, null);
  20806   r = keyByArraycO(self, array);
  20807   ck_assert_ptr_eq(r, null);
  20808   // null value
  20809   r = keyByArraycO(self, null);
  20810   ck_assert_ptr_eq(r, null);
  20811   // empty self
  20812   freeO(self);
  20813   r = keyByArraycO(self, array);
  20814   ck_assert_ptr_eq(r, null);
  20815   setTypeDictO(self);
  20816   r = keyByArraycO(self, array);
  20817   ck_assert_ptr_eq(r, null);
  20818   terminateO(self);
  20819   listFreeS(array);
  20820 
  20821 }
  20822 
  20823 
  20824 void keyBySmallBoolSmallJsonT(CuTest *tc UNUSED) {
  20825 
  20826   char* r;
  20827   smallJsont *self  = allocSmallJson();
  20828   smallBoolt *value = allocSmallBool(true);
  20829 
  20830   createAllocateSmallBool(d);
  20831   setValO(d, false);
  20832   smallJsont *r2 = self->f->setNFreeSmallBool(self, "d", d);
  20833   ck_assert_ptr_ne(r2, null);
  20834   r2 = self->f->setNFreeSmallBool(self, "1", value);
  20835   ck_assert_ptr_ne(r2, null);
  20836   value = allocSmallBool(true);
  20837   r = keyBySmallBoolO(self, value);
  20838   ck_assert_str_eq(r, "1");
  20839   // non existing object
  20840   r2 = self->f->setInt(self, "1", 1);
  20841   ck_assert_ptr_ne(r2, null);
  20842   r = keyBySmallBoolO(self, value);
  20843   ck_assert_ptr_eq(r, null);
  20844   // non smallBool object
  20845   smallIntt *i = allocSmallInt(2);
  20846   r = keyBySmallBoolO(self, (smallBoolt*)i);
  20847   terminateO(i);
  20848   ck_assert_ptr_eq(r, null);
  20849   // null value
  20850   r = keyBySmallBoolO(self, null);
  20851   ck_assert_ptr_eq(r, null);
  20852   // empty self
  20853   freeO(self);
  20854   r = keyBySmallBoolO(self, value);
  20855   ck_assert_ptr_eq(r, null);
  20856   setTypeDictO(self);
  20857   r = keyBySmallBoolO(self, value);
  20858   ck_assert_ptr_eq(r, null);
  20859   terminateO(self);
  20860   terminateO(value);
  20861 
  20862 }
  20863 
  20864 
  20865 void keyBySmallBytesSmallJsonT(CuTest *tc UNUSED) {
  20866 
  20867   char* r;
  20868   smallJsont *self   = allocSmallJson();
  20869   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  20870 
  20871   smallBytest *d = allocSmallBytes("asd", sizeof("asd"));
  20872   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "d", d);
  20873   ck_assert_ptr_ne(r2, null);
  20874   r2 = self->f->setNFreeSmallBytes(self, "1", value);
  20875   ck_assert_ptr_ne(r2, null);
  20876   value = allocSmallBytes("qwe", sizeof("qwe"));
  20877   r = keyBySmallBytesO(self, value);
  20878   ck_assert_str_eq(r, "1");
  20879   // non existing object
  20880   r2 = self->f->setInt(self, "1", 1);
  20881   ck_assert_ptr_ne(r2, null);
  20882   r = keyBySmallBytesO(self, value);
  20883   ck_assert_ptr_eq(r, null);
  20884   // empty value
  20885   freeO(value);
  20886   r = keyBySmallBytesO(self, value);
  20887   ck_assert_ptr_eq(r, null);
  20888   // non smallBytes object
  20889   smallIntt *i = allocSmallInt(2);
  20890   r = keyBySmallBytesO(self, (smallBytest*)i);
  20891   terminateO(i);
  20892   ck_assert_ptr_eq(r, null);
  20893   // null value
  20894   r = keyBySmallBytesO(self, null);
  20895   ck_assert_ptr_eq(r, null);
  20896   // empty self
  20897   freeO(self);
  20898   r = keyBySmallBytesO(self, value);
  20899   ck_assert_ptr_eq(r, null);
  20900   setTypeDictO(self);
  20901   r = keyBySmallBytesO(self, value);
  20902   ck_assert_ptr_eq(r, null);
  20903   terminateO(self);
  20904   terminateO(value);
  20905 
  20906 }
  20907 
  20908 
  20909 void keyBySmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  20910 
  20911   char* r;
  20912   smallJsont *self    = allocSmallJson();
  20913   smallDoublet *value = allocSmallDouble(2.2);
  20914 
  20915   createAllocateSmallDouble(d);
  20916   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "d", d);
  20917   ck_assert_ptr_ne(r2, null);
  20918   r2 = self->f->setNFreeSmallDouble(self, "1", value);
  20919   ck_assert_ptr_ne(r2, null);
  20920   value = allocSmallDouble(2.2);
  20921   r = keyBySmallDoubleO(self, value);
  20922   ck_assert_str_eq(r, "1");
  20923   // non existing object
  20924   r2 = self->f->setInt(self, "1", 1);
  20925   ck_assert_ptr_ne(r2, null);
  20926   r = keyBySmallDoubleO(self, value);
  20927   ck_assert_ptr_eq(r, null);
  20928   // non smallDouble object
  20929   smallIntt *i = allocSmallInt(2);
  20930   r = keyBySmallDoubleO(self, (smallDoublet*)i);
  20931   terminateO(i);
  20932   ck_assert_ptr_eq(r, null);
  20933   // null value
  20934   r = keyBySmallDoubleO(self, null);
  20935   ck_assert_ptr_eq(r, null);
  20936   // empty self
  20937   freeO(self);
  20938   r = keyBySmallDoubleO(self, value);
  20939   ck_assert_ptr_eq(r, null);
  20940   setTypeDictO(self);
  20941   r = keyBySmallDoubleO(self, value);
  20942   ck_assert_ptr_eq(r, null);
  20943   terminateO(self);
  20944   terminateO(value);
  20945 
  20946 }
  20947 
  20948 
  20949 void keyBySmallIntSmallJsonT(CuTest *tc UNUSED) {
  20950 
  20951   char* r;
  20952   smallJsont *self = allocSmallJson();
  20953   smallIntt *value = allocSmallInt(2);
  20954 
  20955   createAllocateSmallInt(d);
  20956   smallJsont *r2 = self->f->setNFreeSmallInt(self, "d", d);
  20957   ck_assert_ptr_ne(r2, null);
  20958   r2 = self->f->setNFreeSmallInt(self, "1", value);
  20959   ck_assert_ptr_ne(r2, null);
  20960   value = allocSmallInt(2);
  20961   r = keyBySmallIntO(self, value);
  20962   ck_assert_str_eq(r, "1");
  20963   // non existing object
  20964   r2 = self->f->setInt(self, "1", 1);
  20965   ck_assert_ptr_ne(r2, null);
  20966   r = keyBySmallIntO(self, value);
  20967   ck_assert_ptr_eq(r, null);
  20968   // non smallInt object
  20969   smallBoolt *i = allocSmallBool(false);
  20970   r = keyBySmallIntO(self, (smallIntt*)i);
  20971   terminateO(i);
  20972   ck_assert_ptr_eq(r, null);
  20973   // null value
  20974   r = keyBySmallIntO(self, null);
  20975   ck_assert_ptr_eq(r, null);
  20976   // empty self
  20977   freeO(self);
  20978   r = keyBySmallIntO(self, value);
  20979   ck_assert_ptr_eq(r, null);
  20980   setTypeDictO(self);
  20981   r = keyBySmallIntO(self, value);
  20982   ck_assert_ptr_eq(r, null);
  20983   terminateO(self);
  20984   terminateO(value);
  20985 
  20986 }
  20987 
  20988 
  20989 void keyBySmallJsonSmallJsonT(CuTest *tc UNUSED) {
  20990 
  20991   char* r;
  20992   smallJsont *self  = allocSmallJson();
  20993   smallJsont *value = allocSmallJson();
  20994 
  20995   // undefined
  20996   createUndefined(u);
  20997   setTopO(value, (baset*)&u);
  20998   self->f->setUndefined(self, "1");
  20999   r = self->f->keyBySmallJson(self, value);
  21000   ck_assert_str_eq(r, "1");
  21001   freeO(value);
  21002   // bool
  21003   setTopBoolO(value, true);
  21004   self->f->setBool(self, "b", true);
  21005   r = self->f->keyBySmallJson(self, value);
  21006   ck_assert_str_eq(r, "b");
  21007   freeO(value);
  21008   // double
  21009   setTopDoubleO(value, 2.2);
  21010   self->f->setDouble(self, "db", 2.2);
  21011   r = self->f->keyBySmallJson(self, value);
  21012   ck_assert_str_eq(r, "db");
  21013   freeO(value);
  21014   // int
  21015   setTopIntO(value, 2);
  21016   self->f->setInt(self, "i", 2);
  21017   r = self->f->keyBySmallJson(self, value);
  21018   ck_assert_str_eq(r, "i");
  21019   freeO(value);
  21020   // string
  21021   setTopSO(value, "qwe");
  21022   self->f->setS(self, "s", "qwe");
  21023   r = self->f->keyBySmallJson(self, value);
  21024   ck_assert_str_eq(r, "s");
  21025   freeO(value);
  21026   // dict
  21027   smallDictt *D = allocSmallDict();
  21028   setTopNFreeDictO(value, D);
  21029   self->f->setNFreeDict(self, "d", allocSmallDict());
  21030   r = self->f->keyBySmallJson(self, value);
  21031   ck_assert_str_eq(r, "d");
  21032   freeO(value);
  21033   // array
  21034   smallArrayt *a = allocSmallArray();
  21035   setTopNFreeArrayO(value, a);
  21036   self->f->setNFreeArray(self, "a", allocSmallArray());
  21037   r = self->f->keyBySmallJson(self, value);
  21038   ck_assert_str_eq(r, "a");
  21039   freeO(value);
  21040   // empty value
  21041   r = self->f->keyBySmallJson(self, value);
  21042   ck_assert_ptr_eq(r, null);
  21043   // non smallJson object
  21044   smallIntt *i = allocSmallInt(2);
  21045   r = self->f->keyBySmallJson(self, (smallJsont*)i);
  21046   terminateO(i);
  21047   ck_assert_ptr_eq(r, null);
  21048   // null value
  21049   r = self->f->keyBySmallJson(self, null);
  21050   ck_assert_ptr_eq(r, null);
  21051   // empty self
  21052   freeO(self);
  21053   r = self->f->keyBySmallJson(self, value);
  21054   ck_assert_ptr_eq(r, null);
  21055   setTypeDictO(self);
  21056   r = self->f->keyBySmallJson(self, value);
  21057   ck_assert_ptr_eq(r, null);
  21058   terminateO(self);
  21059   terminateO(value);
  21060 
  21061 }
  21062 
  21063 
  21064 void keyBySmallStringSmallJsonT(CuTest *tc UNUSED) {
  21065 
  21066   char* r;
  21067   smallJsont *self    = allocSmallJson();
  21068   smallStringt *value = allocSmallString("qwe");
  21069 
  21070   createAllocateSmallString(d);
  21071   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21072   ck_assert_ptr_ne(r2, null);
  21073   r2 = self->f->setNFreeSmallString(self, "1", value);
  21074   ck_assert_ptr_ne(r2, null);
  21075   value = allocSmallString("qwe");
  21076   r = keyBySmallStringO(self, value);
  21077   ck_assert_str_eq(r, "1");
  21078   // non existing object
  21079   r2 = self->f->setInt(self, "1", 1);
  21080   ck_assert_ptr_ne(r2, null);
  21081   r = keyBySmallStringO(self, value);
  21082   ck_assert_ptr_eq(r, null);
  21083   // empty value
  21084   freeO(value);
  21085   r = keyBySmallStringO(self, value);
  21086   ck_assert_ptr_eq(r, null);
  21087   // non smallString object
  21088   smallIntt *i = allocSmallInt(2);
  21089   r = keyBySmallStringO(self, (smallStringt*)i);
  21090   terminateO(i);
  21091   ck_assert_ptr_eq(r, null);
  21092   // null value
  21093   r = keyBySmallStringO(self, null);
  21094   ck_assert_ptr_eq(r, null);
  21095   // empty self
  21096   freeO(self);
  21097   r = keyBySmallStringO(self, value);
  21098   ck_assert_ptr_eq(r, null);
  21099   setTypeDictO(self);
  21100   r = keyBySmallStringO(self, value);
  21101   ck_assert_ptr_eq(r, null);
  21102   terminateO(self);
  21103   terminateO(value);
  21104 
  21105 }
  21106 
  21107 
  21108 void keyBySmallContainerSmallJsonT(CuTest *tc UNUSED) {
  21109 
  21110   char* r;
  21111   smallJsont *self       = allocSmallJson();
  21112   smallContainert *value = allocSmallContainer(null);
  21113 
  21114   createAllocateSmallString(d);
  21115   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21116   ck_assert_ptr_ne(r2, null);
  21117   r = keyBySmallContainerO(self, value);
  21118   ck_assert_ptr_eq(r, null);
  21119   // non smallContainer object
  21120   smallIntt *i = allocSmallInt(2);
  21121   r = keyBySmallContainerO(self, (smallContainert*)i);
  21122   terminateO(i);
  21123   ck_assert_ptr_eq(r, null);
  21124   // null value
  21125   r = keyBySmallContainerO(self, null);
  21126   ck_assert_ptr_eq(r, null);
  21127   // empty self
  21128   freeO(self);
  21129   r = keyBySmallContainerO(self, value);
  21130   ck_assert_ptr_eq(r, null);
  21131   setTypeDictO(self);
  21132   r = keyBySmallContainerO(self, value);
  21133   ck_assert_ptr_eq(r, null);
  21134   terminateO(self);
  21135   terminateO(value);
  21136 
  21137 }
  21138 
  21139 
  21140 void icKeyBySmallJsonT(CuTest *tc UNUSED) {
  21141 
  21142   char* r;
  21143   smallJsont *self = allocSmallJson();
  21144   baset *value;
  21145 
  21146   smallJsont *r2 = self->f->setS(self, "1", "QQ");
  21147   ck_assert_ptr_ne(r2, null);
  21148   value = (baset*) allocSmallString("qq");
  21149   r = icKeyByO(self, value);
  21150   ck_assert_str_eq(r, "1");
  21151   // non existing object
  21152   smallIntt *i = allocSmallInt(2);
  21153   r = icKeyByO(self, (baset*)i);
  21154   terminateO(i);
  21155   ck_assert_ptr_eq(r, null);
  21156   // null value
  21157   r = icKeyByO(self, null);
  21158   ck_assert_ptr_eq(r, null);
  21159   // empty self
  21160   freeO(self);
  21161   r = icKeyByO(self, value);
  21162   ck_assert_ptr_eq(r, null);
  21163   terminateO(self);
  21164   terminateO(value);
  21165 
  21166 }
  21167 
  21168 
  21169 void icKeyBySSmallJsonT(CuTest *tc UNUSED) {
  21170 
  21171   char* r;
  21172   smallJsont *self = allocSmallJson();
  21173 
  21174   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  21175   ck_assert_ptr_ne(r2, null);
  21176   r = icKeyBySO(self, "QWE");
  21177   ck_assert_str_eq(r, "1");
  21178   // non existing object
  21179   r2 = self->f->setInt(self, "1", 1);
  21180   ck_assert_ptr_ne(r2, null);
  21181   r = icKeyBySO(self, "qwe");
  21182   ck_assert_ptr_eq(r, null);
  21183   // null value
  21184   r = icKeyBySO(self, null);
  21185   ck_assert_ptr_eq(r, null);
  21186   // empty self
  21187   freeO(self);
  21188   r = icKeyBySO(self, "qwe");
  21189   ck_assert_ptr_eq(r, null);
  21190   terminateO(self);
  21191 
  21192 }
  21193 
  21194 
  21195 void icKeyByCharSmallJsonT(CuTest *tc UNUSED) {
  21196 
  21197   char* r;
  21198   smallJsont *self = allocSmallJson();
  21199 
  21200   smallJsont *r2 = self->f->setS(self, "1", "q");
  21201   ck_assert_ptr_ne(r2, null);
  21202   r = icKeyByCharO(self, 'Q');
  21203   ck_assert_str_eq(r, "1");
  21204   // non existing object
  21205   r2 = self->f->setInt(self, "1", 1);
  21206   ck_assert_ptr_ne(r2, null);
  21207   r = icKeyByCharO(self, 'q');
  21208   ck_assert_ptr_eq(r, null);
  21209   // empty self
  21210   freeO(self);
  21211   r = icKeyByCharO(self, 'q');
  21212   ck_assert_ptr_eq(r, null);
  21213   terminateO(self);
  21214 
  21215 }
  21216 
  21217 
  21218 void icKeyByDictSmallJsonT(CuTest *tc UNUSED) {
  21219 
  21220   char* r;
  21221   smallJsont *self = allocSmallJson();
  21222   smallDictt *dict = allocSmallDict();
  21223 
  21224   createAllocateSmallDict(d);
  21225   d->f->setS(d, "another", "dict");
  21226   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  21227   ck_assert_ptr_ne(r2, null);
  21228   dict->f->setS(dict, "asd", "asd");
  21229   r2 = self->f->setNFreeDict(self, "1", dict);
  21230   ck_assert_ptr_ne(r2, null);
  21231   dict = allocSmallDict();
  21232   dict->f->setS(dict, "ASD", "asd");
  21233   r = icKeyByDictO(self, dict);
  21234   ck_assert_str_eq(r, "1");
  21235   // non existing object
  21236   r2 = self->f->setInt(self, "1", 1);
  21237   ck_assert_ptr_ne(r2, null);
  21238   r = icKeyByDictO(self, dict);
  21239   ck_assert_ptr_eq(r, null);
  21240   // non smallDict object
  21241   smallIntt *i = allocSmallInt(2);
  21242   r = icKeyByDictO(self, (smallDictt*)i);
  21243   terminateO(i);
  21244   ck_assert_ptr_eq(r, null);
  21245   // null value
  21246   r = icKeyByDictO(self, null);
  21247   ck_assert_ptr_eq(r, null);
  21248   // empty self
  21249   freeO(self);
  21250   r = icKeyByDictO(self, dict);
  21251   ck_assert_ptr_eq(r, null);
  21252   terminateO(self);
  21253   terminateO(dict);
  21254 
  21255 }
  21256 
  21257 
  21258 void icKeyByArraySmallJsonT(CuTest *tc UNUSED) {
  21259 
  21260   char* r;
  21261   smallJsont *self   = allocSmallJson();
  21262   smallArrayt *array = allocSmallArray();
  21263 
  21264   createAllocateSmallArray(d);
  21265   d->f->pushS(d, "another array");
  21266   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  21267   ck_assert_ptr_ne(r2, null);
  21268   array->f->pushS(array, "the array");
  21269   r2 = self->f->setNFreeArray(self, "1", array);
  21270   ck_assert_ptr_ne(r2, null);
  21271   array = allocSmallArray();
  21272   array->f->pushS(array, "The array");
  21273   r = icKeyByArrayO(self, array);
  21274   ck_assert_str_eq(r, "1");
  21275   // non existing object
  21276   r2 = self->f->setInt(self, "1", 1);
  21277   ck_assert_ptr_ne(r2, null);
  21278   r = icKeyByArrayO(self, array);
  21279   ck_assert_ptr_eq(r, null);
  21280   // non smallArray object
  21281   smallIntt *i = allocSmallInt(2);
  21282   r = icKeyByArrayO(self, (smallArrayt*)i);
  21283   terminateO(i);
  21284   ck_assert_ptr_eq(r, null);
  21285   // null value
  21286   r = icKeyByArrayO(self, null);
  21287   ck_assert_ptr_eq(r, null);
  21288   // empty self
  21289   freeO(self);
  21290   r = icKeyByArrayO(self, array);
  21291   ck_assert_ptr_eq(r, null);
  21292   terminateO(self);
  21293   terminateO(array);
  21294 
  21295 }
  21296 
  21297 
  21298 void icKeyByArraycSmallJsonT(CuTest *tc UNUSED) {
  21299 
  21300   char* r;
  21301   smallJsont *self = allocSmallJson();
  21302   char **array     = listCreateS("a","b");
  21303 
  21304   char **d = listCreateS("asd", "zxcv");
  21305   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  21306   ck_assert_ptr_ne(r2, null);
  21307   r2 = self->f->setArrayc(self, "1", array);
  21308   ck_assert_ptr_ne(r2, null);
  21309   iUpperS(&array[0]);
  21310   r = icKeyByArraycO(self, array);
  21311   ck_assert_ptr_ne(r, NULL);
  21312   ck_assert_str_eq(r, "1");
  21313   // non existing object
  21314   r2 = self->f->setInt(self, "1", 1);
  21315   ck_assert_ptr_ne(r2, null);
  21316   r = icKeyByArraycO(self, array);
  21317   ck_assert_ptr_eq(r, null);
  21318   // null value
  21319   r = icKeyByArraycO(self, null);
  21320   ck_assert_ptr_eq(r, null);
  21321   // empty self
  21322   freeO(self);
  21323   r = icKeyByArraycO(self, array);
  21324   ck_assert_ptr_eq(r, null);
  21325   terminateO(self);
  21326   listFreeS(array);
  21327 
  21328 }
  21329 
  21330 
  21331 void icKeyBySmallStringSmallJsonT(CuTest *tc UNUSED) {
  21332 
  21333   char* r;
  21334   smallJsont *self    = allocSmallJson();
  21335   smallStringt *value = allocSmallString("qwe");
  21336 
  21337   createAllocateSmallString(d);
  21338   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  21339   ck_assert_ptr_ne(r2, null);
  21340   r2 = self->f->setNFreeSmallString(self, "1", value);
  21341   ck_assert_ptr_ne(r2, null);
  21342   value = allocSmallString("QWE");
  21343   r = icKeyBySmallStringO(self, value);
  21344   ck_assert_str_eq(r, "1");
  21345   // non existing object
  21346   r2 = self->f->setInt(self, "1", 1);
  21347   ck_assert_ptr_ne(r2, null);
  21348   r = icKeyBySmallStringO(self, value);
  21349   ck_assert_ptr_eq(r, null);
  21350   // empty value
  21351   freeO(value);
  21352   r = icKeyBySmallStringO(self, value);
  21353   ck_assert_ptr_eq(r, null);
  21354   // non smallString object
  21355   smallIntt *i = allocSmallInt(2);
  21356   r = icKeyBySmallStringO(self, (smallStringt*)i);
  21357   terminateO(i);
  21358   ck_assert_ptr_eq(r, null);
  21359   // null value
  21360   r = icKeyBySmallStringO(self, null);
  21361   ck_assert_ptr_eq(r, null);
  21362   // empty self
  21363   freeO(self);
  21364   r = icKeyBySmallStringO(self, value);
  21365   ck_assert_ptr_eq(r, null);
  21366   setTypeDictO(self);
  21367   r = icKeyBySmallStringO(self, value);
  21368   ck_assert_ptr_eq(r, null);
  21369   terminateO(self);
  21370   terminateO(value);
  21371 
  21372 }
  21373 
  21374 
  21375 void replaceSmallJsonT(CuTest *tc UNUSED) {
  21376 
  21377   smallJsont* r;
  21378   smallJsont *self = allocSmallJson();
  21379   setTopSO(self, "#ee#ee#ad");
  21380 
  21381   // replace string, multiple character new delimeter
  21382   r = replaceO(self, "#","^^", 0);
  21383   ck_assert_ptr_ne(r, null);
  21384   char *s = toStringO(r);
  21385   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21386   free(s);
  21387   // replace string, multiple character old delimeter
  21388   freeO(self);
  21389   setTopSO(self, "AA##ee##ee#");
  21390   r = replaceO(self, "##","|", 0);
  21391   ck_assert_ptr_ne(r, null);
  21392   s = toStringO(r);
  21393   ck_assert_str_eq(s, "AA|ee|ee#");
  21394   free(s);
  21395   // replace one time at the start of string
  21396   freeO(self);
  21397   setTopSO(self, "#ee#ee#ad");
  21398   r = replaceO(self, "#","^^",1);
  21399   ck_assert_ptr_ne(r, null);
  21400   s = toStringO(r);
  21401   ck_assert_str_eq(s, "^^ee#ee#ad");
  21402   free(s);
  21403   // replace one time
  21404   freeO(self);
  21405   setTopSO(self, "AA##ee##ee#");
  21406   r = replaceO(self, "##","|",1);
  21407   ck_assert_ptr_ne(r, null);
  21408   s = toStringO(r);
  21409   ck_assert_str_eq(s, "AA|ee##ee#");
  21410   free(s);
  21411   // NULL new delimiter, one time: same as empty delimiter
  21412   freeO(self);
  21413   setTopSO(self, "AA##ee##ee#");
  21414   r = replaceO(self, "##",NULL,1);
  21415   ck_assert_ptr_ne(r, null);
  21416   s = toStringO(r);
  21417   ck_assert_str_eq(s, "AAee##ee#");
  21418   free(s);
  21419   // empty string
  21420   freeO(self);
  21421   setTopSO(self, "");
  21422   r = replaceO(self, "##",NULL,1);
  21423   ck_assert_ptr_ne(r, null);
  21424   s = toStringO(r);
  21425   ck_assert_str_eq(s, "");
  21426   free(s);
  21427   // empty old delimiter
  21428   freeO(self);
  21429   setTopSO(self, "qwe");
  21430   ck_assert_ptr_eq(replaceO(self, "","|",1), NULL);
  21431   // NULL old delimiter
  21432   ck_assert_ptr_eq(replaceO(self, NULL,"|",1), NULL);
  21433   // empty old delimiter
  21434   ck_assert_ptr_eq(replaceO(self, "","|",1), NULL);
  21435   // NULL string
  21436   freeO(self);
  21437   ck_assert_ptr_eq(replaceO(self, "##","|",1), NULL);
  21438   terminateO(self);
  21439 
  21440 }
  21441 
  21442 
  21443 void replaceCharSSmallJsonT(CuTest *tc UNUSED) {
  21444 
  21445   smallJsont* r;
  21446   smallJsont *self = allocSmallJson();
  21447   setTopSO(self, "");
  21448 
  21449   // replace string, multiple character new delimeter
  21450   freeO(self);
  21451   setTopSO(self, "#ee#ee#ad");
  21452   r = replaceCharSO(self, '#',"^^", 0);
  21453   ck_assert_ptr_ne(r, null);
  21454   char *s = toStringO(r);
  21455   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21456   free(s);
  21457   // replace one time at the start of string
  21458   freeO(self);
  21459   setTopSO(self, "#ee#ee#ad");
  21460   r = replaceCharSO(self, '#',"^^",1);
  21461   ck_assert_ptr_ne(r, null);
  21462   s = toStringO(r);
  21463   ck_assert_str_eq(s, "^^ee#ee#ad");
  21464   free(s);
  21465   // replace one time
  21466   freeO(self);
  21467   setTopSO(self, "AA##ee##ee#");
  21468   r = replaceCharSO(self, '#',"|",1);
  21469   ck_assert_ptr_ne(r, null);
  21470   s = toStringO(r);
  21471   ck_assert_str_eq(s, "AA|#ee##ee#");
  21472   free(s);
  21473   // NULL new delimiter, one time: same as empty delimiter
  21474   freeO(self);
  21475   setTopSO(self, "AA#ee##ee#");
  21476   r = replaceCharSO(self, '#',NULL,1);
  21477   ck_assert_ptr_ne(r, null);
  21478   s = toStringO(r);
  21479   ck_assert_str_eq(s, "AAee##ee#");
  21480   free(s);
  21481   // empty string
  21482   freeO(self);
  21483   setTopSO(self, "");
  21484   r = replaceCharSO(self, '#',NULL,1);
  21485   ck_assert_ptr_ne(r, null);
  21486   s = toStringO(r);
  21487   ck_assert_str_eq(s, "");
  21488   free(s);
  21489   // empty old delimiter
  21490   freeO(self);
  21491   setTopSO(self, "qwe");
  21492   ck_assert_ptr_eq(replaceCharSO(self, 0,"|",1), NULL);
  21493   // NULL string
  21494   freeO(self);
  21495   ck_assert_ptr_eq(replaceCharSO(self, '#',"|",1), NULL);
  21496   terminateO(self);
  21497 
  21498 }
  21499 
  21500 
  21501 void replaceSCharSmallJsonT(CuTest *tc UNUSED) {
  21502 
  21503   smallJsont* r;
  21504   smallJsont *self = allocSmallJson();
  21505   setTopSO(self, "");
  21506 
  21507   // replace string, multiple character new delimeter
  21508   freeO(self);
  21509   setTopSO(self, "#ee#ee#ad");
  21510   r = replaceSCharO(self, "#",'^',0);
  21511   ck_assert_ptr_ne(r, null);
  21512   char *s = toStringO(r);
  21513   ck_assert_str_eq(s, "^ee^ee^ad");
  21514   free(s);
  21515   // replace string, multiple character old delimeter
  21516   freeO(self);
  21517   setTopSO(self, "AA##ee##ee#");
  21518   r = replaceSCharO(self, "##",'|',0);
  21519   ck_assert_ptr_ne(r, null);
  21520   s = toStringO(r);
  21521   ck_assert_str_eq(s, "AA|ee|ee#");
  21522   free(s);
  21523   // replace string empty char, multiple character old delimeter
  21524   freeO(self);
  21525   setTopSO(self, "AA##ee##ee#");
  21526   r = replaceSCharO(self, "##", 0,0);
  21527   ck_assert_ptr_ne(r, null);
  21528   s = toStringO(r);
  21529   ck_assert_str_eq(s, "AAeeee#");
  21530   free(s);
  21531   // replace one time at the start of string
  21532   freeO(self);
  21533   setTopSO(self, "#ee#ee#ad");
  21534   r = replaceSCharO(self, "#",'^',1);
  21535   ck_assert_ptr_ne(r, null);
  21536   s = toStringO(r);
  21537   ck_assert_str_eq(s, "^ee#ee#ad");
  21538   free(s);
  21539   // replace one time
  21540   freeO(self);
  21541   setTopSO(self, "AA##ee##ee#");
  21542   r = replaceSCharO(self, "##",'|',1);
  21543   ck_assert_ptr_ne(r, null);
  21544   s = toStringO(r);
  21545   ck_assert_str_eq(s, "AA|ee##ee#");
  21546   free(s);
  21547   // empty string
  21548   freeO(self);
  21549   setTopSO(self, "");
  21550   r = replaceSCharO(self, "##",0,1);
  21551   ck_assert_ptr_ne(r, null);
  21552   s = toStringO(r);
  21553   ck_assert_str_eq(s, "");
  21554   free(s);
  21555   // empty old delimiter
  21556   freeO(self);
  21557   setTopSO(self, "qwe");
  21558   ck_assert_ptr_eq(replaceSCharO(self, "",'|',1), NULL);
  21559   // NULL old delimiter
  21560   ck_assert_ptr_eq(replaceSCharO(self, NULL,'|',1), NULL);
  21561   // NULL string
  21562   freeO(self);
  21563   ck_assert_ptr_eq(replaceSCharO(self, "##",'|',1), NULL);
  21564   terminateO(self);
  21565 
  21566 }
  21567 
  21568 
  21569 void replaceCharCharSmallJsonT(CuTest *tc UNUSED) {
  21570 
  21571   smallJsont* r;
  21572   smallJsont *self = allocSmallJson();
  21573   setTopSO(self, "");
  21574 
  21575   // replace string, multiple character new delimeter
  21576   freeO(self);
  21577   setTopSO(self, "#ee#ee#ad");
  21578   r = replaceCharCharO(self, '#','^', 0);
  21579   ck_assert_ptr_ne(r, null);
  21580   char *s = toStringO(r);
  21581   ck_assert_str_eq(s, "^ee^ee^ad");
  21582   free(s);
  21583   // replace one time at the start of string
  21584   freeO(self);
  21585   setTopSO(self, "#ee#ee#ad");
  21586   r = replaceCharCharO(self, '#','^',1);
  21587   ck_assert_ptr_ne(r, null);
  21588   s = toStringO(r);
  21589   ck_assert_str_eq(s, "^ee#ee#ad");
  21590   free(s);
  21591   // replace one time
  21592   freeO(self);
  21593   setTopSO(self, "AA#ee##ee#");
  21594   r = replaceCharCharO(self, '#','|',1);
  21595   ck_assert_ptr_ne(r, null);
  21596   s = toStringO(r);
  21597   ck_assert_str_eq(s, "AA|ee##ee#");
  21598   free(s);
  21599   // empty string
  21600   freeO(self);
  21601   setTopSO(self, "");
  21602   r = replaceCharCharO(self, '#','^',1);
  21603   ck_assert_ptr_ne(r, null);
  21604   s = toStringO(r);
  21605   ck_assert_str_eq(s, "");
  21606   free(s);
  21607   // empty old delimiter
  21608   freeO(self);
  21609   setTopSO(self, "qwe");
  21610   ck_assert_ptr_eq(replaceCharCharO(self, 0,'|',1), NULL);
  21611   // NULL string
  21612   freeO(self);
  21613   ck_assert_ptr_eq(replaceCharCharO(self, '#','|',1), NULL);
  21614   terminateO(self);
  21615 
  21616 }
  21617 
  21618 
  21619 void replaceSmallStringSmallStringSmallJsonT(CuTest *tc UNUSED) {
  21620 
  21621   smallJsont* r;
  21622   smallJsont *self = allocSmallJson();
  21623   setTopSO(self, "#ee#ee#ad");
  21624   smallStringt *olds = allocSmallString("");
  21625   smallStringt *news = allocSmallString("");
  21626 
  21627   // replace string, multiple character new delimeter
  21628   setValO(olds, "#");
  21629   setValO(news, "^^");
  21630   r = replaceSmallStringSmallStringO(self, olds, news, 0);
  21631   ck_assert_ptr_ne(r, null);
  21632   char *s = toStringO(r);
  21633   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21634   free(s);
  21635   // replace string, multiple character old delimeter
  21636   freeO(self);
  21637   setTopSO(self, "AA##ee##ee#");
  21638   setValO(olds, "##");
  21639   setValO(news, "|");
  21640   r = replaceSmallStringSmallStringO(self, olds, news, 0);
  21641   ck_assert_ptr_ne(r, null);
  21642   s = toStringO(r);
  21643   ck_assert_str_eq(s, "AA|ee|ee#");
  21644   free(s);
  21645   // replace one time at the start of string
  21646   freeO(self);
  21647   setTopSO(self, "#ee#ee#ad");
  21648   setValO(olds, "#");
  21649   setValO(news, "^^");
  21650   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21651   ck_assert_ptr_ne(r, null);
  21652   s = toStringO(r);
  21653   ck_assert_str_eq(s, "^^ee#ee#ad");
  21654   free(s);
  21655   // replace one time
  21656   freeO(self);
  21657   setTopSO(self, "AA##ee##ee#");
  21658   setValO(olds, "##");
  21659   setValO(news, "|");
  21660   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21661   ck_assert_ptr_ne(r, null);
  21662   s = toStringO(r);
  21663   ck_assert_str_eq(s, "AA|ee##ee#");
  21664   free(s);
  21665   // NULL new delimiter, one time: same as empty delimiter
  21666   freeO(self);
  21667   setTopSO(self, "AA##ee##ee#");
  21668   setValO(olds, "##");
  21669   r = replaceSmallStringSmallStringO(self, olds, NULL,1);
  21670   ck_assert_ptr_ne(r, null);
  21671   s = toStringO(r);
  21672   ck_assert_str_eq(s, "AAee##ee#");
  21673   free(s);
  21674   // non smallString object
  21675   terminateO(olds);
  21676   olds = (smallStringt*) allocSmallInt(1);
  21677   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21678   ck_assert_ptr_eq(r, null);
  21679   terminateO(olds);
  21680   terminateO(news);
  21681   olds = allocSmallString("");
  21682   news = (smallStringt*) allocSmallInt(1);
  21683   r = replaceSmallStringSmallStringO(self, olds, news,1);
  21684   ck_assert_ptr_eq(r, null);
  21685   terminateO(news);
  21686   news = allocSmallString("");
  21687   // empty string
  21688   freeO(self);
  21689   setTopSO(self, "");
  21690   setValO(olds, "##");
  21691   r = replaceSmallStringSmallStringO(self, olds, NULL,1);
  21692   ck_assert_ptr_ne(r, null);
  21693   s = toStringO(r);
  21694   ck_assert_str_eq(s, "");
  21695   free(s);
  21696   // empty old delimiter
  21697   freeO(self);
  21698   setTopSO(self, "qwe");
  21699   setValO(olds, "");
  21700   setValO(news, "|");
  21701   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL);
  21702   // NULL old delimiter
  21703   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, NULL, news,1), NULL);
  21704   // NULL string
  21705   freeO(self);
  21706   ck_assert_ptr_eq(replaceSmallStringSmallStringO(self, olds, news,1), NULL);
  21707   terminateO(olds);
  21708   terminateO(news);
  21709   terminateO(self);
  21710 
  21711 }
  21712 
  21713 
  21714 void replaceSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  21715 
  21716   smallJsont* r;
  21717   smallJsont *self = allocSmallJson();
  21718   setTopSO(self, "#ee#ee#ad");
  21719   smallStringt *olds = allocSmallString("");
  21720   const char *news;
  21721 
  21722   // replace string, multiple character new delimeter
  21723   setValO(olds, "#");
  21724   news = "^^";
  21725   r = replaceSmallStringSO(self, olds, news, 0);
  21726   ck_assert_ptr_ne(r, null);
  21727   char *s = toStringO(r);
  21728   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21729   free(s);
  21730   // replace string, multiple character old delimeter
  21731   freeO(self);
  21732   setTopSO(self, "AA##ee##ee#");
  21733   setValO(olds, "##");
  21734   news = "|";
  21735   r = replaceSmallStringSO(self, olds, news, 0);
  21736   ck_assert_ptr_ne(r, null);
  21737   s = toStringO(r);
  21738   ck_assert_str_eq(s, "AA|ee|ee#");
  21739   free(s);
  21740   // replace one time at the start of string
  21741   freeO(self);
  21742   setTopSO(self, "#ee#ee#ad");
  21743   setValO(olds, "#");
  21744   news = "^^";
  21745   r = replaceSmallStringSO(self, olds, news,1);
  21746   ck_assert_ptr_ne(r, null);
  21747   s = toStringO(r);
  21748   ck_assert_str_eq(s, "^^ee#ee#ad");
  21749   free(s);
  21750   // replace one time
  21751   freeO(self);
  21752   setTopSO(self, "AA##ee##ee#");
  21753   setValO(olds, "##");
  21754   news = "|";
  21755   r = replaceSmallStringSO(self, olds, news,1);
  21756   ck_assert_ptr_ne(r, null);
  21757   s = toStringO(r);
  21758   ck_assert_str_eq(s, "AA|ee##ee#");
  21759   free(s);
  21760   // NULL new delimiter, one time: same as empty delimiter
  21761   freeO(self);
  21762   setTopSO(self, "AA##ee##ee#");
  21763   setValO(olds, "##");
  21764   r = replaceSmallStringSO(self, olds, NULL,1);
  21765   ck_assert_ptr_ne(r, null);
  21766   s = toStringO(r);
  21767   ck_assert_str_eq(s, "AAee##ee#");
  21768   free(s);
  21769   // non smallString object
  21770   terminateO(olds);
  21771   olds = (smallStringt*) allocSmallInt(1);
  21772   r = replaceSmallStringSO(self, olds, news,1);
  21773   ck_assert_ptr_eq(r, null);
  21774   terminateO(olds);
  21775   olds = allocSmallString("");
  21776   // empty string
  21777   freeO(self);
  21778   setTopSO(self, "");
  21779   setValO(olds, "##");
  21780   r = replaceSmallStringSO(self, olds, NULL,1);
  21781   ck_assert_ptr_ne(r, null);
  21782   s = toStringO(r);
  21783   ck_assert_str_eq(s, "");
  21784   free(s);
  21785   // empty old delimiter
  21786   freeO(self);
  21787   setTopSO(self, "qwe");
  21788   setValO(olds, "");
  21789   news = "|";
  21790   ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL);
  21791   // NULL old delimiter
  21792   ck_assert_ptr_eq(replaceSmallStringSO(self, NULL, news,1), NULL);
  21793   // NULL string
  21794   freeO(self);
  21795   ck_assert_ptr_eq(replaceSmallStringSO(self, olds, news,1), NULL);
  21796   terminateO(olds);
  21797   terminateO(self);
  21798 
  21799 }
  21800 
  21801 
  21802 void replaceSmallStringCharSmallJsonT(CuTest *tc UNUSED) {
  21803 
  21804   smallJsont* r;
  21805   smallJsont *self = allocSmallJson();
  21806   setTopSO(self, "#ee#ee#ad");
  21807   smallStringt *olds = allocSmallString("");
  21808   char news;
  21809 
  21810   // replace string, multiple character new delimeter
  21811   setValO(olds, "#");
  21812   news = '^';
  21813   r = replaceSmallStringCharO(self, olds, news, 0);
  21814   ck_assert_ptr_ne(r, null);
  21815   char *s = toStringO(r);
  21816   ck_assert_str_eq(s, "^ee^ee^ad");
  21817   free(s);
  21818   // replace string, multiple character old delimeter
  21819   freeO(self);
  21820   setTopSO(self, "AA##ee##ee#");
  21821   setValO(olds, "##");
  21822   news = '|';
  21823   r = replaceSmallStringCharO(self, olds, news, 0);
  21824   ck_assert_ptr_ne(r, null);
  21825   s = toStringO(r);
  21826   ck_assert_str_eq(s, "AA|ee|ee#");
  21827   free(s);
  21828   // replace one time at the start of string
  21829   freeO(self);
  21830   setTopSO(self, "#ee#ee#ad");
  21831   setValO(olds, "#");
  21832   news = '^';
  21833   r = replaceSmallStringCharO(self, olds, news,1);
  21834   ck_assert_ptr_ne(r, null);
  21835   s = toStringO(r);
  21836   ck_assert_str_eq(s, "^ee#ee#ad");
  21837   free(s);
  21838   // replace one time
  21839   freeO(self);
  21840   setTopSO(self, "AA##ee##ee#");
  21841   setValO(olds, "##");
  21842   news = '|';
  21843   r = replaceSmallStringCharO(self, olds, news,1);
  21844   ck_assert_ptr_ne(r, null);
  21845   s = toStringO(r);
  21846   ck_assert_str_eq(s, "AA|ee##ee#");
  21847   free(s);
  21848   // non smallString object
  21849   terminateO(olds);
  21850   olds = (smallStringt*) allocSmallInt(1);
  21851   r = replaceSmallStringCharO(self, olds, news,1);
  21852   ck_assert_ptr_eq(r, null);
  21853   terminateO(olds);
  21854   olds = allocSmallString("");
  21855   // empty string
  21856   freeO(self);
  21857   setTopSO(self, "");
  21858   setValO(olds, "##");
  21859   r = replaceSmallStringCharO(self, olds, news,1);
  21860   ck_assert_ptr_ne(r, null);
  21861   s = toStringO(r);
  21862   ck_assert_str_eq(s, "");
  21863   free(s);
  21864   // empty old delimiter
  21865   freeO(self);
  21866   setTopSO(self, "qwe");
  21867   setValO(olds, "");
  21868   news = '|';
  21869   ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL);
  21870   // NULL old delimiter
  21871   ck_assert_ptr_eq(replaceSmallStringCharO(self, NULL, news,1), NULL);
  21872   // NULL string
  21873   freeO(self);
  21874   ck_assert_ptr_eq(replaceSmallStringCharO(self, olds, news,1), NULL);
  21875   terminateO(olds);
  21876   terminateO(self);
  21877 
  21878 }
  21879 
  21880 
  21881 void replaceSSmallStringSmallJsonT(CuTest *tc UNUSED) {
  21882 
  21883   smallJsont* r;
  21884   smallJsont *self = allocSmallJson();
  21885   setTopSO(self, "#ee#ee#ad");
  21886   const char *olds;
  21887   smallStringt *news = allocSmallString("");
  21888 
  21889   // replace string, multiple character new delimeter
  21890   olds = "#";
  21891   setValO(news, "^^");
  21892   r = replaceSSmallStringO(self, olds, news, 0);
  21893   ck_assert_ptr_ne(r, null);
  21894   char *s = toStringO(r);
  21895   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21896   free(s);
  21897   // replace string, multiple character old delimeter
  21898   freeO(self);
  21899   setTopSO(self, "AA##ee##ee#");
  21900   olds = "##";
  21901   setValO(news, "|");
  21902   r = replaceSSmallStringO(self, olds, news, 0);
  21903   ck_assert_ptr_ne(r, null);
  21904   s = toStringO(r);
  21905   ck_assert_str_eq(s, "AA|ee|ee#");
  21906   free(s);
  21907   // replace one time at the start of string
  21908   freeO(self);
  21909   setTopSO(self, "#ee#ee#ad");
  21910   olds = "#";
  21911   setValO(news, "^^");
  21912   r = replaceSSmallStringO(self, olds, news,1);
  21913   ck_assert_ptr_ne(r, null);
  21914   s = toStringO(r);
  21915   ck_assert_str_eq(s, "^^ee#ee#ad");
  21916   free(s);
  21917   // replace one time
  21918   freeO(self);
  21919   setTopSO(self, "AA##ee##ee#");
  21920   olds = "##";
  21921   setValO(news, "|");
  21922   r = replaceSSmallStringO(self, olds, news,1);
  21923   ck_assert_ptr_ne(r, null);
  21924   s = toStringO(r);
  21925   ck_assert_str_eq(s, "AA|ee##ee#");
  21926   free(s);
  21927   // NULL new delimiter, one time: same as empty delimiter
  21928   freeO(self);
  21929   setTopSO(self, "AA##ee##ee#");
  21930   olds = "##";
  21931   r = replaceSSmallStringO(self, olds, NULL,1);
  21932   ck_assert_ptr_ne(r, null);
  21933   s = toStringO(r);
  21934   ck_assert_str_eq(s, "AAee##ee#");
  21935   free(s);
  21936   // non smallString object
  21937   terminateO(news);
  21938   news = (smallStringt*) allocSmallInt(1);
  21939   r = replaceSSmallStringO(self, olds, news,1);
  21940   ck_assert_ptr_eq(r, null);
  21941   terminateO(news);
  21942   news = allocSmallString("");
  21943   // empty string
  21944   freeO(self);
  21945   setTopSO(self, "");
  21946   olds = "##";
  21947   r = replaceSSmallStringO(self, olds, NULL,1);
  21948   ck_assert_ptr_ne(r, null);
  21949   s = toStringO(r);
  21950   ck_assert_str_eq(s, "");
  21951   free(s);
  21952   // empty old delimiter
  21953   freeO(self);
  21954   setTopSO(self, "qwe");
  21955   olds = "";
  21956   setValO(news, "|");
  21957   ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL);
  21958   // NULL old delimiter
  21959   ck_assert_ptr_eq(replaceSSmallStringO(self, NULL, news,1), NULL);
  21960   // NULL string
  21961   freeO(self);
  21962   ck_assert_ptr_eq(replaceSSmallStringO(self, olds, news,1), NULL);
  21963   terminateO(news);
  21964   terminateO(self);
  21965 
  21966 }
  21967 
  21968 
  21969 void replaceCharSmallStringSmallJsonT(CuTest *tc UNUSED) {
  21970 
  21971   smallJsont* r;
  21972   smallJsont *self = allocSmallJson();
  21973   setTopSO(self, "#ee#ee#ad");
  21974   char olds;
  21975   smallStringt *news = allocSmallString("");
  21976 
  21977   // replace string, multiple character new delimeter
  21978   olds = '#';
  21979   setValO(news, "^^");
  21980   r = replaceCharSmallStringO(self, olds, news, 0);
  21981   ck_assert_ptr_ne(r, null);
  21982   char *s = toStringO(r);
  21983   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  21984   free(s);
  21985   // replace string, multiple character old delimeter
  21986   freeO(self);
  21987   setTopSO(self, "AA#ee#ee");
  21988   olds = '#';
  21989   setValO(news, "|");
  21990   r = replaceCharSmallStringO(self, olds, news, 0);
  21991   ck_assert_ptr_ne(r, null);
  21992   s = toStringO(r);
  21993   ck_assert_str_eq(s, "AA|ee|ee");
  21994   free(s);
  21995   // replace one time at the start of string
  21996   freeO(self);
  21997   setTopSO(self, "#ee#ee#ad");
  21998   olds = '#';
  21999   setValO(news, "^^");
  22000   r = replaceCharSmallStringO(self, olds, news,1);
  22001   ck_assert_ptr_ne(r, null);
  22002   s = toStringO(r);
  22003   ck_assert_str_eq(s, "^^ee#ee#ad");
  22004   free(s);
  22005   // replace one time
  22006   freeO(self);
  22007   setTopSO(self, "AA#ee##ee#");
  22008   olds = '#';
  22009   setValO(news, "|");
  22010   r = replaceCharSmallStringO(self, olds, news,1);
  22011   ck_assert_ptr_ne(r, null);
  22012   s = toStringO(r);
  22013   ck_assert_str_eq(s, "AA|ee##ee#");
  22014   free(s);
  22015   // NULL new delimiter, one time: same as empty delimiter
  22016   freeO(self);
  22017   setTopSO(self, "AA#ee##ee#");
  22018   olds = '#';
  22019   r = replaceCharSmallStringO(self, olds, NULL,1);
  22020   ck_assert_ptr_ne(r, null);
  22021   s = toStringO(r);
  22022   ck_assert_str_eq(s, "AAee##ee#");
  22023   free(s);
  22024   // non smallString object
  22025   terminateO(news);
  22026   news = (smallStringt*) allocSmallInt(1);
  22027   r = replaceCharSmallStringO(self, olds, news,1);
  22028   ck_assert_ptr_eq(r, null);
  22029   terminateO(news);
  22030   news = allocSmallString("");
  22031   // empty string
  22032   freeO(self);
  22033   setTopSO(self, "");
  22034   olds = '#';
  22035   r = replaceCharSmallStringO(self, olds, NULL,1);
  22036   ck_assert_ptr_ne(r, null);
  22037   s = toStringO(r);
  22038   ck_assert_str_eq(s, "");
  22039   free(s);
  22040   // NULL string
  22041   freeO(self);
  22042   setValO(news, "|");
  22043   ck_assert_ptr_eq(replaceCharSmallStringO(self, olds, news,1), NULL);
  22044   terminateO(news);
  22045   terminateO(self);
  22046 
  22047 }
  22048 
  22049 
  22050 void replaceJsonJsonSmallJsonT(CuTest *tc UNUSED) {
  22051 
  22052   smallJsont* r;
  22053   smallJsont *self = allocSmallJson();
  22054   setTopSO(self, "#ee#ee#ad");
  22055   smallJsont *olds = allocSmallJson();
  22056   smallJsont *news = allocSmallJson();
  22057 
  22058   // replace string, multiple character new delimeter
  22059   freeO(olds);
  22060   freeO(news);
  22061   setTopSO(olds, "#");
  22062   setTopSO(news, "^^");
  22063   r = replaceJsonJsonO(self, olds, news, 0);
  22064   ck_assert_ptr_ne(r, null);
  22065   char *s = toStringO(r);
  22066   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22067   free(s);
  22068   // replace string, multiple character old delimeter
  22069   freeO(self);
  22070   setTopSO(self, "AA##ee##ee#");
  22071   freeO(olds);
  22072   freeO(news);
  22073   setTopSO(olds, "##");
  22074   setTopSO(news, "|");
  22075   r = replaceJsonJsonO(self, olds, news, 0);
  22076   ck_assert_ptr_ne(r, null);
  22077   s = toStringO(r);
  22078   ck_assert_str_eq(s, "AA|ee|ee#");
  22079   free(s);
  22080   // replace one time at the start of string
  22081   freeO(self);
  22082   setTopSO(self, "#ee#ee#ad");
  22083   freeO(olds);
  22084   freeO(news);
  22085   setTopSO(olds, "#");
  22086   setTopSO(news, "^^");
  22087   r = replaceJsonJsonO(self, olds, news,1);
  22088   ck_assert_ptr_ne(r, null);
  22089   s = toStringO(r);
  22090   ck_assert_str_eq(s, "^^ee#ee#ad");
  22091   free(s);
  22092   // replace one time
  22093   freeO(self);
  22094   setTopSO(self, "AA##ee##ee#");
  22095   freeO(olds);
  22096   freeO(news);
  22097   setTopSO(olds, "##");
  22098   setTopSO(news, "|");
  22099   r = replaceJsonJsonO(self, olds, news,1);
  22100   ck_assert_ptr_ne(r, null);
  22101   s = toStringO(r);
  22102   ck_assert_str_eq(s, "AA|ee##ee#");
  22103   free(s);
  22104   // NULL new delimiter, one time: same as empty delimiter
  22105   freeO(self);
  22106   setTopSO(self, "AA##ee##ee#");
  22107   freeO(olds);
  22108   setTopSO(olds, "##");
  22109   r = replaceJsonJsonO(self, olds, NULL,1);
  22110   ck_assert_ptr_ne(r, null);
  22111   s = toStringO(r);
  22112   ck_assert_str_eq(s, "AAee##ee#");
  22113   free(s);
  22114   // non json string
  22115   freeO(olds);
  22116   setTopIntO(olds, 1);
  22117   r = replaceJsonJsonO(self, olds, news,1);
  22118   ck_assert_ptr_eq(r, null);
  22119   freeO(olds);
  22120   freeO(news);
  22121   setTopSO(olds, "e");
  22122   setTopIntO(news, 1);
  22123   r = replaceJsonJsonO(self, olds, news,1);
  22124   ck_assert_ptr_eq(r, null);
  22125   // non json object
  22126   terminateO(olds);
  22127   olds = (smallJsont*) allocSmallInt(1);
  22128   r = replaceJsonJsonO(self, olds, news,1);
  22129   ck_assert_ptr_eq(r, null);
  22130   terminateO(olds);
  22131   terminateO(news);
  22132   olds = allocSmallJson();
  22133   news = (smallJsont*) allocSmallInt(1);
  22134   r = replaceJsonJsonO(self, olds, news,1);
  22135   ck_assert_ptr_eq(r, null);
  22136   terminateO(news);
  22137   news = allocSmallJson();
  22138   // empty string
  22139   freeO(self);
  22140   setTopSO(self, "");
  22141   freeO(olds);
  22142   setTopSO(olds, "##");
  22143   r = replaceJsonJsonO(self, olds, NULL,1);
  22144   ck_assert_ptr_ne(r, null);
  22145   s = toStringO(r);
  22146   ck_assert_str_eq(s, "");
  22147   free(s);
  22148   // empty old delimiter
  22149   freeO(self);
  22150   setTopSO(self, "qwe");
  22151   freeO(olds);
  22152   freeO(news);
  22153   setTopSO(olds, "");
  22154   setTopSO(news, "|");
  22155   ck_assert_ptr_eq(replaceJsonJsonO(self, olds, news,1), NULL);
  22156   // NULL old delimiter
  22157   ck_assert_ptr_eq(replaceJsonJsonO(self, NULL, news,1), NULL);
  22158   // NULL string
  22159   freeO(self);
  22160   ck_assert_ptr_eq(replaceJsonJsonO(self, olds, news,1), NULL);
  22161   terminateO(olds);
  22162   terminateO(news);
  22163   terminateO(self);
  22164 
  22165 }
  22166 
  22167 
  22168 void replaceJsonSmallStringSmallJsonT(CuTest *tc UNUSED) {
  22169 
  22170   smallJsont* r;
  22171   smallJsont *self = allocSmallJson();
  22172   setTopSO(self, "#ee#ee#ad");
  22173   smallJsont *olds   = allocSmallJson();
  22174   smallStringt *news = allocSmallString("");
  22175 
  22176   // replace string, multiple character new delimeter
  22177   freeO(olds);
  22178   setTopSO(olds, "#");
  22179   setValO(news, "^^");
  22180   r = replaceJsonSmallStringO(self, olds, news, 0);
  22181   ck_assert_ptr_ne(r, null);
  22182   char *s = toStringO(r);
  22183   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22184   free(s);
  22185   // replace string, multiple character old delimeter
  22186   freeO(self);
  22187   setTopSO(self, "AA##ee##ee#");
  22188   freeO(olds);
  22189   setTopSO(olds, "##");
  22190   setValO(news, "|");
  22191   r = replaceJsonSmallStringO(self, olds, news, 0);
  22192   ck_assert_ptr_ne(r, null);
  22193   s = toStringO(r);
  22194   ck_assert_str_eq(s, "AA|ee|ee#");
  22195   free(s);
  22196   // replace one time at the start of string
  22197   freeO(self);
  22198   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  22206   free(s);
  22207   // replace one time
  22208   freeO(self);
  22209   setTopSO(self, "AA##ee##ee#");
  22210   freeO(olds);
  22211   setTopSO(olds, "##");
  22212   setValO(news, "|");
  22213   r = replaceJsonSmallStringO(self, olds, news,1);
  22214   ck_assert_ptr_ne(r, null);
  22215   s = toStringO(r);
  22216   ck_assert_str_eq(s, "AA|ee##ee#");
  22217   free(s);
  22218   // NULL new delimiter, one time: same as empty delimiter
  22219   freeO(self);
  22220   setTopSO(self, "AA##ee##ee#");
  22221   freeO(olds);
  22222   setTopSO(olds, "##");
  22223   r = replaceJsonSmallStringO(self, olds, NULL,1);
  22224   ck_assert_ptr_ne(r, null);
  22225   s = toStringO(r);
  22226   ck_assert_str_eq(s, "AAee##ee#");
  22227   free(s);
  22228   // non json string
  22229   freeO(olds);
  22230   setTopIntO(olds, 1);
  22231   r = replaceJsonSmallStringO(self, olds, news,1);
  22232   ck_assert_ptr_eq(r, null);
  22233   // non json object
  22234   terminateO(olds);
  22235   olds = (smallJsont*) allocSmallInt(1);
  22236   r = replaceJsonSmallStringO(self, olds, news,1);
  22237   ck_assert_ptr_eq(r, null);
  22238   terminateO(olds);
  22239   terminateO(news);
  22240   olds = allocSmallJson();
  22241   news = (smallStringt*) allocSmallInt(1);
  22242   r = replaceJsonSmallStringO(self, olds, news,1);
  22243   ck_assert_ptr_eq(r, null);
  22244   terminateO(news);
  22245   news = allocSmallString("");
  22246   // empty string
  22247   freeO(self);
  22248   setTopSO(self, "");
  22249   freeO(olds);
  22250   setTopSO(olds, "##");
  22251   r = replaceJsonSmallStringO(self, olds, NULL,1);
  22252   ck_assert_ptr_ne(r, null);
  22253   s = toStringO(r);
  22254   ck_assert_str_eq(s, "");
  22255   free(s);
  22256   // empty old delimiter
  22257   freeO(self);
  22258   setTopSO(self, "qwe");
  22259   freeO(olds);
  22260   setTopSO(olds, "");
  22261   setValO(news, "|");
  22262   ck_assert_ptr_eq(replaceJsonSmallStringO(self, olds, news,1), NULL);
  22263   // NULL old delimiter
  22264   ck_assert_ptr_eq(replaceJsonSmallStringO(self, NULL, news,1), NULL);
  22265   // NULL string
  22266   freeO(self);
  22267   ck_assert_ptr_eq(replaceJsonSmallStringO(self, olds, news,1), NULL);
  22268   terminateO(olds);
  22269   terminateO(news);
  22270   terminateO(self);
  22271 
  22272 }
  22273 
  22274 
  22275 void replaceJsonSSmallJsonT(CuTest *tc UNUSED) {
  22276 
  22277   smallJsont* r;
  22278   smallJsont *self = allocSmallJson();
  22279   setTopSO(self, "#ee#ee#ad");
  22280   smallJsont *olds   = allocSmallJson();
  22281   const char *news;
  22282 
  22283   // replace string, multiple character new delimeter
  22284   freeO(olds);
  22285   setTopSO(olds, "#");
  22286   news = "^^";
  22287   r = replaceJsonSO(self, olds, news, 0);
  22288   ck_assert_ptr_ne(r, null);
  22289   char *s = toStringO(r);
  22290   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22291   free(s);
  22292   // replace string, multiple character old delimeter
  22293   freeO(self);
  22294   setTopSO(self, "AA##ee##ee#");
  22295   freeO(olds);
  22296   setTopSO(olds, "##");
  22297   news = "|";
  22298   r = replaceJsonSO(self, olds, news, 0);
  22299   ck_assert_ptr_ne(r, null);
  22300   s = toStringO(r);
  22301   ck_assert_str_eq(s, "AA|ee|ee#");
  22302   free(s);
  22303   // replace one time at the start of string
  22304   freeO(self);
  22305   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  22313   free(s);
  22314   // replace one time
  22315   freeO(self);
  22316   setTopSO(self, "AA##ee##ee#");
  22317   freeO(olds);
  22318   setTopSO(olds, "##");
  22319   news = "|";
  22320   r = replaceJsonSO(self, olds, news,1);
  22321   ck_assert_ptr_ne(r, null);
  22322   s = toStringO(r);
  22323   ck_assert_str_eq(s, "AA|ee##ee#");
  22324   free(s);
  22325   // NULL new delimiter, one time: same as empty delimiter
  22326   freeO(self);
  22327   setTopSO(self, "AA##ee##ee#");
  22328   freeO(olds);
  22329   setTopSO(olds, "##");
  22330   r = replaceJsonSO(self, olds, NULL,1);
  22331   ck_assert_ptr_ne(r, null);
  22332   s = toStringO(r);
  22333   ck_assert_str_eq(s, "AAee##ee#");
  22334   free(s);
  22335   // non json string
  22336   freeO(olds);
  22337   setTopIntO(olds, 1);
  22338   r = replaceJsonSO(self, olds, news,1);
  22339   ck_assert_ptr_eq(r, null);
  22340   // non json object
  22341   terminateO(olds);
  22342   olds = (smallJsont*) allocSmallInt(1);
  22343   r = replaceJsonSO(self, olds, news,1);
  22344   ck_assert_ptr_eq(r, null);
  22345   terminateO(olds);
  22346   // empty string
  22347   olds = allocSmallJson();
  22348   freeO(self);
  22349   setTopSO(self, "");
  22350   setTopSO(olds, "##");
  22351   r = replaceJsonSO(self, olds, NULL,1);
  22352   ck_assert_ptr_ne(r, null);
  22353   s = toStringO(r);
  22354   ck_assert_str_eq(s, "");
  22355   free(s);
  22356   // empty old delimiter
  22357   freeO(self);
  22358   setTopSO(self, "qwe");
  22359   freeO(olds);
  22360   setTopSO(olds, "");
  22361   news = "|";
  22362   ck_assert_ptr_eq(replaceJsonSO(self, olds, news,1), NULL);
  22363   // NULL old delimiter
  22364   ck_assert_ptr_eq(replaceJsonSO(self, NULL, news,1), NULL);
  22365   // NULL string
  22366   freeO(self);
  22367   ck_assert_ptr_eq(replaceJsonSO(self, olds, news,1), NULL);
  22368   terminateO(olds);
  22369   terminateO(self);
  22370 
  22371 }
  22372 
  22373 
  22374 void replaceJsonCharSmallJsonT(CuTest *tc UNUSED) {
  22375 
  22376   smallJsont* r;
  22377   smallJsont *self = allocSmallJson();
  22378   setTopSO(self, "#ee#ee#ad");
  22379   smallJsont *olds   = allocSmallJson();
  22380   char news;
  22381 
  22382   // replace string, multiple character new delimeter
  22383   freeO(olds);
  22384   setTopSO(olds, "#");
  22385   news = '^';
  22386   r = replaceJsonCharO(self, olds, news, 0);
  22387   ck_assert_ptr_ne(r, null);
  22388   char *s = toStringO(r);
  22389   ck_assert_str_eq(s, "^ee^ee^ad");
  22390   free(s);
  22391   // replace string, multiple character old delimeter
  22392   freeO(self);
  22393   setTopSO(self, "AA##ee##ee#");
  22394   freeO(olds);
  22395   setTopSO(olds, "##");
  22396   news = '|';
  22397   r = replaceJsonCharO(self, olds, news, 0);
  22398   ck_assert_ptr_ne(r, null);
  22399   s = toStringO(r);
  22400   ck_assert_str_eq(s, "AA|ee|ee#");
  22401   free(s);
  22402   // replace one time at the start of string
  22403   freeO(self);
  22404   setTopSO(self, "#ee#ee#ad");
  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, "^ee#ee#ad");
  22412   free(s);
  22413   // replace one time
  22414   freeO(self);
  22415   setTopSO(self, "AA##ee##ee#");
  22416   freeO(olds);
  22417   setTopSO(olds, "##");
  22418   news = '|';
  22419   r = replaceJsonCharO(self, olds, news,1);
  22420   ck_assert_ptr_ne(r, null);
  22421   s = toStringO(r);
  22422   ck_assert_str_eq(s, "AA|ee##ee#");
  22423   free(s);
  22424   // non json string
  22425   freeO(self);
  22426   setTopSO(self, "AA##ee##ee#");
  22427   freeO(olds);
  22428   setTopIntO(olds, 1);
  22429   r = replaceJsonCharO(self, olds, news,1);
  22430   ck_assert_ptr_eq(r, null);
  22431   // non json object
  22432   terminateO(olds);
  22433   olds = (smallJsont*) allocSmallInt(1);
  22434   r = replaceJsonCharO(self, olds, news,1);
  22435   ck_assert_ptr_eq(r, null);
  22436   terminateO(olds);
  22437   // empty string
  22438   olds = allocSmallJson();
  22439   freeO(self);
  22440   setTopSO(self, "");
  22441   setTopSO(olds, "##");
  22442   r = replaceJsonCharO(self, olds, news,1);
  22443   ck_assert_ptr_ne(r, null);
  22444   s = toStringO(r);
  22445   ck_assert_str_eq(s, "");
  22446   free(s);
  22447   // empty old delimiter
  22448   freeO(self);
  22449   setTopSO(self, "qwe");
  22450   freeO(olds);
  22451   setTopSO(olds, "");
  22452   news = '|';
  22453   ck_assert_ptr_eq(replaceJsonCharO(self, olds, news,1), NULL);
  22454   // NULL old delimiter
  22455   ck_assert_ptr_eq(replaceJsonCharO(self, NULL, news,1), NULL);
  22456   // NULL string
  22457   freeO(self);
  22458   ck_assert_ptr_eq(replaceJsonCharO(self, olds, news,1), NULL);
  22459   terminateO(olds);
  22460   terminateO(self);
  22461 
  22462 }
  22463 
  22464 
  22465 void replaceSmallStringJsonSmallJsonT(CuTest *tc UNUSED) {
  22466 
  22467   smallJsont* r;
  22468   smallJsont *self = allocSmallJson();
  22469   setTopSO(self, "#ee#ee#ad");
  22470   smallStringt *olds = allocSmallString("");
  22471   smallJsont *news   = allocSmallJson();
  22472 
  22473   // replace string, multiple character new delimeter
  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   char *s = toStringO(r);
  22480   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22481   free(s);
  22482   // replace string, multiple character old delimeter
  22483   freeO(self);
  22484   setTopSO(self, "AA##ee##ee#");
  22485   freeO(news);
  22486   setValO(olds, "##");
  22487   setTopSO(news, "|");
  22488   r = self->f->replaceSmallStringJson(self, olds, news, 0);
  22489   ck_assert_ptr_ne(r, null);
  22490   s = toStringO(r);
  22491   ck_assert_str_eq(s, "AA|ee|ee#");
  22492   free(s);
  22493   // replace one time at the start of string
  22494   freeO(self);
  22495   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  22503   free(s);
  22504   // replace one time
  22505   freeO(self);
  22506   setTopSO(self, "AA##ee##ee#");
  22507   freeO(news);
  22508   setValO(olds, "##");
  22509   setTopSO(news, "|");
  22510   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22511   ck_assert_ptr_ne(r, null);
  22512   s = toStringO(r);
  22513   ck_assert_str_eq(s, "AA|ee##ee#");
  22514   free(s);
  22515   // NULL new delimiter, one time: same as empty delimiter
  22516   freeO(self);
  22517   setTopSO(self, "AA##ee##ee#");
  22518   setValO(olds, "##");
  22519   r = self->f->replaceSmallStringJson(self, olds, NULL,1);
  22520   ck_assert_ptr_ne(r, null);
  22521   s = toStringO(r);
  22522   ck_assert_str_eq(s, "AAee##ee#");
  22523   free(s);
  22524   // non json string
  22525   freeO(news);
  22526   setTopIntO(news, 1);
  22527   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22528   ck_assert_ptr_eq(r, null);
  22529   // non json object
  22530   terminateO(olds);
  22531   olds = (smallStringt*) allocSmallInt(1);
  22532   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22533   ck_assert_ptr_eq(r, null);
  22534   terminateO(olds);
  22535   terminateO(news);
  22536   olds = allocSmallString("");
  22537   news = (smallJsont*) allocSmallInt(1);
  22538   r = self->f->replaceSmallStringJson(self, olds, news,1);
  22539   ck_assert_ptr_eq(r, null);
  22540   terminateO(news);
  22541   news = allocSmallJson();
  22542   // empty string
  22543   freeO(self);
  22544   setTopSO(self, "");
  22545   setValO(olds, "##");
  22546   r = self->f->replaceSmallStringJson(self, olds, NULL,1);
  22547   ck_assert_ptr_ne(r, null);
  22548   s = toStringO(r);
  22549   ck_assert_str_eq(s, "");
  22550   free(s);
  22551   // empty old delimiter
  22552   freeO(self);
  22553   setTopSO(self, "qwe");
  22554   freeO(news);
  22555   setValO(olds, "");
  22556   setTopSO(news, "|");
  22557   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, olds, news,1), NULL);
  22558   // NULL old delimiter
  22559   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, NULL, news,1), NULL);
  22560   // NULL string
  22561   freeO(self);
  22562   ck_assert_ptr_eq(self->f->replaceSmallStringJson(self, olds, news,1), NULL);
  22563   terminateO(olds);
  22564   terminateO(news);
  22565   terminateO(self);
  22566 
  22567 }
  22568 
  22569 
  22570 void replaceSJsonSmallJsonT(CuTest *tc UNUSED) {
  22571 
  22572   smallJsont* r;
  22573   smallJsont *self = allocSmallJson();
  22574   setTopSO(self, "#ee#ee#ad");
  22575   const char *olds;
  22576   smallJsont *news   = allocSmallJson();
  22577 
  22578   // replace string, multiple character new delimeter
  22579   freeO(news);
  22580   olds = "#";
  22581   setTopSO(news, "^^");
  22582   r = replaceSJsonO(self, olds, news, 0);
  22583   ck_assert_ptr_ne(r, null);
  22584   char *s = toStringO(r);
  22585   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22586   free(s);
  22587   // replace string, multiple character old delimeter
  22588   freeO(self);
  22589   setTopSO(self, "AA##ee##ee#");
  22590   freeO(news);
  22591   olds = "##";
  22592   setTopSO(news, "|");
  22593   r = replaceSJsonO(self, olds, news, 0);
  22594   ck_assert_ptr_ne(r, null);
  22595   s = toStringO(r);
  22596   ck_assert_str_eq(s, "AA|ee|ee#");
  22597   free(s);
  22598   // replace one time at the start of string
  22599   freeO(self);
  22600   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  22608   free(s);
  22609   // replace one time
  22610   freeO(self);
  22611   setTopSO(self, "AA##ee##ee#");
  22612   freeO(news);
  22613   olds = "##";
  22614   setTopSO(news, "|");
  22615   r = replaceSJsonO(self, olds, news,1);
  22616   ck_assert_ptr_ne(r, null);
  22617   s = toStringO(r);
  22618   ck_assert_str_eq(s, "AA|ee##ee#");
  22619   free(s);
  22620   // NULL new delimiter, one time: same as empty delimiter
  22621   freeO(self);
  22622   setTopSO(self, "AA##ee##ee#");
  22623   olds = "##";
  22624   r = replaceSJsonO(self, olds, NULL,1);
  22625   ck_assert_ptr_ne(r, null);
  22626   s = toStringO(r);
  22627   ck_assert_str_eq(s, "AAee##ee#");
  22628   free(s);
  22629   // non json string
  22630   freeO(news);
  22631   olds = "e";
  22632   setTopIntO(news, 1);
  22633   r = replaceSJsonO(self, olds, news,1);
  22634   ck_assert_ptr_eq(r, null);
  22635   // non json object
  22636   terminateO(news);
  22637   news = (smallJsont*) allocSmallInt(1);
  22638   r = replaceSJsonO(self, olds, news,1);
  22639   ck_assert_ptr_eq(r, null);
  22640   terminateO(news);
  22641   news = allocSmallJson();
  22642   // empty string
  22643   freeO(self);
  22644   setTopSO(self, "");
  22645   olds = "##";
  22646   r = replaceSJsonO(self, olds, NULL,1);
  22647   ck_assert_ptr_ne(r, null);
  22648   s = toStringO(r);
  22649   ck_assert_str_eq(s, "");
  22650   free(s);
  22651   // empty old delimiter
  22652   freeO(self);
  22653   setTopSO(self, "qwe");
  22654   freeO(news);
  22655   olds = "";
  22656   setTopSO(news, "|");
  22657   ck_assert_ptr_eq(replaceSJsonO(self, olds, news,1), NULL);
  22658   // NULL old delimiter
  22659   ck_assert_ptr_eq(replaceSJsonO(self, NULL, news,1), NULL);
  22660   // NULL string
  22661   freeO(self);
  22662   ck_assert_ptr_eq(replaceSJsonO(self, olds, news,1), NULL);
  22663   terminateO(news);
  22664   terminateO(self);
  22665 
  22666 }
  22667 
  22668 
  22669 void replaceCharJsonSmallJsonT(CuTest *tc UNUSED) {
  22670 
  22671   smallJsont* r;
  22672   smallJsont *self = allocSmallJson();
  22673   setTopSO(self, "#ee#ee#ad");
  22674   char olds;
  22675   smallJsont *news   = allocSmallJson();
  22676 
  22677   // replace string, multiple character new delimeter
  22678   freeO(news);
  22679   olds = '#';
  22680   setTopSO(news, "^^");
  22681   r = replaceCharJsonO(self, olds, news, 0);
  22682   ck_assert_ptr_ne(r, null);
  22683   char *s = toStringO(r);
  22684   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22685   free(s);
  22686   // replace string, multiple character old delimeter
  22687   freeO(self);
  22688   setTopSO(self, "AA#ee#ee");
  22689   freeO(news);
  22690   olds = '#';
  22691   setTopSO(news, "|");
  22692   r = replaceCharJsonO(self, olds, news, 0);
  22693   ck_assert_ptr_ne(r, null);
  22694   s = toStringO(r);
  22695   ck_assert_str_eq(s, "AA|ee|ee");
  22696   free(s);
  22697   // replace one time at the start of string
  22698   freeO(self);
  22699   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  22707   free(s);
  22708   // replace one time
  22709   freeO(self);
  22710   setTopSO(self, "AA#ee##ee#");
  22711   freeO(news);
  22712   olds = '#';
  22713   setTopSO(news, "|");
  22714   r = replaceCharJsonO(self, olds, news,1);
  22715   ck_assert_ptr_ne(r, null);
  22716   s = toStringO(r);
  22717   ck_assert_str_eq(s, "AA|ee##ee#");
  22718   free(s);
  22719   // NULL new delimiter, one time: same as empty delimiter
  22720   freeO(self);
  22721   setTopSO(self, "AA#ee##ee#");
  22722   olds = '#';
  22723   r = replaceCharJsonO(self, olds, NULL,1);
  22724   ck_assert_ptr_ne(r, null);
  22725   s = toStringO(r);
  22726   ck_assert_str_eq(s, "AAee##ee#");
  22727   free(s);
  22728   // non json string
  22729   freeO(news);
  22730   olds = 'e';
  22731   setTopIntO(news, 1);
  22732   r = replaceCharJsonO(self, olds, news,1);
  22733   ck_assert_ptr_eq(r, null);
  22734   // non json object
  22735   terminateO(news);
  22736   news = (smallJsont*) allocSmallInt(1);
  22737   r = replaceCharJsonO(self, olds, news,1);
  22738   ck_assert_ptr_eq(r, null);
  22739   terminateO(news);
  22740   news = allocSmallJson();
  22741   // empty string
  22742   freeO(self);
  22743   setTopSO(self, "");
  22744   olds = '#';
  22745   r = replaceCharJsonO(self, olds, NULL,1);
  22746   ck_assert_ptr_ne(r, null);
  22747   s = toStringO(r);
  22748   ck_assert_str_eq(s, "");
  22749   free(s);
  22750   // NULL string
  22751   freeO(self);
  22752   freeO(news);
  22753   setTopSO(news, "|");
  22754   ck_assert_ptr_eq(replaceCharJsonO(self, olds, news,1), NULL);
  22755   terminateO(news);
  22756   terminateO(self);
  22757 
  22758 }
  22759 
  22760 
  22761 void replaceManySmallJsonT(CuTest *tc UNUSED) {
  22762 
  22763   smallJsont* r;
  22764   smallJsont *self = allocSmallJson();
  22765   setTopSO(self, "");
  22766 
  22767   // replace string, multiple character new delimeter
  22768   freeO(self);
  22769   setTopSO(self, "#ee#ee#ad");
  22770   r = replaceManyO(self, "#","^^","ad","AD");
  22771   ck_assert_ptr_ne(r, null);
  22772   char *s = toStringO(r);
  22773   ck_assert_str_eq(s, "^^ee^^ee^^AD");
  22774   free(s);
  22775   // replace string, empty new delimeter
  22776   freeO(self);
  22777   setTopSO(self, "#ee#ee#ad");
  22778   r = replaceManyO(self, "#","","ad","AD");
  22779   ck_assert_ptr_ne(r, null);
  22780   s = toStringO(r);
  22781   ck_assert_str_eq(s, "eeeeAD");
  22782   free(s);
  22783   // not enough olds:news pairs
  22784   freeO(self);
  22785   setTopSO(self, "#ee#ee#ad");
  22786   r = replaceManyO(self, "#","","ad");
  22787   ck_assert_ptr_ne(r, null);
  22788   s = toStringO(r);
  22789   ck_assert_str_eq(s, "eeeead");
  22790   free(s);
  22791   // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs
  22792   freeO(self);
  22793   setTopSO(self, "AA##ee##ee#");
  22794   r = replaceManyO(self, "##",NULL);
  22795   ck_assert_ptr_eq(r, null);
  22796   // empty string
  22797   freeO(self);
  22798   setTopSO(self, "");
  22799   r = replaceManyO(self, "##", "");
  22800   ck_assert_ptr_ne(r, null);
  22801   s = toStringO(r);
  22802   ck_assert_str_eq(s, "");
  22803   free(s);
  22804   // empty string many pairs
  22805   freeO(self);
  22806   setTopSO(self, "");
  22807   r = replaceManyO(self, "##", "", "$$", "");
  22808   ck_assert_ptr_ne(r, null);
  22809   s = toStringO(r);
  22810   ck_assert_str_eq(s, "");
  22811   free(s);
  22812   // empty string many pairs empty olds
  22813   freeO(self);
  22814   setTopSO(self, "");
  22815   r = replaceManyO(self, "##", "", "", "");
  22816   ck_assert_ptr_ne(r, null);
  22817   s = toStringO(r);
  22818   ck_assert_str_eq(s, "");
  22819   free(s);
  22820   // empty string and NULL old delimiter
  22821   freeO(self);
  22822   setTopSO(self, "");
  22823   r = replaceManyO(self, NULL,"|");
  22824   ck_assert_ptr_ne(r, null);
  22825   s = toStringO(r);
  22826   ck_assert_str_eq(s, "");
  22827   free(s);
  22828   // empty string and NULL old delimiter not first - same as replace empty string
  22829   freeO(self);
  22830   setTopSO(self, "");
  22831   r = replaceManyO(self,"##","|", NULL,"|");
  22832   ck_assert_ptr_ne(r, null);
  22833   s = toStringO(r);
  22834   ck_assert_str_eq(s, "");
  22835   free(s);
  22836   // empty old delimiter
  22837   freeO(self);
  22838   setTopSO(self, "AA##ee##ee#");
  22839   ck_assert_ptr_eq(replaceManyO(self, "","|", "AA", "BB"), NULL);
  22840   // empty old delimiter not first
  22841   ck_assert_ptr_eq(replaceManyO(self, "##","|", "", "BB"), NULL);
  22842   // NULL string
  22843   freeO(self);
  22844   ck_assert_ptr_eq(replaceManyO(self, "##","|"), NULL);
  22845   terminateO(self);
  22846 
  22847 }
  22848 
  22849 
  22850 void icReplaceSmallJsonT(CuTest *tc UNUSED) {
  22851 
  22852   smallJsont* r;
  22853   smallJsont *self = allocSmallJson();
  22854   setTopSO(self, "BeebeeBad");
  22855 
  22856   // replace string, multiple character new delimeter
  22857   r = icReplaceO(self, "b","^^", 0);
  22858   ck_assert_ptr_ne(r, null);
  22859   char *s = toStringO(r);
  22860   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22861   free(s);
  22862   // replace string, multiple character old delimeter
  22863   freeO(self);
  22864   setTopSO(self, "AA##ee##ee#");
  22865   r = icReplaceO(self, "##","|", 0);
  22866   ck_assert_ptr_ne(r, null);
  22867   s = toStringO(r);
  22868   ck_assert_str_eq(s, "AA|ee|ee#");
  22869   free(s);
  22870   // replace one time at the start of string
  22871   freeO(self);
  22872   setTopSO(self, "#ee#ee#ad");
  22873   r = icReplaceO(self, "#","^^",1);
  22874   ck_assert_ptr_ne(r, null);
  22875   s = toStringO(r);
  22876   ck_assert_str_eq(s, "^^ee#ee#ad");
  22877   free(s);
  22878   // replace one time
  22879   freeO(self);
  22880   setTopSO(self, "AA##ee##ee#");
  22881   r = icReplaceO(self, "##","|",1);
  22882   ck_assert_ptr_ne(r, null);
  22883   s = toStringO(r);
  22884   ck_assert_str_eq(s, "AA|ee##ee#");
  22885   free(s);
  22886   // NULL new delimiter, one time: same as empty delimiter
  22887   freeO(self);
  22888   setTopSO(self, "AA##ee##ee#");
  22889   r = icReplaceO(self, "##",NULL,1);
  22890   ck_assert_ptr_ne(r, null);
  22891   s = toStringO(r);
  22892   ck_assert_str_eq(s, "AAee##ee#");
  22893   free(s);
  22894   // empty string
  22895   freeO(self);
  22896   setTopSO(self, "");
  22897   r = icReplaceO(self, "##",NULL,1);
  22898   ck_assert_ptr_ne(r, null);
  22899   s = toStringO(r);
  22900   ck_assert_str_eq(s, "");
  22901   free(s);
  22902   // empty old delimiter
  22903   freeO(self);
  22904   setTopSO(self, "qwe");
  22905   ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL);
  22906   // NULL old delimiter
  22907   ck_assert_ptr_eq(icReplaceO(self, NULL,"|",1), NULL);
  22908   // empty old delimiter
  22909   ck_assert_ptr_eq(icReplaceO(self, "","|",1), NULL);
  22910   // NULL string
  22911   freeO(self);
  22912   ck_assert_ptr_eq(icReplaceO(self, "##","|",1), NULL);
  22913   terminateO(self);
  22914 
  22915 }
  22916 
  22917 
  22918 void icReplaceCharSSmallJsonT(CuTest *tc UNUSED) {
  22919 
  22920   smallJsont* r;
  22921   smallJsont *self = allocSmallJson();
  22922   setTopSO(self, "");
  22923 
  22924   // replace string, multiple character new delimeter
  22925   freeO(self);
  22926   setTopSO(self, "BeebeeBad");
  22927   r = icReplaceCharSO(self, 'B',"^^", 0);
  22928   ck_assert_ptr_ne(r, null);
  22929   char *s = toStringO(r);
  22930   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  22931   free(s);
  22932   // replace one time at the start of string
  22933   freeO(self);
  22934   setTopSO(self, "#ee#ee#ad");
  22935   r = icReplaceCharSO(self, '#',"^^",1);
  22936   ck_assert_ptr_ne(r, null);
  22937   s = toStringO(r);
  22938   ck_assert_str_eq(s, "^^ee#ee#ad");
  22939   free(s);
  22940   // replace one time
  22941   freeO(self);
  22942   setTopSO(self, "AA##ee##ee#");
  22943   r = icReplaceCharSO(self, '#',"|",1);
  22944   ck_assert_ptr_ne(r, null);
  22945   s = toStringO(r);
  22946   ck_assert_str_eq(s, "AA|#ee##ee#");
  22947   free(s);
  22948   // NULL new delimiter, one time: same as empty delimiter
  22949   freeO(self);
  22950   setTopSO(self, "AA#ee##ee#");
  22951   r = icReplaceCharSO(self, '#',NULL,1);
  22952   ck_assert_ptr_ne(r, null);
  22953   s = toStringO(r);
  22954   ck_assert_str_eq(s, "AAee##ee#");
  22955   free(s);
  22956   // empty string
  22957   freeO(self);
  22958   setTopSO(self, "");
  22959   r = icReplaceCharSO(self, '#',NULL,1);
  22960   ck_assert_ptr_ne(r, null);
  22961   s = toStringO(r);
  22962   ck_assert_str_eq(s, "");
  22963   free(s);
  22964   // empty old delimiter
  22965   freeO(self);
  22966   setTopSO(self, "qwe");
  22967   ck_assert_ptr_eq(icReplaceCharSO(self, 0,"|",1), NULL);
  22968   // NULL string
  22969   freeO(self);
  22970   ck_assert_ptr_eq(icReplaceCharSO(self, '#',"|",1), NULL);
  22971   terminateO(self);
  22972 
  22973 }
  22974 
  22975 
  22976 void icReplaceSCharSmallJsonT(CuTest *tc UNUSED) {
  22977 
  22978   smallJsont* r;
  22979   smallJsont *self = allocSmallJson();
  22980   setTopSO(self, "");
  22981 
  22982   // replace string, multiple character new delimeter
  22983   freeO(self);
  22984   setTopSO(self, "BeebeeBad");
  22985   r = icReplaceSCharO(self, "b",'^',0);
  22986   ck_assert_ptr_ne(r, null);
  22987   char *s = toStringO(r);
  22988   ck_assert_str_eq(s, "^ee^ee^ad");
  22989   free(s);
  22990   // replace string, multiple character old delimeter
  22991   freeO(self);
  22992   setTopSO(self, "AA##ee##ee#");
  22993   r = icReplaceSCharO(self, "##",'|',0);
  22994   ck_assert_ptr_ne(r, null);
  22995   s = toStringO(r);
  22996   ck_assert_str_eq(s, "AA|ee|ee#");
  22997   free(s);
  22998   // replace string empty char, multiple character old delimeter
  22999   freeO(self);
  23000   setTopSO(self, "AA##ee##ee#");
  23001   r = icReplaceSCharO(self, "##", 0,0);
  23002   ck_assert_ptr_ne(r, null);
  23003   s = toStringO(r);
  23004   ck_assert_str_eq(s, "AAeeee#");
  23005   free(s);
  23006   // replace one time at the start of string
  23007   freeO(self);
  23008   setTopSO(self, "#ee#ee#ad");
  23009   r = icReplaceSCharO(self, "#",'^',1);
  23010   ck_assert_ptr_ne(r, null);
  23011   s = toStringO(r);
  23012   ck_assert_str_eq(s, "^ee#ee#ad");
  23013   free(s);
  23014   // replace one time
  23015   freeO(self);
  23016   setTopSO(self, "AA##ee##ee#");
  23017   r = icReplaceSCharO(self, "##",'|',1);
  23018   ck_assert_ptr_ne(r, null);
  23019   s = toStringO(r);
  23020   ck_assert_str_eq(s, "AA|ee##ee#");
  23021   free(s);
  23022   // empty string
  23023   freeO(self);
  23024   setTopSO(self, "");
  23025   r = icReplaceSCharO(self, "##",0,1);
  23026   ck_assert_ptr_ne(r, null);
  23027   s = toStringO(r);
  23028   ck_assert_str_eq(s, "");
  23029   free(s);
  23030   // empty old delimiter
  23031   freeO(self);
  23032   setTopSO(self, "qwe");
  23033   ck_assert_ptr_eq(icReplaceSCharO(self, "",'|',1), NULL);
  23034   // NULL old delimiter
  23035   ck_assert_ptr_eq(icReplaceSCharO(self, NULL,'|',1), NULL);
  23036   // NULL string
  23037   freeO(self);
  23038   ck_assert_ptr_eq(icReplaceSCharO(self, "##",'|',1), NULL);
  23039   terminateO(self);
  23040 
  23041 }
  23042 
  23043 
  23044 void icReplaceCharCharSmallJsonT(CuTest *tc UNUSED) {
  23045 
  23046   smallJsont* r;
  23047   smallJsont *self = allocSmallJson();
  23048   setTopSO(self, "");
  23049 
  23050   // replace string, multiple character new delimeter
  23051   freeO(self);
  23052   setTopSO(self, "beeBeebad");
  23053   r = icReplaceCharCharO(self, 'b','^', 0);
  23054   ck_assert_ptr_ne(r, null);
  23055   char *s = toStringO(r);
  23056   ck_assert_str_eq(s, "^ee^ee^ad");
  23057   free(s);
  23058   // replace one time at the start of string
  23059   freeO(self);
  23060   setTopSO(self, "#ee#ee#ad");
  23061   r = icReplaceCharCharO(self, '#','^',1);
  23062   ck_assert_ptr_ne(r, null);
  23063   s = toStringO(r);
  23064   ck_assert_str_eq(s, "^ee#ee#ad");
  23065   free(s);
  23066   // replace one time
  23067   freeO(self);
  23068   setTopSO(self, "AA#ee##ee#");
  23069   r = icReplaceCharCharO(self, '#','|',1);
  23070   ck_assert_ptr_ne(r, null);
  23071   s = toStringO(r);
  23072   ck_assert_str_eq(s, "AA|ee##ee#");
  23073   free(s);
  23074   // empty string
  23075   freeO(self);
  23076   setTopSO(self, "");
  23077   r = icReplaceCharCharO(self, '#','^',1);
  23078   ck_assert_ptr_ne(r, null);
  23079   s = toStringO(r);
  23080   ck_assert_str_eq(s, "");
  23081   free(s);
  23082   // empty old delimiter
  23083   freeO(self);
  23084   setTopSO(self, "qwe");
  23085   ck_assert_ptr_eq(icReplaceCharCharO(self, 0,'|',1), NULL);
  23086   // NULL string
  23087   freeO(self);
  23088   ck_assert_ptr_eq(icReplaceCharCharO(self, '#','|',1), NULL);
  23089   terminateO(self);
  23090 
  23091 }
  23092 
  23093 
  23094 void icReplaceSmallStringSmallStringSmallJsonT(CuTest *tc UNUSED) {
  23095 
  23096   smallJsont* r;
  23097   smallJsont *self = allocSmallJson();
  23098   setTopSO(self, "beebeebad");
  23099   smallStringt *olds = allocSmallString("");
  23100   smallStringt *news = allocSmallString("");
  23101 
  23102   // replace string, multiple character new delimeter
  23103   setValO(olds, "B");
  23104   setValO(news, "^^");
  23105   r = icReplaceSmallStringSmallStringO(self, olds, news, 0);
  23106   ck_assert_ptr_ne(r, null);
  23107   char *s = toStringO(r);
  23108   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23109   free(s);
  23110   // replace string, multiple character old delimeter
  23111   freeO(self);
  23112   setTopSO(self, "AA##ee##ee#");
  23113   setValO(olds, "##");
  23114   setValO(news, "|");
  23115   r = icReplaceSmallStringSmallStringO(self, olds, news, 0);
  23116   ck_assert_ptr_ne(r, null);
  23117   s = toStringO(r);
  23118   ck_assert_str_eq(s, "AA|ee|ee#");
  23119   free(s);
  23120   // replace one time at the start of string
  23121   freeO(self);
  23122   setTopSO(self, "#ee#ee#ad");
  23123   setValO(olds, "#");
  23124   setValO(news, "^^");
  23125   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23126   ck_assert_ptr_ne(r, null);
  23127   s = toStringO(r);
  23128   ck_assert_str_eq(s, "^^ee#ee#ad");
  23129   free(s);
  23130   // replace one time
  23131   freeO(self);
  23132   setTopSO(self, "AA##ee##ee#");
  23133   setValO(olds, "##");
  23134   setValO(news, "|");
  23135   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23136   ck_assert_ptr_ne(r, null);
  23137   s = toStringO(r);
  23138   ck_assert_str_eq(s, "AA|ee##ee#");
  23139   free(s);
  23140   // NULL new delimiter, one time: same as empty delimiter
  23141   freeO(self);
  23142   setTopSO(self, "AA##ee##ee#");
  23143   setValO(olds, "##");
  23144   r = icReplaceSmallStringSmallStringO(self, olds, NULL,1);
  23145   ck_assert_ptr_ne(r, null);
  23146   s = toStringO(r);
  23147   ck_assert_str_eq(s, "AAee##ee#");
  23148   free(s);
  23149   // non smallString object
  23150   terminateO(olds);
  23151   olds = (smallStringt*) allocSmallInt(1);
  23152   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23153   ck_assert_ptr_eq(r, null);
  23154   terminateO(olds);
  23155   terminateO(news);
  23156   olds = allocSmallString("");
  23157   news = (smallStringt*) allocSmallInt(1);
  23158   r = icReplaceSmallStringSmallStringO(self, olds, news,1);
  23159   ck_assert_ptr_eq(r, null);
  23160   terminateO(news);
  23161   news = allocSmallString("");
  23162   // empty string
  23163   freeO(self);
  23164   setTopSO(self, "");
  23165   setValO(olds, "##");
  23166   r = icReplaceSmallStringSmallStringO(self, olds, NULL,1);
  23167   ck_assert_ptr_ne(r, null);
  23168   s = toStringO(r);
  23169   ck_assert_str_eq(s, "");
  23170   free(s);
  23171   // empty old delimiter
  23172   freeO(self);
  23173   setTopSO(self, "qwe");
  23174   setValO(olds, "");
  23175   setValO(news, "|");
  23176   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL);
  23177   // NULL old delimiter
  23178   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, NULL, news,1), NULL);
  23179   // NULL string
  23180   freeO(self);
  23181   ck_assert_ptr_eq(icReplaceSmallStringSmallStringO(self, olds, news,1), NULL);
  23182   terminateO(olds);
  23183   terminateO(news);
  23184   terminateO(self);
  23185 
  23186 }
  23187 
  23188 
  23189 void icReplaceSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  23190 
  23191   smallJsont* r;
  23192   smallJsont *self = allocSmallJson();
  23193   setTopSO(self, "beebeebad");
  23194   smallStringt *olds = allocSmallString("");
  23195   const char *news;
  23196 
  23197   // replace string, multiple character new delimeter
  23198   setValO(olds, "B");
  23199   news = "^^";
  23200   r = icReplaceSmallStringSO(self, olds, news, 0);
  23201   ck_assert_ptr_ne(r, null);
  23202   char *s = toStringO(r);
  23203   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23204   free(s);
  23205   // replace string, multiple character old delimeter
  23206   freeO(self);
  23207   setTopSO(self, "AA##ee##ee#");
  23208   setValO(olds, "##");
  23209   news = "|";
  23210   r = icReplaceSmallStringSO(self, olds, news, 0);
  23211   ck_assert_ptr_ne(r, null);
  23212   s = toStringO(r);
  23213   ck_assert_str_eq(s, "AA|ee|ee#");
  23214   free(s);
  23215   // replace one time at the start of string
  23216   freeO(self);
  23217   setTopSO(self, "#ee#ee#ad");
  23218   setValO(olds, "#");
  23219   news = "^^";
  23220   r = icReplaceSmallStringSO(self, olds, news,1);
  23221   ck_assert_ptr_ne(r, null);
  23222   s = toStringO(r);
  23223   ck_assert_str_eq(s, "^^ee#ee#ad");
  23224   free(s);
  23225   // replace one time
  23226   freeO(self);
  23227   setTopSO(self, "AA##ee##ee#");
  23228   setValO(olds, "##");
  23229   news = "|";
  23230   r = icReplaceSmallStringSO(self, olds, news,1);
  23231   ck_assert_ptr_ne(r, null);
  23232   s = toStringO(r);
  23233   ck_assert_str_eq(s, "AA|ee##ee#");
  23234   free(s);
  23235   // NULL new delimiter, one time: same as empty delimiter
  23236   freeO(self);
  23237   setTopSO(self, "AA##ee##ee#");
  23238   setValO(olds, "##");
  23239   r = icReplaceSmallStringSO(self, olds, NULL,1);
  23240   ck_assert_ptr_ne(r, null);
  23241   s = toStringO(r);
  23242   ck_assert_str_eq(s, "AAee##ee#");
  23243   free(s);
  23244   // non smallString object
  23245   terminateO(olds);
  23246   olds = (smallStringt*) allocSmallInt(1);
  23247   r = icReplaceSmallStringSO(self, olds, news,1);
  23248   ck_assert_ptr_eq(r, null);
  23249   terminateO(olds);
  23250   olds = allocSmallString("");
  23251   // empty string
  23252   freeO(self);
  23253   setTopSO(self, "");
  23254   setValO(olds, "##");
  23255   r = icReplaceSmallStringSO(self, olds, NULL,1);
  23256   ck_assert_ptr_ne(r, null);
  23257   s = toStringO(r);
  23258   ck_assert_str_eq(s, "");
  23259   free(s);
  23260   // empty old delimiter
  23261   freeO(self);
  23262   setTopSO(self, "qwe");
  23263   setValO(olds, "");
  23264   news = "|";
  23265   ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL);
  23266   // NULL old delimiter
  23267   ck_assert_ptr_eq(icReplaceSmallStringSO(self, NULL, news,1), NULL);
  23268   // NULL string
  23269   freeO(self);
  23270   ck_assert_ptr_eq(icReplaceSmallStringSO(self, olds, news,1), NULL);
  23271   terminateO(olds);
  23272   terminateO(self);
  23273 
  23274 }
  23275 
  23276 
  23277 void icReplaceSmallStringCharSmallJsonT(CuTest *tc UNUSED) {
  23278 
  23279   smallJsont* r;
  23280   smallJsont *self = allocSmallJson();
  23281   setTopSO(self, "beebeebad");
  23282   smallStringt *olds = allocSmallString("");
  23283   char news;
  23284 
  23285   // replace string, multiple character new delimeter
  23286   setValO(olds, "B");
  23287   news = '^';
  23288   r = icReplaceSmallStringCharO(self, olds, news, 0);
  23289   ck_assert_ptr_ne(r, null);
  23290   char *s = toStringO(r);
  23291   ck_assert_str_eq(s, "^ee^ee^ad");
  23292   free(s);
  23293   // replace string, multiple character old delimeter
  23294   freeO(self);
  23295   setTopSO(self, "AA##ee##ee#");
  23296   setValO(olds, "##");
  23297   news = '|';
  23298   r = icReplaceSmallStringCharO(self, olds, news, 0);
  23299   ck_assert_ptr_ne(r, null);
  23300   s = toStringO(r);
  23301   ck_assert_str_eq(s, "AA|ee|ee#");
  23302   free(s);
  23303   // replace one time at the start of string
  23304   freeO(self);
  23305   setTopSO(self, "#ee#ee#ad");
  23306   setValO(olds, "#");
  23307   news = '^';
  23308   r = icReplaceSmallStringCharO(self, olds, news,1);
  23309   ck_assert_ptr_ne(r, null);
  23310   s = toStringO(r);
  23311   ck_assert_str_eq(s, "^ee#ee#ad");
  23312   free(s);
  23313   // replace one time
  23314   freeO(self);
  23315   setTopSO(self, "AA##ee##ee#");
  23316   setValO(olds, "##");
  23317   news = '|';
  23318   r = icReplaceSmallStringCharO(self, olds, news,1);
  23319   ck_assert_ptr_ne(r, null);
  23320   s = toStringO(r);
  23321   ck_assert_str_eq(s, "AA|ee##ee#");
  23322   free(s);
  23323   // non smallString object
  23324   terminateO(olds);
  23325   olds = (smallStringt*) allocSmallInt(1);
  23326   r = icReplaceSmallStringCharO(self, olds, news,1);
  23327   ck_assert_ptr_eq(r, null);
  23328   terminateO(olds);
  23329   olds = allocSmallString("");
  23330   // empty string
  23331   freeO(self);
  23332   setTopSO(self, "");
  23333   setValO(olds, "##");
  23334   r = icReplaceSmallStringCharO(self, olds, news,1);
  23335   ck_assert_ptr_ne(r, null);
  23336   s = toStringO(r);
  23337   ck_assert_str_eq(s, "");
  23338   free(s);
  23339   // empty old delimiter
  23340   freeO(self);
  23341   setTopSO(self, "qwe");
  23342   setValO(olds, "");
  23343   news = '|';
  23344   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL);
  23345   // NULL old delimiter
  23346   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, NULL, news,1), NULL);
  23347   // NULL string
  23348   freeO(self);
  23349   ck_assert_ptr_eq(icReplaceSmallStringCharO(self, olds, news,1), NULL);
  23350   terminateO(olds);
  23351   terminateO(self);
  23352 
  23353 }
  23354 
  23355 
  23356 void icReplaceSSmallStringSmallJsonT(CuTest *tc UNUSED) {
  23357 
  23358   smallJsont* r;
  23359   smallJsont *self = allocSmallJson();
  23360   setTopSO(self, "beebeebad");
  23361   const char *olds;
  23362   smallStringt *news = allocSmallString("");
  23363 
  23364   // replace string, multiple character new delimeter
  23365   olds = "B";
  23366   setValO(news, "^^");
  23367   r = icReplaceSSmallStringO(self, olds, news, 0);
  23368   ck_assert_ptr_ne(r, null);
  23369   char *s = toStringO(r);
  23370   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23371   free(s);
  23372   // replace string, multiple character old delimeter
  23373   freeO(self);
  23374   setTopSO(self, "AA##ee##ee#");
  23375   olds = "##";
  23376   setValO(news, "|");
  23377   r = icReplaceSSmallStringO(self, olds, news, 0);
  23378   ck_assert_ptr_ne(r, null);
  23379   s = toStringO(r);
  23380   ck_assert_str_eq(s, "AA|ee|ee#");
  23381   free(s);
  23382   // replace one time at the start of string
  23383   freeO(self);
  23384   setTopSO(self, "#ee#ee#ad");
  23385   olds = "#";
  23386   setValO(news, "^^");
  23387   r = icReplaceSSmallStringO(self, olds, news,1);
  23388   ck_assert_ptr_ne(r, null);
  23389   s = toStringO(r);
  23390   ck_assert_str_eq(s, "^^ee#ee#ad");
  23391   free(s);
  23392   // replace one time
  23393   freeO(self);
  23394   setTopSO(self, "AA##ee##ee#");
  23395   olds = "##";
  23396   setValO(news, "|");
  23397   r = icReplaceSSmallStringO(self, olds, news,1);
  23398   ck_assert_ptr_ne(r, null);
  23399   s = toStringO(r);
  23400   ck_assert_str_eq(s, "AA|ee##ee#");
  23401   free(s);
  23402   // NULL new delimiter, one time: same as empty delimiter
  23403   freeO(self);
  23404   setTopSO(self, "AA##ee##ee#");
  23405   olds = "##";
  23406   r = icReplaceSSmallStringO(self, olds, NULL,1);
  23407   ck_assert_ptr_ne(r, null);
  23408   s = toStringO(r);
  23409   ck_assert_str_eq(s, "AAee##ee#");
  23410   free(s);
  23411   // non smallString object
  23412   terminateO(news);
  23413   news = (smallStringt*) allocSmallInt(1);
  23414   r = icReplaceSSmallStringO(self, olds, news,1);
  23415   ck_assert_ptr_eq(r, null);
  23416   terminateO(news);
  23417   news = allocSmallString("");
  23418   // empty string
  23419   freeO(self);
  23420   setTopSO(self, "");
  23421   olds = "##";
  23422   r = icReplaceSSmallStringO(self, olds, NULL,1);
  23423   ck_assert_ptr_ne(r, null);
  23424   s = toStringO(r);
  23425   ck_assert_str_eq(s, "");
  23426   free(s);
  23427   // empty old delimiter
  23428   freeO(self);
  23429   setTopSO(self, "qwe");
  23430   olds = "";
  23431   setValO(news, "|");
  23432   ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL);
  23433   // NULL old delimiter
  23434   ck_assert_ptr_eq(icReplaceSSmallStringO(self, NULL, news,1), NULL);
  23435   // NULL string
  23436   freeO(self);
  23437   ck_assert_ptr_eq(icReplaceSSmallStringO(self, olds, news,1), NULL);
  23438   terminateO(news);
  23439   terminateO(self);
  23440 
  23441 }
  23442 
  23443 
  23444 void icReplaceCharSmallStringSmallJsonT(CuTest *tc UNUSED) {
  23445 
  23446   smallJsont* r;
  23447   smallJsont *self = allocSmallJson();
  23448   setTopSO(self, "beebeebad");
  23449   char olds;
  23450   smallStringt *news = allocSmallString("");
  23451 
  23452   // replace string, multiple character new delimeter
  23453   olds = 'B';
  23454   setValO(news, "^^");
  23455   r = icReplaceCharSmallStringO(self, olds, news, 0);
  23456   ck_assert_ptr_ne(r, null);
  23457   char *s = toStringO(r);
  23458   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23459   free(s);
  23460   // replace string, multiple character old delimeter
  23461   freeO(self);
  23462   setTopSO(self, "AA#ee#ee");
  23463   olds = '#';
  23464   setValO(news, "|");
  23465   r = icReplaceCharSmallStringO(self, olds, news, 0);
  23466   ck_assert_ptr_ne(r, null);
  23467   s = toStringO(r);
  23468   ck_assert_str_eq(s, "AA|ee|ee");
  23469   free(s);
  23470   // replace one time at the start of string
  23471   freeO(self);
  23472   setTopSO(self, "#ee#ee#ad");
  23473   olds = '#';
  23474   setValO(news, "^^");
  23475   r = icReplaceCharSmallStringO(self, olds, news,1);
  23476   ck_assert_ptr_ne(r, null);
  23477   s = toStringO(r);
  23478   ck_assert_str_eq(s, "^^ee#ee#ad");
  23479   free(s);
  23480   // replace one time
  23481   freeO(self);
  23482   setTopSO(self, "AA#ee##ee#");
  23483   olds = '#';
  23484   setValO(news, "|");
  23485   r = icReplaceCharSmallStringO(self, olds, news,1);
  23486   ck_assert_ptr_ne(r, null);
  23487   s = toStringO(r);
  23488   ck_assert_str_eq(s, "AA|ee##ee#");
  23489   free(s);
  23490   // NULL new delimiter, one time: same as empty delimiter
  23491   freeO(self);
  23492   setTopSO(self, "AA#ee##ee#");
  23493   olds = '#';
  23494   r = icReplaceCharSmallStringO(self, olds, NULL,1);
  23495   ck_assert_ptr_ne(r, null);
  23496   s = toStringO(r);
  23497   ck_assert_str_eq(s, "AAee##ee#");
  23498   free(s);
  23499   // non smallString object
  23500   terminateO(news);
  23501   news = (smallStringt*) allocSmallInt(1);
  23502   r = icReplaceCharSmallStringO(self, olds, news,1);
  23503   ck_assert_ptr_eq(r, null);
  23504   terminateO(news);
  23505   news = allocSmallString("");
  23506   // empty string
  23507   freeO(self);
  23508   setTopSO(self, "");
  23509   olds = '#';
  23510   r = icReplaceCharSmallStringO(self, olds, NULL,1);
  23511   ck_assert_ptr_ne(r, null);
  23512   s = toStringO(r);
  23513   ck_assert_str_eq(s, "");
  23514   free(s);
  23515   // NULL string
  23516   freeO(self);
  23517   setValO(news, "|");
  23518   ck_assert_ptr_eq(icReplaceCharSmallStringO(self, olds, news,1), NULL);
  23519   terminateO(news);
  23520   terminateO(self);
  23521 
  23522 }
  23523 
  23524 
  23525 void icReplaceJsonJsonSmallJsonT(CuTest *tc UNUSED) {
  23526 
  23527   smallJsont* r;
  23528   smallJsont *self = allocSmallJson();
  23529   setTopSO(self, "BeebeeBad");
  23530   smallJsont *olds = allocSmallJson();
  23531   smallJsont *news = allocSmallJson();
  23532 
  23533   // replace string, multiple character new delimeter
  23534   freeO(olds);
  23535   freeO(news);
  23536   setTopSO(olds, "B");
  23537   setTopSO(news, "^^");
  23538   r = icReplaceJsonJsonO(self, olds, news, 0);
  23539   ck_assert_ptr_ne(r, null);
  23540   char *s = toStringO(r);
  23541   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23542   free(s);
  23543   // replace string, multiple character old delimeter
  23544   freeO(self);
  23545   setTopSO(self, "AA##ee##ee#");
  23546   freeO(olds);
  23547   freeO(news);
  23548   setTopSO(olds, "##");
  23549   setTopSO(news, "|");
  23550   r = icReplaceJsonJsonO(self, olds, news, 0);
  23551   ck_assert_ptr_ne(r, null);
  23552   s = toStringO(r);
  23553   ck_assert_str_eq(s, "AA|ee|ee#");
  23554   free(s);
  23555   // replace one time at the start of string
  23556   freeO(self);
  23557   setTopSO(self, "#ee#ee#ad");
  23558   freeO(olds);
  23559   freeO(news);
  23560   setTopSO(olds, "#");
  23561   setTopSO(news, "^^");
  23562   r = icReplaceJsonJsonO(self, olds, news,1);
  23563   ck_assert_ptr_ne(r, null);
  23564   s = toStringO(r);
  23565   ck_assert_str_eq(s, "^^ee#ee#ad");
  23566   free(s);
  23567   // replace one time
  23568   freeO(self);
  23569   setTopSO(self, "AA##ee##ee#");
  23570   freeO(olds);
  23571   freeO(news);
  23572   setTopSO(olds, "##");
  23573   setTopSO(news, "|");
  23574   r = icReplaceJsonJsonO(self, olds, news,1);
  23575   ck_assert_ptr_ne(r, null);
  23576   s = toStringO(r);
  23577   ck_assert_str_eq(s, "AA|ee##ee#");
  23578   free(s);
  23579   // NULL new delimiter, one time: same as empty delimiter
  23580   freeO(self);
  23581   setTopSO(self, "AA##ee##ee#");
  23582   freeO(olds);
  23583   setTopSO(olds, "##");
  23584   r = icReplaceJsonJsonO(self, olds, NULL,1);
  23585   ck_assert_ptr_ne(r, null);
  23586   s = toStringO(r);
  23587   ck_assert_str_eq(s, "AAee##ee#");
  23588   free(s);
  23589   // non json string
  23590   freeO(olds);
  23591   setTopIntO(olds, 1);
  23592   r = icReplaceJsonJsonO(self, olds, news,1);
  23593   ck_assert_ptr_eq(r, null);
  23594   freeO(olds);
  23595   freeO(news);
  23596   setTopSO(olds, "e");
  23597   setTopIntO(news, 1);
  23598   r = icReplaceJsonJsonO(self, olds, news,1);
  23599   ck_assert_ptr_eq(r, null);
  23600   // non json object
  23601   terminateO(olds);
  23602   olds = (smallJsont*) allocSmallInt(1);
  23603   r = icReplaceJsonJsonO(self, olds, news,1);
  23604   ck_assert_ptr_eq(r, null);
  23605   terminateO(olds);
  23606   terminateO(news);
  23607   olds = allocSmallJson();
  23608   news = (smallJsont*) allocSmallInt(1);
  23609   r = icReplaceJsonJsonO(self, olds, news,1);
  23610   ck_assert_ptr_eq(r, null);
  23611   terminateO(news);
  23612   news = allocSmallJson();
  23613   // empty string
  23614   freeO(self);
  23615   setTopSO(self, "");
  23616   freeO(olds);
  23617   setTopSO(olds, "##");
  23618   r = icReplaceJsonJsonO(self, olds, NULL,1);
  23619   ck_assert_ptr_ne(r, null);
  23620   s = toStringO(r);
  23621   ck_assert_str_eq(s, "");
  23622   free(s);
  23623   // empty old delimiter
  23624   freeO(self);
  23625   setTopSO(self, "qwe");
  23626   freeO(olds);
  23627   freeO(news);
  23628   setTopSO(olds, "");
  23629   setTopSO(news, "|");
  23630   ck_assert_ptr_eq(icReplaceJsonJsonO(self, olds, news,1), NULL);
  23631   // NULL old delimiter
  23632   ck_assert_ptr_eq(icReplaceJsonJsonO(self, NULL, news,1), NULL);
  23633   // NULL string
  23634   freeO(self);
  23635   ck_assert_ptr_eq(icReplaceJsonJsonO(self, olds, news,1), NULL);
  23636   terminateO(olds);
  23637   terminateO(news);
  23638   terminateO(self);
  23639 
  23640 }
  23641 
  23642 
  23643 void icReplaceJsonSmallStringSmallJsonT(CuTest *tc UNUSED) {
  23644 
  23645   smallJsont* r;
  23646   smallJsont *self = allocSmallJson();
  23647   setTopSO(self, "BeebeeBad");
  23648   smallJsont *olds   = allocSmallJson();
  23649   smallStringt *news = allocSmallString("");
  23650 
  23651   // replace string, multiple character new delimeter
  23652   freeO(olds);
  23653   setTopSO(olds, "B");
  23654   setValO(news, "^^");
  23655   r = icReplaceJsonSmallStringO(self, olds, news, 0);
  23656   ck_assert_ptr_ne(r, null);
  23657   char *s = toStringO(r);
  23658   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23659   free(s);
  23660   // replace string, multiple character old delimeter
  23661   freeO(self);
  23662   setTopSO(self, "AA##ee##ee#");
  23663   freeO(olds);
  23664   setTopSO(olds, "##");
  23665   setValO(news, "|");
  23666   r = icReplaceJsonSmallStringO(self, olds, news, 0);
  23667   ck_assert_ptr_ne(r, null);
  23668   s = toStringO(r);
  23669   ck_assert_str_eq(s, "AA|ee|ee#");
  23670   free(s);
  23671   // replace one time at the start of string
  23672   freeO(self);
  23673   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  23681   free(s);
  23682   // replace one time
  23683   freeO(self);
  23684   setTopSO(self, "AA##ee##ee#");
  23685   freeO(olds);
  23686   setTopSO(olds, "##");
  23687   setValO(news, "|");
  23688   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23689   ck_assert_ptr_ne(r, null);
  23690   s = toStringO(r);
  23691   ck_assert_str_eq(s, "AA|ee##ee#");
  23692   free(s);
  23693   // NULL new delimiter, one time: same as empty delimiter
  23694   freeO(self);
  23695   setTopSO(self, "AA##ee##ee#");
  23696   freeO(olds);
  23697   setTopSO(olds, "##");
  23698   r = icReplaceJsonSmallStringO(self, olds, NULL,1);
  23699   ck_assert_ptr_ne(r, null);
  23700   s = toStringO(r);
  23701   ck_assert_str_eq(s, "AAee##ee#");
  23702   free(s);
  23703   // non json string
  23704   freeO(olds);
  23705   setTopIntO(olds, 1);
  23706   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23707   ck_assert_ptr_eq(r, null);
  23708   // non json object
  23709   terminateO(olds);
  23710   olds = (smallJsont*) allocSmallInt(1);
  23711   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23712   ck_assert_ptr_eq(r, null);
  23713   terminateO(olds);
  23714   terminateO(news);
  23715   olds = allocSmallJson();
  23716   news = (smallStringt*) allocSmallInt(1);
  23717   r = icReplaceJsonSmallStringO(self, olds, news,1);
  23718   ck_assert_ptr_eq(r, null);
  23719   terminateO(news);
  23720   news = allocSmallString("");
  23721   // empty string
  23722   freeO(self);
  23723   setTopSO(self, "");
  23724   freeO(olds);
  23725   setTopSO(olds, "##");
  23726   r = icReplaceJsonSmallStringO(self, olds, NULL,1);
  23727   ck_assert_ptr_ne(r, null);
  23728   s = toStringO(r);
  23729   ck_assert_str_eq(s, "");
  23730   free(s);
  23731   // empty old delimiter
  23732   freeO(self);
  23733   setTopSO(self, "qwe");
  23734   freeO(olds);
  23735   setTopSO(olds, "");
  23736   setValO(news, "|");
  23737   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, olds, news,1), NULL);
  23738   // NULL old delimiter
  23739   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, NULL, news,1), NULL);
  23740   // NULL string
  23741   freeO(self);
  23742   ck_assert_ptr_eq(icReplaceJsonSmallStringO(self, olds, news,1), NULL);
  23743   terminateO(olds);
  23744   terminateO(news);
  23745   terminateO(self);
  23746 
  23747 }
  23748 
  23749 
  23750 void icReplaceJsonSSmallJsonT(CuTest *tc UNUSED) {
  23751 
  23752   smallJsont* r;
  23753   smallJsont *self = allocSmallJson();
  23754   setTopSO(self, "BeebeeBad");
  23755   smallJsont *olds   = allocSmallJson();
  23756   const char *news;
  23757 
  23758   // replace string, multiple character new delimeter
  23759   freeO(olds);
  23760   setTopSO(olds, "b");
  23761   news = "^^";
  23762   r = icReplaceJsonSO(self, olds, news, 0);
  23763   ck_assert_ptr_ne(r, null);
  23764   char *s = toStringO(r);
  23765   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23766   free(s);
  23767   // replace string, multiple character old delimeter
  23768   freeO(self);
  23769   setTopSO(self, "AA##ee##ee#");
  23770   freeO(olds);
  23771   setTopSO(olds, "##");
  23772   news = "|";
  23773   r = icReplaceJsonSO(self, olds, news, 0);
  23774   ck_assert_ptr_ne(r, null);
  23775   s = toStringO(r);
  23776   ck_assert_str_eq(s, "AA|ee|ee#");
  23777   free(s);
  23778   // replace one time at the start of string
  23779   freeO(self);
  23780   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  23788   free(s);
  23789   // replace one time
  23790   freeO(self);
  23791   setTopSO(self, "AA##ee##ee#");
  23792   freeO(olds);
  23793   setTopSO(olds, "##");
  23794   news = "|";
  23795   r = icReplaceJsonSO(self, olds, news,1);
  23796   ck_assert_ptr_ne(r, null);
  23797   s = toStringO(r);
  23798   ck_assert_str_eq(s, "AA|ee##ee#");
  23799   free(s);
  23800   // NULL new delimiter, one time: same as empty delimiter
  23801   freeO(self);
  23802   setTopSO(self, "AA##ee##ee#");
  23803   freeO(olds);
  23804   setTopSO(olds, "##");
  23805   r = icReplaceJsonSO(self, olds, NULL,1);
  23806   ck_assert_ptr_ne(r, null);
  23807   s = toStringO(r);
  23808   ck_assert_str_eq(s, "AAee##ee#");
  23809   free(s);
  23810   // non json string
  23811   freeO(olds);
  23812   setTopIntO(olds, 1);
  23813   r = icReplaceJsonSO(self, olds, news,1);
  23814   ck_assert_ptr_eq(r, null);
  23815   // non json object
  23816   terminateO(olds);
  23817   olds = (smallJsont*) allocSmallInt(1);
  23818   r = icReplaceJsonSO(self, olds, news,1);
  23819   ck_assert_ptr_eq(r, null);
  23820   terminateO(olds);
  23821   // empty string
  23822   olds = allocSmallJson();
  23823   freeO(self);
  23824   setTopSO(self, "");
  23825   setTopSO(olds, "##");
  23826   r = icReplaceJsonSO(self, olds, NULL,1);
  23827   ck_assert_ptr_ne(r, null);
  23828   s = toStringO(r);
  23829   ck_assert_str_eq(s, "");
  23830   free(s);
  23831   // empty old delimiter
  23832   freeO(self);
  23833   setTopSO(self, "qwe");
  23834   freeO(olds);
  23835   setTopSO(olds, "");
  23836   news = "|";
  23837   ck_assert_ptr_eq(icReplaceJsonSO(self, olds, news,1), NULL);
  23838   // NULL old delimiter
  23839   ck_assert_ptr_eq(icReplaceJsonSO(self, NULL, news,1), NULL);
  23840   // NULL string
  23841   freeO(self);
  23842   ck_assert_ptr_eq(icReplaceJsonSO(self, olds, news,1), NULL);
  23843   terminateO(olds);
  23844   terminateO(self);
  23845 
  23846 }
  23847 
  23848 
  23849 void icReplaceJsonCharSmallJsonT(CuTest *tc UNUSED) {
  23850 
  23851   smallJsont* r;
  23852   smallJsont *self = allocSmallJson();
  23853   setTopSO(self, "beeBeebad");
  23854   smallJsont *olds   = allocSmallJson();
  23855   char news;
  23856 
  23857   // replace string, multiple character new delimeter
  23858   freeO(olds);
  23859   setTopSO(olds, "B");
  23860   news = '^';
  23861   r = icReplaceJsonCharO(self, olds, news, 0);
  23862   ck_assert_ptr_ne(r, null);
  23863   char *s = toStringO(r);
  23864   ck_assert_str_eq(s, "^ee^ee^ad");
  23865   free(s);
  23866   // replace string, multiple character old delimeter
  23867   freeO(self);
  23868   setTopSO(self, "AA##ee##ee#");
  23869   freeO(olds);
  23870   setTopSO(olds, "##");
  23871   news = '|';
  23872   r = icReplaceJsonCharO(self, olds, news, 0);
  23873   ck_assert_ptr_ne(r, null);
  23874   s = toStringO(r);
  23875   ck_assert_str_eq(s, "AA|ee|ee#");
  23876   free(s);
  23877   // replace one time at the start of string
  23878   freeO(self);
  23879   setTopSO(self, "#ee#ee#ad");
  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, "^ee#ee#ad");
  23887   free(s);
  23888   // replace one time
  23889   freeO(self);
  23890   setTopSO(self, "AA##ee##ee#");
  23891   freeO(olds);
  23892   setTopSO(olds, "##");
  23893   news = '|';
  23894   r = icReplaceJsonCharO(self, olds, news,1);
  23895   ck_assert_ptr_ne(r, null);
  23896   s = toStringO(r);
  23897   ck_assert_str_eq(s, "AA|ee##ee#");
  23898   free(s);
  23899   // non json string
  23900   freeO(self);
  23901   setTopSO(self, "AA##ee##ee#");
  23902   freeO(olds);
  23903   setTopIntO(olds, 1);
  23904   r = icReplaceJsonCharO(self, olds, news,1);
  23905   ck_assert_ptr_eq(r, null);
  23906   // non json object
  23907   terminateO(olds);
  23908   olds = (smallJsont*) allocSmallInt(1);
  23909   r = icReplaceJsonCharO(self, olds, news,1);
  23910   ck_assert_ptr_eq(r, null);
  23911   terminateO(olds);
  23912   // empty string
  23913   olds = allocSmallJson();
  23914   freeO(self);
  23915   setTopSO(self, "");
  23916   setTopSO(olds, "##");
  23917   r = icReplaceJsonCharO(self, olds, news,1);
  23918   ck_assert_ptr_ne(r, null);
  23919   s = toStringO(r);
  23920   ck_assert_str_eq(s, "");
  23921   free(s);
  23922   // empty old delimiter
  23923   freeO(self);
  23924   setTopSO(self, "qwe");
  23925   freeO(olds);
  23926   setTopSO(olds, "");
  23927   news = '|';
  23928   ck_assert_ptr_eq(icReplaceJsonCharO(self, olds, news,1), NULL);
  23929   // NULL old delimiter
  23930   ck_assert_ptr_eq(icReplaceJsonCharO(self, NULL, news,1), NULL);
  23931   // NULL string
  23932   freeO(self);
  23933   ck_assert_ptr_eq(icReplaceJsonCharO(self, olds, news,1), NULL);
  23934   terminateO(olds);
  23935   terminateO(self);
  23936 
  23937 }
  23938 
  23939 
  23940 void icReplaceSmallStringJsonSmallJsonT(CuTest *tc UNUSED) {
  23941 
  23942   smallJsont* r;
  23943   smallJsont *self = allocSmallJson();
  23944   setTopSO(self, "BeeBeeBad");
  23945   smallStringt *olds = allocSmallString("");
  23946   smallJsont *news   = allocSmallJson();
  23947 
  23948   // replace string, multiple character new delimeter
  23949   freeO(news);
  23950   setValO(olds, "b");
  23951   setTopSO(news, "^^");
  23952   r = self->f->icReplaceSmallStringJson(self, olds, news, 0);
  23953   ck_assert_ptr_ne(r, null);
  23954   char *s = toStringO(r);
  23955   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  23956   free(s);
  23957   // replace string, multiple character old delimeter
  23958   freeO(self);
  23959   setTopSO(self, "AA##ee##ee#");
  23960   freeO(news);
  23961   setValO(olds, "##");
  23962   setTopSO(news, "|");
  23963   r = self->f->icReplaceSmallStringJson(self, olds, news, 0);
  23964   ck_assert_ptr_ne(r, null);
  23965   s = toStringO(r);
  23966   ck_assert_str_eq(s, "AA|ee|ee#");
  23967   free(s);
  23968   // replace one time at the start of string
  23969   freeO(self);
  23970   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  23978   free(s);
  23979   // replace one time
  23980   freeO(self);
  23981   setTopSO(self, "AA##ee##ee#");
  23982   freeO(news);
  23983   setValO(olds, "##");
  23984   setTopSO(news, "|");
  23985   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  23986   ck_assert_ptr_ne(r, null);
  23987   s = toStringO(r);
  23988   ck_assert_str_eq(s, "AA|ee##ee#");
  23989   free(s);
  23990   // NULL new delimiter, one time: same as empty delimiter
  23991   freeO(self);
  23992   setTopSO(self, "AA##ee##ee#");
  23993   setValO(olds, "##");
  23994   r = self->f->icReplaceSmallStringJson(self, olds, NULL,1);
  23995   ck_assert_ptr_ne(r, null);
  23996   s = toStringO(r);
  23997   ck_assert_str_eq(s, "AAee##ee#");
  23998   free(s);
  23999   // non json string
  24000   freeO(news);
  24001   setTopIntO(news, 1);
  24002   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  24003   ck_assert_ptr_eq(r, null);
  24004   // non json object
  24005   terminateO(olds);
  24006   olds = (smallStringt*) allocSmallInt(1);
  24007   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  24008   ck_assert_ptr_eq(r, null);
  24009   terminateO(olds);
  24010   terminateO(news);
  24011   olds = allocSmallString("");
  24012   news = (smallJsont*) allocSmallInt(1);
  24013   r = self->f->icReplaceSmallStringJson(self, olds, news,1);
  24014   ck_assert_ptr_eq(r, null);
  24015   terminateO(news);
  24016   news = allocSmallJson();
  24017   // empty string
  24018   freeO(self);
  24019   setTopSO(self, "");
  24020   setValO(olds, "##");
  24021   r = self->f->icReplaceSmallStringJson(self, olds, NULL,1);
  24022   ck_assert_ptr_ne(r, null);
  24023   s = toStringO(r);
  24024   ck_assert_str_eq(s, "");
  24025   free(s);
  24026   // empty old delimiter
  24027   freeO(self);
  24028   setTopSO(self, "qwe");
  24029   freeO(news);
  24030   setValO(olds, "");
  24031   setTopSO(news, "|");
  24032   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, olds, news,1), NULL);
  24033   // NULL old delimiter
  24034   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, NULL, news,1), NULL);
  24035   // NULL string
  24036   freeO(self);
  24037   ck_assert_ptr_eq(self->f->icReplaceSmallStringJson(self, olds, news,1), NULL);
  24038   terminateO(olds);
  24039   terminateO(news);
  24040   terminateO(self);
  24041 
  24042 }
  24043 
  24044 
  24045 void icReplaceSJsonSmallJsonT(CuTest *tc UNUSED) {
  24046 
  24047   smallJsont* r;
  24048   smallJsont *self = allocSmallJson();
  24049   setTopSO(self, "beebeebad");
  24050   const char *olds;
  24051   smallJsont *news   = allocSmallJson();
  24052 
  24053   // replace string, multiple character new delimeter
  24054   freeO(news);
  24055   olds = "B";
  24056   setTopSO(news, "^^");
  24057   r = icReplaceSJsonO(self, olds, news, 0);
  24058   ck_assert_ptr_ne(r, null);
  24059   char *s = toStringO(r);
  24060   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  24061   free(s);
  24062   // replace string, multiple character old delimeter
  24063   freeO(self);
  24064   setTopSO(self, "AA##ee##ee#");
  24065   freeO(news);
  24066   olds = "##";
  24067   setTopSO(news, "|");
  24068   r = icReplaceSJsonO(self, olds, news, 0);
  24069   ck_assert_ptr_ne(r, null);
  24070   s = toStringO(r);
  24071   ck_assert_str_eq(s, "AA|ee|ee#");
  24072   free(s);
  24073   // replace one time at the start of string
  24074   freeO(self);
  24075   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  24083   free(s);
  24084   // replace one time
  24085   freeO(self);
  24086   setTopSO(self, "AA##ee##ee#");
  24087   freeO(news);
  24088   olds = "##";
  24089   setTopSO(news, "|");
  24090   r = icReplaceSJsonO(self, olds, news,1);
  24091   ck_assert_ptr_ne(r, null);
  24092   s = toStringO(r);
  24093   ck_assert_str_eq(s, "AA|ee##ee#");
  24094   free(s);
  24095   // NULL new delimiter, one time: same as empty delimiter
  24096   freeO(self);
  24097   setTopSO(self, "AA##ee##ee#");
  24098   olds = "##";
  24099   r = icReplaceSJsonO(self, olds, NULL,1);
  24100   ck_assert_ptr_ne(r, null);
  24101   s = toStringO(r);
  24102   ck_assert_str_eq(s, "AAee##ee#");
  24103   free(s);
  24104   // non json string
  24105   freeO(news);
  24106   olds = "e";
  24107   setTopIntO(news, 1);
  24108   r = icReplaceSJsonO(self, olds, news,1);
  24109   ck_assert_ptr_eq(r, null);
  24110   // non json object
  24111   terminateO(news);
  24112   news = (smallJsont*) allocSmallInt(1);
  24113   r = icReplaceSJsonO(self, olds, news,1);
  24114   ck_assert_ptr_eq(r, null);
  24115   terminateO(news);
  24116   news = allocSmallJson();
  24117   // empty string
  24118   freeO(self);
  24119   setTopSO(self, "");
  24120   olds = "##";
  24121   r = icReplaceSJsonO(self, olds, NULL,1);
  24122   ck_assert_ptr_ne(r, null);
  24123   s = toStringO(r);
  24124   ck_assert_str_eq(s, "");
  24125   free(s);
  24126   // empty old delimiter
  24127   freeO(self);
  24128   setTopSO(self, "qwe");
  24129   freeO(news);
  24130   olds = "";
  24131   setTopSO(news, "|");
  24132   ck_assert_ptr_eq(icReplaceSJsonO(self, olds, news,1), NULL);
  24133   // NULL old delimiter
  24134   ck_assert_ptr_eq(icReplaceSJsonO(self, NULL, news,1), NULL);
  24135   // NULL string
  24136   freeO(self);
  24137   ck_assert_ptr_eq(icReplaceSJsonO(self, olds, news,1), NULL);
  24138   terminateO(news);
  24139   terminateO(self);
  24140 
  24141 }
  24142 
  24143 
  24144 void icReplaceCharJsonSmallJsonT(CuTest *tc UNUSED) {
  24145 
  24146   smallJsont* r;
  24147   smallJsont *self = allocSmallJson();
  24148   setTopSO(self, "beebeebad");
  24149   char olds;
  24150   smallJsont *news   = allocSmallJson();
  24151 
  24152   // replace string, multiple character new delimeter
  24153   freeO(news);
  24154   olds = 'B';
  24155   setTopSO(news, "^^");
  24156   r = icReplaceCharJsonO(self, olds, news, 0);
  24157   ck_assert_ptr_ne(r, null);
  24158   char *s = toStringO(r);
  24159   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  24160   free(s);
  24161   // replace string, multiple character old delimeter
  24162   freeO(self);
  24163   setTopSO(self, "AA#ee#ee");
  24164   freeO(news);
  24165   olds = '#';
  24166   setTopSO(news, "|");
  24167   r = icReplaceCharJsonO(self, olds, news, 0);
  24168   ck_assert_ptr_ne(r, null);
  24169   s = toStringO(r);
  24170   ck_assert_str_eq(s, "AA|ee|ee");
  24171   free(s);
  24172   // replace one time at the start of string
  24173   freeO(self);
  24174   setTopSO(self, "#ee#ee#ad");
  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, "^^ee#ee#ad");
  24182   free(s);
  24183   // replace one time
  24184   freeO(self);
  24185   setTopSO(self, "AA#ee##ee#");
  24186   freeO(news);
  24187   olds = '#';
  24188   setTopSO(news, "|");
  24189   r = icReplaceCharJsonO(self, olds, news,1);
  24190   ck_assert_ptr_ne(r, null);
  24191   s = toStringO(r);
  24192   ck_assert_str_eq(s, "AA|ee##ee#");
  24193   free(s);
  24194   // NULL new delimiter, one time: same as empty delimiter
  24195   freeO(self);
  24196   setTopSO(self, "AA#ee##ee#");
  24197   olds = '#';
  24198   r = icReplaceCharJsonO(self, olds, NULL,1);
  24199   ck_assert_ptr_ne(r, null);
  24200   s = toStringO(r);
  24201   ck_assert_str_eq(s, "AAee##ee#");
  24202   free(s);
  24203   // non json string
  24204   freeO(news);
  24205   olds = 'e';
  24206   setTopIntO(news, 1);
  24207   r = icReplaceCharJsonO(self, olds, news,1);
  24208   ck_assert_ptr_eq(r, null);
  24209   // non json object
  24210   terminateO(news);
  24211   news = (smallJsont*) allocSmallInt(1);
  24212   r = icReplaceCharJsonO(self, olds, news,1);
  24213   ck_assert_ptr_eq(r, null);
  24214   terminateO(news);
  24215   news = allocSmallJson();
  24216   // empty string
  24217   freeO(self);
  24218   setTopSO(self, "");
  24219   olds = '#';
  24220   r = icReplaceCharJsonO(self, olds, NULL,1);
  24221   ck_assert_ptr_ne(r, null);
  24222   s = toStringO(r);
  24223   ck_assert_str_eq(s, "");
  24224   free(s);
  24225   // NULL string
  24226   freeO(self);
  24227   freeO(news);
  24228   setTopSO(news, "|");
  24229   ck_assert_ptr_eq(icReplaceCharJsonO(self, olds, news,1), NULL);
  24230   terminateO(news);
  24231   terminateO(self);
  24232 
  24233 }
  24234 
  24235 
  24236 void icReplaceManySmallJsonT(CuTest *tc UNUSED) {
  24237 
  24238   smallJsont* r;
  24239   smallJsont *self = allocSmallJson();
  24240   setTopSO(self, "");
  24241 
  24242   // replace string, multiple character new delimeter
  24243   freeO(self);
  24244   setTopSO(self, "beebeebad");
  24245   r = icReplaceManyO(self, "B","^^","aD","AD");
  24246   ck_assert_ptr_ne(r, null);
  24247   char *s = toStringO(r);
  24248   ck_assert_str_eq(s, "^^ee^^ee^^AD");
  24249   free(s);
  24250   // replace string, empty new delimeter
  24251   freeO(self);
  24252   setTopSO(self, "#ee#ee#ad");
  24253   r = icReplaceManyO(self, "#","","ad","AD");
  24254   ck_assert_ptr_ne(r, null);
  24255   s = toStringO(r);
  24256   ck_assert_str_eq(s, "eeeeAD");
  24257   free(s);
  24258   // not enough olds:news pairs
  24259   freeO(self);
  24260   setTopSO(self, "#ee#ee#ad");
  24261   r = icReplaceManyO(self, "#","","ad");
  24262   ck_assert_ptr_ne(r, null);
  24263   s = toStringO(r);
  24264   ck_assert_str_eq(s, "eeeead");
  24265   free(s);
  24266   // NULL new delimiter: same as only 2 parameters or not enough olds:news pairs
  24267   freeO(self);
  24268   setTopSO(self, "AA##ee##ee#");
  24269   r = icReplaceManyO(self, "##",NULL);
  24270   ck_assert_ptr_eq(r, null);
  24271   // empty string
  24272   freeO(self);
  24273   setTopSO(self, "");
  24274   r = icReplaceManyO(self, "##", "");
  24275   ck_assert_ptr_ne(r, null);
  24276   s = toStringO(r);
  24277   ck_assert_str_eq(s, "");
  24278   free(s);
  24279   // empty string many pairs
  24280   freeO(self);
  24281   setTopSO(self, "");
  24282   r = icReplaceManyO(self, "##", "", "$$", "");
  24283   ck_assert_ptr_ne(r, null);
  24284   s = toStringO(r);
  24285   ck_assert_str_eq(s, "");
  24286   free(s);
  24287   // empty string many pairs empty olds
  24288   freeO(self);
  24289   setTopSO(self, "");
  24290   r = icReplaceManyO(self, "##", "", "", "");
  24291   ck_assert_ptr_ne(r, null);
  24292   s = toStringO(r);
  24293   ck_assert_str_eq(s, "");
  24294   free(s);
  24295   // empty string and NULL old delimiter
  24296   freeO(self);
  24297   setTopSO(self, "");
  24298   r = icReplaceManyO(self, NULL,"|");
  24299   ck_assert_ptr_ne(r, null);
  24300   s = toStringO(r);
  24301   ck_assert_str_eq(s, "");
  24302   free(s);
  24303   // empty string and NULL old delimiter not first - same as replace empty string
  24304   freeO(self);
  24305   setTopSO(self, "");
  24306   r = icReplaceManyO(self,"##","|", NULL,"|");
  24307   ck_assert_ptr_ne(r, null);
  24308   s = toStringO(r);
  24309   ck_assert_str_eq(s, "");
  24310   free(s);
  24311   // empty old delimiter
  24312   freeO(self);
  24313   setTopSO(self, "AA##ee##ee#");
  24314   ck_assert_ptr_eq(icReplaceManyO(self, "","|", "AA", "BB"), NULL);
  24315   // empty old delimiter not first
  24316   ck_assert_ptr_eq(icReplaceManyO(self, "##","|", "", "BB"), NULL);
  24317   // NULL string
  24318   freeO(self);
  24319   ck_assert_ptr_eq(icReplaceManyO(self, "##","|"), NULL);
  24320   terminateO(self);
  24321 
  24322 }
  24323 
  24324 
  24325 void equalSmallJsonSmallArrayT(CuTest *tc UNUSED) {
  24326 
  24327   bool r;
  24328   smallJsont *self   = allocG(rtSmallJsont);
  24329   smallArrayt *array = allocSmallArray();
  24330 
  24331   // empty arrays
  24332   setTypeArrayO(self);
  24333   r = self->f->equalSmallArray(self, array);
  24334   ck_assert(r);
  24335   // empty self, non empty array
  24336   array->f->pushInt(array, 1);
  24337   r = self->f->equalSmallArray(self, array);
  24338   ck_assert(!r);
  24339   // non empty self, empty array
  24340   emptyO(array);
  24341   self->f->pushInt(self, 1);
  24342   r = self->f->equalSmallArray(self, array);
  24343   ck_assert(!r);
  24344   // different lengths
  24345   array->f->pushInt(array, 1);
  24346   self->f->pushInt(self, 1);
  24347   r = self->f->equalSmallArray(self, array);
  24348   ck_assert(!r);
  24349   // equal arrays
  24350   array->f->pushInt(array, 1);
  24351   r = self->f->equalSmallArray(self, array);
  24352   ck_assert(r);
  24353   // different int value
  24354   array->f->setAtInt(array, 1, 2);
  24355   r = self->f->equalSmallArray(self, array);
  24356   ck_assert(!r);
  24357   // array same length with a null element in self
  24358   smallIntt *i = self->f->getAtSmallInt(self, 1);
  24359   removeElemIndexO(self, 1);
  24360   terminateO(i);
  24361   r = self->f->equalSmallArray(self, array);
  24362   ck_assert(!r);
  24363   // array same length with a null element in both arrays
  24364   i = array->f->getAtSmallInt(array, 1);
  24365   removeElemO(array, 1);
  24366   terminateO(i);
  24367   r = self->f->equalSmallArray(self, array);
  24368   ck_assert(r);
  24369   // elements of different types
  24370   self->f->setAtBool(self, 1, true);
  24371   array->f->setAtInt(array, 1, 1);
  24372   r = self->f->equalSmallArray(self, array);
  24373   ck_assert(!r);
  24374   // compare bool
  24375   array->f->setAtBool(array, 1, true);
  24376   r = self->f->equalSmallArray(self, array);
  24377   ck_assert(r);
  24378   array->f->setAtBool(array, 1, false);
  24379   r = self->f->equalSmallArray(self, array);
  24380   ck_assert(!r);
  24381   // compare dict
  24382   createSmallDict(d1);
  24383   createSmallDict(d2);
  24384   self->f->setAtDict(self, 1, &d1);
  24385   array->f->setAtDict(array, 1, &d2);
  24386   r = self->f->equalSmallArray(self, array);
  24387   ck_assert(r);
  24388     // reuse dict container, the data is in self already
  24389   resetO(&d1);
  24390   (&d1)->f->setInt(&d1, "a", 1);
  24391   self->f->setAtDict(self, 1, &d1);
  24392   r = self->f->equalSmallArray(self, array);
  24393   ck_assert(!r);
  24394   // compare double
  24395   self->f->setAtDouble(self, 1, 0);
  24396   array->f->setAtDouble(array, 1, 0);
  24397   r = self->f->equalSmallArray(self, array);
  24398   ck_assert(r);
  24399   array->f->setAtDouble(array, 1, 10.5);
  24400   r = self->f->equalSmallArray(self, array);
  24401   ck_assert(!r);
  24402   // compare string
  24403   self->f->setAtS(self, 1, "");
  24404   array->f->setAtS(array, 1, "");
  24405   r = self->f->equalSmallArray(self, array);
  24406   ck_assert(r);
  24407   array->f->setAtS(array, 1, "NO");
  24408   r = self->f->equalSmallArray(self, array);
  24409   ck_assert(!r);
  24410   // compare array elements
  24411   createSmallArray(a1);
  24412   createSmallArray(a2);
  24413   self->f->setAtArray(self, 1, &a1);
  24414   array->f->setAtArray(array, 1, &a2);
  24415   r = self->f->equalSmallArray(self, array);
  24416   ck_assert(r);
  24417     // reuse Array container, the data is in self already
  24418   resetO(&a1);
  24419   (&a1)->f->pushInt(&a1, 1);
  24420   self->f->setAtArray(self, 1, &a1);
  24421   r = self->f->equalSmallArray(self, array);
  24422   ck_assert(!r);
  24423   // compare bytes
  24424   createSmallBytes(b1);
  24425   createSmallBytes(b2);
  24426   self->f->setAtSmallBytes(self, 1, &b1);
  24427   array->f->setAtSmallBytes(array, 1, &b2);
  24428   r = self->f->equalSmallArray(self, array);
  24429   ck_assert(r);
  24430     // reuse SmallBytes container, the data is in self already
  24431   b1.B = null;
  24432   pushBufferO(&b1, &self, 2);
  24433   self->f->setAtSmallBytes(self, 1, &b1);
  24434   r = self->f->equalSmallArray(self, array);
  24435   ck_assert(!r);
  24436     // compare data in both smallBytes elements
  24437   b2.B = null;
  24438   pushBufferO(&b2, (char*)(&self) + 4, 2);
  24439   array->f->setAtSmallBytes(array, 1, &b2);
  24440   r = self->f->equalSmallArray(self, array);
  24441   ck_assert(!r);
  24442   // non smallArray object
  24443   terminateO(array);
  24444   array = (smallArrayt*) allocSmallInt(2);
  24445   r = self->f->equalSmallArray(self, array);
  24446   ck_assert(!r);
  24447   // NULL array
  24448   r = self->f->equalSmallArray(self, NULL);
  24449   ck_assert(!r);
  24450   // non json array
  24451   freeO(self);
  24452   setTypeDictO(self);
  24453   ck_assert(!self->f->equalSmallArray(self, array));
  24454   // non smallArray array
  24455   freeO(self);
  24456   setTypeArrayO(self);
  24457   terminateO(array);
  24458   array = (smallArrayt*) allocSmallInt(2);
  24459   r = self->f->equalSmallArray(self, array);
  24460   ck_assert(!r);
  24461   terminateO(array);
  24462   terminateO(self);
  24463 
  24464 }
  24465 
  24466 
  24467 void equalSmallJsonArrayT(CuTest *tc UNUSED) {
  24468 
  24469   bool r;
  24470   smallJsont *self = allocG(rtSmallJsont);
  24471   char ** p2 = NULL;
  24472 
  24473   // empty arrays
  24474   setTypeArrayO(self);
  24475   r = self->f->equalArray(self, NULL);
  24476   ck_assert(r);
  24477   // empty self, non empty array
  24478   p2 = listCreateS("a");
  24479   r = self->f->equalArray(self, p2);
  24480   ck_assert(!r);
  24481   // non empty self, empty array
  24482   self->f->pushInt(self, 1);
  24483   listFreeS(p2);
  24484   listEmptyS(p2);
  24485   r = self->f->equalArray(self, p2);
  24486   ck_assert(!r);
  24487   // different lengths
  24488   listPushS(&p2, "a");
  24489   self->f->pushInt(self, 2);
  24490   r = self->f->equalArray(self, p2);
  24491   ck_assert(!r);
  24492   // equal arrays
  24493   emptyO(self);
  24494   self->f->pushS(self, "a");
  24495   r = self->f->equalArray(self, p2);
  24496   ck_assert(r);
  24497   // not string type in self
  24498   self->f->setAtInt(self, 0, 0);
  24499   r = self->f->equalArray(self, p2);
  24500   ck_assert(!r);
  24501   // array same length with a null element in self
  24502   smallIntt *i = self->f->getAtSmallInt(self, 0);
  24503   terminateO(i);
  24504   removeElemIndexO(self, 0);
  24505   r = self->f->equalArray(self, p2);
  24506   ck_assert(!r);
  24507   // different strings
  24508   self->f->setAtS(self, 0, "bb");
  24509   r = self->f->equalArray(self, p2);
  24510   ck_assert(!r);
  24511   // non json array
  24512   freeO(self);
  24513   setTypeBoolO(self);
  24514   ck_assert(!self->f->equalArray(self, p2));
  24515   listFreeS(p2);
  24516   terminateO(self);
  24517 
  24518 }
  24519 
  24520 
  24521 void equalSmallJsonBaseT(CuTest *tc UNUSED) {
  24522 
  24523   bool r;
  24524   smallJsont *self = allocSmallJson();
  24525   baset* p2;
  24526 
  24527   // json bool
  24528   setTopBoolO(self, false);
  24529   p2 = (baset*) allocSmallBool(false);
  24530   r = self->f->equalBase(self, p2);
  24531   ck_assert(r);
  24532   freeO(self);
  24533   setTopBoolO(self, true);
  24534   r = self->f->equalBase(self, p2);
  24535   ck_assert(!r);
  24536   terminateO(p2);
  24537   p2 = (baset*) allocSmallBool(true);
  24538   r = self->f->equalBase(self, p2);
  24539   ck_assert(r);
  24540   //  non equal
  24541   terminateO(p2);
  24542   p2 = (baset*) allocSmallString("true ");
  24543   r = self->f->equalBase(self, p2);
  24544   ck_assert(!r);
  24545   // json double
  24546   freeO(self);
  24547   setTopDoubleO(self, 2.2);
  24548   terminateO(p2);
  24549   p2 = (baset*) allocSmallString("2.2");
  24550   r = self->f->equalBase(self, p2);
  24551   ck_assert(r);
  24552   freeO(self);
  24553   setTopDoubleO(self, 2);
  24554   r = self->f->equalBase(self, p2);
  24555   ck_assert(!r);
  24556   terminateO(p2);
  24557   //  p2 is an int so not equal to double (int)2 != (double)2
  24558   //  TODO is this reasonable?
  24559   p2 = (baset*) allocSmallInt(2);
  24560   r = self->f->equalBase(self, p2);
  24561   ck_assert(!r);
  24562   terminateO(p2);
  24563   p2 = (baset*) allocSmallString("asd");
  24564   r = self->f->equalBase(self, p2);
  24565   ck_assert(!r);
  24566   // json int
  24567   freeO(self);
  24568   setTopIntO(self, 2);
  24569   terminateO(p2);
  24570   p2 = (baset*) allocSmallString("2");
  24571   r = self->f->equalBase(self, p2);
  24572   ck_assert(r);
  24573   terminateO(p2);
  24574   p2 = (baset*) allocSmallString("3");
  24575   r = self->f->equalBase(self, p2);
  24576   ck_assert(!r);
  24577   terminateO(p2);
  24578   p2 = (baset*) allocSmallDouble(2);
  24579   r = self->f->equalBase(self, p2);
  24580   ck_assert(!r);
  24581   terminateO(p2);
  24582   p2 = (baset*) allocSmallString("asd");
  24583   r = self->f->equalBase(self, p2);
  24584   ck_assert(!r);
  24585   // json string
  24586   freeO(self);
  24587   setTopSO(self, "12");
  24588   terminateO(p2);
  24589   p2 = (baset*) allocSmallInt(12);
  24590   r = self->f->equalBase(self, p2);
  24591   ck_assert(r);
  24592   // empty self
  24593   freeO(self);
  24594   r = self->f->equalBase(self, p2);
  24595   ck_assert(!r);
  24596   // json dict
  24597   freeO(self);
  24598   setTypeDictO(self);
  24599   terminateO(p2);
  24600   p2 = (baset*) allocSmallInt(12);
  24601   r = self->f->equalBase(self, p2);
  24602   ck_assert(!r);
  24603   terminateO(p2);
  24604   p2 = (baset*) allocSmallDict();
  24605   r = self->f->equalBase(self, p2);
  24606   ck_assert(!r);
  24607   // json array
  24608   freeO(self);
  24609   setTypeArrayO(self);
  24610   terminateO(p2);
  24611   p2 = (baset*) allocSmallInt(12);
  24612   r = self->f->equalBase(self, p2);
  24613   ck_assert(!r);
  24614   self->f->pushInt(self, 1);
  24615   r = self->f->equalBase(self, p2);
  24616   ck_assert(!r);
  24617   terminateO(p2);
  24618   p2 = (baset*) allocSmallArray();
  24619   r = self->f->equalBase(self, p2);
  24620   ck_assert(!r);
  24621   // null object
  24622   freeO(self);
  24623   setTopSO(self, "qwe");
  24624   r = self->f->equalBase(self, null);
  24625   ck_assert(!r);
  24626   terminateO(p2);
  24627   terminateO(self);
  24628 
  24629 }
  24630 
  24631 
  24632 void equalSmallJsonChaT(CuTest *tc UNUSED) {
  24633 
  24634   bool r;
  24635   smallJsont *self = allocSmallJson();
  24636   setTopSO(self, "");
  24637 
  24638   r = equalChaO(self,'q');
  24639   ck_assert(!r);
  24640   freeO(self);
  24641   setTopSO(self, "q");
  24642   r = equalChaO(self,'q');
  24643   ck_assert(r);
  24644   // empty strings
  24645   freeO(self);
  24646   r = equalChaO(self, ' ');
  24647   ck_assert(!r);
  24648   // json int
  24649   freeO(self);
  24650   setTopIntO(self, 1);
  24651   r = equalChaO(self,'1');
  24652   ck_assert(r);
  24653   r = equalChaO(self,'2');
  24654   ck_assert(!r);
  24655   r = equalChaO(self,'q');
  24656   ck_assert(!r);
  24657   // non json string or int
  24658   freeO(self);
  24659   setTypeBoolO(self);
  24660   r = equalChaO(self,'2');
  24661   ck_assert(!r);
  24662   terminateO(self);
  24663 
  24664 }
  24665 
  24666 
  24667 void equalSmallJsonCharT(CuTest *tc UNUSED) {
  24668 
  24669   bool r;
  24670   smallJsont *self = allocSmallJson();
  24671   setTopSO(self, "");
  24672 
  24673   r = equalCharO(self,"qwe");
  24674   ck_assert(!r);
  24675   freeO(self);
  24676   setTopSO(self, "qwe");
  24677   r = equalCharO(self,"qwe");
  24678   ck_assert(r);
  24679   // empty strings
  24680   freeO(self);
  24681   r = equalCharO(self, "");
  24682   ck_assert(!r);
  24683   // json bool
  24684   freeO(self);
  24685   setTypeBoolO(self);
  24686   r = equalCharO(self, "false");
  24687   ck_assert(r);
  24688   r = equalCharO(self, "true");
  24689   ck_assert(!r);
  24690   freeO(self);
  24691   setTopBoolO(self, true);
  24692   r = equalCharO(self, "false");
  24693   ck_assert(!r);
  24694   r = equalCharO(self, "true");
  24695   ck_assert(r);
  24696   r = equalCharO(self, " true");
  24697   ck_assert(!r);
  24698   // json double
  24699   freeO(self);
  24700   setTopDoubleO(self, 2.2);
  24701   r = equalCharO(self, "2.2");
  24702   ck_assert(r);
  24703   freeO(self);
  24704   setTopDoubleO(self, 2);
  24705   r = equalCharO(self, "2.2");
  24706   ck_assert(!r);
  24707   //  value is an int so not equal to double (int)2 != (double)2
  24708   //  TODO is this reasonable?
  24709   r = equalCharO(self, "2");
  24710   ck_assert(!r);
  24711   r = equalCharO(self, "asd");
  24712   ck_assert(!r);
  24713   // json int
  24714   freeO(self);
  24715   setTopIntO(self, 2);
  24716   r = equalCharO(self, "2");
  24717   ck_assert(r);
  24718   r = equalCharO(self, "3");
  24719   ck_assert(!r);
  24720   r = equalCharO(self, "2.0");
  24721   ck_assert(!r);
  24722   r = equalCharO(self, "asd");
  24723   ck_assert(!r);
  24724   // null object
  24725   freeO(self);
  24726   setTopSO(self, "qwe");
  24727   r = equalCharO(self, null);
  24728   ck_assert(!r);
  24729   terminateO(self);
  24730 
  24731 }
  24732 
  24733 
  24734 void equalSmallJsonBoolT(CuTest *tc UNUSED) {
  24735 
  24736   bool r;
  24737   smallJsont* self = allocG(rtSmallJsont);
  24738 
  24739   // empty json
  24740   r = equalBoolO(self, false);
  24741   ck_assert(!r);
  24742   // json bool
  24743   freeO(self);
  24744   setTypeBoolO(self);
  24745   r = equalBoolO(self, false);
  24746   ck_assert(r);
  24747   // json double
  24748   freeO(self);
  24749   setTopDoubleO(self, 1);
  24750   r = equalBoolO(self, true);
  24751   ck_assert(r);
  24752   // json int
  24753   freeO(self);
  24754   setTopIntO(self, 1);
  24755   r = equalBoolO(self, true);
  24756   ck_assert(r);
  24757   // json string
  24758   freeO(self);
  24759   setTopSO(self, "TRUE");
  24760   r = equalBoolO(self, true);
  24761   ck_assert(r);
  24762   freeO(self);
  24763   setTopSO(self, "FALSE");
  24764   r = equalBoolO(self, true);
  24765   ck_assert(!r);
  24766   freeO(self);
  24767   setTopSO(self, "FALSE ");
  24768   r = equalBoolO(self, false);
  24769   ck_assert(!r);
  24770   terminateO(self);
  24771 
  24772 }
  24773 
  24774 
  24775 void equalSmallJsonDoubleT(CuTest *tc UNUSED) {
  24776 
  24777   bool r;
  24778   smallJsont* self = allocG(rtSmallJsont);
  24779 
  24780   // empty json
  24781   r = equalDoubleO(self, 0);
  24782   ck_assert(!r);
  24783   // json bool
  24784   freeO(self);
  24785   setTypeBoolO(self);
  24786   r = equalDoubleO(self, 0);
  24787   ck_assert(r);
  24788   // json double
  24789   freeO(self);
  24790   setTopDoubleO(self, 1.2);
  24791   r = equalDoubleO(self, 1.2);
  24792   ck_assert(r);
  24793   // json int
  24794   freeO(self);
  24795   setTopIntO(self, 1);
  24796   r = equalDoubleO(self, 1);
  24797   ck_assert(r);
  24798   // json string
  24799   freeO(self);
  24800   setTopSO(self, "1.0");
  24801   r = equalDoubleO(self, 1);
  24802   ck_assert(r);
  24803   freeO(self);
  24804   setTopSO(self, "1");
  24805   r = equalDoubleO(self, 1);
  24806   ck_assert(!r);
  24807   freeO(self);
  24808   setTopSO(self, "qwe");
  24809   r = equalDoubleO(self, 0);
  24810   ck_assert(!r);
  24811   terminateO(self);
  24812 
  24813 }
  24814 
  24815 
  24816 void equalSmallJsonInt64T(CuTest *tc UNUSED) {
  24817 
  24818   bool r;
  24819   smallJsont* self = allocG(rtSmallJsont);
  24820 
  24821   // empty json
  24822   r = equalInt64O(self, 0);
  24823   ck_assert(!r);
  24824   // json bool
  24825   freeO(self);
  24826   setTypeBoolO(self);
  24827   r = equalInt64O(self, 0);
  24828   ck_assert(r);
  24829   // json double
  24830   freeO(self);
  24831   setTopDoubleO(self, 2);
  24832   r = equalInt64O(self, 2);
  24833   ck_assert(r);
  24834   // json int
  24835   freeO(self);
  24836   setTopIntO(self, 2);
  24837   r = equalInt64O(self, 2);
  24838   ck_assert(r);
  24839   // json string
  24840   freeO(self);
  24841   setTopSO(self, "3");
  24842   r = equalInt64O(self, 3);
  24843   ck_assert(r);
  24844   freeO(self);
  24845   setTopSO(self, "1.0");
  24846   r = equalInt64O(self, 1);
  24847   ck_assert(!r);
  24848   freeO(self);
  24849   setTopSO(self, "qwe");
  24850   r = equalInt64O(self, 0);
  24851   ck_assert(!r);
  24852   terminateO(self);
  24853 
  24854 }
  24855 
  24856 
  24857 void equalSmallJsonInt32T(CuTest *tc UNUSED) {
  24858 
  24859   bool r;
  24860   smallJsont* self = allocG(rtSmallJsont);
  24861 
  24862   // empty json
  24863   r = equalInt32O(self, 0);
  24864   ck_assert(!r);
  24865   // json bool
  24866   freeO(self);
  24867   setTypeBoolO(self);
  24868   r = equalInt32O(self, 0);
  24869   ck_assert(r);
  24870   // json double
  24871   freeO(self);
  24872   setTopDoubleO(self, 2);
  24873   r = equalInt32O(self, 2);
  24874   ck_assert(r);
  24875   // json int
  24876   freeO(self);
  24877   setTopIntO(self, 2);
  24878   r = equalInt32O(self, 2);
  24879   ck_assert(r);
  24880   // json string
  24881   freeO(self);
  24882   setTopSO(self, "3");
  24883   r = equalInt32O(self, 3);
  24884   ck_assert(r);
  24885   freeO(self);
  24886   setTopSO(self, "1.0");
  24887   r = equalInt32O(self, 1);
  24888   ck_assert(!r);
  24889   freeO(self);
  24890   setTopSO(self, "qwe");
  24891   r = equalInt32O(self, 0);
  24892   ck_assert(!r);
  24893   terminateO(self);
  24894 
  24895 }
  24896 
  24897 
  24898 void equalSmallJsonUint32T(CuTest *tc UNUSED) {
  24899 
  24900   bool r;
  24901   smallJsont* self = allocG(rtSmallJsont);
  24902 
  24903   // empty json
  24904   r = equalUint32O(self, 0);
  24905   ck_assert(!r);
  24906   // json bool
  24907   freeO(self);
  24908   setTypeBoolO(self);
  24909   r = equalUint32O(self, 0);
  24910   ck_assert(r);
  24911   // json double
  24912   freeO(self);
  24913   setTopDoubleO(self, 2);
  24914   r = equalUint32O(self, 2);
  24915   ck_assert(r);
  24916   // json int
  24917   freeO(self);
  24918   setTopIntO(self, 2);
  24919   r = equalUint32O(self, 2);
  24920   ck_assert(r);
  24921   // json string
  24922   freeO(self);
  24923   setTopSO(self, "3");
  24924   r = equalUint32O(self, 3);
  24925   ck_assert(r);
  24926   freeO(self);
  24927   setTopSO(self, "1.0");
  24928   r = equalUint32O(self, 1);
  24929   ck_assert(!r);
  24930   freeO(self);
  24931   setTopSO(self, "qwe");
  24932   r = equalUint32O(self, 0);
  24933   ck_assert(!r);
  24934   terminateO(self);
  24935 
  24936 }
  24937 
  24938 
  24939 void equalSmallJsonUint64T(CuTest *tc UNUSED) {
  24940 
  24941   bool r;
  24942   smallJsont* self = allocG(rtSmallJsont);
  24943 
  24944   // empty json
  24945   r = equalUint64O(self, 0);
  24946   ck_assert(!r);
  24947   // json bool
  24948   freeO(self);
  24949   setTypeBoolO(self);
  24950   r = equalUint64O(self, 0);
  24951   ck_assert(r);
  24952   // json double
  24953   freeO(self);
  24954   setTopDoubleO(self, 2);
  24955   r = equalUint64O(self, 2);
  24956   ck_assert(r);
  24957   // json int
  24958   freeO(self);
  24959   setTopIntO(self, 2);
  24960   r = equalUint64O(self, 2);
  24961   ck_assert(r);
  24962   // json string
  24963   freeO(self);
  24964   setTopSO(self, "3");
  24965   r = equalUint64O(self, 3);
  24966   ck_assert(r);
  24967   freeO(self);
  24968   setTopSO(self, "1.0");
  24969   r = equalUint64O(self, 1);
  24970   ck_assert(!r);
  24971   freeO(self);
  24972   setTopSO(self, "qwe");
  24973   r = equalUint64O(self, 0);
  24974   ck_assert(!r);
  24975   terminateO(self);
  24976 
  24977 }
  24978 
  24979 
  24980 void equalSmallJsonSmallBoolT(CuTest *tc UNUSED) {
  24981 
  24982   bool r;
  24983   smallJsont* self = allocG(rtSmallJsont);
  24984   smallBoolt* p2   = allocSmallBool(false);
  24985 
  24986   // empty json
  24987   r = equalSmallBoolO(self, p2);
  24988   ck_assert(!r);
  24989   // not equal
  24990   setTopBoolO(self, true);
  24991   r = equalSmallBoolO(self, p2);
  24992   ck_assert(!r);
  24993   // equal
  24994   setValO(p2, true);
  24995   r = equalSmallBoolO(self, p2);
  24996   ck_assert(r);
  24997   // empty smallBool
  24998   freeO(p2);
  24999   r = equalSmallBoolO(self, p2);
  25000   ck_assert(!r);
  25001   // non smallBool
  25002   terminateO(p2);
  25003   p2 = (smallBoolt*) allocSmallInt(0);
  25004   r = equalSmallBoolO(self, p2);
  25005   ck_assert(!r);
  25006   // null
  25007   r = equalSmallBoolO(self, null);
  25008   ck_assert(!r);
  25009   terminateO(p2);
  25010   terminateO(self);
  25011 
  25012 }
  25013 
  25014 
  25015 void equalSmallJsonSmallBytesT(CuTest *tc UNUSED) {
  25016 
  25017   bool r;
  25018   smallJsont* self = allocG(rtSmallJsont);
  25019   smallBytest* p2  = allocSmallBytes("true", strlen("true"));
  25020 
  25021   // empty json
  25022   ck_assert(!self->f->equalSmallBytes(self, p2));
  25023   // json bool
  25024   setTopBoolO(self, true);
  25025   ck_assert(!self->f->equalSmallBytes(self, p2));
  25026   freeO(p2);
  25027   pushBufferO(p2, "true", sizeof("true"));
  25028   ck_assert(self->f->equalSmallBytes(self, p2));
  25029   freeO(self);
  25030   setTopBoolO(self, false);
  25031   ck_assert(!self->f->equalSmallBytes(self, p2));
  25032   freeO(p2);
  25033   pushBufferO(p2, "false", sizeof("false"));
  25034   ck_assert(self->f->equalSmallBytes(self, p2));
  25035   freeO(self);
  25036   setTopBoolO(self, true);
  25037   ck_assert(!self->f->equalSmallBytes(self, p2));
  25038   freeO(p2);
  25039   pushBufferO(p2, "False", sizeof("False"));
  25040   ck_assert(!self->f->equalSmallBytes(self, p2));
  25041   // json double
  25042   freeO(self);
  25043   setTopDoubleO(self, 2.2);
  25044   freeO(p2);
  25045   pushBufferO(p2, "2.2", strlen("2.2"));
  25046   r = self->f->equalSmallBytes(self, p2);
  25047   ck_assert(!r);
  25048   freeO(p2);
  25049   pushBufferO(p2, "2.2", sizeof("2.2"));
  25050   r = self->f->equalSmallBytes(self, p2);
  25051   ck_assert(r);
  25052   freeO(self);
  25053   setTopDoubleO(self, 2);
  25054   r = self->f->equalSmallBytes(self, p2);
  25055   ck_assert(!r);
  25056   freeO(p2);
  25057   pushBufferO(p2, "2", sizeof("2"));
  25058   r = self->f->equalSmallBytes(self, p2);
  25059   ck_assert(!r);
  25060   freeO(p2);
  25061   pushBufferO(p2, "asd", sizeof("asd"));
  25062   r = self->f->equalSmallBytes(self, p2);
  25063   ck_assert(!r);
  25064   // json int
  25065   freeO(self);
  25066   setTopIntO(self, 2);
  25067   freeO(p2);
  25068   pushBufferO(p2, "2", strlen("2"));
  25069   r = self->f->equalSmallBytes(self, p2);
  25070   ck_assert(!r);
  25071   freeO(p2);
  25072   pushBufferO(p2, "2", sizeof("2"));
  25073   r = self->f->equalSmallBytes(self, p2);
  25074   ck_assert(r);
  25075   freeO(p2);
  25076   pushBufferO(p2, "3", sizeof("3"));
  25077   r = self->f->equalSmallBytes(self, p2);
  25078   ck_assert(!r);
  25079   freeO(p2);
  25080   pushBufferO(p2, "2.0", sizeof("2.0"));
  25081   r = self->f->equalSmallBytes(self, p2);
  25082   ck_assert(!r);
  25083   freeO(p2);
  25084   pushBufferO(p2, "asd", sizeof("asd"));
  25085   r = self->f->equalSmallBytes(self, p2);
  25086   ck_assert(!r);
  25087   // json string
  25088   freeO(self);
  25089   setTopSO(self, "qweert");
  25090   r = self->f->equalSmallBytes(self, p2);
  25091   ck_assert(!r);
  25092   freeO(self);
  25093   setTopSO(self, "asd");
  25094   r = self->f->equalSmallBytes(self, p2);
  25095   ck_assert(r);
  25096   // empty smallBytes
  25097   freeO(p2);
  25098   ck_assert(!self->f->equalSmallBytes(self, p2));
  25099   // non smallBytes
  25100   terminateO(p2);
  25101   p2 = (smallBytest*) allocSmallInt(0);
  25102   ck_assert(!self->f->equalSmallBytes(self, p2));
  25103   // null
  25104   ck_assert(!self->f->equalSmallBytes(self, null));
  25105   terminateO(p2);
  25106   terminateO(self);
  25107 
  25108 }
  25109 
  25110 
  25111 void equalSmallJsonSmallDoubleT(CuTest *tc UNUSED) {
  25112 
  25113   bool r;
  25114   smallJsont* self = allocG(rtSmallJsont);
  25115   smallDoublet* p2 = allocSmallDouble(0);
  25116 
  25117   // empty json
  25118   r = equalSmallDoubleO(self, p2);
  25119   ck_assert(!r);
  25120   // json bool
  25121   freeO(self);
  25122   setTypeBoolO(self);
  25123   r = equalSmallDoubleO(self, p2);
  25124   ck_assert(r);
  25125   // json double
  25126   freeO(self);
  25127   setTopDoubleO(self, 1.2);
  25128   setValO(p2, 1.2);
  25129   r = equalSmallDoubleO(self, p2);
  25130   ck_assert(r);
  25131   // json int
  25132   freeO(self);
  25133   setTopIntO(self, 1);
  25134   setValO(p2, 1);
  25135   r = equalSmallDoubleO(self, p2);
  25136   ck_assert(r);
  25137   // json string
  25138   freeO(self);
  25139   setTopSO(self, "1.0");
  25140   r = equalSmallDoubleO(self, p2);
  25141   ck_assert(r);
  25142   freeO(self);
  25143   setTopSO(self, "1");
  25144   r = equalSmallDoubleO(self, p2);
  25145   ck_assert(!r);
  25146   freeO(self);
  25147   setTopSO(self, "qwe");
  25148   r = equalSmallDoubleO(self, p2);
  25149   ck_assert(!r);
  25150   // empty smallDouble
  25151   freeO(p2);
  25152   ck_assert(!equalSmallDoubleO(self, p2));
  25153   // non smallDouble
  25154   terminateO(p2);
  25155   p2 = (smallDoublet*) allocSmallInt(0);
  25156   ck_assert(!equalSmallDoubleO(self, p2));
  25157   // null
  25158   ck_assert(!equalSmallDoubleO(self, null));
  25159   terminateO(p2);
  25160   terminateO(self);
  25161 
  25162 }
  25163 
  25164 
  25165 void equalSmallJsonSmallIntT(CuTest *tc UNUSED) {
  25166 
  25167   bool r;
  25168   smallJsont* self = allocG(rtSmallJsont);
  25169   smallIntt* p2    = allocSmallInt(0);
  25170 
  25171   // empty json
  25172   r = equalSmallIntO(self, p2);
  25173   ck_assert(!r);
  25174   // json bool
  25175   freeO(self);
  25176   setTypeBoolO(self);
  25177   r = equalSmallIntO(self, p2);
  25178   ck_assert(r);
  25179   // json double
  25180   freeO(self);
  25181   setTopDoubleO(self, 2);
  25182   setValO(p2, 2);
  25183   r = equalSmallIntO(self, p2);
  25184   ck_assert(r);
  25185   // json int
  25186   freeO(self);
  25187   setTopIntO(self, 2);
  25188   r = equalSmallIntO(self, p2);
  25189   ck_assert(r);
  25190   // json string
  25191   freeO(self);
  25192   setTopSO(self, "3");
  25193   setValO(p2, 3);
  25194   r = equalSmallIntO(self, p2);
  25195   ck_assert(r);
  25196   freeO(self);
  25197   setTopSO(self, "1.0");
  25198   setValO(p2, 1);
  25199   r = equalSmallIntO(self, p2);
  25200   ck_assert(!r);
  25201   freeO(self);
  25202   setTopSO(self, "qwe");
  25203   r = equalSmallIntO(self, p2);
  25204   ck_assert(!r);
  25205   // empty smallInt
  25206   freeO(p2);
  25207   ck_assert(!equalSmallIntO(self, p2));
  25208   // non smallInt
  25209   terminateO(p2);
  25210   p2 = (smallIntt*) allocSmallBool(false);
  25211   ck_assert(!equalSmallIntO(self, p2));
  25212   // null
  25213   ck_assert(!equalSmallIntO(self, null));
  25214   terminateO(p2);
  25215   terminateO(self);
  25216 
  25217 }
  25218 
  25219 
  25220 void equalSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  25221 
  25222   bool r;
  25223   smallJsont* self = allocG(rtSmallJsont);
  25224   smallJsont* p2   = allocSmallJson();
  25225 
  25226   // empty json
  25227   r = equalSmallJsonO(self, p2);
  25228   ck_assert(!r);
  25229   // undefined
  25230   setTypeUndefinedO(p2);
  25231   ck_assert(!equalSmallJsonO(self, p2));
  25232   setTypeUndefinedO(self);
  25233   ck_assert(equalSmallJsonO(self, p2));
  25234   // bool
  25235   freeO(self);
  25236   freeO(p2);
  25237   setTopBoolO(self, true);
  25238   setTopBoolO(p2, true);
  25239   ck_assert(equalSmallJsonO(self, p2));
  25240   // double
  25241   freeO(self);
  25242   freeO(p2);
  25243   setTopDoubleO(self, 2.3);
  25244   setTopDoubleO(p2, 2.3);
  25245   ck_assert(equalSmallJsonO(self, p2));
  25246   // int
  25247   freeO(self);
  25248   freeO(p2);
  25249   setTopIntO(self, 2);
  25250   setTopIntO(p2, 2);
  25251   ck_assert(equalSmallJsonO(self, p2));
  25252   // string
  25253   freeO(self);
  25254   freeO(p2);
  25255   setTopSO(self, "");
  25256   setTopSO(p2, "");
  25257   ck_assert(equalSmallJsonO(self, p2));
  25258   // dict
  25259   freeO(self);
  25260   freeO(p2);
  25261   setTypeDictO(self);
  25262   setTypeDictO(p2);
  25263   ck_assert(equalSmallJsonO(self, p2));
  25264   // array
  25265   freeO(self);
  25266   freeO(p2);
  25267   setTypeArrayO(self);
  25268   setTypeArrayO(p2);
  25269   ck_assert(equalSmallJsonO(self, p2));
  25270   // empty smallJson
  25271   freeO(p2);
  25272   ck_assert(!equalSmallJsonO(self, p2));
  25273   // non smallJson
  25274   terminateO(p2);
  25275   p2 = (smallJsont*) allocSmallBool(false);
  25276   ck_assert(!equalSmallJsonO(self, p2));
  25277   // null
  25278   ck_assert(!equalSmallJsonO(self, null));
  25279   terminateO(p2);
  25280   terminateO(self);
  25281 
  25282 }
  25283 
  25284 
  25285 void equalSmallJsonSmallStringT(CuTest *tc UNUSED) {
  25286 
  25287   bool r;
  25288   smallJsont* self = allocG(rtSmallJsont);
  25289   smallStringt* p2 = allocSmallString("");
  25290 
  25291   // empty json
  25292   r = equalSmallStringO(self, p2);
  25293   ck_assert(!r);
  25294   // json bool
  25295   setTypeBoolO(self);
  25296   setValO(p2, "false");
  25297   r = equalSmallStringO(self, p2);
  25298   ck_assert(r);
  25299   setValO(p2, "true");
  25300   r = equalSmallStringO(self, p2);
  25301   ck_assert(!r);
  25302   freeO(self);
  25303   setTopBoolO(self, true);
  25304   setValO(p2, "false");
  25305   r = equalSmallStringO(self, p2);
  25306   ck_assert(!r);
  25307   setValO(p2, "true");
  25308   r = equalSmallStringO(self, p2);
  25309   ck_assert(r);
  25310   setValO(p2, " true");
  25311   r = equalSmallStringO(self, p2);
  25312   ck_assert(!r);
  25313   // json double
  25314   freeO(self);
  25315   setTopDoubleO(self, 2.2);
  25316   setValO(p2, "2.2");
  25317   r = equalSmallStringO(self, p2);
  25318   ck_assert(r);
  25319   freeO(self);
  25320   setTopDoubleO(self, 2);
  25321   r = equalSmallStringO(self, p2);
  25322   ck_assert(!r);
  25323   setValO(p2, "2");
  25324   r = equalSmallStringO(self, p2);
  25325   ck_assert(!r);
  25326   setValO(p2, "asd");
  25327   r = equalSmallStringO(self, p2);
  25328   ck_assert(!r);
  25329   // json int
  25330   freeO(self);
  25331   setTopIntO(self, 2);
  25332   setValO(p2, "2");
  25333   r = equalSmallStringO(self, p2);
  25334   ck_assert(r);
  25335   setValO(p2, "3");
  25336   r = equalSmallStringO(self, p2);
  25337   ck_assert(!r);
  25338   setValO(p2, "2.0");
  25339   r = equalSmallStringO(self, p2);
  25340   ck_assert(!r);
  25341   setValO(p2, "asd");
  25342   r = equalSmallStringO(self, p2);
  25343   ck_assert(!r);
  25344   // json string
  25345   freeO(self);
  25346   setTopSO(self, "");
  25347   r = equalSmallStringO(self, p2);
  25348   ck_assert(!r);
  25349   freeO(self);
  25350   setTopSO(self, "asd");
  25351   r = equalSmallStringO(self, p2);
  25352   ck_assert(r);
  25353   // empty strings
  25354   freeO(self);
  25355   setValO(p2, "");
  25356   r = equalSmallStringO(self, p2);
  25357   ck_assert(!r);
  25358   // empty smallString
  25359   freeO(p2);
  25360   ck_assert(!equalSmallStringO(self, p2));
  25361   // non smallString
  25362   terminateO(p2);
  25363   p2 = (smallStringt*) allocSmallBool(false);
  25364   ck_assert(!equalSmallStringO(self, p2));
  25365   // null
  25366   ck_assert(!equalSmallStringO(self, null));
  25367   terminateO(p2);
  25368   terminateO(self);
  25369 
  25370 }
  25371 
  25372 
  25373 void equalSmallJsonSmallDictT(CuTest *tc UNUSED) {
  25374 
  25375   bool r;
  25376   smallJsont* self = allocG(rtSmallJsont);
  25377   smallDictt* p2   = allocSmallDict();
  25378 
  25379   // empty json
  25380   r = self->f->equalSmallDict(self, p2);
  25381   ck_assert(!r);
  25382   setTypeDictO(self);
  25383   r = self->f->equalSmallDict(self, p2);
  25384   ck_assert(!r);
  25385   // equal
  25386   self->f->setInt(self, "a", 1);
  25387   self->f->setInt(self, "b", 2);
  25388   self->f->setInt(self, "c", 3);
  25389   p2->f->setInt(p2, "b", 2);
  25390   p2->f->setInt(p2, "a", 1);
  25391   p2->f->setInt(p2, "c", 3);
  25392   r = self->f->equalSmallDict(self, p2);
  25393   ck_assert(r);
  25394   // non equal
  25395   p2->f->setInt(p2, "b", 1);
  25396   r = self->f->equalSmallDict(self, p2);
  25397   ck_assert(!r);
  25398   p2->f->del(p2, "b");
  25399   r = self->f->equalSmallDict(self, p2);
  25400   ck_assert(!r);
  25401   // empty smallDict
  25402   freeO(p2);
  25403   ck_assert(!self->f->equalSmallDict(self, p2));
  25404   // non smallDict
  25405   terminateO(p2);
  25406   p2 = (smallDictt*) allocSmallBool(false);
  25407   ck_assert(!self->f->equalSmallDict(self, p2));
  25408   // null
  25409   ck_assert(!self->f->equalSmallDict(self, null));
  25410   terminateO(p2);
  25411   terminateO(self);
  25412 
  25413 }
  25414 
  25415 
  25416 void icEqualSmallJsonSmallArrayT(CuTest *tc UNUSED) {
  25417 
  25418   bool r;
  25419   smallJsont *self   = allocG(rtSmallJsont);
  25420   smallArrayt *array = allocSmallArray();
  25421 
  25422   // empty arrays
  25423   setTypeArrayO(self);
  25424   r = self->f->icEqualSmallArray(self, array);
  25425   ck_assert(r);
  25426   // empty self, non empty array
  25427   array->f->pushInt(array, 1);
  25428   r = self->f->icEqualSmallArray(self, array);
  25429   ck_assert(!r);
  25430   // non empty self, empty array
  25431   emptyO(array);
  25432   self->f->pushInt(self, 1);
  25433   r = self->f->icEqualSmallArray(self, array);
  25434   ck_assert(!r);
  25435   // different lengths
  25436   array->f->pushInt(array, 1);
  25437   self->f->pushS(self, "a");
  25438   r = self->f->icEqualSmallArray(self, array);
  25439   ck_assert(!r);
  25440   // equal arrays
  25441   array->f->pushS(array, "A");
  25442   r = self->f->icEqualSmallArray(self, array);
  25443   ck_assert(r);
  25444   // different int value
  25445   self->f->setAtInt(self, 1, 1);
  25446   array->f->setAtInt(array, 1, 2);
  25447   r = self->f->icEqualSmallArray(self, array);
  25448   ck_assert(!r);
  25449   // array same length with a null element in self
  25450   smallIntt *i = self->f->getAtSmallInt(self, 1);
  25451   removeElemIndexO(self, 1);
  25452   terminateO(i);
  25453   r = self->f->icEqualSmallArray(self, array);
  25454   ck_assert(!r);
  25455   // array same length with a null element in both arrays
  25456   i = array->f->getAtSmallInt(array, 1);
  25457   removeElemO(array, 1);
  25458   terminateO(i);
  25459   r = self->f->icEqualSmallArray(self, array);
  25460   ck_assert(r);
  25461   // elements of different types
  25462   self->f->setAtBool(self, 1, true);
  25463   array->f->setAtInt(array, 1, 1);
  25464   r = self->f->icEqualSmallArray(self, array);
  25465   ck_assert(!r);
  25466   // compare bool
  25467   array->f->setAtBool(array, 1, true);
  25468   r = self->f->icEqualSmallArray(self, array);
  25469   ck_assert(r);
  25470   array->f->setAtBool(array, 1, false);
  25471   r = self->f->icEqualSmallArray(self, array);
  25472   ck_assert(!r);
  25473   // compare dict
  25474   createSmallDict(d1);
  25475   createSmallDict(d2);
  25476   self->f->setAtDict(self, 1, &d1);
  25477   array->f->setAtDict(array, 1, &d2);
  25478   r = self->f->icEqualSmallArray(self, array);
  25479   ck_assert(r);
  25480     // reuse dict container, the data is in self already
  25481   resetO(&d1);
  25482   (&d1)->f->setInt(&d1, "a", 1);
  25483   self->f->setAtDict(self, 1, &d1);
  25484   r = self->f->icEqualSmallArray(self, array);
  25485   ck_assert(!r);
  25486   // compare double
  25487   self->f->setAtDouble(self, 1, 0);
  25488   array->f->setAtDouble(array, 1, 0);
  25489   r = self->f->icEqualSmallArray(self, array);
  25490   ck_assert(r);
  25491   array->f->setAtDouble(array, 1, 10.5);
  25492   r = self->f->icEqualSmallArray(self, array);
  25493   ck_assert(!r);
  25494   // compare string
  25495   self->f->setAtS(self, 1, "");
  25496   array->f->setAtS(array, 1, "");
  25497   r = self->f->icEqualSmallArray(self, array);
  25498   ck_assert(r);
  25499   array->f->setAtS(array, 1, "NO");
  25500   r = self->f->icEqualSmallArray(self, array);
  25501   ck_assert(!r);
  25502   // compare array elements
  25503   createSmallArray(a1);
  25504   createSmallArray(a2);
  25505   self->f->setAtArray(self, 1, &a1);
  25506   array->f->setAtArray(array, 1, &a2);
  25507   r = self->f->icEqualSmallArray(self, array);
  25508   ck_assert(r);
  25509     // reuse Array container, the data is in self already
  25510   resetO(&a1);
  25511   (&a1)->f->pushInt(&a1, 1);
  25512   self->f->setAtArray(self, 1, &a1);
  25513   r = self->f->icEqualSmallArray(self, array);
  25514   ck_assert(!r);
  25515   // compare bytes
  25516   createSmallBytes(b1);
  25517   createSmallBytes(b2);
  25518   self->f->setAtSmallBytes(self, 1, &b1);
  25519   array->f->setAtSmallBytes(array, 1, &b2);
  25520   r = self->f->icEqualSmallArray(self, array);
  25521   ck_assert(r);
  25522     // reuse SmallBytes container, the data is in self already
  25523   b1.B = null;
  25524   pushBufferO(&b1, &self, 2);
  25525   self->f->setAtSmallBytes(self, 1, &b1);
  25526   r = self->f->icEqualSmallArray(self, array);
  25527   ck_assert(!r);
  25528     // compare data in both smallBytes elements
  25529   b2.B = null;
  25530   pushBufferO(&b2, (char*)(&self) + 4, 2);
  25531   array->f->setAtSmallBytes(array, 1, &b2);
  25532   r = self->f->icEqualSmallArray(self, array);
  25533   ck_assert(!r);
  25534   // non smallArray object
  25535   terminateO(array);
  25536   array = (smallArrayt*) allocSmallInt(2);
  25537   r = self->f->icEqualSmallArray(self, array);
  25538   ck_assert(!r);
  25539   // NULL array
  25540   r = self->f->icEqualSmallArray(self, NULL);
  25541   ck_assert(!r);
  25542   // non json array
  25543   freeO(self);
  25544   setTypeDictO(self);
  25545   ck_assert(!self->f->icEqualSmallArray(self, array));
  25546   // non smallArray array
  25547   freeO(self);
  25548   setTypeArrayO(self);
  25549   terminateO(array);
  25550   array = (smallArrayt*) allocSmallInt(2);
  25551   r = self->f->icEqualSmallArray(self, array);
  25552   ck_assert(!r);
  25553   terminateO(array);
  25554   terminateO(self);
  25555 
  25556 }
  25557 
  25558 
  25559 void icEqualSmallJsonArrayT(CuTest *tc UNUSED) {
  25560 
  25561   bool r;
  25562   smallJsont *self = allocG(rtSmallJsont);
  25563   char ** p2       = NULL;
  25564 
  25565   // empty arrays
  25566   setTypeArrayO(self);
  25567   r = self->f->icEqualArray(self, NULL);
  25568   ck_assert(r);
  25569   // empty self, non empty array
  25570   p2 = listCreateS("a");
  25571   r = self->f->icEqualArray(self, p2);
  25572   ck_assert(!r);
  25573   // non empty self, empty array
  25574   self->f->pushInt(self, 1);
  25575   listFreeS(p2);
  25576   listEmptyS(p2);
  25577   r = self->f->icEqualArray(self, p2);
  25578   ck_assert(!r);
  25579   // different lengths
  25580   listPushS(&p2, "a");
  25581   self->f->pushInt(self, 2);
  25582   r = self->f->icEqualArray(self, p2);
  25583   ck_assert(!r);
  25584   // equal arrays
  25585   emptyO(self);
  25586   self->f->pushS(self, "A");
  25587   r = self->f->icEqualArray(self, p2);
  25588   ck_assert(r);
  25589   // not string type in self
  25590   self->f->setAtInt(self, 0, 0);
  25591   r = self->f->icEqualArray(self, p2);
  25592   ck_assert(!r);
  25593   // array same length with a null element in self
  25594   smallIntt *i = self->f->getAtSmallInt(self, 0);
  25595   terminateO(i);
  25596   removeElemIndexO(self, 0);
  25597   r = self->f->icEqualArray(self, p2);
  25598   ck_assert(!r);
  25599   // different strings
  25600   self->f->setAtS(self, 0, "bb");
  25601   r = self->f->icEqualArray(self, p2);
  25602   ck_assert(!r);
  25603   // non json array
  25604   freeO(self);
  25605   setTypeBoolO(self);
  25606   ck_assert(!self->f->icEqualArray(self, p2));
  25607   listFreeS(p2);
  25608   terminateO(self);
  25609 
  25610 }
  25611 
  25612 
  25613 void icEqualSmallJsonBaseT(CuTest *tc UNUSED) {
  25614 
  25615   bool r;
  25616   smallJsont *self = allocG(rtSmallJsont);
  25617   baset* p2;
  25618 
  25619   // json bool
  25620   setTopBoolO(self, false);
  25621   p2 = (baset*) allocSmallBool(false);
  25622   r = self->f->icEqualBase(self, p2);
  25623   ck_assert(r);
  25624   freeO(self);
  25625   setTopBoolO(self, true);
  25626   r = self->f->icEqualBase(self, p2);
  25627   ck_assert(!r);
  25628   terminateO(p2);
  25629   p2 = (baset*) allocSmallBool(true);
  25630   r = self->f->icEqualBase(self, p2);
  25631   ck_assert(r);
  25632   //  non equal
  25633   terminateO(p2);
  25634   p2 = (baset*) allocSmallString("true ");
  25635   r = self->f->icEqualBase(self, p2);
  25636   ck_assert(!r);
  25637   // json double
  25638   freeO(self);
  25639   setTopDoubleO(self, 2.2);
  25640   terminateO(p2);
  25641   p2 = (baset*) allocSmallString("2.2");
  25642   r = self->f->icEqualBase(self, p2);
  25643   ck_assert(r);
  25644   freeO(self);
  25645   setTopDoubleO(self, 2);
  25646   r = self->f->icEqualBase(self, p2);
  25647   ck_assert(!r);
  25648   terminateO(p2);
  25649   //  p2 is an int so not equal to double (int)2 != (double)2
  25650   //  TODO is this reasonable?
  25651   p2 = (baset*) allocSmallInt(2);
  25652   r = self->f->icEqualBase(self, p2);
  25653   ck_assert(!r);
  25654   terminateO(p2);
  25655   p2 = (baset*) allocSmallString("asd");
  25656   r = self->f->icEqualBase(self, p2);
  25657   ck_assert(!r);
  25658   // json int
  25659   freeO(self);
  25660   setTopIntO(self, 2);
  25661   terminateO(p2);
  25662   p2 = (baset*) allocSmallString("2");
  25663   r = self->f->icEqualBase(self, p2);
  25664   ck_assert(r);
  25665   terminateO(p2);
  25666   p2 = (baset*) allocSmallString("3");
  25667   r = self->f->icEqualBase(self, p2);
  25668   ck_assert(!r);
  25669   terminateO(p2);
  25670   p2 = (baset*) allocSmallDouble(2);
  25671   r = self->f->icEqualBase(self, p2);
  25672   ck_assert(!r);
  25673   terminateO(p2);
  25674   p2 = (baset*) allocSmallString("asd");
  25675   r = self->f->icEqualBase(self, p2);
  25676   ck_assert(!r);
  25677   // json string
  25678   freeO(self);
  25679   setTopSO(self, "asd");
  25680   terminateO(p2);
  25681   p2 = (baset*) allocSmallString("ASD");
  25682   r = self->f->icEqualBase(self, p2);
  25683   ck_assert(r);
  25684   // empty self
  25685   freeO(self);
  25686   r = self->f->icEqualBase(self, p2);
  25687   ck_assert(!r);
  25688   //  non smallString p2
  25689   setTopSO(self, "asd");
  25690   terminateO(p2);
  25691   p2 = (baset*) allocSmallBool(false);
  25692   r = self->f->icEqualBase(self, p2);
  25693   ck_assert(!r);
  25694   // json dict
  25695   freeO(self);
  25696   setTypeDictO(self);
  25697   self->f->setS(self, "1", "a");
  25698   terminateO(p2);
  25699   p2 = (baset*) allocSmallInt(12);
  25700   r = self->f->icEqualBase(self, p2);
  25701   ck_assert(!r);
  25702   terminateO(p2);
  25703   smallDictt *d = allocSmallDict();
  25704   d->f->setS(d, "1", "A");
  25705   p2 = (baset*) d;
  25706   r = self->f->icEqualBase(self, p2);
  25707   ck_assert(r);
  25708   // json array
  25709   freeO(self);
  25710   setTypeArrayO(self);
  25711   self->f->pushS(self, "a");
  25712   terminateO(p2);
  25713   p2 = (baset*) allocSmallInt(12);
  25714   r = self->f->icEqualBase(self, p2);
  25715   ck_assert(!r);
  25716   r = self->f->icEqualBase(self, p2);
  25717   ck_assert(!r);
  25718   terminateO(p2);
  25719   smallArrayt *a = allocSmallArray();
  25720   a->f->pushS(a, "A");
  25721   p2 = (baset*) a;
  25722   r = self->f->icEqualBase(self, p2);
  25723   ck_assert(r);
  25724   // null object
  25725   freeO(self);
  25726   setTopSO(self, "qwe");
  25727   r = self->f->icEqualBase(self, null);
  25728   ck_assert(!r);
  25729   terminateO(p2);
  25730   terminateO(self);
  25731 
  25732 }
  25733 
  25734 
  25735 void icEqualSmallJsonSmallDictT(CuTest *tc UNUSED) {
  25736 
  25737   bool r;
  25738   smallJsont* self = allocG(rtSmallJsont);
  25739   smallDictt* p2   = allocSmallDict();
  25740 
  25741   // empty json
  25742   r = self->f->icEqualSmallDict(self, p2);
  25743   ck_assert(!r);
  25744   setTypeDictO(self);
  25745   r = self->f->icEqualSmallDict(self, p2);
  25746   ck_assert(!r);
  25747   // equal
  25748   self->f->setS(self, "a", "a");
  25749   self->f->setInt(self, "b", 2);
  25750   self->f->setInt(self, "c", 3);
  25751   p2->f->setInt(p2, "b", 2);
  25752   p2->f->setS(p2, "a", "A");
  25753   p2->f->setInt(p2, "c", 3);
  25754   r = self->f->icEqualSmallDict(self, p2);
  25755   ck_assert(r);
  25756   // non equal
  25757   p2->f->setInt(p2, "b", 1);
  25758   r = self->f->icEqualSmallDict(self, p2);
  25759   ck_assert(!r);
  25760   p2->f->del(p2, "b");
  25761   r = self->f->icEqualSmallDict(self, p2);
  25762   ck_assert(!r);
  25763   // empty smallDict
  25764   freeO(p2);
  25765   ck_assert(!self->f->icEqualSmallDict(self, p2));
  25766   // non smallDict
  25767   terminateO(p2);
  25768   p2 = (smallDictt*) allocSmallBool(false);
  25769   ck_assert(!self->f->icEqualSmallDict(self, p2));
  25770   // null
  25771   ck_assert(!self->f->icEqualSmallDict(self, null));
  25772   terminateO(p2);
  25773   terminateO(self);
  25774 
  25775 }
  25776 
  25777 
  25778 void icEqualSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  25779 
  25780   bool r;
  25781   smallJsont *self = allocG(rtSmallJsont);
  25782   smallJsont *string = allocSmallJson();
  25783 
  25784   // empty json
  25785   setTopSO(string, "qwe");
  25786   r = icEqualSmallJsonO(self, string);
  25787   ck_assert(!r);
  25788   // equal
  25789   setTopSO(self, "QWE");
  25790   r = icEqualSmallJsonO(self, string);
  25791   ck_assert(r);
  25792   // different length
  25793   freeO(self);
  25794   setTopSO(self, "QWE ");
  25795   r = icEqualSmallJsonO(self, string);
  25796   ck_assert(!r);
  25797   // non json string
  25798   terminateO(string);
  25799   string = (smallJsont*) allocSmallBool(true);
  25800   r = icEqualSmallJsonO(self, string);
  25801   ck_assert(!r);
  25802   // null
  25803   r = icEqualSmallJsonO(self, null);
  25804   ck_assert(!r);
  25805   terminateO(string);
  25806   terminateO(self);
  25807 
  25808 }
  25809 
  25810 
  25811 void icEqualSmallJsonSmallStringT(CuTest *tc UNUSED) {
  25812 
  25813   bool r;
  25814   smallJsont *self     = allocG(rtSmallJsont);
  25815   smallStringt *string = allocSmallString("qwe");
  25816 
  25817   // empty json
  25818   r = icEqualSmallStringO(self, string);
  25819   ck_assert(!r);
  25820   // equal
  25821   setTopSO(self, "QWE");
  25822   r = icEqualSmallStringO(self, string);
  25823   ck_assert(r);
  25824   // different length
  25825   freeO(self);
  25826   setTopSO(self, "QWE ");
  25827   r = icEqualSmallStringO(self, string);
  25828   ck_assert(!r);
  25829   // empty string
  25830   freeO(string);
  25831   r = icEqualSmallStringO(self, string);
  25832   ck_assert(!r);
  25833   // non json string
  25834   terminateO(string);
  25835   string = (smallStringt*) allocSmallBool(true);
  25836   r = icEqualSmallStringO(self, string);
  25837   ck_assert(!r);
  25838   // null
  25839   r = icEqualSmallStringO(self, null);
  25840   ck_assert(!r);
  25841   terminateO(string);
  25842   terminateO(self);
  25843 
  25844 }
  25845 
  25846 
  25847 void icEqualSSmallJsonT(CuTest *tc UNUSED) {
  25848 
  25849   bool r;
  25850   smallJsont *self = allocG(rtSmallJsont);
  25851 
  25852   // empty json
  25853   r = icEqualSO(self, "qwe");
  25854   ck_assert(!r);
  25855   // equal
  25856   setTopSO(self, "QWE");
  25857   r = icEqualSO(self, "qwe");
  25858   ck_assert(r);
  25859   // different length
  25860   r = icEqualSO(self, "qwe ");
  25861   ck_assert(!r);
  25862   // null
  25863   r = icEqualSO(self, null);
  25864   ck_assert(!r);
  25865   terminateO(self);
  25866 
  25867 }
  25868 
  25869 
  25870 void icEqualCharSmallJsonT(CuTest *tc UNUSED) {
  25871 
  25872   bool r;
  25873   smallJsont *self = allocG(rtSmallJsont);
  25874   setTopSO(self, "");
  25875 
  25876   r = icEqualCharO(self,'q');
  25877   ck_assert(!r);
  25878   freeO(self);
  25879   setTopSO(self, "q");
  25880   r = icEqualCharO(self,'Q');
  25881   ck_assert(r);
  25882   // empty strings
  25883   freeO(self);
  25884   r = icEqualCharO(self, ' ');
  25885   ck_assert(!r);
  25886   // json int
  25887   freeO(self);
  25888   setTopIntO(self, 1);
  25889   r = icEqualCharO(self,'1');
  25890   ck_assert(r);
  25891   r = icEqualCharO(self,'2');
  25892   ck_assert(!r);
  25893   r = icEqualCharO(self,'q');
  25894   ck_assert(!r);
  25895   // non json string or int
  25896   freeO(self);
  25897   setTypeBoolO(self);
  25898   r = icEqualCharO(self,'2');
  25899   ck_assert(!r);
  25900   terminateO(self);
  25901 
  25902 }
  25903 
  25904 
  25905 void equalISSmallJsonT(CuTest *tc UNUSED) {
  25906 
  25907   smallJsont *self = allocSmallJson();
  25908   setTopSO(self, "Ashee|");
  25909 
  25910   // identical strings
  25911   ck_assert(equalISO(self, "shee", 1));
  25912   freeO(self);
  25913   setTopSO(self, "Ashee");
  25914   ck_assert(equalISO(self, "shee", -4));
  25915   // string at index shorter than string2
  25916   ck_assert(!equalISO(self, "shee", 2));
  25917   // empty string
  25918   freeO(self);
  25919   setTopSO(self, "");
  25920   ck_assert(!equalISO(self, "shee", 0));
  25921   ck_assert(equalISO(self, "", 0));
  25922   freeO(self);
  25923   setTopSO(self, "Ashee");
  25924   ck_assert(!equalISO(self, "", 0));
  25925   // index mismatch
  25926   ck_assert(!equalISO(self, "shee", 0));
  25927   // index outside
  25928   ck_assert(!equalISO(self, "shee", 10));
  25929   ck_assert(!equalISO(self, "shee", -10));
  25930   // different strings
  25931   ck_assert(!equalISO(self, "SH",0));
  25932   // empty self
  25933   freeO(self);
  25934   ck_assert(!equalISO(self, "SH",0));
  25935   // NULL string
  25936   freeO(self);
  25937   setTopSO(self, "Ashee");
  25938   ck_assert(!equalISO(self, NULL, 0));
  25939   terminateO(self);
  25940 
  25941 }
  25942 
  25943 
  25944 void equalICharSmallJsonT(CuTest *tc UNUSED) {
  25945 
  25946   smallJsont *self = allocSmallJson();
  25947   setTopSO(self, "Ashee");
  25948 
  25949   // identical strings
  25950   ck_assert(equalICharO(self, 's', 1));
  25951   ck_assert(equalICharO(self, 's', -4));
  25952   ck_assert(!equalICharO(self, 's', 2));
  25953   // empty string
  25954   freeO(self);
  25955   setTopSO(self, "");
  25956   ck_assert(!equalICharO(self, 's', 0));
  25957   ck_assert(equalICharO(self, 0, 0));
  25958   freeO(self);
  25959   setTopSO(self, "Ashee");
  25960   ck_assert(!equalICharO(self, 0, 0));
  25961   // index mismatch
  25962   ck_assert(!equalICharO(self, 's', 0));
  25963   // index outside
  25964   ck_assert(!equalICharO(self, 's', 10));
  25965   ck_assert(!equalICharO(self, 's', -10));
  25966   // different strings
  25967   freeO(self);
  25968   setTopSO(self, "shee");
  25969   ck_assert(!equalICharO(self, 'S',0));
  25970   // NULL string
  25971   ck_assert(!equalICharO(self, 0, 0));
  25972   // empty self
  25973   freeO(self);
  25974   ck_assert(!equalICharO(self, 'S',0));
  25975   terminateO(self);
  25976 
  25977 }
  25978 
  25979 
  25980 void equalIJsonSmallJsonT(CuTest *tc UNUSED) {
  25981 
  25982   smallJsont *self = allocSmallJson();
  25983   setTopSO(self, "Ashee|");
  25984   smallJsont *string = allocSmallJson();
  25985 
  25986   // identical strings
  25987   setTopSO(string, "shee");
  25988   ck_assert(equalIJsonO(self, string, 1));
  25989   freeO(self);
  25990   setTopSO(self, "Ashee");
  25991   ck_assert(equalIJsonO(self, string, -4));
  25992   // string at index shorter than string2
  25993   ck_assert(!equalIJsonO(self, string, 2));
  25994   // empty string
  25995   freeO(self);
  25996   setTopSO(self, "");
  25997   ck_assert(!equalIJsonO(self, string, 0));
  25998   freeO(string);
  25999   setTopSO(string, "");
  26000   ck_assert(equalIJsonO(self, string, 0));
  26001   freeO(self);
  26002   setTopSO(self, "Ashee");
  26003   ck_assert(!equalIJsonO(self, string, 0));
  26004   // index mismatch
  26005   freeO(string);
  26006   setTopSO(string, "shee");
  26007   ck_assert(!equalIJsonO(self, string, 0));
  26008   // index outside
  26009   ck_assert(!equalIJsonO(self, string, 10));
  26010   ck_assert(!equalIJsonO(self, string, -10));
  26011   // different strings
  26012   freeO(string);
  26013   setTopSO(string, "SH");
  26014   ck_assert(!equalIJsonO(self, string,0));
  26015   // non json string
  26016   freeO(string);
  26017   setTopIntO(string, 1);
  26018   ck_assert(!equalIJsonO(self, string,0));
  26019   // non json object
  26020   terminateO(string);
  26021   string = (smallJsont*) allocSmallInt(2);
  26022   ck_assert(!equalIJsonO(self, string,0));
  26023   // empty self
  26024   terminateO(string);
  26025   string = allocSmallJson();
  26026   setTopSO(string, "SH");
  26027   freeO(self);
  26028   ck_assert(!equalIJsonO(self, string,0));
  26029   // NULL string
  26030   freeO(self);
  26031   setTopSO(self, "Ashee");
  26032   ck_assert(!equalIJsonO(self, NULL, 0));
  26033   terminateO(string);
  26034   terminateO(self);
  26035 
  26036 }
  26037 
  26038 
  26039 void equalISmallStringSmallJsonT(CuTest *tc UNUSED) {
  26040 
  26041   smallJsont *self = allocSmallJson();
  26042   setTopSO(self, "Ashee|");
  26043   smallStringt *string = allocSmallString("shee");
  26044 
  26045   // identical strings
  26046   ck_assert(equalISmallStringO(self, string, 1));
  26047   freeO(self);
  26048   setTopSO(self, "Ashee");
  26049   ck_assert(equalISmallStringO(self, string, -4));
  26050   // string at index shorter than string2
  26051   ck_assert(!equalISmallStringO(self, string, 2));
  26052   // empty string
  26053   freeO(self);
  26054   setTopSO(self, "");
  26055   ck_assert(!equalISmallStringO(self, string, 0));
  26056   setValO(string, "");
  26057   ck_assert(equalISmallStringO(self, string, 0));
  26058   freeO(self);
  26059   setTopSO(self, "Ashee");
  26060   ck_assert(!equalISmallStringO(self, string, 0));
  26061   // index mismatch
  26062   freeO(string);
  26063   setValO(string, "shee");
  26064   ck_assert(!equalISmallStringO(self, string, 0));
  26065   // index outside
  26066   ck_assert(!equalISmallStringO(self, string, 10));
  26067   ck_assert(!equalISmallStringO(self, string, -10));
  26068   // different strings
  26069   setValO(string, "SH");
  26070   ck_assert(!equalISmallStringO(self, string,0));
  26071   // non smallString object
  26072   terminateO(string);
  26073   string = (smallStringt*) allocSmallInt(2);
  26074   ck_assert(!equalISmallStringO(self, string,0));
  26075   // empty self
  26076   terminateO(string);
  26077   string = allocSmallString("SH");
  26078   freeO(self);
  26079   ck_assert(!equalISmallStringO(self, string,0));
  26080   // NULL string
  26081   freeO(self);
  26082   setTopSO(self, "Ashee");
  26083   ck_assert(!equalISmallStringO(self, NULL, 0));
  26084   terminateO(string);
  26085   terminateO(self);
  26086 
  26087 }
  26088 
  26089 
  26090 void startsWithSSmallJsonT(CuTest *tc UNUSED) {
  26091 
  26092   smallJsont *self = allocSmallJson();
  26093   setTopSO(self, "shee");
  26094 
  26095   // identical strings
  26096   ck_assert(startsWithSO(self, "shee"));
  26097   freeO(self);
  26098   setTopSO(self, "sheepy");
  26099   ck_assert(startsWithSO(self, "shee"));
  26100   // different strings
  26101   freeO(self);
  26102   setTopSO(self, "shee");
  26103   ck_assert(!startsWithSO(self, "SH"));
  26104   ck_assert(!startsWithSO(self, "sheep"));
  26105   freeO(self);
  26106   setTopSO(self, "-shee");
  26107   ck_assert(!startsWithSO(self, "shee"));
  26108   // NULL string
  26109   ck_assert(!startsWithSO(self, NULL));
  26110   // empty self
  26111   freeO(self);
  26112   ck_assert(!startsWithSO(self, "shee"));
  26113   terminateO(self);
  26114 
  26115 }
  26116 
  26117 
  26118 void startsWithCharSmallJsonT(CuTest *tc UNUSED) {
  26119 
  26120   smallJsont *self = allocSmallJson();
  26121   setTopSO(self, "shee");
  26122 
  26123   // identical strings
  26124   ck_assert(startsWithCharO(self, 's'));
  26125   freeO(self);
  26126   setTopSO(self, "sheepy");
  26127   ck_assert(startsWithCharO(self, 's'));
  26128   freeO(self);
  26129   setTopSO(self, "");
  26130   ck_assert(startsWithCharO(self, 0));
  26131   // different strings
  26132   freeO(self);
  26133   setTopSO(self, "shee");
  26134   ck_assert(!startsWithCharO(self, 'S'));
  26135   freeO(self);
  26136   setTopSO(self, "-shee");
  26137   ck_assert(!startsWithCharO(self, 's'));
  26138   freeO(self);
  26139   setTopSO(self, "");
  26140   ck_assert(!startsWithCharO(self, '0'));
  26141   // NULL string
  26142   freeO(self);
  26143   setTopSO(self, "shee");
  26144   ck_assert(!startsWithCharO(self, 0));
  26145   // empty self
  26146   freeO(self);
  26147   ck_assert(!startsWithCharO(self, '0'));
  26148   terminateO(self);
  26149 
  26150 }
  26151 
  26152 
  26153 void startsWithSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26154 
  26155   smallJsont *self = allocSmallJson();
  26156   setTopSO(self, "shee");
  26157   smallStringt *string = allocSmallString("shee");
  26158 
  26159   // identical strings
  26160   ck_assert(startsWithSmallStringO(self, string));
  26161   freeO(self);
  26162   setTopSO(self, "sheepy");
  26163   ck_assert(startsWithSmallStringO(self, string));
  26164   // different strings
  26165   freeO(self);
  26166   setTopSO(self, "shee");
  26167   setValO(string, "SH");
  26168   ck_assert(!startsWithSmallStringO(self, string));
  26169   setValO(string, "sheep");
  26170   ck_assert(!startsWithSmallStringO(self, string));
  26171   freeO(self);
  26172   setTopSO(self, "-shee");
  26173   setValO(string, "shee");
  26174   ck_assert(!startsWithSmallStringO(self, string));
  26175   // non smallString object
  26176   terminateO(string);
  26177   string = (smallStringt*) allocSmallInt(1);
  26178   ck_assert(!startsWithSmallStringO(self, string));
  26179   terminateO(string);
  26180   string = allocSmallString("shee");
  26181   // NULL string
  26182   ck_assert(!startsWithSmallStringO(self, NULL));
  26183   // empty self
  26184   freeO(self);
  26185   ck_assert(!startsWithSmallStringO(self, string));
  26186   terminateO(string);
  26187   terminateO(self);
  26188 
  26189 }
  26190 
  26191 
  26192 void startsWithJsonSmallJsonT(CuTest *tc UNUSED) {
  26193 
  26194   smallJsont *self = allocSmallJson();
  26195   setTopSO(self, "shee");
  26196   smallJsont *string = allocSmallJson();
  26197 
  26198   // identical strings
  26199   setTopSO(string, "shee");
  26200   ck_assert(startsWithJsonO(self, string));
  26201   freeO(self);
  26202   setTopSO(self, "sheepy");
  26203   ck_assert(startsWithJsonO(self, string));
  26204   // different strings
  26205   freeO(self);
  26206   setTopSO(self, "shee");
  26207   freeO(string);
  26208   setTopSO(string, "SH");
  26209   ck_assert(!startsWithJsonO(self, string));
  26210   freeO(string);
  26211   setTopSO(string, "sheep");
  26212   ck_assert(!startsWithJsonO(self, string));
  26213   freeO(self);
  26214   setTopSO(self, "-shee");
  26215   freeO(string);
  26216   setTopSO(string, "shee");
  26217   ck_assert(!startsWithJsonO(self, string));
  26218   // non json string
  26219   freeO(string);
  26220   setTopIntO(string, 1);
  26221   ck_assert(!startsWithJsonO(self, string));
  26222   // non json object
  26223   terminateO(string);
  26224   string = (smallJsont*) allocSmallInt(1);
  26225   ck_assert(!startsWithJsonO(self, string));
  26226   terminateO(string);
  26227   string = allocSmallJson();
  26228   // NULL string
  26229   ck_assert(!startsWithJsonO(self, NULL));
  26230   // empty self
  26231   freeO(self);
  26232   setTopSO(string, "shee");
  26233   ck_assert(!startsWithJsonO(self, string));
  26234   terminateO(string);
  26235   terminateO(self);
  26236 
  26237 }
  26238 
  26239 
  26240 void endsWithSSmallJsonT(CuTest *tc UNUSED) {
  26241 
  26242   smallJsont *self = allocSmallJson();
  26243   setTopSO(self, "shee");
  26244 
  26245   // identical strings
  26246   ck_assert(endsWithSO(self, "shee"));
  26247   freeO(self);
  26248   setTopSO(self, "sheepy");
  26249   ck_assert(endsWithSO(self, "eepy"));
  26250   // different strings
  26251   freeO(self);
  26252   setTopSO(self, "shee");
  26253   ck_assert(!endsWithSO(self, "SH"));
  26254   ck_assert(!endsWithSO(self, "sheep"));
  26255   freeO(self);
  26256   setTopSO(self, "shee-");
  26257   ck_assert(!endsWithSO(self, "shee"));
  26258   // NULL string
  26259   ck_assert(!endsWithSO(self, NULL));
  26260   // empty self
  26261   freeO(self);
  26262   ck_assert(!endsWithSO(self, "shee"));
  26263   terminateO(self);
  26264 
  26265 }
  26266 
  26267 
  26268 void endsWithCharSmallJsonT(CuTest *tc UNUSED) {
  26269 
  26270   smallJsont *self = allocSmallJson();
  26271   setTopSO(self, "shee");
  26272 
  26273   // identical strings
  26274   ck_assert(endsWithCharO(self, 'e'));
  26275   freeO(self);
  26276   setTopSO(self, "sheepy");
  26277   ck_assert(endsWithCharO(self, 'y'));
  26278   freeO(self);
  26279   setTopSO(self, "");
  26280   ck_assert(endsWithCharO(self, 0));
  26281   // different strings
  26282   freeO(self);
  26283   setTopSO(self, "shee");
  26284   ck_assert(!endsWithCharO(self, 'E'));
  26285   ck_assert(!endsWithCharO(self, 'p'));
  26286   freeO(self);
  26287   setTopSO(self, "shee-");
  26288   ck_assert(!endsWithCharO(self, 'e'));
  26289   freeO(self);
  26290   setTopSO(self, "");
  26291   ck_assert(!endsWithCharO(self, '0'));
  26292   // NULL string
  26293   freeO(self);
  26294   setTopSO(self, "a");
  26295   ck_assert(!endsWithCharO(self, 0));
  26296   // empty self
  26297   freeO(self);
  26298   ck_assert(!endsWithCharO(self, '0'));
  26299   terminateO(self);
  26300 
  26301 }
  26302 
  26303 
  26304 void endsWithSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26305 
  26306   smallJsont *self = allocSmallJson();
  26307   setTopSO(self, "shee");
  26308   smallStringt *string = allocSmallString("shee");
  26309 
  26310   // identical strings
  26311   ck_assert(endsWithSmallStringO(self, string));
  26312   freeO(self);
  26313   setTopSO(self, "sheepy");
  26314   setValO(string, "eepy");
  26315   ck_assert(endsWithSmallStringO(self, string));
  26316   // different strings
  26317   freeO(self);
  26318   setTopSO(self, "shee");
  26319   ck_assert(!endsWithSmallStringO(self, string));
  26320   setValO(string, "sheep");
  26321   ck_assert(!endsWithSmallStringO(self, string));
  26322   freeO(self);
  26323   setTopSO(self, "shee-");
  26324   setValO(string, "shee");
  26325   ck_assert(!endsWithSmallStringO(self, string));
  26326   // non smallString object
  26327   terminateO(string);
  26328   string = (smallStringt*) allocSmallInt(1);
  26329   ck_assert(!endsWithSmallStringO(self, string));
  26330   terminateO(string);
  26331   string = allocSmallString("shee");
  26332   // NULL string
  26333   ck_assert(!endsWithSmallStringO(self, NULL));
  26334   // empty self
  26335   freeO(self);
  26336   ck_assert(!endsWithSmallStringO(self, string));
  26337   terminateO(string);
  26338   terminateO(self);
  26339 
  26340 }
  26341 
  26342 
  26343 void endsWithJsonSmallJsonT(CuTest *tc UNUSED) {
  26344 
  26345   smallJsont *self = allocSmallJson();
  26346   setTopSO(self, "shee");
  26347   smallJsont *string = allocSmallJson();
  26348 
  26349   // identical strings
  26350   setTopSO(string, "shee");
  26351   ck_assert(endsWithJsonO(self, string));
  26352   freeO(self);
  26353   setTopSO(self, "sheepy");
  26354   freeO(string);
  26355   setTopSO(string, "eepy");
  26356   ck_assert(endsWithJsonO(self, string));
  26357   // different strings
  26358   freeO(self);
  26359   setTopSO(self, "shee");
  26360   freeO(string);
  26361   setTopSO(string, "SH");
  26362   ck_assert(!endsWithJsonO(self, string));
  26363   freeO(string);
  26364   setTopSO(string, "sheep");
  26365   ck_assert(!endsWithJsonO(self, string));
  26366   freeO(self);
  26367   setTopSO(self, "shee-");
  26368   freeO(string);
  26369   setTopSO(string, "shee");
  26370   ck_assert(!endsWithJsonO(self, string));
  26371   // non json string
  26372   freeO(string);
  26373   setTopIntO(string, 1);
  26374   ck_assert(!endsWithJsonO(self, string));
  26375   // non json object
  26376   terminateO(string);
  26377   string = (smallJsont*) allocSmallInt(1);
  26378   ck_assert(!endsWithJsonO(self, string));
  26379   terminateO(string);
  26380   string = allocSmallJson();
  26381   setTopSO(string, "shee");
  26382   // NULL string
  26383   ck_assert(!endsWithJsonO(self, NULL));
  26384   // empty self
  26385   freeO(self);
  26386   ck_assert(!endsWithJsonO(self, string));
  26387   terminateO(string);
  26388   terminateO(self);
  26389 
  26390 }
  26391 
  26392 
  26393 void countSSmallJsonT(CuTest *tc UNUSED) {
  26394 
  26395   smallJsont *self = allocSmallJson();
  26396   setTopSO(self, "sheepy");
  26397 
  26398   // positive count
  26399   ck_assert_int_eq(countSO(self, "shee"), 1);
  26400   freeO(self);
  26401   setTopSO(self, "aaa aaa");
  26402   ck_assert_int_eq(countSO(self, "a"), 6);
  26403   ck_assert_int_eq(countSO(self, "aa"), 2);
  26404   // 0 count
  26405   freeO(self);
  26406   setTopSO(self, "shee");
  26407   ck_assert_int_eq(countSO(self, "SH"), 0);
  26408   ck_assert_int_eq(countSO(self, "sheepy"), 0);
  26409   freeO(self);
  26410   setTopSO(self, "aaa aaa");
  26411   ck_assert_int_eq(countSO(self, "ab"), 0);
  26412   // empty string
  26413   ck_assert_int_eq(countSO(self, ""), -1);
  26414   // NULL string
  26415   ck_assert_int_eq(countSO(self, NULL), -1);
  26416   // empty self
  26417   freeO(self);
  26418   ck_assert_int_eq(countSO(self, "ab"), -1);
  26419   terminateO(self);
  26420 
  26421 }
  26422 
  26423 
  26424 void countCharSmallJsonT(CuTest *tc UNUSED) {
  26425 
  26426   smallJsont *self = allocSmallJson();
  26427   setTopSO(self, "shee");
  26428 
  26429   // positive count
  26430   ck_assert_int_eq(countCharO(self, 's'), 1);
  26431   freeO(self);
  26432   setTopSO(self, "aaa aaa");
  26433   ck_assert_int_eq(countCharO(self, 'a'), 6);
  26434   // 0 count
  26435   freeO(self);
  26436   setTopSO(self, "shee");
  26437   ck_assert_int_eq(countCharO(self, 'S'), 0);
  26438   ck_assert_int_eq(countCharO(self, 'y'), 0);
  26439   freeO(self);
  26440   setTopSO(self, "aaa aaa");
  26441   ck_assert_int_eq(countCharO(self, 'b'), 0);
  26442   // empty string
  26443   freeO(self);
  26444   setTopSO(self, "");
  26445   ck_assert_int_eq(countCharO(self, 'a'), 0);
  26446   ck_assert_int_eq(countCharO(self, 0), -1);
  26447   // NULL string
  26448   freeO(self);
  26449   setTopSO(self, "a");
  26450   ck_assert_int_eq(countCharO(self, 0), -1);
  26451   // empty self
  26452   freeO(self);
  26453   ck_assert_int_eq(countCharO(self, 'a'), -1);
  26454   terminateO(self);
  26455 
  26456 }
  26457 
  26458 
  26459 void countSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26460 
  26461   smallJsont *self = allocSmallJson();
  26462   setTopSO(self, "sheepy");
  26463   smallStringt *string = allocSmallString("shee");
  26464 
  26465   // positive count
  26466   ck_assert_int_eq(countSmallStringO(self, string), 1);
  26467   freeO(self);
  26468   setTopSO(self, "aaa aaa");
  26469   setValO(string, "a");
  26470   ck_assert_int_eq(countSmallStringO(self, string), 6);
  26471   setValO(string, "aa");
  26472   ck_assert_int_eq(countSmallStringO(self, string), 2);
  26473   // 0 count
  26474   freeO(self);
  26475   setTopSO(self, "shee");
  26476   setValO(string, "SH");
  26477   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26478   setValO(string, "sheepy");
  26479   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26480   freeO(self);
  26481   setTopSO(self, "aaa aaa");
  26482   setValO(string, "ab");
  26483   ck_assert_int_eq(countSmallStringO(self, string), 0);
  26484   // non json object
  26485   terminateO(string);
  26486   string = (smallStringt*) allocSmallInt(1);
  26487   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26488   terminateO(string);
  26489   string = allocSmallString("");
  26490   // empty string
  26491   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26492   freeO(string);
  26493   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26494   // NULL string
  26495   ck_assert_int_eq(countSmallStringO(self, NULL), -1);
  26496   // empty self
  26497   freeO(self);
  26498   setValO(string, "ab");
  26499   ck_assert_int_eq(countSmallStringO(self, string), -1);
  26500   terminateO(string);
  26501   terminateO(self);
  26502 
  26503 }
  26504 
  26505 
  26506 void countJsonSmallJsonT(CuTest *tc UNUSED) {
  26507 
  26508   smallJsont *self = allocSmallJson();
  26509   setTopSO(self, "sheepy");
  26510   smallJsont *string = allocSmallJson();
  26511 
  26512   // positive count
  26513   setTopSO(string, "shee");
  26514   ck_assert_int_eq(countJsonO(self, string), 1);
  26515   freeO(self);
  26516   setTopSO(self, "aaa aaa");
  26517   freeO(string);
  26518   setTopSO(string, "a");
  26519   ck_assert_int_eq(countJsonO(self, string), 6);
  26520   freeO(string);
  26521   setTopSO(string, "aa");
  26522   ck_assert_int_eq(countJsonO(self, string), 2);
  26523   // 0 count
  26524   freeO(self);
  26525   setTopSO(self, "shee");
  26526   freeO(string);
  26527   setTopSO(string, "SH");
  26528   ck_assert_int_eq(countJsonO(self, string), 0);
  26529   freeO(string);
  26530   setTopSO(string, "sheepy");
  26531   ck_assert_int_eq(countJsonO(self, string), 0);
  26532   freeO(self);
  26533   setTopSO(self, "aaa aaa");
  26534   freeO(string);
  26535   setTopSO(string, "ab");
  26536   ck_assert_int_eq(countJsonO(self, string), 0);
  26537   // non json string
  26538   freeO(string);
  26539   setTopIntO(string, -1);
  26540   ck_assert_int_eq(countJsonO(self, string), -1);
  26541   // non json object
  26542   terminateO(string);
  26543   string = (smallJsont*) allocSmallInt(1);
  26544   ck_assert_int_eq(countJsonO(self, string), -1);
  26545   terminateO(string);
  26546   string = allocSmallJson();
  26547   // empty string
  26548   setTopSO(string, "");
  26549   ck_assert_int_eq(countJsonO(self, string), -1);
  26550   // NULL string
  26551   ck_assert_int_eq(countJsonO(self, NULL), -1);
  26552   // empty self
  26553   freeO(self);
  26554   freeO(string);
  26555   setTopSO(string, "ab");
  26556   ck_assert_int_eq(countJsonO(self, string), -1);
  26557   terminateO(string);
  26558   terminateO(self);
  26559 
  26560 }
  26561 
  26562 
  26563 void icStartsWithSSmallJsonT(CuTest *tc UNUSED) {
  26564 
  26565   smallJsont *self = allocSmallJson();
  26566   setTopSO(self, "shee");
  26567 
  26568   // identical strings
  26569   ck_assert(icStartsWithSO(self, "shee"));
  26570   freeO(self);
  26571   setTopSO(self, "sheepy");
  26572   ck_assert(icStartsWithSO(self, "shee"));
  26573   // different strings
  26574   freeO(self);
  26575   setTopSO(self, "shee");
  26576   ck_assert(icStartsWithSO(self, "SH"));
  26577   ck_assert(!icStartsWithSO(self, "sheep"));
  26578   freeO(self);
  26579   setTopSO(self, "-shee");
  26580   ck_assert(!icStartsWithSO(self, "shee"));
  26581   // NULL string
  26582   ck_assert(!icStartsWithSO(self, NULL));
  26583   // empty self
  26584   freeO(self);
  26585   ck_assert(!icStartsWithSO(self, "shee"));
  26586   terminateO(self);
  26587 
  26588 }
  26589 
  26590 
  26591 void icStartsWithCharSmallJsonT(CuTest *tc UNUSED) {
  26592 
  26593   smallJsont *self = allocSmallJson();
  26594   setTopSO(self, "shee");
  26595 
  26596   // identical strings
  26597   ck_assert(icStartsWithCharO(self, 's'));
  26598   freeO(self);
  26599   setTopSO(self, "sheepy");
  26600   ck_assert(icStartsWithCharO(self, 's'));
  26601   freeO(self);
  26602   setTopSO(self, "");
  26603   ck_assert(icStartsWithCharO(self, 0));
  26604   // different strings
  26605   freeO(self);
  26606   setTopSO(self, "shee");
  26607   ck_assert(icStartsWithCharO(self, 'S'));
  26608   freeO(self);
  26609   setTopSO(self, "-shee");
  26610   ck_assert(!icStartsWithCharO(self, 's'));
  26611   freeO(self);
  26612   setTopSO(self, "");
  26613   ck_assert(!icStartsWithCharO(self, '0'));
  26614   // NULL string
  26615   freeO(self);
  26616   setTopSO(self, "shee");
  26617   ck_assert(!icStartsWithCharO(self, 0));
  26618   // empty self
  26619   freeO(self);
  26620   ck_assert(!icStartsWithCharO(self, '0'));
  26621   terminateO(self);
  26622 
  26623 }
  26624 
  26625 
  26626 void icStartsWithSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26627 
  26628   smallJsont *self = allocSmallJson();
  26629   setTopSO(self, "shee");
  26630   smallStringt *string = allocSmallString("shee");
  26631 
  26632   // identical strings
  26633   ck_assert(icStartsWithSmallStringO(self, string));
  26634   freeO(self);
  26635   setTopSO(self, "sheepy");
  26636   ck_assert(icStartsWithSmallStringO(self, string));
  26637   // different strings
  26638   freeO(self);
  26639   setTopSO(self, "shee");
  26640   setValO(string, "SH");
  26641   ck_assert(icStartsWithSmallStringO(self, string));
  26642   setValO(string, "sheep");
  26643   ck_assert(!icStartsWithSmallStringO(self, string));
  26644   freeO(self);
  26645   setTopSO(self, "-shee");
  26646   setValO(string, "shee");
  26647   ck_assert(!icStartsWithSmallStringO(self, string));
  26648   // non smallString object
  26649   terminateO(string);
  26650   string = (smallStringt*) allocSmallInt(1);
  26651   ck_assert(!icStartsWithSmallStringO(self, string));
  26652   terminateO(string);
  26653   string = allocSmallString("shee");
  26654   // NULL string
  26655   ck_assert(!icStartsWithSmallStringO(self, NULL));
  26656   // empty self
  26657   freeO(self);
  26658   ck_assert(!icStartsWithSmallStringO(self, string));
  26659   terminateO(string);
  26660   terminateO(self);
  26661 
  26662 }
  26663 
  26664 
  26665 void icStartsWithJsonSmallJsonT(CuTest *tc UNUSED) {
  26666 
  26667   smallJsont *self = allocSmallJson();
  26668   setTopSO(self, "shee");
  26669   smallJsont *string = allocSmallJson();
  26670 
  26671   // identical strings
  26672   setTopSO(string, "shee");
  26673   ck_assert(icStartsWithJsonO(self, string));
  26674   freeO(self);
  26675   setTopSO(self, "sheepy");
  26676   ck_assert(icStartsWithJsonO(self, string));
  26677   // different strings
  26678   freeO(self);
  26679   setTopSO(self, "shee");
  26680   freeO(string);
  26681   setTopSO(string, "SH");
  26682   ck_assert(icStartsWithJsonO(self, string));
  26683   freeO(string);
  26684   setTopSO(string, "sheep");
  26685   ck_assert(!icStartsWithJsonO(self, string));
  26686   freeO(self);
  26687   setTopSO(self, "-shee");
  26688   freeO(string);
  26689   setTopSO(string, "shee");
  26690   ck_assert(!icStartsWithJsonO(self, string));
  26691   // non json string
  26692   freeO(string);
  26693   setTopIntO(string, 1);
  26694   ck_assert(!icStartsWithJsonO(self, string));
  26695   // non json object
  26696   terminateO(string);
  26697   string = (smallJsont*) allocSmallInt(1);
  26698   ck_assert(!icStartsWithJsonO(self, string));
  26699   terminateO(string);
  26700   string = allocSmallJson();
  26701   // NULL string
  26702   ck_assert(!icStartsWithJsonO(self, NULL));
  26703   // empty self
  26704   freeO(self);
  26705   setTopSO(string, "shee");
  26706   ck_assert(!icStartsWithJsonO(self, string));
  26707   terminateO(string);
  26708   terminateO(self);
  26709 
  26710 }
  26711 
  26712 
  26713 void icEndsWithSSmallJsonT(CuTest *tc UNUSED) {
  26714 
  26715   smallJsont *self = allocSmallJson();
  26716   setTopSO(self, "shee");
  26717 
  26718   // identical strings
  26719   ck_assert(icEndsWithSO(self, "shee"));
  26720   freeO(self);
  26721   setTopSO(self, "sheepy");
  26722   ck_assert(icEndsWithSO(self, "EEPY"));
  26723   // different strings
  26724   freeO(self);
  26725   setTopSO(self, "shee");
  26726   ck_assert(!icEndsWithSO(self, "SH"));
  26727   ck_assert(!icEndsWithSO(self, "sheep"));
  26728   freeO(self);
  26729   setTopSO(self, "shee-");
  26730   ck_assert(!icEndsWithSO(self, "shee"));
  26731   // NULL string
  26732   ck_assert(!icEndsWithSO(self, NULL));
  26733   // empty self
  26734   freeO(self);
  26735   ck_assert(!icEndsWithSO(self, "shee"));
  26736   terminateO(self);
  26737 
  26738 }
  26739 
  26740 
  26741 void icEndsWithCharSmallJsonT(CuTest *tc UNUSED) {
  26742 
  26743   smallJsont *self = allocSmallJson();
  26744   setTopSO(self, "shee");
  26745 
  26746   // identical strings
  26747   ck_assert(icEndsWithCharO(self, 'e'));
  26748   freeO(self);
  26749   setTopSO(self, "sheepy");
  26750   ck_assert(icEndsWithCharO(self, 'y'));
  26751   freeO(self);
  26752   setTopSO(self, "");
  26753   ck_assert(icEndsWithCharO(self, 0));
  26754   // different strings
  26755   freeO(self);
  26756   setTopSO(self, "shee");
  26757   ck_assert(icEndsWithCharO(self, 'E'));
  26758   ck_assert(!icEndsWithCharO(self, 'p'));
  26759   freeO(self);
  26760   setTopSO(self, "shee-");
  26761   ck_assert(!icEndsWithCharO(self, 'e'));
  26762   freeO(self);
  26763   setTopSO(self, "");
  26764   ck_assert(!icEndsWithCharO(self, '0'));
  26765   // NULL string
  26766   freeO(self);
  26767   setTopSO(self, "a");
  26768   ck_assert(!icEndsWithCharO(self, 0));
  26769   // empty self
  26770   freeO(self);
  26771   ck_assert(!icEndsWithCharO(self, '0'));
  26772   terminateO(self);
  26773 
  26774 }
  26775 
  26776 
  26777 void icEndsWithSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26778 
  26779   smallJsont *self = allocSmallJson();
  26780   setTopSO(self, "shee");
  26781   smallStringt *string = allocSmallString("shee");
  26782 
  26783   // identical strings
  26784   ck_assert(icEndsWithSmallStringO(self, string));
  26785   freeO(self);
  26786   setTopSO(self, "sheepy");
  26787   setValO(string, "EEPY");
  26788   ck_assert(icEndsWithSmallStringO(self, string));
  26789   // different strings
  26790   freeO(self);
  26791   setTopSO(self, "shee");
  26792   ck_assert(!icEndsWithSmallStringO(self, string));
  26793   setValO(string, "sheep");
  26794   ck_assert(!icEndsWithSmallStringO(self, string));
  26795   freeO(self);
  26796   setTopSO(self, "shee-");
  26797   setValO(string, "shee");
  26798   ck_assert(!icEndsWithSmallStringO(self, string));
  26799   // non smallString object
  26800   terminateO(string);
  26801   string = (smallStringt*) allocSmallInt(1);
  26802   ck_assert(!icEndsWithSmallStringO(self, string));
  26803   terminateO(string);
  26804   string = allocSmallString("shee");
  26805   // NULL string
  26806   ck_assert(!icEndsWithSmallStringO(self, NULL));
  26807   // empty self
  26808   freeO(self);
  26809   ck_assert(!icEndsWithSmallStringO(self, string));
  26810   terminateO(string);
  26811   terminateO(self);
  26812 
  26813 }
  26814 
  26815 
  26816 void icEndsWithJsonSmallJsonT(CuTest *tc UNUSED) {
  26817 
  26818   smallJsont *self = allocSmallJson();
  26819   setTopSO(self, "shee");
  26820   smallJsont *string = allocSmallJson();
  26821 
  26822   // identical strings
  26823   setTopSO(string, "shee");
  26824   ck_assert(icEndsWithJsonO(self, string));
  26825   freeO(self);
  26826   setTopSO(self, "sheepy");
  26827   freeO(string);
  26828   setTopSO(string, "EEPY");
  26829   ck_assert(icEndsWithJsonO(self, string));
  26830   // different strings
  26831   freeO(self);
  26832   setTopSO(self, "shee");
  26833   freeO(string);
  26834   setTopSO(string, "SH");
  26835   ck_assert(!icEndsWithJsonO(self, string));
  26836   freeO(string);
  26837   setTopSO(string, "sheep");
  26838   ck_assert(!icEndsWithJsonO(self, string));
  26839   freeO(self);
  26840   setTopSO(self, "shee-");
  26841   freeO(string);
  26842   setTopSO(string, "shee");
  26843   ck_assert(!icEndsWithJsonO(self, string));
  26844   // non json string
  26845   freeO(string);
  26846   setTopIntO(string, 1);
  26847   ck_assert(!icEndsWithJsonO(self, string));
  26848   // non json object
  26849   terminateO(string);
  26850   string = (smallJsont*) allocSmallInt(1);
  26851   ck_assert(!icEndsWithJsonO(self, string));
  26852   terminateO(string);
  26853   string = allocSmallJson();
  26854   setTopSO(string, "shee");
  26855   // NULL string
  26856   ck_assert(!icEndsWithJsonO(self, NULL));
  26857   // empty self
  26858   freeO(self);
  26859   ck_assert(!icEndsWithJsonO(self, string));
  26860   terminateO(string);
  26861   terminateO(self);
  26862 
  26863 }
  26864 
  26865 
  26866 void icCountSSmallJsonT(CuTest *tc UNUSED) {
  26867 
  26868   smallJsont *self = allocSmallJson();
  26869   setTopSO(self, "sheepy");
  26870 
  26871   // positive count
  26872   ck_assert_int_eq(icCountSO(self, "shee"), 1);
  26873   freeO(self);
  26874   setTopSO(self, "aaa aaa");
  26875   ck_assert_int_eq(icCountSO(self, "a"), 6);
  26876   ck_assert_int_eq(icCountSO(self, "Aa"), 2);
  26877   // 0 icCount
  26878   freeO(self);
  26879   setTopSO(self, "shee");
  26880   ck_assert_int_eq(icCountSO(self, "SH"), 1);
  26881   ck_assert_int_eq(icCountSO(self, "sheepy"), 0);
  26882   freeO(self);
  26883   setTopSO(self, "aaa aaa");
  26884   ck_assert_int_eq(icCountSO(self, "ab"), 0);
  26885   // empty string
  26886   ck_assert_int_eq(icCountSO(self, ""), -1);
  26887   // NULL string
  26888   ck_assert_int_eq(icCountSO(self, NULL), -1);
  26889   // empty self
  26890   freeO(self);
  26891   ck_assert_int_eq(icCountSO(self, "ab"), -1);
  26892   terminateO(self);
  26893 
  26894 }
  26895 
  26896 
  26897 void icCountCharSmallJsonT(CuTest *tc UNUSED) {
  26898 
  26899   smallJsont *self = allocSmallJson();
  26900   setTopSO(self, "shee");
  26901 
  26902   // positive count
  26903   ck_assert_int_eq(icCountCharO(self, 's'), 1);
  26904   freeO(self);
  26905   setTopSO(self, "aaa aaa");
  26906   ck_assert_int_eq(icCountCharO(self, 'a'), 6);
  26907   // 0 icCount
  26908   freeO(self);
  26909   setTopSO(self, "shee");
  26910   ck_assert_int_eq(icCountCharO(self, 'S'), 1);
  26911   ck_assert_int_eq(icCountCharO(self, 'y'), 0);
  26912   freeO(self);
  26913   setTopSO(self, "aaa aaa");
  26914   ck_assert_int_eq(icCountCharO(self, 'b'), 0);
  26915   // empty string
  26916   freeO(self);
  26917   setTopSO(self, "");
  26918   ck_assert_int_eq(icCountCharO(self, 'a'), 0);
  26919   ck_assert_int_eq(icCountCharO(self, 0), -1);
  26920   // NULL string
  26921   freeO(self);
  26922   setTopSO(self, "a");
  26923   ck_assert_int_eq(icCountCharO(self, 0), -1);
  26924   // empty self
  26925   freeO(self);
  26926   ck_assert_int_eq(icCountCharO(self, 'a'), -1);
  26927   terminateO(self);
  26928 
  26929 }
  26930 
  26931 
  26932 void icCountSmallStringSmallJsonT(CuTest *tc UNUSED) {
  26933 
  26934   smallJsont *self = allocSmallJson();
  26935   setTopSO(self, "sheepy");
  26936   smallStringt *string = allocSmallString("shee");
  26937 
  26938   // positive count
  26939   ck_assert_int_eq(icCountSmallStringO(self, string), 1);
  26940   freeO(self);
  26941   setTopSO(self, "aaa aaa");
  26942   setValO(string, "a");
  26943   ck_assert_int_eq(icCountSmallStringO(self, string), 6);
  26944   setValO(string, "aa");
  26945   ck_assert_int_eq(icCountSmallStringO(self, string), 2);
  26946   // 0 icCount
  26947   freeO(self);
  26948   setTopSO(self, "shee");
  26949   setValO(string, "SH");
  26950   ck_assert_int_eq(icCountSmallStringO(self, string), 1);
  26951   setValO(string, "sheepy");
  26952   ck_assert_int_eq(icCountSmallStringO(self, string), 0);
  26953   freeO(self);
  26954   setTopSO(self, "aaa aaa");
  26955   setValO(string, "ab");
  26956   ck_assert_int_eq(icCountSmallStringO(self, string), 0);
  26957   // non json object
  26958   terminateO(string);
  26959   string = (smallStringt*) allocSmallInt(1);
  26960   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26961   terminateO(string);
  26962   string = allocSmallString("");
  26963   // empty string
  26964   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26965   freeO(string);
  26966   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26967   // NULL string
  26968   ck_assert_int_eq(icCountSmallStringO(self, NULL), -1);
  26969   // empty self
  26970   freeO(self);
  26971   setValO(string, "ab");
  26972   ck_assert_int_eq(icCountSmallStringO(self, string), -1);
  26973   terminateO(string);
  26974   terminateO(self);
  26975 
  26976 }
  26977 
  26978 
  26979 void icCountJsonSmallJsonT(CuTest *tc UNUSED) {
  26980 
  26981   smallJsont *self = allocSmallJson();
  26982   setTopSO(self, "sheepy");
  26983   smallJsont *string = allocSmallJson();
  26984 
  26985   // positive count
  26986   setTopSO(string, "shee");
  26987   ck_assert_int_eq(icCountJsonO(self, string), 1);
  26988   freeO(self);
  26989   setTopSO(self, "aaa aaa");
  26990   freeO(string);
  26991   setTopSO(string, "a");
  26992   ck_assert_int_eq(icCountJsonO(self, string), 6);
  26993   freeO(string);
  26994   setTopSO(string, "aa");
  26995   ck_assert_int_eq(icCountJsonO(self, string), 2);
  26996   // 0 icCount
  26997   freeO(self);
  26998   setTopSO(self, "shee");
  26999   freeO(string);
  27000   setTopSO(string, "SH");
  27001   ck_assert_int_eq(icCountJsonO(self, string), 1);
  27002   freeO(string);
  27003   setTopSO(string, "sheepy");
  27004   ck_assert_int_eq(icCountJsonO(self, string), 0);
  27005   freeO(self);
  27006   setTopSO(self, "aaa aaa");
  27007   freeO(string);
  27008   setTopSO(string, "ab");
  27009   ck_assert_int_eq(icCountJsonO(self, string), 0);
  27010   // non json string
  27011   freeO(string);
  27012   setTopIntO(string, -1);
  27013   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27014   // non json object
  27015   terminateO(string);
  27016   string = (smallJsont*) allocSmallInt(1);
  27017   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27018   terminateO(string);
  27019   string = allocSmallJson();
  27020   // empty string
  27021   setTopSO(string, "");
  27022   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27023   // NULL string
  27024   ck_assert_int_eq(icCountJsonO(self, NULL), -1);
  27025   // empty self
  27026   freeO(self);
  27027   freeO(string);
  27028   setTopSO(string, "ab");
  27029   ck_assert_int_eq(icCountJsonO(self, string), -1);
  27030   terminateO(string);
  27031   terminateO(self);
  27032 
  27033 }
  27034 
  27035 
  27036 void isNumberSmallJsonT(CuTest *tc UNUSED) {
  27037 
  27038   smallJsont *self = allocSmallJson();
  27039   setTopSO(self, "");
  27040 
  27041   // number
  27042   freeO(self);
  27043   setTopSO(self, "-12.3");
  27044   ck_assert(isNumberO(self));
  27045   freeO(self);
  27046   setTopSO(self, "-123");
  27047   ck_assert(isNumberO(self));
  27048   freeO(self);
  27049   setTopSO(self, "123");
  27050   ck_assert(isNumberO(self));
  27051   freeO(self);
  27052   setTopSO(self, "1e23");
  27053   ck_assert(isNumberO(self));
  27054   freeO(self);
  27055   setTopSO(self, "12E-3");
  27056   ck_assert(isNumberO(self));
  27057   freeO(self);
  27058   setTopSO(self, ".123");
  27059   ck_assert(isNumberO(self));
  27060   freeO(self);
  27061   setTopSO(self, "-.123");
  27062   ck_assert(isNumberO(self));
  27063   freeO(self);
  27064   setTopSO(self, "1E+32");
  27065   ck_assert(isNumberO(self));
  27066   // not a number
  27067   freeO(self);
  27068   setTopSO(self, ".12e3");
  27069   ck_assert(!isNumberO(self));
  27070   freeO(self);
  27071   setTopSO(self, "-.12e3");
  27072   ck_assert(!isNumberO(self));
  27073   freeO(self);
  27074   setTopSO(self, "-1-23");
  27075   ck_assert(!isNumberO(self));
  27076   freeO(self);
  27077   setTopSO(self, "123-");
  27078   ck_assert(!isNumberO(self));
  27079   freeO(self);
  27080   setTopSO(self, "-");
  27081   ck_assert(!isNumberO(self));
  27082   freeO(self);
  27083   setTopSO(self, "-123.");
  27084   ck_assert(!isNumberO(self));
  27085   freeO(self);
  27086   setTopSO(self, "-1.2.3");
  27087   ck_assert(!isNumberO(self));
  27088   freeO(self);
  27089   setTopSO(self, "1-2.3");
  27090   ck_assert(!isNumberO(self));
  27091   freeO(self);
  27092   setTopSO(self, "12..3");
  27093   ck_assert(!isNumberO(self));
  27094   freeO(self);
  27095   setTopSO(self, ".12.3");
  27096   ck_assert(!isNumberO(self));
  27097   freeO(self);
  27098   setTopSO(self, ".");
  27099   ck_assert(!isNumberO(self));
  27100   freeO(self);
  27101   setTopSO(self, "E12");
  27102   ck_assert(!isNumberO(self));
  27103   freeO(self);
  27104   setTopSO(self, "E1E2");
  27105   ck_assert(!isNumberO(self));
  27106   freeO(self);
  27107   setTopSO(self, "E1.2");
  27108   ck_assert(!isNumberO(self));
  27109   freeO(self);
  27110   setTopSO(self, "1E");
  27111   ck_assert(!isNumberO(self));
  27112   freeO(self);
  27113   setTopSO(self, "1E2.3");
  27114   ck_assert(!isNumberO(self));
  27115   freeO(self);
  27116   setTopSO(self, "1-");
  27117   ck_assert(!isNumberO(self));
  27118   freeO(self);
  27119   setTopSO(self, "1E-");
  27120   ck_assert(!isNumberO(self));
  27121   freeO(self);
  27122   setTopSO(self, "lib123sheepy");
  27123   ck_assert(!isNumberO(self));
  27124   // string without number
  27125   freeO(self);
  27126   setTopSO(self, "s");
  27127   ck_assert(!isNumberO(self));
  27128   // empty string
  27129   freeO(self);
  27130   setTopSO(self, "");
  27131   ck_assert(!isNumberO(self));
  27132   // NULL string
  27133   freeO(self);
  27134   ck_assert(!isNumberO(self));
  27135   terminateO(self);
  27136 
  27137 }
  27138 
  27139 
  27140 void isIntSmallJsonT(CuTest *tc UNUSED) {
  27141 
  27142   smallJsont *self = allocSmallJson();
  27143   setTopSO(self, "");
  27144 
  27145   // integer
  27146   freeO(self);
  27147   setTopSO(self, "-123");
  27148   ck_assert(isIntO(self));
  27149   freeO(self);
  27150   setTopSO(self, "123");
  27151   ck_assert(isIntO(self));
  27152   // not a integer
  27153   freeO(self);
  27154   setTopSO(self, "1e23");
  27155   ck_assert(!isIntO(self));
  27156   freeO(self);
  27157   setTopSO(self, "12E-3");
  27158   ck_assert(!isIntO(self));
  27159   freeO(self);
  27160   setTopSO(self, "-12.3");
  27161   ck_assert(!isIntO(self));
  27162   freeO(self);
  27163   setTopSO(self, "-1-23");
  27164   ck_assert(!isIntO(self));
  27165   freeO(self);
  27166   setTopSO(self, "123-");
  27167   ck_assert(!isIntO(self));
  27168   freeO(self);
  27169   setTopSO(self, "-");
  27170   ck_assert(!isIntO(self));
  27171   freeO(self);
  27172   setTopSO(self, "-123.");
  27173   ck_assert(!isIntO(self));
  27174   freeO(self);
  27175   setTopSO(self, ".123");
  27176   ck_assert(!isIntO(self));
  27177   freeO(self);
  27178   setTopSO(self, "-1.2.3");
  27179   ck_assert(!isIntO(self));
  27180   freeO(self);
  27181   setTopSO(self, "1-2.3");
  27182   ck_assert(!isIntO(self));
  27183   freeO(self);
  27184   setTopSO(self, "12..3");
  27185   ck_assert(!isIntO(self));
  27186   freeO(self);
  27187   setTopSO(self, ".");
  27188   ck_assert(!isIntO(self));
  27189   freeO(self);
  27190   setTopSO(self, "1E");
  27191   ck_assert(!isIntO(self));
  27192   freeO(self);
  27193   setTopSO(self, "1-");
  27194   ck_assert(!isIntO(self));
  27195   freeO(self);
  27196   setTopSO(self, "1E-");
  27197   ck_assert(!isIntO(self));
  27198   freeO(self);
  27199   setTopSO(self, "lib123sheepy");
  27200   ck_assert(!isIntO(self));
  27201   // string without number
  27202   freeO(self);
  27203   setTopSO(self, "s");
  27204   ck_assert(!isIntO(self));
  27205   // empty string
  27206   freeO(self);
  27207   setTopSO(self, "");
  27208   ck_assert(!isIntO(self));
  27209   // NULL string
  27210   freeO(self);
  27211   ck_assert(!isIntO(self));
  27212   terminateO(self);
  27213 
  27214 }
  27215 
  27216 
  27217 void parseIntSmallJsonT(CuTest *tc UNUSED) {
  27218 
  27219   smallJsont *self = allocSmallJson();
  27220   setTopSO(self, "");
  27221 
  27222   // number
  27223   freeO(self);
  27224   setTopSO(self, "123sheepy");
  27225   ck_assert_int_eq(parseIntO(self), 123);
  27226   freeO(self);
  27227   setTopSO(self, "lib123sheepy");
  27228   ck_assert_int_eq(parseIntO(self), 123);
  27229   freeO(self);
  27230   setTopSO(self, "-123");
  27231   ck_assert_int_eq(parseIntO(self), -123);
  27232   // out of range - TODO check stderr
  27233   freeO(self);
  27234   setTopSO(self, "999999999999999999999999999999999999999");
  27235   parseIntO(self);
  27236   // string without number
  27237   freeO(self);
  27238   setTopSO(self, "sheepy");
  27239   ck_assert_int_eq(parseIntO(self), 0);
  27240   // NULL string
  27241   freeO(self);
  27242   ck_assert_int_eq(parseIntO(self), 0);
  27243   terminateO(self);
  27244 
  27245 }
  27246 
  27247 
  27248 void parseDoubleSmallJsonT(CuTest *tc UNUSED) {
  27249 
  27250   smallJsont *self = allocSmallJson();
  27251   setTopSO(self, "");
  27252 
  27253   // number
  27254   freeO(self);
  27255   setTopSO(self, "123.2sheepy");
  27256   ck_assert_int_eq(parseDoubleO(self), 123);
  27257   freeO(self);
  27258   setTopSO(self, "lib123sheepy");
  27259   ck_assert_int_eq(parseDoubleO(self), 123);
  27260   freeO(self);
  27261   setTopSO(self, "-123");
  27262   ck_assert_int_eq(parseDoubleO(self), -123);
  27263   // out of range - TODO check stderr
  27264   freeO(self);
  27265   setTopSO(self, "999999999999999999999999999999999999999");
  27266   parseDoubleO(self);
  27267   // string without number
  27268   freeO(self);
  27269   setTopSO(self, "sheepy");
  27270   ck_assert_int_eq(parseDoubleO(self), 0);
  27271   // NULL string
  27272   freeO(self);
  27273   ck_assert_int_eq(parseDoubleO(self), 0);
  27274   terminateO(self);
  27275 
  27276 }
  27277 
  27278 
  27279 void intToSmallJsonT(CuTest *tc UNUSED) {
  27280 
  27281   smallJsont* r;
  27282   smallJsont *self = allocSmallJson();
  27283   setTopSO(self, "");
  27284 
  27285   // number
  27286   r = intToO(self, 123);
  27287   ck_assert_ptr_ne(r, null);
  27288   char *s = toStringO(r);
  27289   ck_assert_str_eq(s, "123");
  27290   free(s);
  27291   r = intToO(self, -465464123);
  27292   ck_assert_ptr_ne(r, null);
  27293   s = toStringO(r);
  27294   ck_assert_str_eq(s, "-465464123");
  27295   free(s);
  27296   terminateO(self);
  27297 
  27298 }
  27299 
  27300 
  27301 void doubleToSmallJsonT(CuTest *tc UNUSED) {
  27302 
  27303   smallJsont* r;
  27304   smallJsont *self = allocSmallJson();
  27305   setTopSO(self, "");
  27306 
  27307   // number
  27308   r = doubleToO(self, 123.4);
  27309   ck_assert_ptr_ne(r, null);
  27310   char *s = toStringO(r);
  27311   ck_assert_str_eq(s, "1.234000e+02");
  27312   free(s);
  27313   r = doubleToO(self, -4652445e5);
  27314   ck_assert_ptr_ne(r, null);
  27315   s = toStringO(r);
  27316   ck_assert_str_eq(s, "-4.652445e+11");
  27317   free(s);
  27318   terminateO(self);
  27319 
  27320 }
  27321 
  27322 
  27323 void upperSmallJsonT(CuTest *tc UNUSED) {
  27324 
  27325   smallJsont* r;
  27326   smallJsont *self = allocSmallJson();
  27327   setTopSO(self, "sheepy");
  27328 
  27329   // string
  27330   r = upperO(self);
  27331   ck_assert_ptr_ne(r, null);
  27332   char *s = toStringO(r);
  27333   ck_assert_str_eq(s, "SHEEPY");
  27334   free(s);
  27335   // NULL string
  27336   freeO(self);
  27337   ck_assert_ptr_eq(upperO(self), NULL);
  27338   terminateO(self);
  27339 
  27340 }
  27341 
  27342 
  27343 void lowerSmallJsonT(CuTest *tc UNUSED) {
  27344 
  27345   smallJsont* r;
  27346   smallJsont *self = allocSmallJson();
  27347   setTopSO(self, "SHeePY");
  27348 
  27349   // string
  27350   r = lowerO(self);
  27351   ck_assert_ptr_ne(r, null);
  27352   char *s = toStringO(r);
  27353   ck_assert_str_eq(s, "sheepy");
  27354   free(s);
  27355   // NULL string
  27356   freeO(self);
  27357   ck_assert_ptr_eq(lowerO(self), NULL);
  27358   terminateO(self);
  27359 
  27360 }
  27361 
  27362 
  27363 void trimSmallJsonT(CuTest *tc UNUSED) {
  27364 
  27365   smallJsont* r;
  27366   smallJsont *self = allocSmallJson();
  27367   setTopSO(self, "");
  27368 
  27369   // no spaces
  27370   freeO(self);
  27371   setTopSO(self, "SHeePY");
  27372   r = trimO(self);
  27373   ck_assert_ptr_ne(r, null);
  27374   char *s = toStringO(r);
  27375   ck_assert_str_eq(s, "SHeePY");
  27376   free(s);
  27377   // heading spaces
  27378   freeO(self);
  27379   setTopSO(self, "  SHeePY");
  27380   r = trimO(self);
  27381   ck_assert_ptr_ne(r, null);
  27382   s = toStringO(r);
  27383   ck_assert_str_eq(s, "SHeePY");
  27384   free(s);
  27385   // trailing spaces
  27386   freeO(self);
  27387   setTopSO(self, "SHeePY	");
  27388   r = trimO(self);
  27389   ck_assert_ptr_ne(r, null);
  27390   s = toStringO(r);
  27391   ck_assert_str_eq(s, "SHeePY");
  27392   free(s);
  27393   // string with spaces in the middle
  27394   freeO(self);
  27395   setTopSO(self, "	SHe ePY	");
  27396   r = trimO(self);
  27397   ck_assert_ptr_ne(r, null);
  27398   s = toStringO(r);
  27399   ck_assert_str_eq(s, "SHe ePY");
  27400   free(s);
  27401   // all spaces
  27402   freeO(self);
  27403   setTopSO(self, "	 	");
  27404   r = trimO(self);
  27405   ck_assert_ptr_ne(r, null);
  27406   s = toStringO(r);
  27407   ck_assert_str_eq(s, "");
  27408   free(s);
  27409   // empty string
  27410   freeO(self);
  27411   setTopSO(self, "");
  27412   r = trimO(self);
  27413   ck_assert_ptr_ne(r, null);
  27414   s = toStringO(r);
  27415   ck_assert_str_eq(s, "");
  27416   free(s);
  27417   // NULL string
  27418   freeO(self);
  27419   ck_assert_ptr_eq(trimO(self), NULL);
  27420   // json dict
  27421   freeO(self);
  27422   // empty self
  27423   setTypeDictO(self);
  27424   r = trimO(self);
  27425   ck_assert_ptr_ne(r, null);
  27426   self->f->setS(self, "1", "2");
  27427   self->f->setS(self, "3", "4");
  27428   self->f->delElem(self, "3");
  27429   r = trimO(self);
  27430   ck_assert_ptr_ne(r, null);
  27431   ck_assert_int_eq(lenO(self), 1);
  27432   s = toStringO(r);
  27433   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  27434   free(s);
  27435   self->f->delElem(self, "1");
  27436   r = trimO(self);
  27437   ck_assert_ptr_ne(r, null);
  27438   ck_assert_int_eq(lenO(self), 0);
  27439   s = toStringO(r);
  27440   ck_assert_str_eq(s, "{}");
  27441   free(s);
  27442   // json array
  27443   freeO(self);
  27444   self->f->pushS(self, "qwe");
  27445   self->f->pushUndefined(self);
  27446   self->f->pushInt(self, 123);
  27447   ck_assert_uint_eq(lenO(self), 3);
  27448   delElemIndexO(self, 0);
  27449   delElemIndexO(self, 1);
  27450   r = trimO(self);
  27451   ck_assert_uint_eq(lenO(self), 1);
  27452   ck_assert_ptr_ne(r, null);
  27453   s = toStringO(r);
  27454   ck_assert_str_eq(s, "[123]");
  27455   free(s);
  27456   terminateO(self);
  27457 
  27458 }
  27459 
  27460 
  27461 void lTrimSmallJsonT(CuTest *tc UNUSED) {
  27462 
  27463   smallJsont* r;
  27464   smallJsont *self = allocSmallJson();
  27465   setTopSO(self, "");
  27466 
  27467   // no spaces
  27468   freeO(self);
  27469   setTopSO(self, "SHeePY");
  27470   r = lTrimO(self);
  27471   ck_assert_ptr_ne(r, null);
  27472   char *s = toStringO(r);
  27473   ck_assert_str_eq(s, "SHeePY");
  27474   free(s);
  27475   // heading spaces
  27476   freeO(self);
  27477   setTopSO(self, "  SHeePY");
  27478   r = lTrimO(self);
  27479   ck_assert_ptr_ne(r, null);
  27480   s = toStringO(r);
  27481   ck_assert_str_eq(s, "SHeePY");
  27482   free(s);
  27483   // trailing spaces
  27484   freeO(self);
  27485   setTopSO(self, "SHeePY	");
  27486   r = lTrimO(self);
  27487   ck_assert_ptr_ne(r, null);
  27488   s = toStringO(r);
  27489   ck_assert_str_eq(s, "SHeePY	");
  27490   free(s);
  27491   // string with spaces in the middle
  27492   freeO(self);
  27493   setTopSO(self, "	SHe ePY	");
  27494   r = lTrimO(self);
  27495   ck_assert_ptr_ne(r, null);
  27496   s = toStringO(r);
  27497   ck_assert_str_eq(s, "SHe ePY	");
  27498   free(s);
  27499   // all spaces
  27500   freeO(self);
  27501   setTopSO(self, "	 	");
  27502   r = lTrimO(self);
  27503   ck_assert_ptr_ne(r, null);
  27504   s = toStringO(r);
  27505   ck_assert_str_eq(s, "");
  27506   free(s);
  27507   freeO(self);
  27508   setTopSO(self, "");
  27509   r = lTrimO(self);
  27510   ck_assert_ptr_ne(r, null);
  27511   s = toStringO(r);
  27512   ck_assert_str_eq(s, "");
  27513   free(s);
  27514   // NULL string
  27515   freeO(self);
  27516   ck_assert_ptr_eq(lTrimO(self), NULL);
  27517   terminateO(self);
  27518 
  27519 }
  27520 
  27521 
  27522 void rTrimSmallJsonT(CuTest *tc UNUSED) {
  27523 
  27524   smallJsont* r;
  27525   smallJsont *self = allocSmallJson();
  27526   setTopSO(self, "");
  27527 
  27528   // no spaces
  27529   freeO(self);
  27530   setTopSO(self, "SHeePY");
  27531   r = rTrimO(self);
  27532   ck_assert_ptr_ne(r, null);
  27533   char *s = toStringO(r);
  27534   ck_assert_str_eq(s, "SHeePY");
  27535   free(s);
  27536   // heading spaces
  27537   freeO(self);
  27538   setTopSO(self, "  SHeePY");
  27539   r = rTrimO(self);
  27540   ck_assert_ptr_ne(r, null);
  27541   s = toStringO(r);
  27542   ck_assert_str_eq(s, "  SHeePY");
  27543   free(s);
  27544   // trailing spaces
  27545   freeO(self);
  27546   setTopSO(self, "SHeePY	");
  27547   r = rTrimO(self);
  27548   ck_assert_ptr_ne(r, null);
  27549   s = toStringO(r);
  27550   ck_assert_str_eq(s, "SHeePY");
  27551   free(s);
  27552   // string with spaces in the middle
  27553   freeO(self);
  27554   setTopSO(self, "	SHe ePY	");
  27555   r = rTrimO(self);
  27556   ck_assert_ptr_ne(r, null);
  27557   s = toStringO(r);
  27558   ck_assert_str_eq(s, "	SHe ePY");
  27559   free(s);
  27560   // all spaces
  27561   freeO(self);
  27562   setTopSO(self, "	 	");
  27563   r = rTrimO(self);
  27564   ck_assert_ptr_ne(r, null);
  27565   s = toStringO(r);
  27566   ck_assert_str_eq(s, "");
  27567   free(s);
  27568   // empty string
  27569   freeO(self);
  27570   setTopSO(self, "");
  27571   r = rTrimO(self);
  27572   ck_assert_ptr_ne(r, null);
  27573   s = toStringO(r);
  27574   ck_assert_str_eq(s, "");
  27575   free(s);
  27576   // NULL string
  27577   freeO(self);
  27578   ck_assert_ptr_eq(rTrimO(self), NULL);
  27579   terminateO(self);
  27580 
  27581 }
  27582 
  27583 
  27584 void keysSmallJsonT(CuTest *tc UNUSED) {
  27585 
  27586   char** r;
  27587   smallJsont *self = allocG(rtSmallJsont);
  27588 
  27589   self->f->setS(self, "1", "2");
  27590   self->f->setS(self, "3", "4");
  27591   r = keysO(self);
  27592   ck_assert_ptr_ne(r, null);
  27593   char *s = toStringListSGF(r);
  27594   ck_assert_str_eq(s, "[\"1\",\"3\"]");
  27595   free(s);
  27596   listFreeS(r);
  27597   // empty self
  27598   freeO(self);
  27599   r = keysO(self);
  27600   ck_assert_ptr_eq(r, null);
  27601   setTypeDictO(self);
  27602   r = keysO(self);
  27603   ck_assert_ptr_eq(r, null);
  27604   terminateO(self);
  27605 
  27606 }
  27607 
  27608 
  27609 void keysSmallStringSmallJsonT(CuTest *tc UNUSED) {
  27610 
  27611   smallArrayt* r;
  27612   smallJsont *self = allocSmallJson();
  27613 
  27614   self->f->setS(self, "1", "2");
  27615   self->f->setS(self, "3", "4");
  27616   r = keysSmallStringO(self);
  27617   ck_assert_ptr_ne(r, null);
  27618   char *s = toStringO(r);
  27619   ck_assert_str_eq(s, "[\"1\",\"3\"]");
  27620   free(s);
  27621   terminateO(r);
  27622   // empty self
  27623   freeO(self);
  27624   r = keysSmallStringO(self);
  27625   ck_assert_ptr_ne(r, null);
  27626   s = toStringO(r);
  27627   ck_assert_str_eq(s, "[]");
  27628   free(s);
  27629   terminateO(r);
  27630   terminateO(self);
  27631 
  27632 }
  27633 
  27634 
  27635 void valuesSmallJsonT(CuTest *tc UNUSED) {
  27636 
  27637   smallArrayt* r;
  27638   smallJsont *self = allocG(rtSmallJsont);
  27639 
  27640   // empty json
  27641   r = valuesO(self);
  27642   ck_assert_ptr_eq(r, null);
  27643   setTypeDictO(self);
  27644   r = valuesO(self);
  27645   ck_assert_ptr_eq(r, null);
  27646   // values
  27647   self->f->setUndefined(self, "qwe");
  27648   self->f->setS(self, "123", "sheepy");
  27649   r = valuesO(self);
  27650   ck_assert_ptr_ne(r, null);
  27651   char *s  = toStringO(r);
  27652   ck_assert_str_eq(s, "[null,\"sheepy\"]");
  27653   free(s);
  27654   smashO(r);
  27655   terminateO(self);
  27656 
  27657 }
  27658 
  27659 
  27660 void compactSmallJsonT(CuTest *tc UNUSED) {
  27661 
  27662   smallJsont* r;
  27663   smallJsont *self = allocSmallJson();
  27664 
  27665   r = compactO(self);
  27666   ck_assert_ptr_eq(r, NULL);
  27667   // add and remove elements
  27668   self->f->pushUndefined(self);
  27669   //  null element
  27670   self->f->pushUndefined(self);
  27671   delElemIndexO(self, 1);
  27672   self->f->pushBool(self, true);
  27673   createSmallContainer(c);
  27674   self->f->pushSmallContainer(self, &c);
  27675   //  empty dict
  27676   createSmallDict(d);
  27677   self->f->pushDict(self, &d);
  27678   resetO(&d);
  27679   (&d)->f->setInt(&d, "a", 1);
  27680   self->f->pushDict(self, &d);
  27681   self->f->pushDouble(self, 2);
  27682   self->f->pushInt(self, 5);
  27683   self->f->pushS(self, "   ");
  27684   self->f->pushS(self, "asd");
  27685   //  empty Array
  27686   createSmallArray(a);
  27687   self->f->pushArray(self, &a);
  27688   resetO(&a);
  27689   (&a)->f->pushInt(&a, 1);
  27690   self->f->pushArray(self, &a);
  27691   //  empty bytes
  27692   createSmallBytes(b);
  27693   self->f->pushSmallBytes(self, &b);
  27694   smallBytest *B = allocSmallBytes("asd", 4);
  27695   self->f->pushNFreeSmallBytes(self, B);
  27696   r = compactO(self);
  27697   ck_assert_ptr_ne(r, NULL);
  27698   ck_assert_int_eq(lenO(r), 8);
  27699   char *s = toStringO(r);
  27700   ck_assert_str_eq(s, "[true,\"<data container>\",{\"a\":1},2.000000e+00,5,\"asd\",[1],[0x61,0x73,0x64,0x00]]");
  27701   free(s);
  27702   // array with blank elements becomes empty after compact
  27703   // self->topA should not be null
  27704   // self->topA should an empty sArray to avoid issues with the setP function
  27705   self->f->free(self);
  27706   self->f->pushS(self, "  ");
  27707   self->f->pushS(self, "");
  27708   r = compactO(self);
  27709   ck_assert_ptr_ne(r, NULL);
  27710   ck_assert_ptr_ne(r->topA, NULL);
  27711   ck_assert_int_eq(lenO(r), 0);
  27712   s = toStringO(r);
  27713   ck_assert_str_eq(s, "[]");
  27714   free(s);
  27715   // empty array
  27716   emptyO(self);
  27717   r = compactO(self);
  27718   ck_assert_ptr_eq(r, NULL);
  27719   terminateO(self);
  27720 
  27721 }
  27722 
  27723 
  27724 void isEmptySmallJsonT(CuTest *tc UNUSED) {
  27725 
  27726   bool r;
  27727   smallJsont *self = allocSmallJson();
  27728 
  27729   r = isEmptyO(self);
  27730   ck_assert(r);
  27731   self->f->setInt(self, "a", 1);
  27732   r = isEmptyO(self);
  27733   ck_assert(!r);
  27734   self->f->delElem(self, "a");
  27735   r = isEmptyO(self);
  27736   ck_assert(r);
  27737   terminateO(self);
  27738 
  27739 }
  27740 
  27741 
  27742 void isBlankSmallJsonT(CuTest *tc UNUSED) {
  27743 
  27744   bool r;
  27745   smallJsont *self = allocSmallJson();
  27746 
  27747   // json dict
  27748   setTypeDictO(self);
  27749   r = isBlankO(self);
  27750   ck_assert(r);
  27751   // json string
  27752   freeO(self);
  27753   setTopSO(self, " ");
  27754   r = isBlankO(self);
  27755   ck_assert(r);
  27756   // json array
  27757   freeO(self);
  27758   // bool
  27759   self->f->pushBool(self, true);
  27760   r = isBlankO(self);
  27761   ck_assert(!r);
  27762   // container
  27763   emptyO(self);
  27764   createSmallContainer(c);
  27765   self->f->pushSmallContainer(self, &c);
  27766   r = isBlankO(self);
  27767   ck_assert(!r);
  27768   // blank dict
  27769   emptyO(self);
  27770   createSmallDict(d);
  27771   self->f->pushDict(self, &d);
  27772   r = isBlankO(self);
  27773   ck_assert(r);
  27774   // dict
  27775   emptyO(self);
  27776   resetO(&d);
  27777   (&d)->f->setInt(&d, "a", 1);
  27778   self->f->pushDict(self, &d);
  27779   r = isBlankO(self);
  27780   ck_assert(!r);
  27781   // double
  27782   emptyO(self);
  27783   self->f->pushDouble(self, 0);
  27784   r = isBlankO(self);
  27785   ck_assert(!r);
  27786   // int
  27787   emptyO(self);
  27788   self->f->pushInt(self, 0);
  27789   r = isBlankO(self);
  27790   ck_assert(!r);
  27791   // blank string
  27792   emptyO(self);
  27793   self->f->pushS(self, "   ");
  27794   r = isBlankO(self);
  27795   ck_assert(r);
  27796   // string
  27797   emptyO(self);
  27798   self->f->pushS(self, "asd");
  27799   r = isBlankO(self);
  27800   ck_assert(!r);
  27801   // blank dict
  27802   emptyO(self);
  27803   createSmallArray(a);
  27804   self->f->pushArray(self, &a);
  27805   r = isBlankO(self);
  27806   ck_assert(r);
  27807   // dict
  27808   emptyO(self);
  27809   resetO(&a);
  27810   (&a)->f->pushInt(&a, 1);
  27811   self->f->pushArray(self, &a);
  27812   r = isBlankO(self);
  27813   ck_assert(!r);
  27814   // blank Bytes
  27815   emptyO(self);
  27816   createSmallBytes(b);
  27817   self->f->pushSmallBytes(self, &b);
  27818   r = isBlankO(self);
  27819   ck_assert(r);
  27820   // Bytes
  27821   emptyO(self);
  27822   smallBytest *B = allocSmallBytes("asd", 4);
  27823   self->f->pushNFreeSmallBytes(self, B);
  27824   r = isBlankO(self);
  27825   ck_assert(!r);
  27826   // empty array
  27827   emptyO(self);
  27828   r = isBlankO(self);
  27829   ck_assert(r);
  27830   terminateO(self);
  27831 
  27832 }
  27833 
  27834 
  27835 bool fef(void *closure UNUSED, baset *e) {
  27836   bool r = true;
  27837   if   (isOUndefined(e)) r = true;
  27838   elif (isOSmallInt(e)) r = false;
  27839   else {
  27840     static u16 c;
  27841     r = !c;
  27842     c++;
  27843   }
  27844   return r;
  27845 }
  27846 
  27847 void forEachSmallJsonFT(CuTest *tc UNUSED) {
  27848 
  27849   smallJsont *self = allocSmallJson();
  27850 
  27851   // empty array
  27852   // direct return
  27853   self->f->forEach(self, NULL, fef);
  27854   setTypeArrayO(self);
  27855   self->f->forEach(self, NULL, fef);
  27856   // array with elements
  27857   self->f->pushUndefined(self);
  27858   self->f->pushBool(self, true);
  27859   //  base class
  27860   createAllocateSmallInt(i);
  27861   i->type = "userclass";
  27862   self->f->push(self, (baset*)i);
  27863   createAllocateSmallInt(j);
  27864   j->type = "userclass";
  27865   self->f->push(self, (baset*)j);
  27866   delElemIndexO(self, 1);
  27867   self->f->pushInt(self, 2);
  27868   self->f->forEach(self, NULL, fef);
  27869   self->f->del(self, 2, 4);
  27870   self->f->forEach(self, NULL, fef);
  27871   terminateO(self);
  27872 
  27873 }
  27874 
  27875 
  27876 bool ef(void *closure UNUSED, u64 i UNUSED, baset *e) {
  27877   bool r = true;
  27878   if   (isOUndefined(e)) r = true;
  27879   elif (isOSmallInt(e)) r = false;
  27880   else {
  27881     static u16 c;
  27882     r = !c;
  27883     c++;
  27884   }
  27885   return r;
  27886 }
  27887 
  27888 void enumerateSmallJsonFT(CuTest *tc UNUSED) {
  27889 
  27890   smallJsont *self = allocSmallJson();
  27891 
  27892   // empty array
  27893   // direct return
  27894   self->f->enumerate(self, NULL, ef);
  27895   setTypeArrayO(self);
  27896   self->f->enumerate(self, NULL, ef);
  27897   // enumerate elements
  27898   self->f->pushUndefined(self);
  27899   self->f->pushBool(self, true);
  27900   //  base class
  27901   createAllocateSmallInt(i);
  27902   i->type = "userclass";
  27903   self->f->push(self, (baset*)i);
  27904   createAllocateSmallInt(j);
  27905   j->type = "userclass";
  27906   self->f->push(self, (baset*)j);
  27907   delElemIndexO(self, 1);
  27908   self->f->pushInt(self, 2);
  27909   self->f->enumerate(self, NULL, ef);
  27910   self->f->del(self, 2, 4);
  27911   self->f->enumerate(self, NULL, ef);
  27912   terminateO(self);
  27913 
  27914 }
  27915 
  27916 
  27917 bool enumerateElement(void *closure, char *key UNUSED, baset *element UNUSED) {
  27918   int *c = closure;
  27919   (*c)++;
  27920   return *c != 2 ? true : false;
  27921 }
  27922 
  27923 void enumerateDictSmallJsonT(CuTest *tc UNUSED) {
  27924 
  27925   smallJsont *self = allocSmallJson();
  27926   int closure      = 0;
  27927 
  27928   self->f->enumerateDict(self, &closure, enumerateElement);
  27929   self->f->setInt(self, "a", 1);
  27930   self->f->setInt(self, "b", 2);
  27931   self->f->setInt(self, "c", 3);
  27932   self->f->delElem(self, "a");
  27933   self->f->enumerateDict(self, &closure, enumerateElement);
  27934   ck_assert_int_eq(closure, 2);
  27935   // baset object in container
  27936   closure = -2;
  27937   smallIntt *i = allocSmallInt(2);
  27938   i->type = "randomClass";
  27939   self->f->set(self, "d", (baset*)i);
  27940   i = allocSmallInt(3);
  27941   i->type = "randomClass";
  27942   self->f->set(self, "e", (baset*)i);
  27943   self->f->enumerateDict(self, &closure, enumerateElement);
  27944   ck_assert_int_eq(closure, 2);
  27945   terminateO(self);
  27946 
  27947 }
  27948 
  27949 
  27950 void joinSmallJsonT(CuTest *tc UNUSED) {
  27951 
  27952   smallStringt* r;
  27953   smallJsont *self = allocSmallJson();
  27954 
  27955   // join non string objects
  27956   self->f->pushUndefined(self);
  27957   self->f->pushInt(self, 123);
  27958   r = joinO(self, ";");
  27959   ck_assert_ptr_ne(r, NULL);
  27960   char *s = toStringO(r);
  27961   terminateO(r);
  27962   ck_assert_str_eq(s, "null;123");
  27963   free(s);
  27964   // join strings
  27965   emptyO(self);
  27966   self->f->pushS(self, "a");
  27967   self->f->pushS(self, "b");
  27968   self->f->pushS(self, "c");
  27969   self->f->pushS(self, "d");
  27970   delElemIndexO(self, 1);
  27971   r = joinO(self, ";");
  27972   ck_assert_ptr_ne(r, NULL);
  27973   s = toStringO(r);
  27974   terminateO(r);
  27975   ck_assert_str_eq(s, "a;c;d");
  27976   free(s);
  27977   // null delimiter
  27978   r = joinO(self, NULL);
  27979   ck_assert_ptr_eq(r, NULL);
  27980   // empty array
  27981   emptyO(self);
  27982   r = joinO(self, ";");
  27983   ck_assert_ptr_eq(r, NULL);
  27984   freeO(self);
  27985   r = joinO(self, ";");
  27986   ck_assert_ptr_eq(r, NULL);
  27987   terminateO(self);
  27988 
  27989 }
  27990 
  27991 
  27992 void joinCharSmallJsonT(CuTest *tc UNUSED) {
  27993 
  27994   smallStringt* r;
  27995   smallJsont *self = allocSmallJson();
  27996 
  27997   // join non string objects
  27998   self->f->pushUndefined(self);
  27999   self->f->pushInt(self, 123);
  28000   r = joinCharO(self, ';');
  28001   ck_assert_ptr_ne(r, NULL);
  28002   char *s = toStringO(r);
  28003   terminateO(r);
  28004   ck_assert_str_eq(s, "null;123");
  28005   free(s);
  28006   // join strings
  28007   emptyO(self);
  28008   self->f->pushS(self, "a");
  28009   self->f->pushS(self, "b");
  28010   self->f->pushS(self, "c");
  28011   self->f->pushS(self, "d");
  28012   delElemIndexO(self, 1);
  28013   r = joinCharO(self, ';');
  28014   ck_assert_ptr_ne(r, NULL);
  28015   s = toStringO(r);
  28016   terminateO(r);
  28017   ck_assert_str_eq(s, "a;c;d");
  28018   free(s);
  28019   // empty array
  28020   emptyO(self);
  28021   r = joinCharO(self, ';');
  28022   ck_assert_ptr_eq(r, NULL);
  28023   terminateO(self);
  28024 
  28025 }
  28026 
  28027 
  28028 void joinSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  28029 
  28030   smallStringt* r;
  28031   smallJsont *self = allocSmallJson();
  28032   smallJsont* delim = allocSmallJson();
  28033 
  28034   // join non string objects
  28035   setTopSO(delim, ";");
  28036   self->f->pushUndefined(self);
  28037   self->f->pushInt(self, 123);
  28038   r = self->f->joinSmallJson(self, delim);
  28039   ck_assert_ptr_ne(r, NULL);
  28040   char *s = toStringO(r);
  28041   terminateO(r);
  28042   ck_assert_str_eq(s, "null;123");
  28043   free(s);
  28044   // join strings
  28045   emptyO(self);
  28046   self->f->pushS(self, "a");
  28047   self->f->pushS(self, "b");
  28048   self->f->pushS(self, "c");
  28049   self->f->pushS(self, "d");
  28050   delElemIndexO(self, 1);
  28051   r = self->f->joinSmallJson(self, delim);
  28052   ck_assert_ptr_ne(r, NULL);
  28053   s = toStringO(r);
  28054   terminateO(r);
  28055   ck_assert_str_eq(s, "a;c;d");
  28056   free(s);
  28057   // delimiter not a string
  28058   freeO(delim);
  28059   setTopIntO(delim, 1);
  28060   r = self->f->joinSmallJson(self, delim);
  28061   ck_assert_ptr_eq(r, NULL);
  28062   // non smallJson object
  28063   terminateO(delim);
  28064   delim = (smallJsont*) allocSmallInt(2);
  28065   r = self->f->joinSmallJson(self, delim);
  28066   ck_assert_ptr_eq(r, NULL);
  28067   // null delimiter
  28068   r = self->f->joinSmallJson(self, NULL);
  28069   ck_assert_ptr_eq(r, NULL);
  28070   // empty array
  28071   emptyO(self);
  28072   freeO(delim);
  28073   setTopSO(delim, ";");
  28074   r = self->f->joinSmallJson(self, delim);
  28075   ck_assert_ptr_eq(r, NULL);
  28076   terminateO(self);
  28077   terminateO(delim);
  28078 
  28079 }
  28080 
  28081 
  28082 void joinSmallStringSmallJsonT(CuTest *tc UNUSED) {
  28083 
  28084   smallStringt* r;
  28085   smallJsont *self   = allocSmallJson();
  28086   smallStringt* delim = allocSmallString(";");
  28087 
  28088   // join non string objects
  28089   self->f->pushUndefined(self);
  28090   self->f->pushInt(self, 123);
  28091   r = joinSmallStringO(self, delim);
  28092   ck_assert_ptr_ne(r, NULL);
  28093   char *s = toStringO(r);
  28094   terminateO(r);
  28095   ck_assert_str_eq(s, "null;123");
  28096   free(s);
  28097   // join strings
  28098   emptyO(self);
  28099   self->f->pushS(self, "a");
  28100   self->f->pushS(self, "b");
  28101   self->f->pushS(self, "c");
  28102   self->f->pushS(self, "d");
  28103   delElemIndexO(self, 1);
  28104   r = joinSmallStringO(self, delim);
  28105   ck_assert_ptr_ne(r, NULL);
  28106   s = toStringO(r);
  28107   terminateO(r);
  28108   ck_assert_str_eq(s, "a;c;d");
  28109   free(s);
  28110   // delimiter with no string
  28111   freeO(delim);
  28112   r = joinSmallStringO(self, delim);
  28113   ck_assert_ptr_eq(r, NULL);
  28114   // non smallString delim
  28115   terminateO(delim);
  28116   delim = (smallStringt*) allocSmallInt(0);
  28117   r = joinSmallStringO(self, delim);
  28118   ck_assert_ptr_eq(r, NULL);
  28119   terminateO(delim);
  28120   // null delimiter
  28121   r = joinSmallStringO(self, NULL);
  28122   ck_assert_ptr_eq(r, NULL);
  28123   // empty array
  28124   emptyO(self);
  28125   delim = allocSmallString(";");
  28126   r = joinSmallStringO(self, delim);
  28127   ck_assert_ptr_eq(r, NULL);
  28128   terminateO(self);
  28129   terminateO(delim);
  28130 
  28131 }
  28132 
  28133 
  28134 void joinSSmallJsonT(CuTest *tc UNUSED) {
  28135 
  28136   char* r;
  28137   smallJsont *self = allocSmallJson();
  28138 
  28139   // join non string objects
  28140   self->f->pushUndefined(self);
  28141   self->f->pushInt(self, 123);
  28142   r = self->f->joinS(self, ";");
  28143   ck_assert_ptr_ne(r, NULL);
  28144   ck_assert_str_eq(r, "null;123");
  28145   free(r);
  28146   // join strings
  28147   emptyO(self);
  28148   self->f->pushS(self, "a");
  28149   self->f->pushS(self, "b");
  28150   self->f->pushS(self, "c");
  28151   self->f->pushS(self, "d");
  28152   delElemIndexO(self, 1);
  28153   r = self->f->joinS(self, ";");
  28154   ck_assert_ptr_ne(r, NULL);
  28155   ck_assert_str_eq(r, "a;c;d");
  28156   free(r);
  28157   // null delimiter
  28158   r = self->f->joinS(self, NULL);
  28159   ck_assert_ptr_eq(r, NULL);
  28160   // empty array
  28161   emptyO(self);
  28162   r = self->f->joinS(self, ";");
  28163   ck_assert_ptr_eq(r, NULL);
  28164   terminateO(self);
  28165 
  28166 }
  28167 
  28168 
  28169 void joinCharSSmallJsonT(CuTest *tc UNUSED) {
  28170 
  28171   char* r;
  28172   smallJsont *self = allocSmallJson();
  28173 
  28174   // join non string objects
  28175   self->f->pushUndefined(self);
  28176   self->f->pushInt(self, 123);
  28177   r = joinCharSO(self, ';');
  28178   ck_assert_ptr_ne(r, NULL);
  28179   ck_assert_str_eq(r, "null;123");
  28180   free(r);
  28181   // join strings
  28182   emptyO(self);
  28183   self->f->pushS(self, "a");
  28184   self->f->pushS(self, "b");
  28185   self->f->pushS(self, "c");
  28186   self->f->pushS(self, "d");
  28187   delElemIndexO(self, 1);
  28188   r = joinCharSO(self, ';');
  28189   ck_assert_ptr_ne(r, NULL);
  28190   ck_assert_str_eq(r, "a;c;d");
  28191   free(r);
  28192   // empty array
  28193   emptyO(self);
  28194   r = joinCharSO(self, ';');
  28195   ck_assert_ptr_eq(r, NULL);
  28196   terminateO(self);
  28197 
  28198 }
  28199 
  28200 
  28201 void joinSmallJsonSSmallJsonT(CuTest *tc UNUSED) {
  28202 
  28203   char* r;
  28204   smallJsont *self = allocSmallJson();
  28205   smallJsont* delim = allocSmallJson();
  28206 
  28207   // join non string objects
  28208   setTopSO(delim, ";");
  28209   self->f->pushUndefined(self);
  28210   self->f->pushInt(self, 123);
  28211   r = joinSmallJsonSO(self, delim);
  28212   ck_assert_ptr_ne(r, NULL);
  28213   ck_assert_str_eq(r, "null;123");
  28214   free(r);
  28215   // join strings
  28216   emptyO(self);
  28217   self->f->pushS(self, "a");
  28218   self->f->pushS(self, "b");
  28219   self->f->pushS(self, "c");
  28220   self->f->pushS(self, "d");
  28221   delElemIndexO(self, 1);
  28222   r = joinSmallJsonSO(self, delim);
  28223   ck_assert_ptr_ne(r, NULL);
  28224   ck_assert_str_eq(r, "a;c;d");
  28225   free(r);
  28226   // delimiter not a string
  28227   freeO(delim);
  28228   setTopIntO(delim, 1);
  28229   r = joinSmallJsonSO(self, delim);
  28230   ck_assert_ptr_eq(r, NULL);
  28231   // non smallJson object
  28232   terminateO(delim);
  28233   delim = (smallJsont*) allocSmallInt(2);
  28234   r = joinSmallJsonSO(self, delim);
  28235   ck_assert_ptr_eq(r, NULL);
  28236   // null delimiter
  28237   r = joinSmallJsonSO(self, NULL);
  28238   ck_assert_ptr_eq(r, NULL);
  28239   // empty array
  28240   emptyO(self);
  28241   freeO(delim);
  28242   setTopSO(delim, ";");
  28243   r = joinSmallJsonSO(self, delim);
  28244   ck_assert_ptr_eq(r, NULL);
  28245   terminateO(self);
  28246   terminateO(delim);
  28247 
  28248 }
  28249 
  28250 
  28251 void joinSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  28252 
  28253   char* r;
  28254   smallJsont *self   = allocSmallJson();
  28255   smallStringt* delim = allocSmallString(";");
  28256 
  28257   // join non string objects
  28258   self->f->pushUndefined(self);
  28259   self->f->pushInt(self, 123);
  28260   r = joinSmallStringSO(self, delim);
  28261   ck_assert_ptr_ne(r, NULL);
  28262   ck_assert_str_eq(r, "null;123");
  28263   free(r);
  28264   // join strings
  28265   emptyO(self);
  28266   self->f->pushS(self, "a");
  28267   self->f->pushS(self, "b");
  28268   self->f->pushS(self, "c");
  28269   self->f->pushS(self, "d");
  28270   delElemIndexO(self, 1);
  28271   r = joinSmallStringSO(self, delim);
  28272   ck_assert_ptr_ne(r, NULL);
  28273   ck_assert_str_eq(r, "a;c;d");
  28274   free(r);
  28275   // delimiter with no string
  28276   freeO(delim);
  28277   r = joinSmallStringSO(self, delim);
  28278   ck_assert_ptr_eq(r, NULL);
  28279   // non smallString delim
  28280   terminateO(delim);
  28281   delim = (smallStringt*) allocSmallInt(0);
  28282   r = joinSmallStringSO(self, delim);
  28283   ck_assert_ptr_eq(r, NULL);
  28284   terminateO(delim);
  28285   // null delimiter
  28286   r = joinSmallStringSO(self, NULL);
  28287   ck_assert_ptr_eq(r, NULL);
  28288   // empty array
  28289   emptyO(self);
  28290   delim = allocSmallString(";");
  28291   r = joinSmallStringSO(self, delim);
  28292   ck_assert_ptr_eq(r, NULL);
  28293   terminateO(self);
  28294   terminateO(delim);
  28295 
  28296 }
  28297 
  28298 
  28299 void splitSmallJsonT(CuTest *tc UNUSED) {
  28300 
  28301   smallJsont* r;
  28302   smallJsont *self = allocSmallJson();
  28303   setTopSO(self, "");
  28304 
  28305   // string
  28306   freeO(self);
  28307   setTopSO(self, "one/two");
  28308   r = splitO(self, "/");
  28309   ck_assert_ptr_ne(r, null);
  28310   char *s = toStringO(r);
  28311   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28312   free(s);
  28313   terminateO(r);
  28314   // delimiter on the edge
  28315   freeO(self);
  28316   setTopSO(self, "/one");
  28317   r = splitO(self, "/");
  28318   ck_assert_ptr_ne(r, null);
  28319   s = toStringO(r);
  28320   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28321   free(s);
  28322   terminateO(r);
  28323   freeO(self);
  28324   setTopSO(self, "one/");
  28325   r = splitO(self, "/");
  28326   ck_assert_ptr_ne(r, null);
  28327   s = toStringO(r);
  28328   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28329   free(s);
  28330   terminateO(r);
  28331   // delimiter not found
  28332   freeO(self);
  28333   setTopSO(self, "one/two");
  28334   r = splitO(self, "||");
  28335   ck_assert_ptr_ne(r, null);
  28336   s = toStringO(r);
  28337   ck_assert_str_eq(s, "[\"one/two\"]");
  28338   free(s);
  28339   terminateO(r);
  28340   // split with several delimiters after each other
  28341   freeO(self);
  28342   setTopSO(self, "one/two  three ");
  28343   r = splitO(self, " ");
  28344   ck_assert_ptr_ne(r, null);
  28345   s = toStringO(r);
  28346   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28347   free(s);
  28348   terminateO(r);
  28349   // multiple character delimiter
  28350   freeO(self);
  28351   setTopSO(self, "AAe three extract");
  28352   r = splitO(self, "e ");
  28353   ck_assert_ptr_ne(r, null);
  28354   s = toStringO(r);
  28355   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28356   free(s);
  28357   terminateO(r);
  28358   // empty delimiter
  28359   freeO(self);
  28360   setTopSO(self, "AAd");
  28361   r = splitO(self, "");
  28362   ck_assert_ptr_ne(r, null);
  28363   s = toStringO(r);
  28364   ck_assert_str_eq(s, "[\"AAd\"]");
  28365   free(s);
  28366   terminateO(r);
  28367   // empty string
  28368   emptyO(self);
  28369   r = splitO(self, "$");
  28370   ck_assert_ptr_ne(r, null);
  28371   s = toStringO(r);
  28372   ck_assert_str_eq(s, "[\"\"]");
  28373   free(s);
  28374   terminateO(r);
  28375   // NULL list
  28376   freeO(self);
  28377   ck_assert_ptr_eq(splitO(self, ";"), NULL);
  28378   // NULL delimiter
  28379   freeO(self);
  28380   setTopSO(self, "test");
  28381   ck_assert_ptr_eq(splitO(self, NULL), NULL);
  28382   terminateO(self);
  28383 
  28384 }
  28385 
  28386 
  28387 void splitCharSmallJsonT(CuTest *tc UNUSED) {
  28388 
  28389   smallJsont* r;
  28390   smallJsont *self = allocSmallJson();
  28391   setTopSO(self, "");
  28392 
  28393   // string
  28394   freeO(self);
  28395   setTopSO(self, "one/two");
  28396   r = splitCharO(self, '/');
  28397   ck_assert_ptr_ne(r, null);
  28398   char *s = toStringO(r);
  28399   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28400   free(s);
  28401   terminateO(r);
  28402   // delimiter on the edge
  28403   freeO(self);
  28404   setTopSO(self, "/one");
  28405   r = splitCharO(self, '/');
  28406   ck_assert_ptr_ne(r, null);
  28407   s = toStringO(r);
  28408   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28409   free(s);
  28410   terminateO(r);
  28411   freeO(self);
  28412   setTopSO(self, "one/");
  28413   r = splitCharO(self, '/');
  28414   ck_assert_ptr_ne(r, null);
  28415   s = toStringO(r);
  28416   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28417   free(s);
  28418   terminateO(r);
  28419   // delimiter not found
  28420   freeO(self);
  28421   setTopSO(self, "one/two");
  28422   r = splitCharO(self, '|');
  28423   ck_assert_ptr_ne(r, null);
  28424   s = toStringO(r);
  28425   ck_assert_str_eq(s, "[\"one/two\"]");
  28426   free(s);
  28427   terminateO(r);
  28428   // split with several delimiters after each other
  28429   freeO(self);
  28430   setTopSO(self, "one/two  three ");
  28431   r = splitCharO(self, ' ');
  28432   ck_assert_ptr_ne(r, null);
  28433   s = toStringO(r);
  28434   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28435   free(s);
  28436   terminateO(r);
  28437   // empty string
  28438   emptyO(self);
  28439   r = splitCharO(self, '$');
  28440   ck_assert_ptr_ne(r, null);
  28441   s = toStringO(r);
  28442   ck_assert_str_eq(s, "[\"\"]");
  28443   free(s);
  28444   terminateO(r);
  28445   // NULL list
  28446   freeO(self);
  28447   ck_assert_ptr_eq(splitCharO(self, ';'), NULL);
  28448   terminateO(self);
  28449 
  28450 }
  28451 
  28452 
  28453 void splitSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  28454 
  28455   smallJsont* r;
  28456   smallJsont *self = allocSmallJson();
  28457   setTopSO(self, "");
  28458   smallJsont *delim  = allocSmallJson();
  28459 
  28460   // string
  28461   freeO(self);
  28462   setTopSO(self, "one/two");
  28463   setTopSO(delim, "/");
  28464   r = self->f->splitSmallJson(self, delim);
  28465   ck_assert_ptr_ne(r, null);
  28466   char *s = toStringO(r);
  28467   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28468   free(s);
  28469   terminateO(r);
  28470   // delimiter on the edge
  28471   freeO(self);
  28472   setTopSO(self, "/one");
  28473   r = self->f->splitSmallJson(self, delim);
  28474   ck_assert_ptr_ne(r, null);
  28475   s = toStringO(r);
  28476   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28477   free(s);
  28478   terminateO(r);
  28479   freeO(self);
  28480   setTopSO(self, "one/");
  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\",\"\"]");
  28485   free(s);
  28486   terminateO(r);
  28487   // delimiter not found
  28488   freeO(self);
  28489   setTopSO(self, "one/two");
  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\"]");
  28496   free(s);
  28497   terminateO(r);
  28498   // split with several delimiters after each other
  28499   freeO(self);
  28500   setTopSO(self, "one/two  three ");
  28501   freeO(delim);
  28502   setTopSO(delim, " ");
  28503   r = self->f->splitSmallJson(self, delim);
  28504   ck_assert_ptr_ne(r, null);
  28505   s = toStringO(r);
  28506   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28507   free(s);
  28508   terminateO(r);
  28509   // multiple character delimiter
  28510   freeO(self);
  28511   setTopSO(self, "AAe three extract");
  28512   freeO(delim);
  28513   setTopSO(delim, "e ");
  28514   r = self->f->splitSmallJson(self, delim);
  28515   ck_assert_ptr_ne(r, null);
  28516   s = toStringO(r);
  28517   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28518   free(s);
  28519   terminateO(r);
  28520   // empty delimiter
  28521   freeO(self);
  28522   setTopSO(self, "AAd");
  28523   freeO(delim);
  28524   setTopSO(delim, "");
  28525   r = self->f->splitSmallJson(self, delim);
  28526   ck_assert_ptr_ne(r, null);
  28527   s = toStringO(r);
  28528   ck_assert_str_eq(s, "[\"AAd\"]");
  28529   free(s);
  28530   terminateO(r);
  28531   // empty string
  28532   emptyO(self);
  28533   freeO(delim);
  28534   setTopSO(delim, "$");
  28535   r = self->f->splitSmallJson(self, delim);
  28536   ck_assert_ptr_ne(r, null);
  28537   s = toStringO(r);
  28538   ck_assert_str_eq(s, "[\"\"]");
  28539   free(s);
  28540   terminateO(r);
  28541   // non json string delimiter
  28542   freeO(delim);
  28543   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28544   // non json object delimiter
  28545   terminateO(delim);
  28546   delim = (smallJsont*) allocSmallInt(1);
  28547   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28548   terminateO(delim);
  28549   delim  = allocSmallJson();
  28550   // NULL list
  28551   freeO(self);
  28552   freeO(delim);
  28553   setTopSO(delim, ";");
  28554   ck_assert_ptr_eq(self->f->splitSmallJson(self, delim), NULL);
  28555   // NULL delimiter
  28556   freeO(self);
  28557   setTopSO(self, "test");
  28558   ck_assert_ptr_eq(self->f->splitSmallJson(self, NULL), NULL);
  28559   terminateO(delim);
  28560   terminateO(self);
  28561 
  28562 }
  28563 
  28564 
  28565 void splitSmallStringSmallJsonT(CuTest *tc UNUSED) {
  28566 
  28567   smallJsont* r;
  28568   smallJsont *self = allocSmallJson();
  28569   setTopSO(self, "");
  28570   smallStringt *delim = allocSmallString("/");
  28571 
  28572   // string
  28573   freeO(self);
  28574   setTopSO(self, "one/two");
  28575   r = self->f->splitSmallString(self, delim);
  28576   ck_assert_ptr_ne(r, null);
  28577   char *s = toStringO(r);
  28578   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  28579   free(s);
  28580   terminateO(r);
  28581   // delimiter on the edge
  28582   freeO(self);
  28583   setTopSO(self, "/one");
  28584   r = self->f->splitSmallString(self, delim);
  28585   ck_assert_ptr_ne(r, null);
  28586   s = toStringO(r);
  28587   ck_assert_str_eq(s, "[\"\",\"one\"]");
  28588   free(s);
  28589   terminateO(r);
  28590   freeO(self);
  28591   setTopSO(self, "one/");
  28592   r = self->f->splitSmallString(self, delim);
  28593   ck_assert_ptr_ne(r, null);
  28594   s = toStringO(r);
  28595   ck_assert_str_eq(s, "[\"one\",\"\"]");
  28596   free(s);
  28597   terminateO(r);
  28598   // delimiter not found
  28599   freeO(self);
  28600   setTopSO(self, "one/two");
  28601   setValO(delim, "||");
  28602   r = self->f->splitSmallString(self, delim);
  28603   ck_assert_ptr_ne(r, null);
  28604   s = toStringO(r);
  28605   ck_assert_str_eq(s, "[\"one/two\"]");
  28606   free(s);
  28607   terminateO(r);
  28608   // split with several delimiters after each other
  28609   freeO(self);
  28610   setTopSO(self, "one/two  three ");
  28611   setValO(delim, " ");
  28612   r = self->f->splitSmallString(self, delim);
  28613   ck_assert_ptr_ne(r, null);
  28614   s = toStringO(r);
  28615   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  28616   free(s);
  28617   terminateO(r);
  28618   // multiple character delimiter
  28619   freeO(self);
  28620   setTopSO(self, "AAe three extract");
  28621   setValO(delim, "e ");
  28622   r = self->f->splitSmallString(self, delim);
  28623   ck_assert_ptr_ne(r, null);
  28624   s = toStringO(r);
  28625   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  28626   free(s);
  28627   terminateO(r);
  28628   // empty delimiter
  28629   freeO(self);
  28630   setTopSO(self, "AAd");
  28631   setValO(delim, "");
  28632   r = self->f->splitSmallString(self, delim);
  28633   ck_assert_ptr_ne(r, null);
  28634   s = toStringO(r);
  28635   ck_assert_str_eq(s, "[\"AAd\"]");
  28636   free(s);
  28637   terminateO(r);
  28638   // empty string
  28639   emptyO(self);
  28640   setValO(delim, "$");
  28641   r = self->f->splitSmallString(self, delim);
  28642   ck_assert_ptr_ne(r, null);
  28643   s = toStringO(r);
  28644   ck_assert_str_eq(s, "[\"\"]");
  28645   free(s);
  28646   terminateO(r);
  28647   // null string delimiter
  28648   freeO(delim);
  28649   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28650   // non json object delimiter
  28651   terminateO(delim);
  28652   delim = (smallStringt*) allocSmallInt(1);
  28653   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28654   terminateO(delim);
  28655   // NULL list
  28656   freeO(self);
  28657   delim  = allocSmallString(";");
  28658   ck_assert_ptr_eq(self->f->splitSmallString(self, delim), NULL);
  28659   // NULL delimiter
  28660   freeO(self);
  28661   setTopSO(self, "test");
  28662   ck_assert_ptr_eq(self->f->splitSmallString(self, NULL), NULL);
  28663   terminateO(delim);
  28664   terminateO(self);
  28665 
  28666 }
  28667 
  28668 
  28669 void splitSSmallJsonT(CuTest *tc UNUSED) {
  28670 
  28671   char** r;
  28672   smallJsont *self = allocSmallJson();
  28673   setTopSO(self, "");
  28674 
  28675   // string
  28676   freeO(self);
  28677   setTopSO(self, "one/two");
  28678   r = splitSO(self, "/");
  28679   ck_assert_uint_eq(listLengthS(r),2);
  28680   ck_assert_str_eq(r[0], "one");
  28681   ck_assert_str_eq(r[1], "two");
  28682   listFreeS(r);
  28683   // delimiter on the edge
  28684   freeO(self);
  28685   setTopSO(self, "/one");
  28686   r = splitSO(self, "/");
  28687   ck_assert_uint_eq(listLengthS(r),2);
  28688   ck_assert_str_eq(r[0], "");
  28689   ck_assert_str_eq(r[1], "one");
  28690   listFreeS(r);
  28691   freeO(self);
  28692   setTopSO(self, "one/");
  28693   r = splitSO(self, "/");
  28694   ck_assert_uint_eq(listLengthS(r),2);
  28695   ck_assert_str_eq(r[0], "one");
  28696   ck_assert_str_eq(r[1], "");
  28697   listFreeS(r);
  28698   // delimiter not found
  28699   freeO(self);
  28700   setTopSO(self, "one/two");
  28701   r = splitSO(self, "||");
  28702   ck_assert_uint_eq(listLengthS(r),1);
  28703   ck_assert_str_eq(r[0], "one/two");
  28704   listFreeS(r);
  28705   // split with several delimiters after each other
  28706   freeO(self);
  28707   setTopSO(self, "one/two  three ");
  28708   r = splitSO(self, " ");
  28709   ck_assert_uint_eq(listLengthS(r),4);
  28710   ck_assert_str_eq(r[0], "one/two");
  28711   ck_assert_str_eq(r[1], "");
  28712   ck_assert_str_eq(r[2], "three");
  28713   ck_assert_str_eq(r[3], "");
  28714   listFreeS(r);
  28715   // multiple character delimiter
  28716   freeO(self);
  28717   setTopSO(self, "AAe three extract");
  28718   r = splitSO(self, "e ");
  28719   ck_assert_uint_eq(listLengthS(r),3);
  28720   ck_assert_str_eq(r[0], "AA");
  28721   ck_assert_str_eq(r[1], "thre");
  28722   ck_assert_str_eq(r[2], "extract");
  28723   listFreeS(r);
  28724   // empty delimiter
  28725   freeO(self);
  28726   setTopSO(self, "AAd");
  28727   r = splitSO(self, "");
  28728   ck_assert_uint_eq(listLengthS(r),1);
  28729   ck_assert_str_eq(r[0], "AAd");
  28730   listFreeS(r);
  28731   // empty string
  28732   emptyO(self);
  28733   r = splitSO(self, "$");
  28734   ck_assert_uint_eq(listLengthS(r),1);
  28735   ck_assert_str_eq(r[0], "");
  28736   listFreeS(r);
  28737   // NULL list
  28738   freeO(self);
  28739   ck_assert_ptr_eq(splitSO(self, ";"), NULL);
  28740   // NULL delimiter
  28741   freeO(self);
  28742   setTopSO(self, "test");
  28743   ck_assert_ptr_eq(splitSO(self, NULL), NULL);
  28744   terminateO(self);
  28745 
  28746 }
  28747 
  28748 
  28749 void splitCharSSmallJsonT(CuTest *tc UNUSED) {
  28750 
  28751   char** r;
  28752   smallJsont *self = allocSmallJson();
  28753   setTopSO(self, "");
  28754 
  28755   // string
  28756   freeO(self);
  28757   setTopSO(self, "one/two");
  28758   r = splitCharSO(self, '/');
  28759   ck_assert_uint_eq(listLengthS(r),2);
  28760   ck_assert_str_eq(r[0], "one");
  28761   ck_assert_str_eq(r[1], "two");
  28762   listFreeS(r);
  28763   // delimiter on the edge
  28764   freeO(self);
  28765   setTopSO(self, "/one");
  28766   r = splitCharSO(self, '/');
  28767   ck_assert_uint_eq(listLengthS(r),2);
  28768   ck_assert_str_eq(r[0], "");
  28769   ck_assert_str_eq(r[1], "one");
  28770   listFreeS(r);
  28771   freeO(self);
  28772   setTopSO(self, "one/");
  28773   r = splitCharSO(self, '/');
  28774   ck_assert_uint_eq(listLengthS(r),2);
  28775   ck_assert_str_eq(r[0], "one");
  28776   ck_assert_str_eq(r[1], "");
  28777   listFreeS(r);
  28778   // delimiter not found
  28779   freeO(self);
  28780   setTopSO(self, "one/two");
  28781   r = splitCharSO(self, '|');
  28782   ck_assert_uint_eq(listLengthS(r),1);
  28783   ck_assert_str_eq(r[0], "one/two");
  28784   listFreeS(r);
  28785   // split with several delimiters after each other
  28786   freeO(self);
  28787   setTopSO(self, "one/two  three ");
  28788   r = splitCharSO(self, ' ');
  28789   ck_assert_uint_eq(listLengthS(r),4);
  28790   ck_assert_str_eq(r[0], "one/two");
  28791   ck_assert_str_eq(r[1], "");
  28792   ck_assert_str_eq(r[2], "three");
  28793   ck_assert_str_eq(r[3], "");
  28794   listFreeS(r);
  28795   // empty string
  28796   emptyO(self);
  28797   r = splitCharSO(self, '$');
  28798   ck_assert_uint_eq(listLengthS(r),1);
  28799   ck_assert_str_eq(r[0], "");
  28800   listFreeS(r);
  28801   // NULL list
  28802   freeO(self);
  28803   ck_assert_ptr_eq(splitCharSO(self, ';'), NULL);
  28804   terminateO(self);
  28805 
  28806 }
  28807 
  28808 
  28809 void splitSmallJsonSSmallJsonT(CuTest *tc UNUSED) {
  28810 
  28811   char** r;
  28812   smallJsont *self = allocSmallJson();
  28813   setTopSO(self, "");
  28814   smallJsont *delim  = allocSmallJson();
  28815 
  28816   // string
  28817   freeO(self);
  28818   setTopSO(self, "one/two");
  28819   setTopSO(delim, "/");
  28820   r = splitSmallJsonSO(self, delim);
  28821   ck_assert_uint_eq(listLengthS(r),2);
  28822   ck_assert_str_eq(r[0], "one");
  28823   ck_assert_str_eq(r[1], "two");
  28824   listFreeS(r);
  28825   // delimiter on the edge
  28826   freeO(self);
  28827   setTopSO(self, "/one");
  28828   r = splitSmallJsonSO(self, delim);
  28829   ck_assert_uint_eq(listLengthS(r),2);
  28830   ck_assert_str_eq(r[0], "");
  28831   ck_assert_str_eq(r[1], "one");
  28832   listFreeS(r);
  28833   freeO(self);
  28834   setTopSO(self, "one/");
  28835   r = splitSmallJsonSO(self, delim);
  28836   ck_assert_uint_eq(listLengthS(r),2);
  28837   ck_assert_str_eq(r[0], "one");
  28838   ck_assert_str_eq(r[1], "");
  28839   listFreeS(r);
  28840   // delimiter not found
  28841   freeO(self);
  28842   setTopSO(self, "one/two");
  28843   freeO(delim);
  28844   setTopSO(delim, "||");
  28845   r = splitSmallJsonSO(self, delim);
  28846   ck_assert_uint_eq(listLengthS(r),1);
  28847   ck_assert_str_eq(r[0], "one/two");
  28848   listFreeS(r);
  28849   // split with several delimiters after each other
  28850   freeO(self);
  28851   setTopSO(self, "one/two  three ");
  28852   freeO(delim);
  28853   setTopSO(delim, " ");
  28854   r = splitSmallJsonSO(self, delim);
  28855   ck_assert_uint_eq(listLengthS(r),4);
  28856   ck_assert_str_eq(r[0], "one/two");
  28857   ck_assert_str_eq(r[1], "");
  28858   ck_assert_str_eq(r[2], "three");
  28859   ck_assert_str_eq(r[3], "");
  28860   listFreeS(r);
  28861   // multiple character delimiter
  28862   freeO(self);
  28863   setTopSO(self, "AAe three extract");
  28864   freeO(delim);
  28865   setTopSO(delim, "e ");
  28866   r = splitSmallJsonSO(self, delim);
  28867   ck_assert_uint_eq(listLengthS(r),3);
  28868   ck_assert_str_eq(r[0], "AA");
  28869   ck_assert_str_eq(r[1], "thre");
  28870   ck_assert_str_eq(r[2], "extract");
  28871   listFreeS(r);
  28872   // empty delimiter
  28873   freeO(self);
  28874   setTopSO(self, "AAd");
  28875   freeO(delim);
  28876   setTopSO(delim, "");
  28877   r = splitSmallJsonSO(self, delim);
  28878   ck_assert_uint_eq(listLengthS(r),1);
  28879   ck_assert_str_eq(r[0], "AAd");
  28880   listFreeS(r);
  28881   // empty string
  28882   emptyO(self);
  28883   freeO(delim);
  28884   setTopSO(delim, "$");
  28885   r = splitSmallJsonSO(self, delim);
  28886   ck_assert_uint_eq(listLengthS(r),1);
  28887   ck_assert_str_eq(r[0], "");
  28888   listFreeS(r);
  28889   // non json string delimiter
  28890   freeO(delim);
  28891   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28892   // non json object delimiter
  28893   terminateO(delim);
  28894   delim = (smallJsont*) allocSmallInt(1);
  28895   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28896   terminateO(delim);
  28897   delim  = allocSmallJson();
  28898   // NULL list
  28899   freeO(self);
  28900   freeO(delim);
  28901   setTopSO(delim, ";");
  28902   ck_assert_ptr_eq(splitSmallJsonSO(self, delim), NULL);
  28903   // NULL delimiter
  28904   freeO(self);
  28905   setTopSO(self, "test");
  28906   ck_assert_ptr_eq(splitSmallJsonSO(self, NULL), NULL);
  28907   terminateO(delim);
  28908   terminateO(self);
  28909 
  28910 }
  28911 
  28912 
  28913 void splitSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  28914 
  28915   char** r;
  28916   smallJsont *self = allocSmallJson();
  28917   setTopSO(self, "");
  28918   smallStringt *delim = allocSmallString("/");
  28919 
  28920   // string
  28921   freeO(self);
  28922   setTopSO(self, "one/two");
  28923   r = splitSmallStringSO(self, delim);
  28924   ck_assert_uint_eq(listLengthS(r),2);
  28925   ck_assert_str_eq(r[0], "one");
  28926   ck_assert_str_eq(r[1], "two");
  28927   listFreeS(r);
  28928   // delimiter on the edge
  28929   freeO(self);
  28930   setTopSO(self, "/one");
  28931   r = splitSmallStringSO(self, delim);
  28932   ck_assert_uint_eq(listLengthS(r),2);
  28933   ck_assert_str_eq(r[0], "");
  28934   ck_assert_str_eq(r[1], "one");
  28935   listFreeS(r);
  28936   freeO(self);
  28937   setTopSO(self, "one/");
  28938   r = splitSmallStringSO(self, delim);
  28939   ck_assert_uint_eq(listLengthS(r),2);
  28940   ck_assert_str_eq(r[0], "one");
  28941   ck_assert_str_eq(r[1], "");
  28942   listFreeS(r);
  28943   // delimiter not found
  28944   freeO(self);
  28945   setTopSO(self, "one/two");
  28946   setValO(delim, "||");
  28947   r = splitSmallStringSO(self, delim);
  28948   ck_assert_uint_eq(listLengthS(r),1);
  28949   ck_assert_str_eq(r[0], "one/two");
  28950   listFreeS(r);
  28951   // split with several delimiters after each other
  28952   freeO(self);
  28953   setTopSO(self, "one/two  three ");
  28954   setValO(delim, " ");
  28955   r = splitSmallStringSO(self, delim);
  28956   ck_assert_uint_eq(listLengthS(r),4);
  28957   ck_assert_str_eq(r[0], "one/two");
  28958   ck_assert_str_eq(r[1], "");
  28959   ck_assert_str_eq(r[2], "three");
  28960   ck_assert_str_eq(r[3], "");
  28961   listFreeS(r);
  28962   // multiple character delimiter
  28963   freeO(self);
  28964   setTopSO(self, "AAe three extract");
  28965   setValO(delim, "e ");
  28966   r = splitSmallStringSO(self, delim);
  28967   ck_assert_uint_eq(listLengthS(r),3);
  28968   ck_assert_str_eq(r[0], "AA");
  28969   ck_assert_str_eq(r[1], "thre");
  28970   ck_assert_str_eq(r[2], "extract");
  28971   listFreeS(r);
  28972   // empty delimiter
  28973   freeO(self);
  28974   setTopSO(self, "AAd");
  28975   setValO(delim, "");
  28976   r = splitSmallStringSO(self, delim);
  28977   ck_assert_uint_eq(listLengthS(r),1);
  28978   ck_assert_str_eq(r[0], "AAd");
  28979   listFreeS(r);
  28980   // empty string
  28981   emptyO(self);
  28982   setValO(delim, "$");
  28983   r = splitSmallStringSO(self, delim);
  28984   ck_assert_uint_eq(listLengthS(r),1);
  28985   ck_assert_str_eq(r[0], "");
  28986   listFreeS(r);
  28987   // non smallString object delimiter
  28988   terminateO(delim);
  28989   delim = (smallStringt*) allocSmallInt(1);
  28990   ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL);
  28991   terminateO(delim);
  28992   // NULL list
  28993   freeO(self);
  28994   delim  = allocSmallString(";");
  28995   ck_assert_ptr_eq(splitSmallStringSO(self, delim), NULL);
  28996   // NULL delimiter
  28997   freeO(self);
  28998   setTopSO(self, "test");
  28999   ck_assert_ptr_eq(splitSmallStringSO(self, NULL), NULL);
  29000   terminateO(delim);
  29001   terminateO(self);
  29002 
  29003 }
  29004 
  29005 
  29006 void extractSmallJsonT(CuTest *tc UNUSED) {
  29007 
  29008   smallJsont* r;
  29009   smallJsont *self = allocSmallJson();
  29010   setTopSO(self, "");
  29011 
  29012   // string
  29013   freeO(self);
  29014   setTopSO(self, "one/two|");
  29015   r = extractO(self, "/", "|");
  29016   ck_assert_ptr_ne(r, null);
  29017   char *s = toStringO(r);
  29018   ck_assert_str_eq(s, "[\"two\"]");
  29019   free(s);
  29020   terminateO(r);
  29021   // delimiter not found
  29022   freeO(self);
  29023   setTopSO(self, "one/two");
  29024   r = extractO(self, "||", "/");
  29025   ck_assert_ptr_eq(r, NULL);
  29026   // extractO with several delimiters after each other
  29027   freeO(self);
  29028   setTopSO(self, "one/ two  /three ");
  29029   r = extractO(self, "/", " ");
  29030   ck_assert_ptr_ne(r, null);
  29031   s = toStringO(r);
  29032   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29033   free(s);
  29034   terminateO(r);
  29035   // multiple character delimiter
  29036   freeO(self);
  29037   setTopSO(self, "AAe thre|e extract");
  29038   r = extractO(self, "e ", "|");
  29039   ck_assert_ptr_ne(r, null);
  29040   s = toStringO(r);
  29041   ck_assert_str_eq(s, "[\"thre\"]");
  29042   free(s);
  29043   terminateO(r);
  29044   // empty delimiter
  29045   freeO(self);
  29046   setTopSO(self, "AAd");
  29047   r = extractO(self, "", "Ad");
  29048   ck_assert_ptr_eq(r, NULL);
  29049   freeO(self);
  29050   setTopSO(self, "AAd");
  29051   r = extractO(self, "A", "");
  29052   ck_assert_ptr_eq(r, NULL);
  29053   // empty string
  29054   freeO(self);
  29055   setTopSO(self, "");
  29056   r = extractO(self, "$", "#");
  29057   ck_assert_ptr_eq(r, NULL);
  29058   // delim1 = delim2
  29059   freeO(self);
  29060   setTopSO(self, "");
  29061   r = extractO(self, "$", "$");
  29062   ck_assert_ptr_eq(r, NULL);
  29063   // NULL string
  29064   freeO(self);
  29065   ck_assert_ptr_eq(extractO(self, ";", ","), NULL);
  29066   // NULL delimiter
  29067   freeO(self);
  29068   setTopSO(self, "test");
  29069   ck_assert_ptr_eq(extractO(self, NULL, ","), NULL);
  29070   ck_assert_ptr_eq(extractO(self, ",", NULL), NULL);
  29071   terminateO(self);
  29072 
  29073 }
  29074 
  29075 
  29076 void extractCharSSmallJsonT(CuTest *tc UNUSED) {
  29077 
  29078   smallJsont* r;
  29079   smallJsont *self = allocSmallJson();
  29080   setTopSO(self, "");
  29081 
  29082   // string
  29083   freeO(self);
  29084   setTopSO(self, "one/two|");
  29085   r = extractCharSO(self, '/', "|");
  29086   ck_assert_ptr_ne(r, null);
  29087   char *s = toStringO(r);
  29088   ck_assert_str_eq(s, "[\"two\"]");
  29089   free(s);
  29090   terminateO(r);
  29091   // delimiter not found
  29092   freeO(self);
  29093   setTopSO(self, "one/two");
  29094   r = extractCharSO(self, '|', "/");
  29095   ck_assert_ptr_eq(r, NULL);
  29096   // extractCharSO with several delimiters after each other
  29097   freeO(self);
  29098   setTopSO(self, "one/ two  /three ");
  29099   r = extractCharSO(self, '/', " ");
  29100   ck_assert_ptr_ne(r, null);
  29101   s = toStringO(r);
  29102   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29103   free(s);
  29104   terminateO(r);
  29105   // multiple character delimiter
  29106   freeO(self);
  29107   setTopSO(self, "AAe thre|e extract");
  29108   r = extractCharSO(self, ' ', "|e");
  29109   ck_assert_ptr_ne(r, null);
  29110   s = toStringO(r);
  29111   ck_assert_str_eq(s, "[\"thre\"]");
  29112   free(s);
  29113   terminateO(r);
  29114   // empty delimiter
  29115   freeO(self);
  29116   setTopSO(self, "AAd");
  29117   r = extractCharSO(self, 'A', "");
  29118   ck_assert_ptr_eq(r, NULL);
  29119   // empty string
  29120   freeO(self);
  29121   setTopSO(self, "");
  29122   r = extractCharSO(self, '$', "#");
  29123   ck_assert_ptr_eq(r, NULL);
  29124   // delim1 = delim2
  29125   freeO(self);
  29126   setTopSO(self, "");
  29127   r = extractCharSO(self, '$', "$");
  29128   ck_assert_ptr_eq(r, NULL);
  29129   // NULL string
  29130   freeO(self);
  29131   ck_assert_ptr_eq(extractCharSO(self, ';', ","), NULL);
  29132   // NULL delimiter
  29133   freeO(self);
  29134   setTopSO(self, "test");
  29135   ck_assert_ptr_eq(extractCharSO(self, ',', NULL), NULL);
  29136   terminateO(self);
  29137 
  29138 }
  29139 
  29140 
  29141 void extractSCharSmallJsonT(CuTest *tc UNUSED) {
  29142 
  29143   smallJsont* r;
  29144   smallJsont *self = allocSmallJson();
  29145   setTopSO(self, "");
  29146 
  29147   // string
  29148   freeO(self);
  29149   setTopSO(self, "one/two|");
  29150   r = extractSCharO(self, "/", '|');
  29151   ck_assert_ptr_ne(r, null);
  29152   char *s = toStringO(r);
  29153   ck_assert_str_eq(s, "[\"two\"]");
  29154   free(s);
  29155   terminateO(r);
  29156   // delimiter not found
  29157   freeO(self);
  29158   setTopSO(self, "one/two");
  29159   r = extractSCharO(self, "||", '/');
  29160   ck_assert_ptr_eq(r, NULL);
  29161   // extractSCharO with several delimiters after each other
  29162   freeO(self);
  29163   setTopSO(self, "one/ two  /three ");
  29164   r = extractSCharO(self, "/", ' ');
  29165   ck_assert_ptr_ne(r, null);
  29166   s = toStringO(r);
  29167   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29168   free(s);
  29169   terminateO(r);
  29170   // multiple character delimiter
  29171   freeO(self);
  29172   setTopSO(self, "AAe thre|e extract");
  29173   r = extractSCharO(self, "e ", '|');
  29174   ck_assert_ptr_ne(r, null);
  29175   s = toStringO(r);
  29176   ck_assert_str_eq(s, "[\"thre\"]");
  29177   free(s);
  29178   terminateO(r);
  29179   // empty delimiter
  29180   freeO(self);
  29181   setTopSO(self, "AAd");
  29182   r = extractSCharO(self, "", 'A');
  29183   ck_assert_ptr_eq(r, NULL);
  29184   // empty string
  29185   freeO(self);
  29186   setTopSO(self, "");
  29187   r = extractSCharO(self, "$", '#');
  29188   ck_assert_ptr_eq(r, NULL);
  29189   // delim1 = delim2
  29190   freeO(self);
  29191   setTopSO(self, "");
  29192   r = extractSCharO(self, "$", '$');
  29193   ck_assert_ptr_eq(r, NULL);
  29194   // NULL string
  29195   freeO(self);
  29196   ck_assert_ptr_eq(extractSCharO(self, ";", ','), NULL);
  29197   // NULL delimiter
  29198   freeO(self);
  29199   setTopSO(self, "test");
  29200   ck_assert_ptr_eq(extractSCharO(self, NULL, ','), NULL);
  29201   terminateO(self);
  29202 
  29203 }
  29204 
  29205 
  29206 void extractCharCharSmallJsonT(CuTest *tc UNUSED) {
  29207 
  29208   smallJsont* r;
  29209   smallJsont *self = allocSmallJson();
  29210   setTopSO(self, "");
  29211 
  29212   // string
  29213   freeO(self);
  29214   setTopSO(self, "one/two|");
  29215   r = extractCharCharO(self, '/', '|');
  29216   ck_assert_ptr_ne(r, null);
  29217   char *s = toStringO(r);
  29218   ck_assert_str_eq(s, "[\"two\"]");
  29219   free(s);
  29220   terminateO(r);
  29221   // delimiter not found
  29222   freeO(self);
  29223   setTopSO(self, "one/two");
  29224   r = extractCharCharO(self, '|', '/');
  29225   ck_assert_ptr_eq(r, NULL);
  29226   // extractCharCharO with several delimiters after each other
  29227   freeO(self);
  29228   setTopSO(self, "one/ two  /three ");
  29229   r = extractCharCharO(self, '/', ' ');
  29230   ck_assert_ptr_ne(r, null);
  29231   s = toStringO(r);
  29232   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29233   free(s);
  29234   terminateO(r);
  29235   // multiple character delimiter
  29236   freeO(self);
  29237   setTopSO(self, "AAe thre|e extract");
  29238   r = extractCharCharO(self, ' ', '|');
  29239   ck_assert_ptr_ne(r, null);
  29240   s = toStringO(r);
  29241   ck_assert_str_eq(s, "[\"thre\"]");
  29242   free(s);
  29243   terminateO(r);
  29244   // empty string
  29245   freeO(self);
  29246   setTopSO(self, "");
  29247   r = extractCharCharO(self, '$', '#');
  29248   ck_assert_ptr_eq(r, NULL);
  29249   // delim1 = delim2
  29250   freeO(self);
  29251   setTopSO(self, "");
  29252   r = extractCharCharO(self, '$', '$');
  29253   ck_assert_ptr_eq(r, NULL);
  29254   // NULL string
  29255   freeO(self);
  29256   ck_assert_ptr_eq(extractCharCharO(self, ';', ','), NULL);
  29257   terminateO(self);
  29258 
  29259 }
  29260 
  29261 
  29262 void extractSmallJsonSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  29263 
  29264   smallJsont* r;
  29265   smallJsont *self = allocSmallJson();
  29266   setTopSO(self, "");
  29267   smallJsont* delim1 = allocSmallJson();
  29268   smallJsont* delim2 = allocSmallJson();
  29269 
  29270   // string
  29271   freeO(self);
  29272   setTopSO(self, "one/two|");
  29273   setTopSO(delim1, "/");
  29274   setTopSO(delim2, "|");
  29275   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29276   ck_assert_ptr_ne(r, null);
  29277   char *s = toStringO(r);
  29278   ck_assert_str_eq(s, "[\"two\"]");
  29279   free(s);
  29280   terminateO(r);
  29281   // delimiter not found
  29282   freeO(self);
  29283   setTopSO(self, "one/two");
  29284   freeO(delim1);
  29285   freeO(delim2);
  29286   setTopSO(delim1, "||");
  29287   setTopSO(delim2, "/");
  29288   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29289   ck_assert_ptr_eq(r, NULL);
  29290   // extractSmallJsonSmallJsonO with several delimiters after each other
  29291   freeO(self);
  29292   setTopSO(self, "one/ two  /three ");
  29293   freeO(delim1);
  29294   freeO(delim2);
  29295   setTopSO(delim1, "/");
  29296   setTopSO(delim2, " ");
  29297   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29298   ck_assert_ptr_ne(r, null);
  29299   s = toStringO(r);
  29300   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29301   free(s);
  29302   terminateO(r);
  29303   // multiple character delimiter
  29304   freeO(self);
  29305   setTopSO(self, "AAe thre|e extract");
  29306   freeO(delim1);
  29307   freeO(delim2);
  29308   setTopSO(delim1, "e ");
  29309   setTopSO(delim2, "|");
  29310   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29311   ck_assert_ptr_ne(r, null);
  29312   s = toStringO(r);
  29313   ck_assert_str_eq(s, "[\"thre\"]");
  29314   free(s);
  29315   terminateO(r);
  29316   // empty delimiter
  29317   freeO(self);
  29318   setTopSO(self, "AAd");
  29319   freeO(delim1);
  29320   freeO(delim2);
  29321   setTopSO(delim1, "");
  29322   setTopSO(delim2, "Ad");
  29323   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29324   ck_assert_ptr_eq(r, NULL);
  29325   freeO(self);
  29326   setTopSO(self, "AAd");
  29327   freeO(delim1);
  29328   freeO(delim2);
  29329   setTopSO(delim1, "A");
  29330   setTopSO(delim2, "");
  29331   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29332   ck_assert_ptr_eq(r, NULL);
  29333   // empty string
  29334   freeO(self);
  29335   setTopSO(self, "");
  29336   freeO(delim1);
  29337   freeO(delim2);
  29338   setTopSO(delim1, "$");
  29339   setTopSO(delim2, "#");
  29340   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29341   ck_assert_ptr_eq(r, NULL);
  29342   // delim1 = delim2
  29343   freeO(self);
  29344   setTopSO(self, "$qwe$");
  29345   freeO(delim1);
  29346   freeO(delim2);
  29347   setTopSO(delim1, "$");
  29348   setTopSO(delim2, "$");
  29349   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29350   ck_assert_ptr_eq(r, NULL);
  29351   // non json string
  29352   freeO(delim1);
  29353   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29354   ck_assert_ptr_eq(r, NULL);
  29355   setTopSO(delim1, "$");
  29356   freeO(delim2);
  29357   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29358   ck_assert_ptr_eq(r, NULL);
  29359   // non json object
  29360   terminateO(delim1);
  29361   delim1 = (smallJsont*) allocSmallInt(1);
  29362   setTopSO(delim2, "$");
  29363   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29364   ck_assert_ptr_eq(r, NULL);
  29365   terminateO(delim1);
  29366   delim1 = allocSmallJson();
  29367   setTopSO(delim1, ";");
  29368   terminateO(delim2);
  29369   delim2 = (smallJsont*) allocSmallInt(1);
  29370   r = extractSmallJsonSmallJsonO(self, delim1, delim2);
  29371   ck_assert_ptr_eq(r, NULL);
  29372   terminateO(delim2);
  29373   delim2 = allocSmallJson();
  29374   // NULL string
  29375   freeO(self);
  29376   freeO(delim1);
  29377   freeO(delim2);
  29378   setTopSO(delim1, ";");
  29379   setTopSO(delim2, ",");
  29380   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, delim2), NULL);
  29381   // NULL delimiter
  29382   freeO(self);
  29383   setTopSO(self, "test");
  29384   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, NULL, delim2), NULL);
  29385   ck_assert_ptr_eq(extractSmallJsonSmallJsonO(self, delim1, NULL), NULL);
  29386   terminateO(delim1);
  29387   terminateO(delim2);
  29388   terminateO(self);
  29389 
  29390 }
  29391 
  29392 
  29393 void extractSmallJsonSmallStringSmallJsonT(CuTest *tc UNUSED) {
  29394 
  29395   smallJsont* r;
  29396   smallJsont *self = allocSmallJson();
  29397   setTopSO(self, "");
  29398   smallJsont* delim1   = allocSmallJson();
  29399   smallStringt* delim2 = allocSmallString("|");
  29400 
  29401   // string
  29402   freeO(self);
  29403   setTopSO(self, "one/two|");
  29404   setTopSO(delim1, "/");
  29405   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29406   ck_assert_ptr_ne(r, null);
  29407   char *s = toStringO(r);
  29408   ck_assert_str_eq(s, "[\"two\"]");
  29409   free(s);
  29410   terminateO(r);
  29411   // delimiter not found
  29412   freeO(self);
  29413   setTopSO(self, "one/two");
  29414   freeO(delim1);
  29415   setTopSO(delim1, "||");
  29416   setValO(delim2, "/");
  29417   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29418   ck_assert_ptr_eq(r, NULL);
  29419   // extractSmallJsonSmallStringO with several delimiters after each other
  29420   freeO(self);
  29421   setTopSO(self, "one/ two  /three ");
  29422   freeO(delim1);
  29423   setTopSO(delim1, "/");
  29424   setValO(delim2, " ");
  29425   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29426   ck_assert_ptr_ne(r, null);
  29427   s = toStringO(r);
  29428   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29429   free(s);
  29430   terminateO(r);
  29431   // multiple character delimiter
  29432   freeO(self);
  29433   setTopSO(self, "AAe thre|e extract");
  29434   freeO(delim1);
  29435   setTopSO(delim1, "e ");
  29436   setValO(delim2, "|");
  29437   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29438   ck_assert_ptr_ne(r, null);
  29439   s = toStringO(r);
  29440   ck_assert_str_eq(s, "[\"thre\"]");
  29441   free(s);
  29442   terminateO(r);
  29443   // empty delimiter
  29444   freeO(self);
  29445   setTopSO(self, "AAd");
  29446   freeO(delim1);
  29447   setTopSO(delim1, "");
  29448   setValO(delim2, "Ad");
  29449   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29450   ck_assert_ptr_eq(r, NULL);
  29451   freeO(self);
  29452   setTopSO(self, "AAd");
  29453   freeO(delim1);
  29454   setTopSO(delim1, "A");
  29455   setValO(delim2, "");
  29456   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29457   ck_assert_ptr_eq(r, NULL);
  29458   // empty string
  29459   freeO(self);
  29460   setTopSO(self, "");
  29461   freeO(delim1);
  29462   setTopSO(delim1, "$");
  29463   setValO(delim2, "#");
  29464   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29465   ck_assert_ptr_eq(r, NULL);
  29466   // delim1 = delim2
  29467   freeO(self);
  29468   setTopSO(self, "$qwe$");
  29469   freeO(delim1);
  29470   setTopSO(delim1, "$");
  29471   setValO(delim2, "$");
  29472   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29473   ck_assert_ptr_eq(r, NULL);
  29474   // non json string
  29475   freeO(delim1);
  29476   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29477   ck_assert_ptr_eq(r, NULL);
  29478   // non json object
  29479   terminateO(delim1);
  29480   delim1 = (smallJsont*) allocSmallInt(1);
  29481   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29482   ck_assert_ptr_eq(r, NULL);
  29483   terminateO(delim1);
  29484   delim1 = allocSmallJson();
  29485   setTopSO(delim1, ";");
  29486   terminateO(delim2);
  29487   delim2 = (smallStringt*) allocSmallInt(1);
  29488   r = extractSmallJsonSmallStringO(self, delim1, delim2);
  29489   ck_assert_ptr_eq(r, NULL);
  29490   terminateO(delim2);
  29491   delim2 = allocSmallString(",");
  29492   // NULL string
  29493   freeO(self);
  29494   freeO(delim1);
  29495   setTopSO(delim1, ";");
  29496   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, delim2), NULL);
  29497   // NULL delimiter
  29498   freeO(self);
  29499   setTopSO(self, "test");
  29500   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, NULL, delim2), NULL);
  29501   ck_assert_ptr_eq(extractSmallJsonSmallStringO(self, delim1, NULL), NULL);
  29502   terminateO(delim1);
  29503   terminateO(delim2);
  29504   terminateO(self);
  29505 
  29506 }
  29507 
  29508 
  29509 void extractSmallJsonSSmallJsonT(CuTest *tc UNUSED) {
  29510 
  29511   smallJsont* r;
  29512   smallJsont *self = allocSmallJson();
  29513   setTopSO(self, "");
  29514   smallJsont* delim1 = allocSmallJson();
  29515 
  29516   // string
  29517   freeO(self);
  29518   setTopSO(self, "one/two|");
  29519   setTopSO(delim1, "/");
  29520   r = extractSmallJsonSO(self, delim1, "|");
  29521   ck_assert_ptr_ne(r, null);
  29522   char *s = toStringO(r);
  29523   ck_assert_str_eq(s, "[\"two\"]");
  29524   free(s);
  29525   terminateO(r);
  29526   // delimiter not found
  29527   freeO(self);
  29528   setTopSO(self, "one/two");
  29529   freeO(delim1);
  29530   setTopSO(delim1, "||");
  29531   r = extractSmallJsonSO(self, delim1, "/");
  29532   ck_assert_ptr_eq(r, NULL);
  29533   // extractSmallJsonSO with several delimiters after each other
  29534   freeO(self);
  29535   setTopSO(self, "one/ two  /three ");
  29536   freeO(delim1);
  29537   setTopSO(delim1, "/");
  29538   r = extractSmallJsonSO(self, delim1, " ");
  29539   ck_assert_ptr_ne(r, null);
  29540   s = toStringO(r);
  29541   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29542   free(s);
  29543   terminateO(r);
  29544   // multiple character delimiter
  29545   freeO(self);
  29546   setTopSO(self, "AAe thre|e extract");
  29547   freeO(delim1);
  29548   setTopSO(delim1, "e ");
  29549   r = extractSmallJsonSO(self, delim1, "|");
  29550   ck_assert_ptr_ne(r, null);
  29551   s = toStringO(r);
  29552   ck_assert_str_eq(s, "[\"thre\"]");
  29553   free(s);
  29554   terminateO(r);
  29555   // empty delimiter
  29556   freeO(self);
  29557   setTopSO(self, "AAd");
  29558   freeO(delim1);
  29559   setTopSO(delim1, "");
  29560   r = extractSmallJsonSO(self, delim1, "Ad");
  29561   ck_assert_ptr_eq(r, NULL);
  29562   freeO(self);
  29563   setTopSO(self, "AAd");
  29564   freeO(delim1);
  29565   setTopSO(delim1, "A");
  29566   r = extractSmallJsonSO(self, delim1, "");
  29567   ck_assert_ptr_eq(r, NULL);
  29568   // empty string
  29569   freeO(self);
  29570   setTopSO(self, "");
  29571   freeO(delim1);
  29572   setTopSO(delim1, "$");
  29573   r = extractSmallJsonSO(self, delim1, "#");
  29574   ck_assert_ptr_eq(r, NULL);
  29575   // delim1 = delim2
  29576   freeO(self);
  29577   setTopSO(self, "$qwe$");
  29578   freeO(delim1);
  29579   setTopSO(delim1, "$");
  29580   r = extractSmallJsonSO(self, delim1, "$");
  29581   ck_assert_ptr_eq(r, NULL);
  29582   // non json string
  29583   freeO(delim1);
  29584   r = extractSmallJsonSO(self, delim1, "$");
  29585   ck_assert_ptr_eq(r, NULL);
  29586   // non json object
  29587   terminateO(delim1);
  29588   delim1 = (smallJsont*) allocSmallInt(1);
  29589   r = extractSmallJsonSO(self, delim1, "$");
  29590   ck_assert_ptr_eq(r, NULL);
  29591   terminateO(delim1);
  29592   delim1 = allocSmallJson();
  29593   // NULL string
  29594   freeO(self);
  29595   freeO(delim1);
  29596   setTopSO(delim1, ";");
  29597   ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, ","), NULL);
  29598   // NULL delimiter
  29599   freeO(self);
  29600   setTopSO(self, "test");
  29601   ck_assert_ptr_eq(extractSmallJsonSO(self, NULL, ","), NULL);
  29602   ck_assert_ptr_eq(extractSmallJsonSO(self, delim1, NULL), NULL);
  29603   terminateO(delim1);
  29604   terminateO(self);
  29605 
  29606 }
  29607 
  29608 
  29609 void extractSmallJsonCharSmallJsonT(CuTest *tc UNUSED) {
  29610 
  29611   smallJsont* r;
  29612   smallJsont *self = allocSmallJson();
  29613   setTopSO(self, "");
  29614   smallJsont* delim1 = allocSmallJson();
  29615 
  29616   // string
  29617   freeO(self);
  29618   setTopSO(self, "one/two|");
  29619   setTopSO(delim1, "/");
  29620   r = extractSmallJsonCharO(self, delim1, '|');
  29621   ck_assert_ptr_ne(r, null);
  29622   char *s = toStringO(r);
  29623   ck_assert_str_eq(s, "[\"two\"]");
  29624   free(s);
  29625   terminateO(r);
  29626   // delimiter not found
  29627   freeO(self);
  29628   setTopSO(self, "one/two");
  29629   freeO(delim1);
  29630   setTopSO(delim1, "||");
  29631   r = extractSmallJsonCharO(self, delim1, '/');
  29632   ck_assert_ptr_eq(r, NULL);
  29633   // extractSmallJsonCharO with several delimiters after each other
  29634   freeO(self);
  29635   setTopSO(self, "one/ two  /three ");
  29636   freeO(delim1);
  29637   setTopSO(delim1, "/");
  29638   r = extractSmallJsonCharO(self, delim1, ' ');
  29639   ck_assert_ptr_ne(r, null);
  29640   s = toStringO(r);
  29641   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29642   free(s);
  29643   terminateO(r);
  29644   // multiple character delimiter
  29645   freeO(self);
  29646   setTopSO(self, "AAe thre|e extract");
  29647   freeO(delim1);
  29648   setTopSO(delim1, "e ");
  29649   r = extractSmallJsonCharO(self, delim1, '|');
  29650   ck_assert_ptr_ne(r, null);
  29651   s = toStringO(r);
  29652   ck_assert_str_eq(s, "[\"thre\"]");
  29653   free(s);
  29654   terminateO(r);
  29655   // empty delimiter
  29656   freeO(self);
  29657   setTopSO(self, "AAd");
  29658   freeO(delim1);
  29659   setTopSO(delim1, "");
  29660   r = extractSmallJsonCharO(self, delim1, 'd');
  29661   ck_assert_ptr_eq(r, NULL);
  29662   freeO(self);
  29663   setTopSO(self, "AAd");
  29664   // empty string
  29665   freeO(self);
  29666   setTopSO(self, "");
  29667   freeO(delim1);
  29668   setTopSO(delim1, "$");
  29669   r = extractSmallJsonCharO(self, delim1, '#');
  29670   ck_assert_ptr_eq(r, NULL);
  29671   // delim1 = delim2
  29672   freeO(self);
  29673   setTopSO(self, "$qwe$");
  29674   freeO(delim1);
  29675   setTopSO(delim1, "$");
  29676   r = extractSmallJsonCharO(self, delim1, '$');
  29677   ck_assert_ptr_eq(r, NULL);
  29678   // non json string
  29679   freeO(delim1);
  29680   r = extractSmallJsonCharO(self, delim1, '$');
  29681   ck_assert_ptr_eq(r, NULL);
  29682   // non json object
  29683   terminateO(delim1);
  29684   delim1 = (smallJsont*) allocSmallInt(1);
  29685   r = extractSmallJsonCharO(self, delim1, '$');
  29686   ck_assert_ptr_eq(r, NULL);
  29687   terminateO(delim1);
  29688   delim1 = allocSmallJson();
  29689   // NULL string
  29690   freeO(self);
  29691   freeO(delim1);
  29692   setTopSO(delim1, ";");
  29693   ck_assert_ptr_eq(extractSmallJsonCharO(self, delim1, ','), NULL);
  29694   // NULL delimiter
  29695   freeO(self);
  29696   setTopSO(self, "test");
  29697   ck_assert_ptr_eq(extractSmallJsonCharO(self, NULL, ','), NULL);
  29698   terminateO(delim1);
  29699   terminateO(self);
  29700 
  29701 }
  29702 
  29703 
  29704 void extractSmallStringSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  29705 
  29706   smallJsont* r;
  29707   smallJsont *self = allocSmallJson();
  29708   setTopSO(self, "");
  29709   smallStringt* delim1 = allocSmallString("/");
  29710   smallJsont* delim2   = allocSmallJson();
  29711 
  29712   // string
  29713   freeO(self);
  29714   setTopSO(self, "one/two|");
  29715   setTopSO(delim2, "|");
  29716   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29717   ck_assert_ptr_ne(r, null);
  29718   char *s = toStringO(r);
  29719   ck_assert_str_eq(s, "[\"two\"]");
  29720   free(s);
  29721   terminateO(r);
  29722   // delimiter not found
  29723   freeO(self);
  29724   setTopSO(self, "one/two");
  29725   freeO(delim2);
  29726   setValO(delim1, "||");
  29727   setTopSO(delim2, "/");
  29728   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29729   ck_assert_ptr_eq(r, NULL);
  29730   // extractSmallStringSmallJsonO with several delimiters after each other
  29731   freeO(self);
  29732   setTopSO(self, "one/ two  /three ");
  29733   freeO(delim2);
  29734   setValO(delim1, "/");
  29735   setTopSO(delim2, " ");
  29736   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29737   ck_assert_ptr_ne(r, null);
  29738   s = toStringO(r);
  29739   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29740   free(s);
  29741   terminateO(r);
  29742   // multiple character delimiter
  29743   freeO(self);
  29744   setTopSO(self, "AAe thre|e extract");
  29745   freeO(delim2);
  29746   setValO(delim1, "e ");
  29747   setTopSO(delim2, "|");
  29748   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29749   ck_assert_ptr_ne(r, null);
  29750   s = toStringO(r);
  29751   ck_assert_str_eq(s, "[\"thre\"]");
  29752   free(s);
  29753   terminateO(r);
  29754   // empty delimiter
  29755   freeO(self);
  29756   setTopSO(self, "AAd");
  29757   freeO(delim2);
  29758   setValO(delim1, "");
  29759   setTopSO(delim2, "Ad");
  29760   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29761   ck_assert_ptr_eq(r, NULL);
  29762   freeO(self);
  29763   setTopSO(self, "AAd");
  29764   freeO(delim2);
  29765   setValO(delim1, "A");
  29766   setTopSO(delim2, "");
  29767   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29768   ck_assert_ptr_eq(r, NULL);
  29769   // empty string
  29770   freeO(self);
  29771   setTopSO(self, "");
  29772   freeO(delim2);
  29773   setValO(delim1, "$");
  29774   setTopSO(delim2, "#");
  29775   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29776   ck_assert_ptr_eq(r, NULL);
  29777   // delim1 = delim2
  29778   freeO(self);
  29779   setTopSO(self, "$qwe$");
  29780   freeO(delim2);
  29781   setValO(delim1, "$");
  29782   setTopSO(delim2, "$");
  29783   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29784   ck_assert_ptr_eq(r, NULL);
  29785   // non json string
  29786   freeO(delim2);
  29787   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29788   ck_assert_ptr_eq(r, NULL);
  29789   // non json object
  29790   terminateO(delim1);
  29791   delim1 = (smallStringt*) allocSmallInt(1);
  29792   setTopSO(delim2, "$");
  29793   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29794   ck_assert_ptr_eq(r, NULL);
  29795   terminateO(delim1);
  29796   delim1 = allocSmallString(";");
  29797   terminateO(delim2);
  29798   delim2 = (smallJsont*) allocSmallInt(1);
  29799   r = extractSmallStringSmallJsonO(self, delim1, delim2);
  29800   ck_assert_ptr_eq(r, NULL);
  29801   terminateO(delim2);
  29802   delim2 = allocSmallJson();
  29803   // NULL string
  29804   freeO(self);
  29805   freeO(delim2);
  29806   setValO(delim1, ";");
  29807   setTopSO(delim2, ",");
  29808   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, delim2), NULL);
  29809   // NULL delimiter
  29810   freeO(self);
  29811   setTopSO(self, "test");
  29812   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, NULL, delim2), NULL);
  29813   ck_assert_ptr_eq(extractSmallStringSmallJsonO(self, delim1, NULL), NULL);
  29814   terminateO(delim1);
  29815   terminateO(delim2);
  29816   terminateO(self);
  29817 
  29818 }
  29819 
  29820 
  29821 void extractSmallStringSmallStringSmallJsonT(CuTest *tc UNUSED) {
  29822 
  29823   smallJsont* r;
  29824   smallJsont *self = allocSmallJson();
  29825   setTopSO(self, "");
  29826   smallStringt* delim1 = allocSmallString("/");
  29827   smallStringt* delim2 = allocSmallString("|");
  29828 
  29829   // string
  29830   freeO(self);
  29831   setTopSO(self, "one/two|");
  29832   setValO(delim2, "|");
  29833   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29834   ck_assert_ptr_ne(r, null);
  29835   char *s = toStringO(r);
  29836   ck_assert_str_eq(s, "[\"two\"]");
  29837   free(s);
  29838   terminateO(r);
  29839   // delimiter not found
  29840   freeO(self);
  29841   setTopSO(self, "one/two");
  29842   setValO(delim1, "||");
  29843   setValO(delim2, "/");
  29844   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29845   ck_assert_ptr_eq(r, NULL);
  29846   // extractSmallStringSmallStringO with several delimiters after each other
  29847   freeO(self);
  29848   setTopSO(self, "one/ two  /three ");
  29849   setValO(delim1, "/");
  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, "[\"\",\"three\"]");
  29855   free(s);
  29856   terminateO(r);
  29857   // multiple character delimiter
  29858   freeO(self);
  29859   setTopSO(self, "AAe thre|e extract");
  29860   setValO(delim1, "e ");
  29861   setValO(delim2, "|");
  29862   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29863   ck_assert_ptr_ne(r, null);
  29864   s = toStringO(r);
  29865   ck_assert_str_eq(s, "[\"thre\"]");
  29866   free(s);
  29867   terminateO(r);
  29868   // empty delimiter
  29869   freeO(self);
  29870   setTopSO(self, "AAd");
  29871   setValO(delim1, "");
  29872   setValO(delim2, "Ad");
  29873   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29874   ck_assert_ptr_eq(r, NULL);
  29875   freeO(self);
  29876   setTopSO(self, "AAd");
  29877   setValO(delim1, "A");
  29878   setValO(delim2, "");
  29879   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29880   ck_assert_ptr_eq(r, NULL);
  29881   // empty string
  29882   freeO(self);
  29883   setTopSO(self, "");
  29884   setValO(delim1, "$");
  29885   setValO(delim2, "#");
  29886   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29887   ck_assert_ptr_eq(r, NULL);
  29888   // delim1 = delim2
  29889   freeO(self);
  29890   setTopSO(self, "$qwe$");
  29891   setValO(delim1, "$");
  29892   setValO(delim2, "$");
  29893   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29894   ck_assert_ptr_eq(r, NULL);
  29895   // non json object
  29896   terminateO(delim1);
  29897   delim1 = (smallStringt*) allocSmallInt(1);
  29898   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29899   ck_assert_ptr_eq(r, NULL);
  29900   terminateO(delim1);
  29901   delim1 = allocSmallString(";");
  29902   terminateO(delim2);
  29903   delim2 = (smallStringt*) allocSmallInt(1);
  29904   r = extractSmallStringSmallStringO(self, delim1, delim2);
  29905   ck_assert_ptr_eq(r, NULL);
  29906   terminateO(delim2);
  29907   delim2 = allocSmallString(",");
  29908   // NULL string
  29909   freeO(self);
  29910   setValO(delim1, ";");
  29911   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, delim2), NULL);
  29912   // NULL delimiter
  29913   freeO(self);
  29914   setTopSO(self, "test");
  29915   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, NULL, delim2), NULL);
  29916   ck_assert_ptr_eq(extractSmallStringSmallStringO(self, delim1, NULL), NULL);
  29917   terminateO(delim1);
  29918   terminateO(delim2);
  29919   terminateO(self);
  29920 
  29921 }
  29922 
  29923 
  29924 void extractSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  29925 
  29926   smallJsont* r;
  29927   smallJsont *self = allocSmallJson();
  29928   setTopSO(self, "");
  29929   smallStringt* delim1 = allocSmallString("/");
  29930 
  29931   // string
  29932   freeO(self);
  29933   setTopSO(self, "one/two|");
  29934   r = extractSmallStringSO(self, delim1, "|");
  29935   ck_assert_ptr_ne(r, null);
  29936   char *s = toStringO(r);
  29937   ck_assert_str_eq(s, "[\"two\"]");
  29938   free(s);
  29939   terminateO(r);
  29940   // delimiter not found
  29941   freeO(self);
  29942   setTopSO(self, "one/two");
  29943   setValO(delim1, "||");
  29944   r = extractSmallStringSO(self, delim1, "/");
  29945   ck_assert_ptr_eq(r, NULL);
  29946   // extractSmallStringSO with several delimiters after each other
  29947   freeO(self);
  29948   setTopSO(self, "one/ two  /three ");
  29949   setValO(delim1, "/");
  29950   r = extractSmallStringSO(self, delim1, " ");
  29951   ck_assert_ptr_ne(r, null);
  29952   s = toStringO(r);
  29953   ck_assert_str_eq(s, "[\"\",\"three\"]");
  29954   free(s);
  29955   terminateO(r);
  29956   // multiple character delimiter
  29957   freeO(self);
  29958   setTopSO(self, "AAe thre|e extract");
  29959   setValO(delim1, "e ");
  29960   r = extractSmallStringSO(self, delim1, "|");
  29961   ck_assert_ptr_ne(r, null);
  29962   s = toStringO(r);
  29963   ck_assert_str_eq(s, "[\"thre\"]");
  29964   free(s);
  29965   terminateO(r);
  29966   // empty delimiter
  29967   freeO(self);
  29968   setTopSO(self, "AAd");
  29969   setValO(delim1, "");
  29970   r = extractSmallStringSO(self, delim1, "Ad");
  29971   ck_assert_ptr_eq(r, NULL);
  29972   freeO(self);
  29973   setTopSO(self, "AAd");
  29974   setValO(delim1, "A");
  29975   r = extractSmallStringSO(self, delim1, "");
  29976   ck_assert_ptr_eq(r, NULL);
  29977   // empty string
  29978   freeO(self);
  29979   setTopSO(self, "");
  29980   setValO(delim1, "$");
  29981   r = extractSmallStringSO(self, delim1, "#");
  29982   ck_assert_ptr_eq(r, NULL);
  29983   // delim1 = delim2
  29984   freeO(self);
  29985   setTopSO(self, "$qwe$");
  29986   setValO(delim1, "$");
  29987   r = extractSmallStringSO(self, delim1, "$");
  29988   ck_assert_ptr_eq(r, NULL);
  29989   // non json object
  29990   terminateO(delim1);
  29991   delim1 = (smallStringt*) allocSmallInt(1);
  29992   r = extractSmallStringSO(self, delim1, "$");
  29993   ck_assert_ptr_eq(r, NULL);
  29994   terminateO(delim1);
  29995   delim1 = allocSmallString(";");
  29996   // NULL string
  29997   freeO(self);
  29998   setValO(delim1, ";");
  29999   ck_assert_ptr_eq(extractSmallStringSO(self, delim1, ","), NULL);
  30000   // NULL delimiter
  30001   freeO(self);
  30002   setTopSO(self, "test");
  30003   ck_assert_ptr_eq(extractSmallStringSO(self, NULL, ","), NULL);
  30004   ck_assert_ptr_eq(extractSmallStringSO(self, delim1, NULL), NULL);
  30005   terminateO(delim1);
  30006   terminateO(self);
  30007 
  30008 }
  30009 
  30010 
  30011 void extractSmallStringCharSmallJsonT(CuTest *tc UNUSED) {
  30012 
  30013   smallJsont* r;
  30014   smallJsont *self = allocSmallJson();
  30015   setTopSO(self, "");
  30016   smallStringt* delim1 = allocSmallString("/");
  30017 
  30018   // string
  30019   freeO(self);
  30020   setTopSO(self, "one/two|");
  30021   r = extractSmallStringCharO(self, delim1, '|');
  30022   ck_assert_ptr_ne(r, null);
  30023   char *s = toStringO(r);
  30024   ck_assert_str_eq(s, "[\"two\"]");
  30025   free(s);
  30026   terminateO(r);
  30027   // delimiter not found
  30028   freeO(self);
  30029   setTopSO(self, "one/two");
  30030   setValO(delim1, "||");
  30031   r = extractSmallStringCharO(self, delim1, '/');
  30032   ck_assert_ptr_eq(r, NULL);
  30033   // extractSmallStringCharO with several delimiters after each other
  30034   freeO(self);
  30035   setTopSO(self, "one/ two  /three ");
  30036   setValO(delim1, "/");
  30037   r = extractSmallStringCharO(self, delim1, ' ');
  30038   ck_assert_ptr_ne(r, null);
  30039   s = toStringO(r);
  30040   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30041   free(s);
  30042   terminateO(r);
  30043   // multiple character delimiter
  30044   freeO(self);
  30045   setTopSO(self, "AAe thre|e extract");
  30046   setValO(delim1, "e ");
  30047   r = extractSmallStringCharO(self, delim1, '|');
  30048   ck_assert_ptr_ne(r, null);
  30049   s = toStringO(r);
  30050   ck_assert_str_eq(s, "[\"thre\"]");
  30051   free(s);
  30052   terminateO(r);
  30053   // empty delimiter
  30054   freeO(self);
  30055   setTopSO(self, "AAd");
  30056   setValO(delim1, "");
  30057   r = extractSmallStringCharO(self, delim1, 'A');
  30058   ck_assert_ptr_eq(r, NULL);
  30059   freeO(self);
  30060   setTopSO(self, "AAd");
  30061   setValO(delim1, "A");
  30062   // empty string
  30063   freeO(self);
  30064   setTopSO(self, "");
  30065   setValO(delim1, "$");
  30066   r = extractSmallStringCharO(self, delim1, '#');
  30067   ck_assert_ptr_eq(r, NULL);
  30068   // delim1 = delim2
  30069   freeO(self);
  30070   setTopSO(self, "$qwe$");
  30071   setValO(delim1, "$");
  30072   r = extractSmallStringCharO(self, delim1, '$');
  30073   ck_assert_ptr_eq(r, NULL);
  30074   // non json object
  30075   terminateO(delim1);
  30076   delim1 = (smallStringt*) allocSmallInt(1);
  30077   r = extractSmallStringCharO(self, delim1, '$');
  30078   ck_assert_ptr_eq(r, NULL);
  30079   terminateO(delim1);
  30080   delim1 = allocSmallString(";");
  30081   // NULL string
  30082   freeO(self);
  30083   setValO(delim1, ";");
  30084   ck_assert_ptr_eq(extractSmallStringCharO(self, delim1, ','), NULL);
  30085   // NULL delimiter
  30086   freeO(self);
  30087   setTopSO(self, "test");
  30088   ck_assert_ptr_eq(extractSmallStringCharO(self, NULL, ','), NULL);
  30089   terminateO(delim1);
  30090   terminateO(self);
  30091 
  30092 }
  30093 
  30094 
  30095 void extractSSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  30096 
  30097   smallJsont* r;
  30098   smallJsont *self = allocSmallJson();
  30099   setTopSO(self, "");
  30100   smallJsont* delim2 = allocSmallJson();
  30101 
  30102   // string
  30103   freeO(self);
  30104   setTopSO(self, "one/two|");
  30105   setTopSO(delim2, "|");
  30106   r = extractSSmallJsonO(self, "/", delim2);
  30107   ck_assert_ptr_ne(r, null);
  30108   char *s = toStringO(r);
  30109   ck_assert_str_eq(s, "[\"two\"]");
  30110   free(s);
  30111   terminateO(r);
  30112   // delimiter not found
  30113   freeO(self);
  30114   setTopSO(self, "one/two");
  30115   freeO(delim2);
  30116   setTopSO(delim2, "/");
  30117   r = extractSSmallJsonO(self, "||", delim2);
  30118   ck_assert_ptr_eq(r, NULL);
  30119   // extractSSmallJsonO with several delimiters after each other
  30120   freeO(self);
  30121   setTopSO(self, "one/ two  /three ");
  30122   freeO(delim2);
  30123   setTopSO(delim2, " ");
  30124   r = extractSSmallJsonO(self, "/", delim2);
  30125   ck_assert_ptr_ne(r, null);
  30126   s = toStringO(r);
  30127   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30128   free(s);
  30129   terminateO(r);
  30130   // multiple character delimiter
  30131   freeO(self);
  30132   setTopSO(self, "AAe thre|e extract");
  30133   freeO(delim2);
  30134   setTopSO(delim2, "|");
  30135   r = extractSSmallJsonO(self, "e ", delim2);
  30136   ck_assert_ptr_ne(r, null);
  30137   s = toStringO(r);
  30138   ck_assert_str_eq(s, "[\"thre\"]");
  30139   free(s);
  30140   terminateO(r);
  30141   // empty delimiter
  30142   freeO(self);
  30143   setTopSO(self, "AAd");
  30144   freeO(delim2);
  30145   setTopSO(delim2, "Ad");
  30146   r = extractSSmallJsonO(self, "", delim2);
  30147   ck_assert_ptr_eq(r, NULL);
  30148   freeO(self);
  30149   setTopSO(self, "AAd");
  30150   freeO(delim2);
  30151   setTopSO(delim2, "");
  30152   r = extractSSmallJsonO(self, "A", delim2);
  30153   ck_assert_ptr_eq(r, NULL);
  30154   // empty string
  30155   freeO(self);
  30156   setTopSO(self, "");
  30157   freeO(delim2);
  30158   setTopSO(delim2, "#");
  30159   r = extractSSmallJsonO(self, "$", delim2);
  30160   ck_assert_ptr_eq(r, NULL);
  30161   // delim1 = delim2
  30162   freeO(self);
  30163   setTopSO(self, "$qwe$");
  30164   freeO(delim2);
  30165   setTopSO(delim2, "$");
  30166   r = extractSSmallJsonO(self, "$", delim2);
  30167   ck_assert_ptr_eq(r, NULL);
  30168   // non json string
  30169   freeO(delim2);
  30170   r = extractSSmallJsonO(self, "$", delim2);
  30171   ck_assert_ptr_eq(r, NULL);
  30172   // non json object
  30173   terminateO(delim2);
  30174   delim2 = (smallJsont*) allocSmallInt(1);
  30175   r = extractSSmallJsonO(self, ";", delim2);
  30176   ck_assert_ptr_eq(r, NULL);
  30177   terminateO(delim2);
  30178   delim2 = allocSmallJson();
  30179   // NULL string
  30180   freeO(self);
  30181   freeO(delim2);
  30182   setTopSO(delim2, ",");
  30183   ck_assert_ptr_eq(extractSSmallJsonO(self, ";", delim2), NULL);
  30184   // NULL delimiter
  30185   freeO(self);
  30186   setTopSO(self, "test");
  30187   ck_assert_ptr_eq(extractSSmallJsonO(self, NULL, delim2), NULL);
  30188   ck_assert_ptr_eq(extractSSmallJsonO(self, ";", NULL), NULL);
  30189   terminateO(delim2);
  30190   terminateO(self);
  30191 
  30192 }
  30193 
  30194 
  30195 void extractSSmallStringSmallJsonT(CuTest *tc UNUSED) {
  30196 
  30197   smallJsont* r;
  30198   smallJsont *self = allocSmallJson();
  30199   setTopSO(self, "");
  30200   smallStringt* delim2 = allocSmallString("|");
  30201 
  30202   // string
  30203   freeO(self);
  30204   setTopSO(self, "one/two|");
  30205   setValO(delim2, "|");
  30206   r = extractSSmallStringO(self, "/", delim2);
  30207   ck_assert_ptr_ne(r, null);
  30208   char *s = toStringO(r);
  30209   ck_assert_str_eq(s, "[\"two\"]");
  30210   free(s);
  30211   terminateO(r);
  30212   // delimiter not found
  30213   freeO(self);
  30214   setTopSO(self, "one/two");
  30215   setValO(delim2, "/");
  30216   r = extractSSmallStringO(self, "||", delim2);
  30217   ck_assert_ptr_eq(r, NULL);
  30218   // extractSSmallStringO with several delimiters after each other
  30219   freeO(self);
  30220   setTopSO(self, "one/ two  /three ");
  30221   setValO(delim2, " ");
  30222   r = extractSSmallStringO(self, "/", delim2);
  30223   ck_assert_ptr_ne(r, null);
  30224   s = toStringO(r);
  30225   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30226   free(s);
  30227   terminateO(r);
  30228   // multiple character delimiter
  30229   freeO(self);
  30230   setTopSO(self, "AAe thre|e extract");
  30231   setValO(delim2, "|");
  30232   r = extractSSmallStringO(self, "e ", delim2);
  30233   ck_assert_ptr_ne(r, null);
  30234   s = toStringO(r);
  30235   ck_assert_str_eq(s, "[\"thre\"]");
  30236   free(s);
  30237   terminateO(r);
  30238   // empty delimiter
  30239   freeO(self);
  30240   setTopSO(self, "AAd");
  30241   setValO(delim2, "Ad");
  30242   r = extractSSmallStringO(self, "", delim2);
  30243   ck_assert_ptr_eq(r, NULL);
  30244   freeO(self);
  30245   setTopSO(self, "AAd");
  30246   setValO(delim2, "");
  30247   r = extractSSmallStringO(self, "A", delim2);
  30248   ck_assert_ptr_eq(r, NULL);
  30249   // empty string
  30250   freeO(self);
  30251   setTopSO(self, "");
  30252   setValO(delim2, "#");
  30253   r = extractSSmallStringO(self, "$", delim2);
  30254   ck_assert_ptr_eq(r, NULL);
  30255   // delim1 = delim2
  30256   freeO(self);
  30257   setTopSO(self, "$qwe$");
  30258   setValO(delim2, "$");
  30259   r = extractSSmallStringO(self, "$", delim2);
  30260   ck_assert_ptr_eq(r, NULL);
  30261   // non json object
  30262   terminateO(delim2);
  30263   delim2 = (smallStringt*) allocSmallInt(1);
  30264   r = extractSSmallStringO(self, ";", delim2);
  30265   ck_assert_ptr_eq(r, NULL);
  30266   terminateO(delim2);
  30267   delim2 = allocSmallString(",");
  30268   // NULL string
  30269   freeO(self);
  30270   ck_assert_ptr_eq(extractSSmallStringO(self, ";", delim2), NULL);
  30271   // NULL delimiter
  30272   freeO(self);
  30273   setTopSO(self, "test");
  30274   ck_assert_ptr_eq(extractSSmallStringO(self, NULL, delim2), NULL);
  30275   ck_assert_ptr_eq(extractSSmallStringO(self, ";", NULL), NULL);
  30276   terminateO(delim2);
  30277   terminateO(self);
  30278 
  30279 }
  30280 
  30281 
  30282 void extractCharSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  30283 
  30284   smallJsont* r;
  30285   smallJsont *self = allocSmallJson();
  30286   setTopSO(self, "");
  30287   smallJsont* delim2 = allocSmallJson();
  30288 
  30289   // string
  30290   freeO(self);
  30291   setTopSO(self, "one/two|");
  30292   setTopSO(delim2, "|");
  30293   r = extractCharSmallJsonO(self, '/', delim2);
  30294   ck_assert_ptr_ne(r, null);
  30295   char *s = toStringO(r);
  30296   ck_assert_str_eq(s, "[\"two\"]");
  30297   free(s);
  30298   terminateO(r);
  30299   // delimiter not found
  30300   freeO(self);
  30301   setTopSO(self, "one/two");
  30302   freeO(delim2);
  30303   setTopSO(delim2, "/");
  30304   r = extractCharSmallJsonO(self, '|', delim2);
  30305   ck_assert_ptr_eq(r, NULL);
  30306   // extractCharSmallJsonO with several delimiters after each other
  30307   freeO(self);
  30308   setTopSO(self, "one/ two  /three ");
  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, "[\"\",\"three\"]");
  30315   free(s);
  30316   terminateO(r);
  30317   // multiple character delimiter
  30318   freeO(self);
  30319   setTopSO(self, "AAe thre|e extract");
  30320   freeO(delim2);
  30321   setTopSO(delim2, "|");
  30322   r = extractCharSmallJsonO(self, ' ', delim2);
  30323   ck_assert_ptr_ne(r, null);
  30324   s = toStringO(r);
  30325   ck_assert_str_eq(s, "[\"thre\"]");
  30326   free(s);
  30327   terminateO(r);
  30328   // empty delimiter
  30329   freeO(self);
  30330   setTopSO(self, "AAd");
  30331   freeO(delim2);
  30332   setTopSO(delim2, "");
  30333   r = extractCharSmallJsonO(self, 'A', delim2);
  30334   ck_assert_ptr_eq(r, NULL);
  30335   // empty string
  30336   freeO(self);
  30337   setTopSO(self, "");
  30338   freeO(delim2);
  30339   setTopSO(delim2, "#");
  30340   r = extractCharSmallJsonO(self, '$', delim2);
  30341   ck_assert_ptr_eq(r, NULL);
  30342   // delim1 = delim2
  30343   freeO(self);
  30344   setTopSO(self, "$qwe$");
  30345   freeO(delim2);
  30346   setTopSO(delim2, "$");
  30347   r = extractCharSmallJsonO(self, '$', delim2);
  30348   ck_assert_ptr_eq(r, NULL);
  30349   // non json string
  30350   freeO(delim2);
  30351   r = extractCharSmallJsonO(self, '$', delim2);
  30352   ck_assert_ptr_eq(r, NULL);
  30353   // non json object
  30354   terminateO(delim2);
  30355   delim2 = (smallJsont*) allocSmallInt(1);
  30356   r = extractCharSmallJsonO(self, ';', delim2);
  30357   ck_assert_ptr_eq(r, NULL);
  30358   terminateO(delim2);
  30359   delim2 = allocSmallJson();
  30360   // NULL string
  30361   freeO(self);
  30362   freeO(delim2);
  30363   setTopSO(delim2, ",");
  30364   ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', delim2), NULL);
  30365   // NULL delimiter
  30366   freeO(self);
  30367   setTopSO(self, "test");
  30368   ck_assert_ptr_eq(extractCharSmallJsonO(self, ';', NULL), NULL);
  30369   terminateO(delim2);
  30370   terminateO(self);
  30371 
  30372 }
  30373 
  30374 
  30375 void extractCharSmallStringSmallJsonT(CuTest *tc UNUSED) {
  30376 
  30377   smallJsont* r;
  30378   smallJsont *self = allocSmallJson();
  30379   setTopSO(self, "");
  30380   smallStringt* delim2 = allocSmallString("|");
  30381 
  30382   // string
  30383   freeO(self);
  30384   setTopSO(self, "one/two|");
  30385   setValO(delim2, "|");
  30386   r = extractCharSmallStringO(self, '/', delim2);
  30387   ck_assert_ptr_ne(r, null);
  30388   char *s = toStringO(r);
  30389   ck_assert_str_eq(s, "[\"two\"]");
  30390   free(s);
  30391   terminateO(r);
  30392   // delimiter not found
  30393   freeO(self);
  30394   setTopSO(self, "one/two");
  30395   setValO(delim2, "/");
  30396   r = extractCharSmallStringO(self, '|', delim2);
  30397   ck_assert_ptr_eq(r, NULL);
  30398   // extractCharSmallStringO with several delimiters after each other
  30399   freeO(self);
  30400   setTopSO(self, "one/ two  /three ");
  30401   setValO(delim2, " ");
  30402   r = extractCharSmallStringO(self, '/', delim2);
  30403   ck_assert_ptr_ne(r, null);
  30404   s = toStringO(r);
  30405   ck_assert_str_eq(s, "[\"\",\"three\"]");
  30406   free(s);
  30407   terminateO(r);
  30408   // multiple character delimiter
  30409   freeO(self);
  30410   setTopSO(self, "AAe thre|e extract");
  30411   setValO(delim2, "|e");
  30412   r = extractCharSmallStringO(self, ' ', delim2);
  30413   ck_assert_ptr_ne(r, null);
  30414   s = toStringO(r);
  30415   ck_assert_str_eq(s, "[\"thre\"]");
  30416   free(s);
  30417   terminateO(r);
  30418   // empty delimiter
  30419   freeO(self);
  30420   setTopSO(self, "AAd");
  30421   setValO(delim2, "");
  30422   r = extractCharSmallStringO(self, 'A', delim2);
  30423   ck_assert_ptr_eq(r, NULL);
  30424   // empty string
  30425   freeO(self);
  30426   setTopSO(self, "");
  30427   setValO(delim2, "#");
  30428   r = extractCharSmallStringO(self, '$', delim2);
  30429   ck_assert_ptr_eq(r, NULL);
  30430   // delim1 = delim2
  30431   freeO(self);
  30432   setTopSO(self, "$qwe$");
  30433   setValO(delim2, "$");
  30434   r = extractCharSmallStringO(self, '$', delim2);
  30435   ck_assert_ptr_eq(r, NULL);
  30436   // non json object
  30437   terminateO(delim2);
  30438   delim2 = (smallStringt*) allocSmallInt(1);
  30439   r = extractCharSmallStringO(self, ';', delim2);
  30440   ck_assert_ptr_eq(r, NULL);
  30441   terminateO(delim2);
  30442   delim2 = allocSmallString(",");
  30443   // NULL string
  30444   freeO(self);
  30445   ck_assert_ptr_eq(extractCharSmallStringO(self, ';', delim2), NULL);
  30446   // NULL delimiter
  30447   freeO(self);
  30448   setTopSO(self, "test");
  30449   ck_assert_ptr_eq(extractCharSmallStringO(self, ';', NULL), NULL);
  30450   terminateO(delim2);
  30451   terminateO(self);
  30452 
  30453 }
  30454 
  30455 
  30456 void icSplitSmallJsonT(CuTest *tc UNUSED) {
  30457 
  30458   smallJsont* r;
  30459   smallJsont *self = allocSmallJson();
  30460   setTopSO(self, "");
  30461 
  30462   // string
  30463   freeO(self);
  30464   setTopSO(self, "one/two");
  30465   r = icSplitO(self, "/");
  30466   ck_assert_ptr_ne(r, null);
  30467   char *s = toStringO(r);
  30468   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30469   free(s);
  30470   terminateO(r);
  30471   // delimiter on the edge
  30472   freeO(self);
  30473   setTopSO(self, "/one");
  30474   r = icSplitO(self, "/");
  30475   ck_assert_ptr_ne(r, null);
  30476   s = toStringO(r);
  30477   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30478   free(s);
  30479   terminateO(r);
  30480   freeO(self);
  30481   setTopSO(self, "one/");
  30482   r = icSplitO(self, "/");
  30483   ck_assert_ptr_ne(r, null);
  30484   s = toStringO(r);
  30485   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30486   free(s);
  30487   terminateO(r);
  30488   // delimiter not found
  30489   freeO(self);
  30490   setTopSO(self, "one/two");
  30491   r = icSplitO(self, "||");
  30492   ck_assert_ptr_ne(r, null);
  30493   s = toStringO(r);
  30494   ck_assert_str_eq(s, "[\"one/two\"]");
  30495   free(s);
  30496   terminateO(r);
  30497   // icSplit with several delimiters after each other
  30498   freeO(self);
  30499   setTopSO(self, "one/two  three ");
  30500   r = icSplitO(self, " ");
  30501   ck_assert_ptr_ne(r, null);
  30502   s = toStringO(r);
  30503   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30504   free(s);
  30505   terminateO(r);
  30506   // multiple character delimiter
  30507   freeO(self);
  30508   setTopSO(self, "AAe three extract");
  30509   r = icSplitO(self, "E ");
  30510   ck_assert_ptr_ne(r, null);
  30511   s = toStringO(r);
  30512   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30513   free(s);
  30514   terminateO(r);
  30515   // empty delimiter
  30516   freeO(self);
  30517   setTopSO(self, "AAd");
  30518   r = icSplitO(self, "");
  30519   ck_assert_ptr_ne(r, null);
  30520   s = toStringO(r);
  30521   ck_assert_str_eq(s, "[\"AAd\"]");
  30522   free(s);
  30523   terminateO(r);
  30524   // empty string
  30525   emptyO(self);
  30526   r = icSplitO(self, "$");
  30527   ck_assert_ptr_ne(r, null);
  30528   s = toStringO(r);
  30529   ck_assert_str_eq(s, "[\"\"]");
  30530   free(s);
  30531   terminateO(r);
  30532   // NULL list
  30533   freeO(self);
  30534   ck_assert_ptr_eq(icSplitO(self, ";"), NULL);
  30535   // NULL delimiter
  30536   freeO(self);
  30537   setTopSO(self, "test");
  30538   ck_assert_ptr_eq(icSplitO(self, NULL), NULL);
  30539   terminateO(self);
  30540 
  30541 }
  30542 
  30543 
  30544 void icSplitCharSmallJsonT(CuTest *tc UNUSED) {
  30545 
  30546   smallJsont* r;
  30547   smallJsont *self = allocSmallJson();
  30548   setTopSO(self, "");
  30549 
  30550   // string
  30551   freeO(self);
  30552   setTopSO(self, "one/two");
  30553   r = icSplitCharO(self, 'T');
  30554   ck_assert_ptr_ne(r, null);
  30555   char *s = toStringO(r);
  30556   ck_assert_str_eq(s, "[\"one/\",\"wo\"]");
  30557   free(s);
  30558   terminateO(r);
  30559   // delimiter on the edge
  30560   freeO(self);
  30561   setTopSO(self, "/one");
  30562   r = icSplitCharO(self, '/');
  30563   ck_assert_ptr_ne(r, null);
  30564   s = toStringO(r);
  30565   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30566   free(s);
  30567   terminateO(r);
  30568   freeO(self);
  30569   setTopSO(self, "one/");
  30570   r = icSplitCharO(self, '/');
  30571   ck_assert_ptr_ne(r, null);
  30572   s = toStringO(r);
  30573   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30574   free(s);
  30575   terminateO(r);
  30576   // delimiter not found
  30577   freeO(self);
  30578   setTopSO(self, "one/two");
  30579   r = icSplitCharO(self, '|');
  30580   ck_assert_ptr_ne(r, null);
  30581   s = toStringO(r);
  30582   ck_assert_str_eq(s, "[\"one/two\"]");
  30583   free(s);
  30584   terminateO(r);
  30585   // icSplit with several delimiters after each other
  30586   freeO(self);
  30587   setTopSO(self, "one/two  three ");
  30588   r = icSplitCharO(self, ' ');
  30589   ck_assert_ptr_ne(r, null);
  30590   s = toStringO(r);
  30591   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30592   free(s);
  30593   terminateO(r);
  30594   // empty string
  30595   emptyO(self);
  30596   r = icSplitCharO(self, '$');
  30597   ck_assert_ptr_ne(r, null);
  30598   s = toStringO(r);
  30599   ck_assert_str_eq(s, "[\"\"]");
  30600   free(s);
  30601   terminateO(r);
  30602   // NULL list
  30603   freeO(self);
  30604   ck_assert_ptr_eq(icSplitCharO(self, ';'), NULL);
  30605   terminateO(self);
  30606 
  30607 }
  30608 
  30609 
  30610 void icSplitSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  30611 
  30612   smallJsont* r;
  30613   smallJsont *self = allocSmallJson();
  30614   setTopSO(self, "");
  30615   smallJsont *delim  = allocSmallJson();
  30616 
  30617   // string
  30618   freeO(self);
  30619   setTopSO(self, "one/two");
  30620   setTopSO(delim, "/");
  30621   r = self->f->icSplitSmallJson(self, delim);
  30622   ck_assert_ptr_ne(r, null);
  30623   char *s = toStringO(r);
  30624   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30625   free(s);
  30626   terminateO(r);
  30627   // delimiter on the edge
  30628   freeO(self);
  30629   setTopSO(self, "/one");
  30630   r = self->f->icSplitSmallJson(self, delim);
  30631   ck_assert_ptr_ne(r, null);
  30632   s = toStringO(r);
  30633   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30634   free(s);
  30635   terminateO(r);
  30636   freeO(self);
  30637   setTopSO(self, "one/");
  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\",\"\"]");
  30642   free(s);
  30643   terminateO(r);
  30644   // delimiter not found
  30645   freeO(self);
  30646   setTopSO(self, "one/two");
  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\"]");
  30653   free(s);
  30654   terminateO(r);
  30655   // icSplit with several delimiters after each other
  30656   freeO(self);
  30657   setTopSO(self, "one/two  three ");
  30658   freeO(delim);
  30659   setTopSO(delim, " ");
  30660   r = self->f->icSplitSmallJson(self, delim);
  30661   ck_assert_ptr_ne(r, null);
  30662   s = toStringO(r);
  30663   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30664   free(s);
  30665   terminateO(r);
  30666   // multiple character delimiter
  30667   freeO(self);
  30668   setTopSO(self, "AAe three extract");
  30669   freeO(delim);
  30670   setTopSO(delim, "E ");
  30671   r = self->f->icSplitSmallJson(self, delim);
  30672   ck_assert_ptr_ne(r, null);
  30673   s = toStringO(r);
  30674   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30675   free(s);
  30676   terminateO(r);
  30677   // empty delimiter
  30678   freeO(self);
  30679   setTopSO(self, "AAd");
  30680   freeO(delim);
  30681   setTopSO(delim, "");
  30682   r = self->f->icSplitSmallJson(self, delim);
  30683   ck_assert_ptr_ne(r, null);
  30684   s = toStringO(r);
  30685   ck_assert_str_eq(s, "[\"AAd\"]");
  30686   free(s);
  30687   terminateO(r);
  30688   // empty string
  30689   emptyO(self);
  30690   freeO(delim);
  30691   setTopSO(delim, "$");
  30692   r = self->f->icSplitSmallJson(self, delim);
  30693   ck_assert_ptr_ne(r, null);
  30694   s = toStringO(r);
  30695   ck_assert_str_eq(s, "[\"\"]");
  30696   free(s);
  30697   terminateO(r);
  30698   // non json string delimiter
  30699   freeO(delim);
  30700   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30701   // non json object delimiter
  30702   terminateO(delim);
  30703   delim = (smallJsont*) allocSmallInt(1);
  30704   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30705   terminateO(delim);
  30706   delim  = allocSmallJson();
  30707   // NULL list
  30708   freeO(self);
  30709   freeO(delim);
  30710   setTopSO(delim, ";");
  30711   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, delim), NULL);
  30712   // NULL delimiter
  30713   freeO(self);
  30714   setTopSO(self, "test");
  30715   ck_assert_ptr_eq(self->f->icSplitSmallJson(self, NULL), NULL);
  30716   terminateO(delim);
  30717   terminateO(self);
  30718 
  30719 }
  30720 
  30721 
  30722 void icSplitSmallStringSmallJsonT(CuTest *tc UNUSED) {
  30723 
  30724   smallJsont* r;
  30725   smallJsont *self = allocSmallJson();
  30726   setTopSO(self, "");
  30727   smallStringt *delim = allocSmallString("/");
  30728 
  30729   // string
  30730   freeO(self);
  30731   setTopSO(self, "one/two");
  30732   r = self->f->icSplitSmallString(self, delim);
  30733   ck_assert_ptr_ne(r, null);
  30734   char *s = toStringO(r);
  30735   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  30736   free(s);
  30737   terminateO(r);
  30738   // delimiter on the edge
  30739   freeO(self);
  30740   setTopSO(self, "/one");
  30741   r = self->f->icSplitSmallString(self, delim);
  30742   ck_assert_ptr_ne(r, null);
  30743   s = toStringO(r);
  30744   ck_assert_str_eq(s, "[\"\",\"one\"]");
  30745   free(s);
  30746   terminateO(r);
  30747   freeO(self);
  30748   setTopSO(self, "one/");
  30749   r = self->f->icSplitSmallString(self, delim);
  30750   ck_assert_ptr_ne(r, null);
  30751   s = toStringO(r);
  30752   ck_assert_str_eq(s, "[\"one\",\"\"]");
  30753   free(s);
  30754   terminateO(r);
  30755   // delimiter not found
  30756   freeO(self);
  30757   setTopSO(self, "one/two");
  30758   setValO(delim, "||");
  30759   r = self->f->icSplitSmallString(self, delim);
  30760   ck_assert_ptr_ne(r, null);
  30761   s = toStringO(r);
  30762   ck_assert_str_eq(s, "[\"one/two\"]");
  30763   free(s);
  30764   terminateO(r);
  30765   // icSplit with several delimiters after each other
  30766   freeO(self);
  30767   setTopSO(self, "one/two  three ");
  30768   setValO(delim, " ");
  30769   r = self->f->icSplitSmallString(self, delim);
  30770   ck_assert_ptr_ne(r, null);
  30771   s = toStringO(r);
  30772   ck_assert_str_eq(s, "[\"one/two\",\"\",\"three\",\"\"]");
  30773   free(s);
  30774   terminateO(r);
  30775   // multiple character delimiter
  30776   freeO(self);
  30777   setTopSO(self, "AAe three extract");
  30778   setValO(delim, "E ");
  30779   r = self->f->icSplitSmallString(self, delim);
  30780   ck_assert_ptr_ne(r, null);
  30781   s = toStringO(r);
  30782   ck_assert_str_eq(s, "[\"AA\",\"thre\",\"extract\"]");
  30783   free(s);
  30784   terminateO(r);
  30785   // empty delimiter
  30786   freeO(self);
  30787   setTopSO(self, "AAd");
  30788   setValO(delim, "");
  30789   r = self->f->icSplitSmallString(self, delim);
  30790   ck_assert_ptr_ne(r, null);
  30791   s = toStringO(r);
  30792   ck_assert_str_eq(s, "[\"AAd\"]");
  30793   free(s);
  30794   terminateO(r);
  30795   // empty string
  30796   emptyO(self);
  30797   setValO(delim, "$");
  30798   r = self->f->icSplitSmallString(self, delim);
  30799   ck_assert_ptr_ne(r, null);
  30800   s = toStringO(r);
  30801   ck_assert_str_eq(s, "[\"\"]");
  30802   free(s);
  30803   terminateO(r);
  30804   // null string delimiter
  30805   freeO(delim);
  30806   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30807   // non json object delimiter
  30808   terminateO(delim);
  30809   delim = (smallStringt*) allocSmallInt(1);
  30810   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30811   terminateO(delim);
  30812   // NULL list
  30813   freeO(self);
  30814   delim  = allocSmallString(";");
  30815   ck_assert_ptr_eq(self->f->icSplitSmallString(self, delim), NULL);
  30816   // NULL delimiter
  30817   freeO(self);
  30818   setTopSO(self, "test");
  30819   ck_assert_ptr_eq(self->f->icSplitSmallString(self, NULL), NULL);
  30820   terminateO(delim);
  30821   terminateO(self);
  30822 
  30823 }
  30824 
  30825 
  30826 void icSplitSSmallJsonT(CuTest *tc UNUSED) {
  30827 
  30828   char** r;
  30829   smallJsont *self = allocSmallJson();
  30830   setTopSO(self, "");
  30831 
  30832   // string
  30833   freeO(self);
  30834   setTopSO(self, "one/two");
  30835   r = icSplitSO(self, "/");
  30836   ck_assert_uint_eq(listLengthS(r),2);
  30837   ck_assert_str_eq(r[0], "one");
  30838   ck_assert_str_eq(r[1], "two");
  30839   listFreeS(r);
  30840   // delimiter on the edge
  30841   freeO(self);
  30842   setTopSO(self, "/one");
  30843   r = icSplitSO(self, "/");
  30844   ck_assert_uint_eq(listLengthS(r),2);
  30845   ck_assert_str_eq(r[0], "");
  30846   ck_assert_str_eq(r[1], "one");
  30847   listFreeS(r);
  30848   freeO(self);
  30849   setTopSO(self, "one/");
  30850   r = icSplitSO(self, "/");
  30851   ck_assert_uint_eq(listLengthS(r),2);
  30852   ck_assert_str_eq(r[0], "one");
  30853   ck_assert_str_eq(r[1], "");
  30854   listFreeS(r);
  30855   // delimiter not found
  30856   freeO(self);
  30857   setTopSO(self, "one/two");
  30858   r = icSplitSO(self, "||");
  30859   ck_assert_uint_eq(listLengthS(r),1);
  30860   ck_assert_str_eq(r[0], "one/two");
  30861   listFreeS(r);
  30862   // icSplit with several delimiters after each other
  30863   freeO(self);
  30864   setTopSO(self, "one/two  three ");
  30865   r = icSplitSO(self, " ");
  30866   ck_assert_uint_eq(listLengthS(r),4);
  30867   ck_assert_str_eq(r[0], "one/two");
  30868   ck_assert_str_eq(r[1], "");
  30869   ck_assert_str_eq(r[2], "three");
  30870   ck_assert_str_eq(r[3], "");
  30871   listFreeS(r);
  30872   // multiple character delimiter
  30873   freeO(self);
  30874   setTopSO(self, "AAe three extract");
  30875   r = icSplitSO(self, "E ");
  30876   ck_assert_uint_eq(listLengthS(r),3);
  30877   ck_assert_str_eq(r[0], "AA");
  30878   ck_assert_str_eq(r[1], "thre");
  30879   ck_assert_str_eq(r[2], "extract");
  30880   listFreeS(r);
  30881   // empty delimiter
  30882   freeO(self);
  30883   setTopSO(self, "AAd");
  30884   r = icSplitSO(self, "");
  30885   ck_assert_uint_eq(listLengthS(r),1);
  30886   ck_assert_str_eq(r[0], "AAd");
  30887   listFreeS(r);
  30888   // empty string
  30889   emptyO(self);
  30890   r = icSplitSO(self, "$");
  30891   ck_assert_uint_eq(listLengthS(r),1);
  30892   ck_assert_str_eq(r[0], "");
  30893   listFreeS(r);
  30894   // NULL list
  30895   freeO(self);
  30896   ck_assert_ptr_eq(icSplitSO(self, ";"), NULL);
  30897   // NULL delimiter
  30898   freeO(self);
  30899   setTopSO(self, "test");
  30900   ck_assert_ptr_eq(icSplitSO(self, NULL), NULL);
  30901   terminateO(self);
  30902 
  30903 }
  30904 
  30905 
  30906 void icSplitCharSSmallJsonT(CuTest *tc UNUSED) {
  30907 
  30908   char** r;
  30909   smallJsont *self = allocSmallJson();
  30910   setTopSO(self, "");
  30911 
  30912   // string
  30913   freeO(self);
  30914   setTopSO(self, "one/two");
  30915   r = icSplitCharSO(self, 'T');
  30916   ck_assert_uint_eq(listLengthS(r),2);
  30917   ck_assert_str_eq(r[0], "one/");
  30918   ck_assert_str_eq(r[1], "wo");
  30919   listFreeS(r);
  30920   // delimiter on the edge
  30921   freeO(self);
  30922   setTopSO(self, "/one");
  30923   r = icSplitCharSO(self, '/');
  30924   ck_assert_uint_eq(listLengthS(r),2);
  30925   ck_assert_str_eq(r[0], "");
  30926   ck_assert_str_eq(r[1], "one");
  30927   listFreeS(r);
  30928   freeO(self);
  30929   setTopSO(self, "one/");
  30930   r = icSplitCharSO(self, '/');
  30931   ck_assert_uint_eq(listLengthS(r),2);
  30932   ck_assert_str_eq(r[0], "one");
  30933   ck_assert_str_eq(r[1], "");
  30934   listFreeS(r);
  30935   // delimiter not found
  30936   freeO(self);
  30937   setTopSO(self, "one/two");
  30938   r = icSplitCharSO(self, '|');
  30939   ck_assert_uint_eq(listLengthS(r),1);
  30940   ck_assert_str_eq(r[0], "one/two");
  30941   listFreeS(r);
  30942   // icSplit with several delimiters after each other
  30943   freeO(self);
  30944   setTopSO(self, "one/two  three ");
  30945   r = icSplitCharSO(self, ' ');
  30946   ck_assert_uint_eq(listLengthS(r),4);
  30947   ck_assert_str_eq(r[0], "one/two");
  30948   ck_assert_str_eq(r[1], "");
  30949   ck_assert_str_eq(r[2], "three");
  30950   ck_assert_str_eq(r[3], "");
  30951   listFreeS(r);
  30952   // empty string
  30953   emptyO(self);
  30954   r = icSplitCharSO(self, '$');
  30955   ck_assert_uint_eq(listLengthS(r),1);
  30956   ck_assert_str_eq(r[0], "");
  30957   listFreeS(r);
  30958   // NULL list
  30959   freeO(self);
  30960   ck_assert_ptr_eq(icSplitCharSO(self, ';'), NULL);
  30961   terminateO(self);
  30962 
  30963 }
  30964 
  30965 
  30966 void icSplitSmallJsonSSmallJsonT(CuTest *tc UNUSED) {
  30967 
  30968   char** r;
  30969   smallJsont *self = allocSmallJson();
  30970   setTopSO(self, "");
  30971   smallJsont *delim  = allocSmallJson();
  30972 
  30973   // string
  30974   freeO(self);
  30975   setTopSO(self, "one/two");
  30976   setTopSO(delim, "/");
  30977   r = icSplitSmallJsonSO(self, delim);
  30978   ck_assert_uint_eq(listLengthS(r),2);
  30979   ck_assert_str_eq(r[0], "one");
  30980   ck_assert_str_eq(r[1], "two");
  30981   listFreeS(r);
  30982   // delimiter on the edge
  30983   freeO(self);
  30984   setTopSO(self, "/one");
  30985   r = icSplitSmallJsonSO(self, delim);
  30986   ck_assert_uint_eq(listLengthS(r),2);
  30987   ck_assert_str_eq(r[0], "");
  30988   ck_assert_str_eq(r[1], "one");
  30989   listFreeS(r);
  30990   freeO(self);
  30991   setTopSO(self, "one/");
  30992   r = icSplitSmallJsonSO(self, delim);
  30993   ck_assert_uint_eq(listLengthS(r),2);
  30994   ck_assert_str_eq(r[0], "one");
  30995   ck_assert_str_eq(r[1], "");
  30996   listFreeS(r);
  30997   // delimiter not found
  30998   freeO(self);
  30999   setTopSO(self, "one/two");
  31000   freeO(delim);
  31001   setTopSO(delim, "||");
  31002   r = icSplitSmallJsonSO(self, delim);
  31003   ck_assert_uint_eq(listLengthS(r),1);
  31004   ck_assert_str_eq(r[0], "one/two");
  31005   listFreeS(r);
  31006   // icSplit with several delimiters after each other
  31007   freeO(self);
  31008   setTopSO(self, "one/two  three ");
  31009   freeO(delim);
  31010   setTopSO(delim, " ");
  31011   r = icSplitSmallJsonSO(self, delim);
  31012   ck_assert_uint_eq(listLengthS(r),4);
  31013   ck_assert_str_eq(r[0], "one/two");
  31014   ck_assert_str_eq(r[1], "");
  31015   ck_assert_str_eq(r[2], "three");
  31016   ck_assert_str_eq(r[3], "");
  31017   listFreeS(r);
  31018   // multiple character delimiter
  31019   freeO(self);
  31020   setTopSO(self, "AAe three extract");
  31021   freeO(delim);
  31022   setTopSO(delim, "E ");
  31023   r = icSplitSmallJsonSO(self, delim);
  31024   ck_assert_uint_eq(listLengthS(r),3);
  31025   ck_assert_str_eq(r[0], "AA");
  31026   ck_assert_str_eq(r[1], "thre");
  31027   ck_assert_str_eq(r[2], "extract");
  31028   listFreeS(r);
  31029   // empty delimiter
  31030   freeO(self);
  31031   setTopSO(self, "AAd");
  31032   freeO(delim);
  31033   setTopSO(delim, "");
  31034   r = icSplitSmallJsonSO(self, delim);
  31035   ck_assert_uint_eq(listLengthS(r),1);
  31036   ck_assert_str_eq(r[0], "AAd");
  31037   listFreeS(r);
  31038   // empty string
  31039   emptyO(self);
  31040   freeO(delim);
  31041   setTopSO(delim, "$");
  31042   r = icSplitSmallJsonSO(self, delim);
  31043   ck_assert_uint_eq(listLengthS(r),1);
  31044   ck_assert_str_eq(r[0], "");
  31045   listFreeS(r);
  31046   // non json string delimiter
  31047   freeO(delim);
  31048   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31049   // non json object delimiter
  31050   terminateO(delim);
  31051   delim = (smallJsont*) allocSmallInt(1);
  31052   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31053   terminateO(delim);
  31054   delim  = allocSmallJson();
  31055   // NULL list
  31056   freeO(self);
  31057   freeO(delim);
  31058   setTopSO(delim, ";");
  31059   ck_assert_ptr_eq(icSplitSmallJsonSO(self, delim), NULL);
  31060   // NULL delimiter
  31061   freeO(self);
  31062   setTopSO(self, "test");
  31063   ck_assert_ptr_eq(icSplitSmallJsonSO(self, NULL), NULL);
  31064   terminateO(delim);
  31065   terminateO(self);
  31066 
  31067 }
  31068 
  31069 
  31070 void icSplitSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  31071 
  31072   char** r;
  31073   smallJsont *self = allocSmallJson();
  31074   setTopSO(self, "");
  31075   smallStringt *delim = allocSmallString("/");
  31076 
  31077   // string
  31078   freeO(self);
  31079   setTopSO(self, "one/two");
  31080   r = icSplitSmallStringSO(self, delim);
  31081   ck_assert_uint_eq(listLengthS(r),2);
  31082   ck_assert_str_eq(r[0], "one");
  31083   ck_assert_str_eq(r[1], "two");
  31084   listFreeS(r);
  31085   // delimiter on the edge
  31086   freeO(self);
  31087   setTopSO(self, "/one");
  31088   r = icSplitSmallStringSO(self, delim);
  31089   ck_assert_uint_eq(listLengthS(r),2);
  31090   ck_assert_str_eq(r[0], "");
  31091   ck_assert_str_eq(r[1], "one");
  31092   listFreeS(r);
  31093   freeO(self);
  31094   setTopSO(self, "one/");
  31095   r = icSplitSmallStringSO(self, delim);
  31096   ck_assert_uint_eq(listLengthS(r),2);
  31097   ck_assert_str_eq(r[0], "one");
  31098   ck_assert_str_eq(r[1], "");
  31099   listFreeS(r);
  31100   // delimiter not found
  31101   freeO(self);
  31102   setTopSO(self, "one/two");
  31103   setValO(delim, "||");
  31104   r = icSplitSmallStringSO(self, delim);
  31105   ck_assert_uint_eq(listLengthS(r),1);
  31106   ck_assert_str_eq(r[0], "one/two");
  31107   listFreeS(r);
  31108   // icSplit with several delimiters after each other
  31109   freeO(self);
  31110   setTopSO(self, "one/two  three ");
  31111   setValO(delim, " ");
  31112   r = icSplitSmallStringSO(self, delim);
  31113   ck_assert_uint_eq(listLengthS(r),4);
  31114   ck_assert_str_eq(r[0], "one/two");
  31115   ck_assert_str_eq(r[1], "");
  31116   ck_assert_str_eq(r[2], "three");
  31117   ck_assert_str_eq(r[3], "");
  31118   listFreeS(r);
  31119   // multiple character delimiter
  31120   freeO(self);
  31121   setTopSO(self, "AAe three extract");
  31122   setValO(delim, "E ");
  31123   r = icSplitSmallStringSO(self, delim);
  31124   ck_assert_uint_eq(listLengthS(r),3);
  31125   ck_assert_str_eq(r[0], "AA");
  31126   ck_assert_str_eq(r[1], "thre");
  31127   ck_assert_str_eq(r[2], "extract");
  31128   listFreeS(r);
  31129   // empty delimiter
  31130   freeO(self);
  31131   setTopSO(self, "AAd");
  31132   setValO(delim, "");
  31133   r = icSplitSmallStringSO(self, delim);
  31134   ck_assert_uint_eq(listLengthS(r),1);
  31135   ck_assert_str_eq(r[0], "AAd");
  31136   listFreeS(r);
  31137   // empty string
  31138   emptyO(self);
  31139   setValO(delim, "$");
  31140   r = icSplitSmallStringSO(self, delim);
  31141   ck_assert_uint_eq(listLengthS(r),1);
  31142   ck_assert_str_eq(r[0], "");
  31143   listFreeS(r);
  31144   // non smallString object delimiter
  31145   terminateO(delim);
  31146   delim = (smallStringt*) allocSmallInt(1);
  31147   ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL);
  31148   terminateO(delim);
  31149   // NULL list
  31150   freeO(self);
  31151   delim  = allocSmallString(";");
  31152   ck_assert_ptr_eq(icSplitSmallStringSO(self, delim), NULL);
  31153   // NULL delimiter
  31154   freeO(self);
  31155   setTopSO(self, "test");
  31156   ck_assert_ptr_eq(icSplitSmallStringSO(self, NULL), NULL);
  31157   terminateO(delim);
  31158   terminateO(self);
  31159 
  31160 }
  31161 
  31162 
  31163 void icExtractSmallJsonT(CuTest *tc UNUSED) {
  31164 
  31165   smallJsont* r;
  31166   smallJsont *self = allocSmallJson();
  31167   setTopSO(self, "");
  31168 
  31169   // string
  31170   freeO(self);
  31171   setTopSO(self, "one/twos");
  31172   r = icExtractO(self, "E", "S");
  31173   ck_assert_ptr_ne(r, null);
  31174   char *s = toStringO(r);
  31175   ck_assert_str_eq(s, "[\"/two\"]");
  31176   free(s);
  31177   terminateO(r);
  31178   // delimiter not found
  31179   freeO(self);
  31180   setTopSO(self, "one/two");
  31181   r = icExtractO(self, "||", "/");
  31182   ck_assert_ptr_eq(r, NULL);
  31183   // icExtractO with several delimiters after each other
  31184   freeO(self);
  31185   setTopSO(self, "one/ two  /three ");
  31186   r = icExtractO(self, "/", " ");
  31187   ck_assert_ptr_ne(r, null);
  31188   s = toStringO(r);
  31189   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31190   free(s);
  31191   terminateO(r);
  31192   // multiple character delimiter
  31193   freeO(self);
  31194   setTopSO(self, "AAe thre|e icExtract");
  31195   r = icExtractO(self, "e ", "|");
  31196   ck_assert_ptr_ne(r, null);
  31197   s = toStringO(r);
  31198   ck_assert_str_eq(s, "[\"thre\"]");
  31199   free(s);
  31200   terminateO(r);
  31201   // empty delimiter
  31202   freeO(self);
  31203   setTopSO(self, "AAd");
  31204   r = icExtractO(self, "", "Ad");
  31205   ck_assert_ptr_eq(r, NULL);
  31206   freeO(self);
  31207   setTopSO(self, "AAd");
  31208   r = icExtractO(self, "A", "");
  31209   ck_assert_ptr_eq(r, NULL);
  31210   // empty string
  31211   freeO(self);
  31212   setTopSO(self, "");
  31213   r = icExtractO(self, "$", "#");
  31214   ck_assert_ptr_eq(r, NULL);
  31215   // delim1 = delim2
  31216   freeO(self);
  31217   setTopSO(self, "");
  31218   r = icExtractO(self, "$", "$");
  31219   ck_assert_ptr_eq(r, NULL);
  31220   // NULL string
  31221   freeO(self);
  31222   ck_assert_ptr_eq(icExtractO(self, ";", ","), NULL);
  31223   // NULL delimiter
  31224   freeO(self);
  31225   setTopSO(self, "test");
  31226   ck_assert_ptr_eq(icExtractO(self, NULL, ","), NULL);
  31227   ck_assert_ptr_eq(icExtractO(self, ",", NULL), NULL);
  31228   terminateO(self);
  31229 
  31230 }
  31231 
  31232 
  31233 void icExtractCharSSmallJsonT(CuTest *tc UNUSED) {
  31234 
  31235   smallJsont* r;
  31236   smallJsont *self = allocSmallJson();
  31237   setTopSO(self, "");
  31238 
  31239   // string
  31240   freeO(self);
  31241   setTopSO(self, "one/twos");
  31242   r = icExtractCharSO(self, 'E', "S");
  31243   ck_assert_ptr_ne(r, null);
  31244   char *s = toStringO(r);
  31245   ck_assert_str_eq(s, "[\"/two\"]");
  31246   free(s);
  31247   terminateO(r);
  31248   // delimiter not found
  31249   freeO(self);
  31250   setTopSO(self, "one/two");
  31251   r = icExtractCharSO(self, '|', "/");
  31252   ck_assert_ptr_eq(r, NULL);
  31253   // icExtractCharSO with several delimiters after each other
  31254   freeO(self);
  31255   setTopSO(self, "one/ two  /three ");
  31256   r = icExtractCharSO(self, '/', " ");
  31257   ck_assert_ptr_ne(r, null);
  31258   s = toStringO(r);
  31259   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31260   free(s);
  31261   terminateO(r);
  31262   // multiple character delimiter
  31263   freeO(self);
  31264   setTopSO(self, "AAe thre|e icExtract");
  31265   r = icExtractCharSO(self, ' ', "|e");
  31266   ck_assert_ptr_ne(r, null);
  31267   s = toStringO(r);
  31268   ck_assert_str_eq(s, "[\"thre\"]");
  31269   free(s);
  31270   terminateO(r);
  31271   // empty delimiter
  31272   freeO(self);
  31273   setTopSO(self, "AAd");
  31274   r = icExtractCharSO(self, 'A', "");
  31275   ck_assert_ptr_eq(r, NULL);
  31276   // empty string
  31277   freeO(self);
  31278   setTopSO(self, "");
  31279   r = icExtractCharSO(self, '$', "#");
  31280   ck_assert_ptr_eq(r, NULL);
  31281   // delim1 = delim2
  31282   freeO(self);
  31283   setTopSO(self, "");
  31284   r = icExtractCharSO(self, '$', "$");
  31285   ck_assert_ptr_eq(r, NULL);
  31286   // NULL string
  31287   freeO(self);
  31288   ck_assert_ptr_eq(icExtractCharSO(self, ';', ","), NULL);
  31289   // NULL delimiter
  31290   freeO(self);
  31291   setTopSO(self, "test");
  31292   ck_assert_ptr_eq(icExtractCharSO(self, ',', NULL), NULL);
  31293   terminateO(self);
  31294 
  31295 }
  31296 
  31297 
  31298 void icExtractSCharSmallJsonT(CuTest *tc UNUSED) {
  31299 
  31300   smallJsont* r;
  31301   smallJsont *self = allocSmallJson();
  31302   setTopSO(self, "");
  31303 
  31304   // string
  31305   freeO(self);
  31306   setTopSO(self, "one/twos");
  31307   r = icExtractSCharO(self, "E", 'S');
  31308   ck_assert_ptr_ne(r, null);
  31309   char *s = toStringO(r);
  31310   ck_assert_str_eq(s, "[\"/two\"]");
  31311   free(s);
  31312   terminateO(r);
  31313   // delimiter not found
  31314   freeO(self);
  31315   setTopSO(self, "one/two");
  31316   r = icExtractSCharO(self, "||", '/');
  31317   ck_assert_ptr_eq(r, NULL);
  31318   // icExtractSCharO with several delimiters after each other
  31319   freeO(self);
  31320   setTopSO(self, "one/ two  /three ");
  31321   r = icExtractSCharO(self, "/", ' ');
  31322   ck_assert_ptr_ne(r, null);
  31323   s = toStringO(r);
  31324   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31325   free(s);
  31326   terminateO(r);
  31327   // multiple character delimiter
  31328   freeO(self);
  31329   setTopSO(self, "AAe thre|e icExtract");
  31330   r = icExtractSCharO(self, "e ", '|');
  31331   ck_assert_ptr_ne(r, null);
  31332   s = toStringO(r);
  31333   ck_assert_str_eq(s, "[\"thre\"]");
  31334   free(s);
  31335   terminateO(r);
  31336   // empty delimiter
  31337   freeO(self);
  31338   setTopSO(self, "AAd");
  31339   r = icExtractSCharO(self, "", 'A');
  31340   ck_assert_ptr_eq(r, NULL);
  31341   // empty string
  31342   freeO(self);
  31343   setTopSO(self, "");
  31344   r = icExtractSCharO(self, "$", '#');
  31345   ck_assert_ptr_eq(r, NULL);
  31346   // delim1 = delim2
  31347   freeO(self);
  31348   setTopSO(self, "");
  31349   r = icExtractSCharO(self, "$", '$');
  31350   ck_assert_ptr_eq(r, NULL);
  31351   // NULL string
  31352   freeO(self);
  31353   ck_assert_ptr_eq(icExtractSCharO(self, ";", ','), NULL);
  31354   // NULL delimiter
  31355   freeO(self);
  31356   setTopSO(self, "test");
  31357   ck_assert_ptr_eq(icExtractSCharO(self, NULL, ','), NULL);
  31358   terminateO(self);
  31359 
  31360 }
  31361 
  31362 
  31363 void icExtractCharCharSmallJsonT(CuTest *tc UNUSED) {
  31364 
  31365   smallJsont* r;
  31366   smallJsont *self = allocSmallJson();
  31367   setTopSO(self, "");
  31368 
  31369   // string
  31370   freeO(self);
  31371   setTopSO(self, "one/twos");
  31372   r = icExtractCharCharO(self, 'E', 'S');
  31373   ck_assert_ptr_ne(r, null);
  31374   char *s = toStringO(r);
  31375   ck_assert_str_eq(s, "[\"/two\"]");
  31376   free(s);
  31377   terminateO(r);
  31378   // delimiter not found
  31379   freeO(self);
  31380   setTopSO(self, "one/two");
  31381   r = icExtractCharCharO(self, '|', '/');
  31382   ck_assert_ptr_eq(r, NULL);
  31383   // icExtractCharCharO with several delimiters after each other
  31384   freeO(self);
  31385   setTopSO(self, "one/ two  /three ");
  31386   r = icExtractCharCharO(self, '/', ' ');
  31387   ck_assert_ptr_ne(r, null);
  31388   s = toStringO(r);
  31389   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31390   free(s);
  31391   terminateO(r);
  31392   // multiple character delimiter
  31393   freeO(self);
  31394   setTopSO(self, "AAe thre|e icExtract");
  31395   r = icExtractCharCharO(self, ' ', '|');
  31396   ck_assert_ptr_ne(r, null);
  31397   s = toStringO(r);
  31398   ck_assert_str_eq(s, "[\"thre\"]");
  31399   free(s);
  31400   terminateO(r);
  31401   // empty string
  31402   freeO(self);
  31403   setTopSO(self, "");
  31404   r = icExtractCharCharO(self, '$', '#');
  31405   ck_assert_ptr_eq(r, NULL);
  31406   // delim1 = delim2
  31407   freeO(self);
  31408   setTopSO(self, "");
  31409   r = icExtractCharCharO(self, '$', '$');
  31410   ck_assert_ptr_eq(r, NULL);
  31411   // NULL string
  31412   freeO(self);
  31413   ck_assert_ptr_eq(icExtractCharCharO(self, ';', ','), NULL);
  31414   terminateO(self);
  31415 
  31416 }
  31417 
  31418 
  31419 void icExtractSmallJsonSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  31420 
  31421   smallJsont* r;
  31422   smallJsont *self = allocSmallJson();
  31423   setTopSO(self, "");
  31424   smallJsont* delim1 = allocSmallJson();
  31425   smallJsont* delim2 = allocSmallJson();
  31426 
  31427   // string
  31428   freeO(self);
  31429   setTopSO(self, "one/twos");
  31430   setTopSO(delim1, "E");
  31431   setTopSO(delim2, "S");
  31432   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31433   ck_assert_ptr_ne(r, null);
  31434   char *s = toStringO(r);
  31435   ck_assert_str_eq(s, "[\"/two\"]");
  31436   free(s);
  31437   terminateO(r);
  31438   // delimiter not found
  31439   freeO(self);
  31440   setTopSO(self, "one/two");
  31441   freeO(delim1);
  31442   freeO(delim2);
  31443   setTopSO(delim1, "||");
  31444   setTopSO(delim2, "/");
  31445   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31446   ck_assert_ptr_eq(r, NULL);
  31447   // icExtractSmallJsonSmallJsonO with several delimiters after each other
  31448   freeO(self);
  31449   setTopSO(self, "one/ two  /three ");
  31450   freeO(delim1);
  31451   freeO(delim2);
  31452   setTopSO(delim1, "/");
  31453   setTopSO(delim2, " ");
  31454   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31455   ck_assert_ptr_ne(r, null);
  31456   s = toStringO(r);
  31457   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31458   free(s);
  31459   terminateO(r);
  31460   // multiple character delimiter
  31461   freeO(self);
  31462   setTopSO(self, "AAe thre|e icExtract");
  31463   freeO(delim1);
  31464   freeO(delim2);
  31465   setTopSO(delim1, "e ");
  31466   setTopSO(delim2, "|");
  31467   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31468   ck_assert_ptr_ne(r, null);
  31469   s = toStringO(r);
  31470   ck_assert_str_eq(s, "[\"thre\"]");
  31471   free(s);
  31472   terminateO(r);
  31473   // empty delimiter
  31474   freeO(self);
  31475   setTopSO(self, "AAd");
  31476   freeO(delim1);
  31477   freeO(delim2);
  31478   setTopSO(delim1, "");
  31479   setTopSO(delim2, "Ad");
  31480   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31481   ck_assert_ptr_eq(r, NULL);
  31482   freeO(self);
  31483   setTopSO(self, "AAd");
  31484   freeO(delim1);
  31485   freeO(delim2);
  31486   setTopSO(delim1, "A");
  31487   setTopSO(delim2, "");
  31488   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31489   ck_assert_ptr_eq(r, NULL);
  31490   // empty string
  31491   freeO(self);
  31492   setTopSO(self, "");
  31493   freeO(delim1);
  31494   freeO(delim2);
  31495   setTopSO(delim1, "$");
  31496   setTopSO(delim2, "#");
  31497   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31498   ck_assert_ptr_eq(r, NULL);
  31499   // delim1 = delim2
  31500   freeO(self);
  31501   setTopSO(self, "$qwe$");
  31502   freeO(delim1);
  31503   freeO(delim2);
  31504   setTopSO(delim1, "$");
  31505   setTopSO(delim2, "$");
  31506   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31507   ck_assert_ptr_eq(r, NULL);
  31508   // non json string
  31509   freeO(delim1);
  31510   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31511   ck_assert_ptr_eq(r, NULL);
  31512   setTopSO(delim1, "$");
  31513   freeO(delim2);
  31514   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31515   ck_assert_ptr_eq(r, NULL);
  31516   // non json object
  31517   terminateO(delim1);
  31518   delim1 = (smallJsont*) allocSmallInt(1);
  31519   setTopSO(delim2, "$");
  31520   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31521   ck_assert_ptr_eq(r, NULL);
  31522   terminateO(delim1);
  31523   delim1 = allocSmallJson();
  31524   setTopSO(delim1, ";");
  31525   terminateO(delim2);
  31526   delim2 = (smallJsont*) allocSmallInt(1);
  31527   r = icExtractSmallJsonSmallJsonO(self, delim1, delim2);
  31528   ck_assert_ptr_eq(r, NULL);
  31529   terminateO(delim2);
  31530   delim2 = allocSmallJson();
  31531   // NULL string
  31532   freeO(self);
  31533   freeO(delim1);
  31534   freeO(delim2);
  31535   setTopSO(delim1, ";");
  31536   setTopSO(delim2, ",");
  31537   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, delim2), NULL);
  31538   // NULL delimiter
  31539   freeO(self);
  31540   setTopSO(self, "test");
  31541   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, NULL, delim2), NULL);
  31542   ck_assert_ptr_eq(icExtractSmallJsonSmallJsonO(self, delim1, NULL), NULL);
  31543   terminateO(delim1);
  31544   terminateO(delim2);
  31545   terminateO(self);
  31546 
  31547 }
  31548 
  31549 
  31550 void icExtractSmallJsonSmallStringSmallJsonT(CuTest *tc UNUSED) {
  31551 
  31552   smallJsont* r;
  31553   smallJsont *self = allocSmallJson();
  31554   setTopSO(self, "");
  31555   smallJsont* delim1   = allocSmallJson();
  31556   smallStringt* delim2 = allocSmallString("S");
  31557 
  31558   // string
  31559   freeO(self);
  31560   setTopSO(self, "one/twos");
  31561   setTopSO(delim1, "E");
  31562   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31563   ck_assert_ptr_ne(r, null);
  31564   char *s = toStringO(r);
  31565   ck_assert_str_eq(s, "[\"/two\"]");
  31566   free(s);
  31567   terminateO(r);
  31568   // delimiter not found
  31569   freeO(self);
  31570   setTopSO(self, "one/two");
  31571   freeO(delim1);
  31572   setTopSO(delim1, "||");
  31573   setValO(delim2, "/");
  31574   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31575   ck_assert_ptr_eq(r, NULL);
  31576   // icExtractSmallJsonSmallStringO with several delimiters after each other
  31577   freeO(self);
  31578   setTopSO(self, "one/ two  /three ");
  31579   freeO(delim1);
  31580   setTopSO(delim1, "/");
  31581   setValO(delim2, " ");
  31582   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31583   ck_assert_ptr_ne(r, null);
  31584   s = toStringO(r);
  31585   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31586   free(s);
  31587   terminateO(r);
  31588   // multiple character delimiter
  31589   freeO(self);
  31590   setTopSO(self, "AAe thre|e icExtract");
  31591   freeO(delim1);
  31592   setTopSO(delim1, "e ");
  31593   setValO(delim2, "|");
  31594   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31595   ck_assert_ptr_ne(r, null);
  31596   s = toStringO(r);
  31597   ck_assert_str_eq(s, "[\"thre\"]");
  31598   free(s);
  31599   terminateO(r);
  31600   // empty delimiter
  31601   freeO(self);
  31602   setTopSO(self, "AAd");
  31603   freeO(delim1);
  31604   setTopSO(delim1, "");
  31605   setValO(delim2, "Ad");
  31606   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31607   ck_assert_ptr_eq(r, NULL);
  31608   freeO(self);
  31609   setTopSO(self, "AAd");
  31610   freeO(delim1);
  31611   setTopSO(delim1, "A");
  31612   setValO(delim2, "");
  31613   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31614   ck_assert_ptr_eq(r, NULL);
  31615   // empty string
  31616   freeO(self);
  31617   setTopSO(self, "");
  31618   freeO(delim1);
  31619   setTopSO(delim1, "$");
  31620   setValO(delim2, "#");
  31621   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31622   ck_assert_ptr_eq(r, NULL);
  31623   // delim1 = delim2
  31624   freeO(self);
  31625   setTopSO(self, "$qwe$");
  31626   freeO(delim1);
  31627   setTopSO(delim1, "$");
  31628   setValO(delim2, "$");
  31629   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31630   ck_assert_ptr_eq(r, NULL);
  31631   // non json string
  31632   freeO(delim1);
  31633   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31634   ck_assert_ptr_eq(r, NULL);
  31635   // non json object
  31636   terminateO(delim1);
  31637   delim1 = (smallJsont*) allocSmallInt(1);
  31638   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31639   ck_assert_ptr_eq(r, NULL);
  31640   terminateO(delim1);
  31641   delim1 = allocSmallJson();
  31642   setTopSO(delim1, ";");
  31643   terminateO(delim2);
  31644   delim2 = (smallStringt*) allocSmallInt(1);
  31645   r = icExtractSmallJsonSmallStringO(self, delim1, delim2);
  31646   ck_assert_ptr_eq(r, NULL);
  31647   terminateO(delim2);
  31648   delim2 = allocSmallString(",");
  31649   // NULL string
  31650   freeO(self);
  31651   freeO(delim1);
  31652   setTopSO(delim1, ";");
  31653   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, delim2), NULL);
  31654   // NULL delimiter
  31655   freeO(self);
  31656   setTopSO(self, "test");
  31657   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, NULL, delim2), NULL);
  31658   ck_assert_ptr_eq(icExtractSmallJsonSmallStringO(self, delim1, NULL), NULL);
  31659   terminateO(delim1);
  31660   terminateO(delim2);
  31661   terminateO(self);
  31662 
  31663 }
  31664 
  31665 
  31666 void icExtractSmallJsonSSmallJsonT(CuTest *tc UNUSED) {
  31667 
  31668   smallJsont* r;
  31669   smallJsont *self = allocSmallJson();
  31670   setTopSO(self, "");
  31671   smallJsont* delim1 = allocSmallJson();
  31672 
  31673   // string
  31674   freeO(self);
  31675   setTopSO(self, "one/twos");
  31676   setTopSO(delim1, "E");
  31677   r = icExtractSmallJsonSO(self, delim1, "S");
  31678   ck_assert_ptr_ne(r, null);
  31679   char *s = toStringO(r);
  31680   ck_assert_str_eq(s, "[\"/two\"]");
  31681   free(s);
  31682   terminateO(r);
  31683   // delimiter not found
  31684   freeO(self);
  31685   setTopSO(self, "one/two");
  31686   freeO(delim1);
  31687   setTopSO(delim1, "||");
  31688   r = icExtractSmallJsonSO(self, delim1, "/");
  31689   ck_assert_ptr_eq(r, NULL);
  31690   // icExtractSmallJsonSO with several delimiters after each other
  31691   freeO(self);
  31692   setTopSO(self, "one/ two  /three ");
  31693   freeO(delim1);
  31694   setTopSO(delim1, "/");
  31695   r = icExtractSmallJsonSO(self, delim1, " ");
  31696   ck_assert_ptr_ne(r, null);
  31697   s = toStringO(r);
  31698   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31699   free(s);
  31700   terminateO(r);
  31701   // multiple character delimiter
  31702   freeO(self);
  31703   setTopSO(self, "AAe thre|e icExtract");
  31704   freeO(delim1);
  31705   setTopSO(delim1, "e ");
  31706   r = icExtractSmallJsonSO(self, delim1, "|");
  31707   ck_assert_ptr_ne(r, null);
  31708   s = toStringO(r);
  31709   ck_assert_str_eq(s, "[\"thre\"]");
  31710   free(s);
  31711   terminateO(r);
  31712   // empty delimiter
  31713   freeO(self);
  31714   setTopSO(self, "AAd");
  31715   freeO(delim1);
  31716   setTopSO(delim1, "");
  31717   r = icExtractSmallJsonSO(self, delim1, "Ad");
  31718   ck_assert_ptr_eq(r, NULL);
  31719   freeO(self);
  31720   setTopSO(self, "AAd");
  31721   freeO(delim1);
  31722   setTopSO(delim1, "A");
  31723   r = icExtractSmallJsonSO(self, delim1, "");
  31724   ck_assert_ptr_eq(r, NULL);
  31725   // empty string
  31726   freeO(self);
  31727   setTopSO(self, "");
  31728   freeO(delim1);
  31729   setTopSO(delim1, "$");
  31730   r = icExtractSmallJsonSO(self, delim1, "#");
  31731   ck_assert_ptr_eq(r, NULL);
  31732   // delim1 = delim2
  31733   freeO(self);
  31734   setTopSO(self, "$qwe$");
  31735   freeO(delim1);
  31736   setTopSO(delim1, "$");
  31737   r = icExtractSmallJsonSO(self, delim1, "$");
  31738   ck_assert_ptr_eq(r, NULL);
  31739   // non json string
  31740   freeO(delim1);
  31741   r = icExtractSmallJsonSO(self, delim1, "$");
  31742   ck_assert_ptr_eq(r, NULL);
  31743   // non json object
  31744   terminateO(delim1);
  31745   delim1 = (smallJsont*) allocSmallInt(1);
  31746   r = icExtractSmallJsonSO(self, delim1, "$");
  31747   ck_assert_ptr_eq(r, NULL);
  31748   terminateO(delim1);
  31749   delim1 = allocSmallJson();
  31750   // NULL string
  31751   freeO(self);
  31752   freeO(delim1);
  31753   setTopSO(delim1, ";");
  31754   ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, ","), NULL);
  31755   // NULL delimiter
  31756   freeO(self);
  31757   setTopSO(self, "test");
  31758   ck_assert_ptr_eq(icExtractSmallJsonSO(self, NULL, ","), NULL);
  31759   ck_assert_ptr_eq(icExtractSmallJsonSO(self, delim1, NULL), NULL);
  31760   terminateO(delim1);
  31761   terminateO(self);
  31762 
  31763 }
  31764 
  31765 
  31766 void icExtractSmallJsonCharSmallJsonT(CuTest *tc UNUSED) {
  31767 
  31768   smallJsont* r;
  31769   smallJsont *self = allocSmallJson();
  31770   setTopSO(self, "");
  31771   smallJsont* delim1 = allocSmallJson();
  31772 
  31773   // string
  31774   freeO(self);
  31775   setTopSO(self, "one/twos");
  31776   setTopSO(delim1, "E");
  31777   r = icExtractSmallJsonCharO(self, delim1, 'S');
  31778   ck_assert_ptr_ne(r, null);
  31779   char *s = toStringO(r);
  31780   ck_assert_str_eq(s, "[\"/two\"]");
  31781   free(s);
  31782   terminateO(r);
  31783   // delimiter not found
  31784   freeO(self);
  31785   setTopSO(self, "one/two");
  31786   freeO(delim1);
  31787   setTopSO(delim1, "||");
  31788   r = icExtractSmallJsonCharO(self, delim1, '/');
  31789   ck_assert_ptr_eq(r, NULL);
  31790   // icExtractSmallJsonCharO with several delimiters after each other
  31791   freeO(self);
  31792   setTopSO(self, "one/ two  /three ");
  31793   freeO(delim1);
  31794   setTopSO(delim1, "/");
  31795   r = icExtractSmallJsonCharO(self, delim1, ' ');
  31796   ck_assert_ptr_ne(r, null);
  31797   s = toStringO(r);
  31798   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31799   free(s);
  31800   terminateO(r);
  31801   // multiple character delimiter
  31802   freeO(self);
  31803   setTopSO(self, "AAe thre|e icExtract");
  31804   freeO(delim1);
  31805   setTopSO(delim1, "e ");
  31806   r = icExtractSmallJsonCharO(self, delim1, '|');
  31807   ck_assert_ptr_ne(r, null);
  31808   s = toStringO(r);
  31809   ck_assert_str_eq(s, "[\"thre\"]");
  31810   free(s);
  31811   terminateO(r);
  31812   // empty delimiter
  31813   freeO(self);
  31814   setTopSO(self, "AAd");
  31815   freeO(delim1);
  31816   setTopSO(delim1, "");
  31817   r = icExtractSmallJsonCharO(self, delim1, 'd');
  31818   ck_assert_ptr_eq(r, NULL);
  31819   freeO(self);
  31820   setTopSO(self, "AAd");
  31821   // empty string
  31822   freeO(self);
  31823   setTopSO(self, "");
  31824   freeO(delim1);
  31825   setTopSO(delim1, "$");
  31826   r = icExtractSmallJsonCharO(self, delim1, '#');
  31827   ck_assert_ptr_eq(r, NULL);
  31828   // delim1 = delim2
  31829   freeO(self);
  31830   setTopSO(self, "$qwe$");
  31831   freeO(delim1);
  31832   setTopSO(delim1, "$");
  31833   r = icExtractSmallJsonCharO(self, delim1, '$');
  31834   ck_assert_ptr_eq(r, NULL);
  31835   // non json string
  31836   freeO(delim1);
  31837   r = icExtractSmallJsonCharO(self, delim1, '$');
  31838   ck_assert_ptr_eq(r, NULL);
  31839   // non json object
  31840   terminateO(delim1);
  31841   delim1 = (smallJsont*) allocSmallInt(1);
  31842   r = icExtractSmallJsonCharO(self, delim1, '$');
  31843   ck_assert_ptr_eq(r, NULL);
  31844   terminateO(delim1);
  31845   delim1 = allocSmallJson();
  31846   // NULL string
  31847   freeO(self);
  31848   freeO(delim1);
  31849   setTopSO(delim1, ";");
  31850   ck_assert_ptr_eq(icExtractSmallJsonCharO(self, delim1, ','), NULL);
  31851   // NULL delimiter
  31852   freeO(self);
  31853   setTopSO(self, "test");
  31854   ck_assert_ptr_eq(icExtractSmallJsonCharO(self, NULL, ','), NULL);
  31855   terminateO(delim1);
  31856   terminateO(self);
  31857 
  31858 }
  31859 
  31860 
  31861 void icExtractSmallStringSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  31862 
  31863   smallJsont* r;
  31864   smallJsont *self = allocSmallJson();
  31865   setTopSO(self, "");
  31866   smallStringt* delim1 = allocSmallString("E");
  31867   smallJsont* delim2   = allocSmallJson();
  31868 
  31869   // string
  31870   freeO(self);
  31871   setTopSO(self, "one/twos");
  31872   setTopSO(delim2, "S");
  31873   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31874   ck_assert_ptr_ne(r, null);
  31875   char *s = toStringO(r);
  31876   ck_assert_str_eq(s, "[\"/two\"]");
  31877   free(s);
  31878   terminateO(r);
  31879   // delimiter not found
  31880   freeO(self);
  31881   setTopSO(self, "one/two");
  31882   freeO(delim2);
  31883   setValO(delim1, "||");
  31884   setTopSO(delim2, "/");
  31885   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31886   ck_assert_ptr_eq(r, NULL);
  31887   // icExtractSmallStringSmallJsonO with several delimiters after each other
  31888   freeO(self);
  31889   setTopSO(self, "one/ two  /three ");
  31890   freeO(delim2);
  31891   setValO(delim1, "/");
  31892   setTopSO(delim2, " ");
  31893   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31894   ck_assert_ptr_ne(r, null);
  31895   s = toStringO(r);
  31896   ck_assert_str_eq(s, "[\"\",\"three\"]");
  31897   free(s);
  31898   terminateO(r);
  31899   // multiple character delimiter
  31900   freeO(self);
  31901   setTopSO(self, "AAe thre|e icExtract");
  31902   freeO(delim2);
  31903   setValO(delim1, "e ");
  31904   setTopSO(delim2, "|");
  31905   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31906   ck_assert_ptr_ne(r, null);
  31907   s = toStringO(r);
  31908   ck_assert_str_eq(s, "[\"thre\"]");
  31909   free(s);
  31910   terminateO(r);
  31911   // empty delimiter
  31912   freeO(self);
  31913   setTopSO(self, "AAd");
  31914   freeO(delim2);
  31915   setValO(delim1, "");
  31916   setTopSO(delim2, "Ad");
  31917   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31918   ck_assert_ptr_eq(r, NULL);
  31919   freeO(self);
  31920   setTopSO(self, "AAd");
  31921   freeO(delim2);
  31922   setValO(delim1, "A");
  31923   setTopSO(delim2, "");
  31924   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31925   ck_assert_ptr_eq(r, NULL);
  31926   // empty string
  31927   freeO(self);
  31928   setTopSO(self, "");
  31929   freeO(delim2);
  31930   setValO(delim1, "$");
  31931   setTopSO(delim2, "#");
  31932   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31933   ck_assert_ptr_eq(r, NULL);
  31934   // delim1 = delim2
  31935   freeO(self);
  31936   setTopSO(self, "$qwe$");
  31937   freeO(delim2);
  31938   setValO(delim1, "$");
  31939   setTopSO(delim2, "$");
  31940   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31941   ck_assert_ptr_eq(r, NULL);
  31942   // non json string
  31943   freeO(delim2);
  31944   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31945   ck_assert_ptr_eq(r, NULL);
  31946   // non json object
  31947   terminateO(delim1);
  31948   delim1 = (smallStringt*) allocSmallInt(1);
  31949   setTopSO(delim2, "$");
  31950   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31951   ck_assert_ptr_eq(r, NULL);
  31952   terminateO(delim1);
  31953   delim1 = allocSmallString(";");
  31954   terminateO(delim2);
  31955   delim2 = (smallJsont*) allocSmallInt(1);
  31956   r = icExtractSmallStringSmallJsonO(self, delim1, delim2);
  31957   ck_assert_ptr_eq(r, NULL);
  31958   terminateO(delim2);
  31959   delim2 = allocSmallJson();
  31960   // NULL string
  31961   freeO(self);
  31962   freeO(delim2);
  31963   setValO(delim1, ";");
  31964   setTopSO(delim2, ",");
  31965   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, delim2), NULL);
  31966   // NULL delimiter
  31967   freeO(self);
  31968   setTopSO(self, "test");
  31969   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, NULL, delim2), NULL);
  31970   ck_assert_ptr_eq(icExtractSmallStringSmallJsonO(self, delim1, NULL), NULL);
  31971   terminateO(delim1);
  31972   terminateO(delim2);
  31973   terminateO(self);
  31974 
  31975 }
  31976 
  31977 
  31978 void icExtractSmallStringSmallStringSmallJsonT(CuTest *tc UNUSED) {
  31979 
  31980   smallJsont* r;
  31981   smallJsont *self = allocSmallJson();
  31982   setTopSO(self, "");
  31983   smallStringt* delim1 = allocSmallString("E");
  31984   smallStringt* delim2 = allocSmallString("|");
  31985 
  31986   // string
  31987   freeO(self);
  31988   setTopSO(self, "one/twos");
  31989   setValO(delim2, "S");
  31990   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  31991   ck_assert_ptr_ne(r, null);
  31992   char *s = toStringO(r);
  31993   ck_assert_str_eq(s, "[\"/two\"]");
  31994   free(s);
  31995   terminateO(r);
  31996   // delimiter not found
  31997   freeO(self);
  31998   setTopSO(self, "one/two");
  31999   setValO(delim1, "||");
  32000   setValO(delim2, "/");
  32001   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32002   ck_assert_ptr_eq(r, NULL);
  32003   // icExtractSmallStringSmallStringO with several delimiters after each other
  32004   freeO(self);
  32005   setTopSO(self, "one/ two  /three ");
  32006   setValO(delim1, "/");
  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, "[\"\",\"three\"]");
  32012   free(s);
  32013   terminateO(r);
  32014   // multiple character delimiter
  32015   freeO(self);
  32016   setTopSO(self, "AAe thre|e icExtract");
  32017   setValO(delim1, "e ");
  32018   setValO(delim2, "|");
  32019   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32020   ck_assert_ptr_ne(r, null);
  32021   s = toStringO(r);
  32022   ck_assert_str_eq(s, "[\"thre\"]");
  32023   free(s);
  32024   terminateO(r);
  32025   // empty delimiter
  32026   freeO(self);
  32027   setTopSO(self, "AAd");
  32028   setValO(delim1, "");
  32029   setValO(delim2, "Ad");
  32030   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32031   ck_assert_ptr_eq(r, NULL);
  32032   freeO(self);
  32033   setTopSO(self, "AAd");
  32034   setValO(delim1, "A");
  32035   setValO(delim2, "");
  32036   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32037   ck_assert_ptr_eq(r, NULL);
  32038   // empty string
  32039   freeO(self);
  32040   setTopSO(self, "");
  32041   setValO(delim1, "$");
  32042   setValO(delim2, "#");
  32043   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32044   ck_assert_ptr_eq(r, NULL);
  32045   // delim1 = delim2
  32046   freeO(self);
  32047   setTopSO(self, "$qwe$");
  32048   setValO(delim1, "$");
  32049   setValO(delim2, "$");
  32050   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32051   ck_assert_ptr_eq(r, NULL);
  32052   // non json object
  32053   terminateO(delim1);
  32054   delim1 = (smallStringt*) allocSmallInt(1);
  32055   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32056   ck_assert_ptr_eq(r, NULL);
  32057   terminateO(delim1);
  32058   delim1 = allocSmallString(";");
  32059   terminateO(delim2);
  32060   delim2 = (smallStringt*) allocSmallInt(1);
  32061   r = icExtractSmallStringSmallStringO(self, delim1, delim2);
  32062   ck_assert_ptr_eq(r, NULL);
  32063   terminateO(delim2);
  32064   delim2 = allocSmallString(",");
  32065   // NULL string
  32066   freeO(self);
  32067   setValO(delim1, ";");
  32068   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, delim2), NULL);
  32069   // NULL delimiter
  32070   freeO(self);
  32071   setTopSO(self, "test");
  32072   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, NULL, delim2), NULL);
  32073   ck_assert_ptr_eq(icExtractSmallStringSmallStringO(self, delim1, NULL), NULL);
  32074   terminateO(delim1);
  32075   terminateO(delim2);
  32076   terminateO(self);
  32077 
  32078 }
  32079 
  32080 
  32081 void icExtractSmallStringSSmallJsonT(CuTest *tc UNUSED) {
  32082 
  32083   smallJsont* r;
  32084   smallJsont *self = allocSmallJson();
  32085   setTopSO(self, "");
  32086   smallStringt* delim1 = allocSmallString("E");
  32087 
  32088   // string
  32089   freeO(self);
  32090   setTopSO(self, "one/twos");
  32091   r = icExtractSmallStringSO(self, delim1, "S");
  32092   ck_assert_ptr_ne(r, null);
  32093   char *s = toStringO(r);
  32094   ck_assert_str_eq(s, "[\"/two\"]");
  32095   free(s);
  32096   terminateO(r);
  32097   // delimiter not found
  32098   freeO(self);
  32099   setTopSO(self, "one/two");
  32100   setValO(delim1, "||");
  32101   r = icExtractSmallStringSO(self, delim1, "/");
  32102   ck_assert_ptr_eq(r, NULL);
  32103   // icExtractSmallStringSO with several delimiters after each other
  32104   freeO(self);
  32105   setTopSO(self, "one/ two  /three ");
  32106   setValO(delim1, "/");
  32107   r = icExtractSmallStringSO(self, delim1, " ");
  32108   ck_assert_ptr_ne(r, null);
  32109   s = toStringO(r);
  32110   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32111   free(s);
  32112   terminateO(r);
  32113   // multiple character delimiter
  32114   freeO(self);
  32115   setTopSO(self, "AAe thre|e icExtract");
  32116   setValO(delim1, "e ");
  32117   r = icExtractSmallStringSO(self, delim1, "|");
  32118   ck_assert_ptr_ne(r, null);
  32119   s = toStringO(r);
  32120   ck_assert_str_eq(s, "[\"thre\"]");
  32121   free(s);
  32122   terminateO(r);
  32123   // empty delimiter
  32124   freeO(self);
  32125   setTopSO(self, "AAd");
  32126   setValO(delim1, "");
  32127   r = icExtractSmallStringSO(self, delim1, "Ad");
  32128   ck_assert_ptr_eq(r, NULL);
  32129   freeO(self);
  32130   setTopSO(self, "AAd");
  32131   setValO(delim1, "A");
  32132   r = icExtractSmallStringSO(self, delim1, "");
  32133   ck_assert_ptr_eq(r, NULL);
  32134   // empty string
  32135   freeO(self);
  32136   setTopSO(self, "");
  32137   setValO(delim1, "$");
  32138   r = icExtractSmallStringSO(self, delim1, "#");
  32139   ck_assert_ptr_eq(r, NULL);
  32140   // delim1 = delim2
  32141   freeO(self);
  32142   setTopSO(self, "$qwe$");
  32143   setValO(delim1, "$");
  32144   r = icExtractSmallStringSO(self, delim1, "$");
  32145   ck_assert_ptr_eq(r, NULL);
  32146   // non json object
  32147   terminateO(delim1);
  32148   delim1 = (smallStringt*) allocSmallInt(1);
  32149   r = icExtractSmallStringSO(self, delim1, "$");
  32150   ck_assert_ptr_eq(r, NULL);
  32151   terminateO(delim1);
  32152   delim1 = allocSmallString(";");
  32153   // NULL string
  32154   freeO(self);
  32155   setValO(delim1, ";");
  32156   ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, ","), NULL);
  32157   // NULL delimiter
  32158   freeO(self);
  32159   setTopSO(self, "test");
  32160   ck_assert_ptr_eq(icExtractSmallStringSO(self, NULL, ","), NULL);
  32161   ck_assert_ptr_eq(icExtractSmallStringSO(self, delim1, NULL), NULL);
  32162   terminateO(delim1);
  32163   terminateO(self);
  32164 
  32165 }
  32166 
  32167 
  32168 void icExtractSmallStringCharSmallJsonT(CuTest *tc UNUSED) {
  32169 
  32170   smallJsont* r;
  32171   smallJsont *self = allocSmallJson();
  32172   setTopSO(self, "");
  32173   smallStringt* delim1 = allocSmallString("E");
  32174 
  32175   // string
  32176   freeO(self);
  32177   setTopSO(self, "one/twos");
  32178   r = icExtractSmallStringCharO(self, delim1, 'S');
  32179   ck_assert_ptr_ne(r, null);
  32180   char *s = toStringO(r);
  32181   ck_assert_str_eq(s, "[\"/two\"]");
  32182   free(s);
  32183   terminateO(r);
  32184   // delimiter not found
  32185   freeO(self);
  32186   setTopSO(self, "one/two");
  32187   setValO(delim1, "||");
  32188   r = icExtractSmallStringCharO(self, delim1, '/');
  32189   ck_assert_ptr_eq(r, NULL);
  32190   // icExtractSmallStringCharO with several delimiters after each other
  32191   freeO(self);
  32192   setTopSO(self, "one/ two  /three ");
  32193   setValO(delim1, "/");
  32194   r = icExtractSmallStringCharO(self, delim1, ' ');
  32195   ck_assert_ptr_ne(r, null);
  32196   s = toStringO(r);
  32197   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32198   free(s);
  32199   terminateO(r);
  32200   // multiple character delimiter
  32201   freeO(self);
  32202   setTopSO(self, "AAe thre|e icExtract");
  32203   setValO(delim1, "e ");
  32204   r = icExtractSmallStringCharO(self, delim1, '|');
  32205   ck_assert_ptr_ne(r, null);
  32206   s = toStringO(r);
  32207   ck_assert_str_eq(s, "[\"thre\"]");
  32208   free(s);
  32209   terminateO(r);
  32210   // empty delimiter
  32211   freeO(self);
  32212   setTopSO(self, "AAd");
  32213   setValO(delim1, "");
  32214   r = icExtractSmallStringCharO(self, delim1, 'A');
  32215   ck_assert_ptr_eq(r, NULL);
  32216   freeO(self);
  32217   setTopSO(self, "AAd");
  32218   setValO(delim1, "A");
  32219   // empty string
  32220   freeO(self);
  32221   setTopSO(self, "");
  32222   setValO(delim1, "$");
  32223   r = icExtractSmallStringCharO(self, delim1, '#');
  32224   ck_assert_ptr_eq(r, NULL);
  32225   // delim1 = delim2
  32226   freeO(self);
  32227   setTopSO(self, "$qwe$");
  32228   setValO(delim1, "$");
  32229   r = icExtractSmallStringCharO(self, delim1, '$');
  32230   ck_assert_ptr_eq(r, NULL);
  32231   // non json object
  32232   terminateO(delim1);
  32233   delim1 = (smallStringt*) allocSmallInt(1);
  32234   r = icExtractSmallStringCharO(self, delim1, '$');
  32235   ck_assert_ptr_eq(r, NULL);
  32236   terminateO(delim1);
  32237   delim1 = allocSmallString(";");
  32238   // NULL string
  32239   freeO(self);
  32240   setValO(delim1, ";");
  32241   ck_assert_ptr_eq(icExtractSmallStringCharO(self, delim1, ','), NULL);
  32242   // NULL delimiter
  32243   freeO(self);
  32244   setTopSO(self, "test");
  32245   ck_assert_ptr_eq(icExtractSmallStringCharO(self, NULL, ','), NULL);
  32246   terminateO(delim1);
  32247   terminateO(self);
  32248 
  32249 }
  32250 
  32251 
  32252 void icExtractSSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  32253 
  32254   smallJsont* r;
  32255   smallJsont *self = allocSmallJson();
  32256   setTopSO(self, "");
  32257   smallJsont* delim2 = allocSmallJson();
  32258 
  32259   // string
  32260   freeO(self);
  32261   setTopSO(self, "one/twos");
  32262   setTopSO(delim2, "S");
  32263   r = icExtractSSmallJsonO(self, "E", delim2);
  32264   ck_assert_ptr_ne(r, null);
  32265   char *s = toStringO(r);
  32266   ck_assert_str_eq(s, "[\"/two\"]");
  32267   free(s);
  32268   terminateO(r);
  32269   // delimiter not found
  32270   freeO(self);
  32271   setTopSO(self, "one/two");
  32272   freeO(delim2);
  32273   setTopSO(delim2, "/");
  32274   r = icExtractSSmallJsonO(self, "||", delim2);
  32275   ck_assert_ptr_eq(r, NULL);
  32276   // icExtractSSmallJsonO with several delimiters after each other
  32277   freeO(self);
  32278   setTopSO(self, "one/ two  /three ");
  32279   freeO(delim2);
  32280   setTopSO(delim2, " ");
  32281   r = icExtractSSmallJsonO(self, "/", delim2);
  32282   ck_assert_ptr_ne(r, null);
  32283   s = toStringO(r);
  32284   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32285   free(s);
  32286   terminateO(r);
  32287   // multiple character delimiter
  32288   freeO(self);
  32289   setTopSO(self, "AAe thre|e icExtract");
  32290   freeO(delim2);
  32291   setTopSO(delim2, "|");
  32292   r = icExtractSSmallJsonO(self, "e ", delim2);
  32293   ck_assert_ptr_ne(r, null);
  32294   s = toStringO(r);
  32295   ck_assert_str_eq(s, "[\"thre\"]");
  32296   free(s);
  32297   terminateO(r);
  32298   // empty delimiter
  32299   freeO(self);
  32300   setTopSO(self, "AAd");
  32301   freeO(delim2);
  32302   setTopSO(delim2, "Ad");
  32303   r = icExtractSSmallJsonO(self, "", delim2);
  32304   ck_assert_ptr_eq(r, NULL);
  32305   freeO(self);
  32306   setTopSO(self, "AAd");
  32307   freeO(delim2);
  32308   setTopSO(delim2, "");
  32309   r = icExtractSSmallJsonO(self, "A", delim2);
  32310   ck_assert_ptr_eq(r, NULL);
  32311   // empty string
  32312   freeO(self);
  32313   setTopSO(self, "");
  32314   freeO(delim2);
  32315   setTopSO(delim2, "#");
  32316   r = icExtractSSmallJsonO(self, "$", delim2);
  32317   ck_assert_ptr_eq(r, NULL);
  32318   // delim1 = delim2
  32319   freeO(self);
  32320   setTopSO(self, "$qwe$");
  32321   freeO(delim2);
  32322   setTopSO(delim2, "$");
  32323   r = icExtractSSmallJsonO(self, "$", delim2);
  32324   ck_assert_ptr_eq(r, NULL);
  32325   // non json string
  32326   freeO(delim2);
  32327   r = icExtractSSmallJsonO(self, "$", delim2);
  32328   ck_assert_ptr_eq(r, NULL);
  32329   // non json object
  32330   terminateO(delim2);
  32331   delim2 = (smallJsont*) allocSmallInt(1);
  32332   r = icExtractSSmallJsonO(self, ";", delim2);
  32333   ck_assert_ptr_eq(r, NULL);
  32334   terminateO(delim2);
  32335   delim2 = allocSmallJson();
  32336   // NULL string
  32337   freeO(self);
  32338   freeO(delim2);
  32339   setTopSO(delim2, ",");
  32340   ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", delim2), NULL);
  32341   // NULL delimiter
  32342   freeO(self);
  32343   setTopSO(self, "test");
  32344   ck_assert_ptr_eq(icExtractSSmallJsonO(self, NULL, delim2), NULL);
  32345   ck_assert_ptr_eq(icExtractSSmallJsonO(self, ";", NULL), NULL);
  32346   terminateO(delim2);
  32347   terminateO(self);
  32348 
  32349 }
  32350 
  32351 
  32352 void icExtractSSmallStringSmallJsonT(CuTest *tc UNUSED) {
  32353 
  32354   smallJsont* r;
  32355   smallJsont *self = allocSmallJson();
  32356   setTopSO(self, "");
  32357   smallStringt* delim2 = allocSmallString("|");
  32358 
  32359   // string
  32360   freeO(self);
  32361   setTopSO(self, "one/twos");
  32362   setValO(delim2, "S");
  32363   r = icExtractSSmallStringO(self, "E", delim2);
  32364   ck_assert_ptr_ne(r, null);
  32365   char *s = toStringO(r);
  32366   ck_assert_str_eq(s, "[\"/two\"]");
  32367   free(s);
  32368   terminateO(r);
  32369   // delimiter not found
  32370   freeO(self);
  32371   setTopSO(self, "one/two");
  32372   setValO(delim2, "/");
  32373   r = icExtractSSmallStringO(self, "||", delim2);
  32374   ck_assert_ptr_eq(r, NULL);
  32375   // icExtractSSmallStringO with several delimiters after each other
  32376   freeO(self);
  32377   setTopSO(self, "one/ two  /three ");
  32378   setValO(delim2, " ");
  32379   r = icExtractSSmallStringO(self, "/", delim2);
  32380   ck_assert_ptr_ne(r, null);
  32381   s = toStringO(r);
  32382   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32383   free(s);
  32384   terminateO(r);
  32385   // multiple character delimiter
  32386   freeO(self);
  32387   setTopSO(self, "AAe thre|e icExtract");
  32388   setValO(delim2, "|");
  32389   r = icExtractSSmallStringO(self, "e ", delim2);
  32390   ck_assert_ptr_ne(r, null);
  32391   s = toStringO(r);
  32392   ck_assert_str_eq(s, "[\"thre\"]");
  32393   free(s);
  32394   terminateO(r);
  32395   // empty delimiter
  32396   freeO(self);
  32397   setTopSO(self, "AAd");
  32398   setValO(delim2, "Ad");
  32399   r = icExtractSSmallStringO(self, "", delim2);
  32400   ck_assert_ptr_eq(r, NULL);
  32401   freeO(self);
  32402   setTopSO(self, "AAd");
  32403   setValO(delim2, "");
  32404   r = icExtractSSmallStringO(self, "A", delim2);
  32405   ck_assert_ptr_eq(r, NULL);
  32406   // empty string
  32407   freeO(self);
  32408   setTopSO(self, "");
  32409   setValO(delim2, "#");
  32410   r = icExtractSSmallStringO(self, "$", delim2);
  32411   ck_assert_ptr_eq(r, NULL);
  32412   // delim1 = delim2
  32413   freeO(self);
  32414   setTopSO(self, "$qwe$");
  32415   setValO(delim2, "$");
  32416   r = icExtractSSmallStringO(self, "$", delim2);
  32417   ck_assert_ptr_eq(r, NULL);
  32418   // non json object
  32419   terminateO(delim2);
  32420   delim2 = (smallStringt*) allocSmallInt(1);
  32421   r = icExtractSSmallStringO(self, ";", delim2);
  32422   ck_assert_ptr_eq(r, NULL);
  32423   terminateO(delim2);
  32424   delim2 = allocSmallString(",");
  32425   // NULL string
  32426   freeO(self);
  32427   ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", delim2), NULL);
  32428   // NULL delimiter
  32429   freeO(self);
  32430   setTopSO(self, "test");
  32431   ck_assert_ptr_eq(icExtractSSmallStringO(self, NULL, delim2), NULL);
  32432   ck_assert_ptr_eq(icExtractSSmallStringO(self, ";", NULL), NULL);
  32433   terminateO(delim2);
  32434   terminateO(self);
  32435 
  32436 }
  32437 
  32438 
  32439 void icExtractCharSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  32440 
  32441   smallJsont* r;
  32442   smallJsont *self = allocSmallJson();
  32443   setTopSO(self, "");
  32444   smallJsont* delim2 = allocSmallJson();
  32445 
  32446   // string
  32447   freeO(self);
  32448   setTopSO(self, "one/twos");
  32449   setTopSO(delim2, "S");
  32450   r = icExtractCharSmallJsonO(self, 'E', delim2);
  32451   ck_assert_ptr_ne(r, null);
  32452   char *s = toStringO(r);
  32453   ck_assert_str_eq(s, "[\"/two\"]");
  32454   free(s);
  32455   terminateO(r);
  32456   // delimiter not found
  32457   freeO(self);
  32458   setTopSO(self, "one/two");
  32459   freeO(delim2);
  32460   setTopSO(delim2, "/");
  32461   r = icExtractCharSmallJsonO(self, '|', delim2);
  32462   ck_assert_ptr_eq(r, NULL);
  32463   // icExtractCharSmallJsonO with several delimiters after each other
  32464   freeO(self);
  32465   setTopSO(self, "one/ two  /three ");
  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, "[\"\",\"three\"]");
  32472   free(s);
  32473   terminateO(r);
  32474   // multiple character delimiter
  32475   freeO(self);
  32476   setTopSO(self, "AAe thre|e icExtract");
  32477   freeO(delim2);
  32478   setTopSO(delim2, "|");
  32479   r = icExtractCharSmallJsonO(self, ' ', delim2);
  32480   ck_assert_ptr_ne(r, null);
  32481   s = toStringO(r);
  32482   ck_assert_str_eq(s, "[\"thre\"]");
  32483   free(s);
  32484   terminateO(r);
  32485   // empty delimiter
  32486   freeO(self);
  32487   setTopSO(self, "AAd");
  32488   freeO(delim2);
  32489   setTopSO(delim2, "");
  32490   r = icExtractCharSmallJsonO(self, 'A', delim2);
  32491   ck_assert_ptr_eq(r, NULL);
  32492   // empty string
  32493   freeO(self);
  32494   setTopSO(self, "");
  32495   freeO(delim2);
  32496   setTopSO(delim2, "#");
  32497   r = icExtractCharSmallJsonO(self, '$', delim2);
  32498   ck_assert_ptr_eq(r, NULL);
  32499   // delim1 = delim2
  32500   freeO(self);
  32501   setTopSO(self, "$qwe$");
  32502   freeO(delim2);
  32503   setTopSO(delim2, "$");
  32504   r = icExtractCharSmallJsonO(self, '$', delim2);
  32505   ck_assert_ptr_eq(r, NULL);
  32506   // non json string
  32507   freeO(delim2);
  32508   r = icExtractCharSmallJsonO(self, '$', delim2);
  32509   ck_assert_ptr_eq(r, NULL);
  32510   // non json object
  32511   terminateO(delim2);
  32512   delim2 = (smallJsont*) allocSmallInt(1);
  32513   r = icExtractCharSmallJsonO(self, ';', delim2);
  32514   ck_assert_ptr_eq(r, NULL);
  32515   terminateO(delim2);
  32516   delim2 = allocSmallJson();
  32517   // NULL string
  32518   freeO(self);
  32519   freeO(delim2);
  32520   setTopSO(delim2, ",");
  32521   ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', delim2), NULL);
  32522   // NULL delimiter
  32523   freeO(self);
  32524   setTopSO(self, "test");
  32525   ck_assert_ptr_eq(icExtractCharSmallJsonO(self, ';', NULL), NULL);
  32526   terminateO(delim2);
  32527   terminateO(self);
  32528 
  32529 }
  32530 
  32531 
  32532 void icExtractCharSmallStringSmallJsonT(CuTest *tc UNUSED) {
  32533 
  32534   smallJsont* r;
  32535   smallJsont *self = allocSmallJson();
  32536   setTopSO(self, "");
  32537   smallStringt* delim2 = allocSmallString("|");
  32538 
  32539   // string
  32540   freeO(self);
  32541   setTopSO(self, "one/twos");
  32542   setValO(delim2, "S");
  32543   r = icExtractCharSmallStringO(self, 'E', delim2);
  32544   ck_assert_ptr_ne(r, null);
  32545   char *s = toStringO(r);
  32546   ck_assert_str_eq(s, "[\"/two\"]");
  32547   free(s);
  32548   terminateO(r);
  32549   // delimiter not found
  32550   freeO(self);
  32551   setTopSO(self, "one/two");
  32552   setValO(delim2, "/");
  32553   r = icExtractCharSmallStringO(self, '|', delim2);
  32554   ck_assert_ptr_eq(r, NULL);
  32555   // icExtractCharSmallStringO with several delimiters after each other
  32556   freeO(self);
  32557   setTopSO(self, "one/ two  /three ");
  32558   setValO(delim2, " ");
  32559   r = icExtractCharSmallStringO(self, '/', delim2);
  32560   ck_assert_ptr_ne(r, null);
  32561   s = toStringO(r);
  32562   ck_assert_str_eq(s, "[\"\",\"three\"]");
  32563   free(s);
  32564   terminateO(r);
  32565   // multiple character delimiter
  32566   freeO(self);
  32567   setTopSO(self, "AAe thre|e icExtract");
  32568   setValO(delim2, "|e");
  32569   r = icExtractCharSmallStringO(self, ' ', delim2);
  32570   ck_assert_ptr_ne(r, null);
  32571   s = toStringO(r);
  32572   ck_assert_str_eq(s, "[\"thre\"]");
  32573   free(s);
  32574   terminateO(r);
  32575   // empty delimiter
  32576   freeO(self);
  32577   setTopSO(self, "AAd");
  32578   setValO(delim2, "");
  32579   r = icExtractCharSmallStringO(self, 'A', delim2);
  32580   ck_assert_ptr_eq(r, NULL);
  32581   // empty string
  32582   freeO(self);
  32583   setTopSO(self, "");
  32584   setValO(delim2, "#");
  32585   r = icExtractCharSmallStringO(self, '$', delim2);
  32586   ck_assert_ptr_eq(r, NULL);
  32587   // delim1 = delim2
  32588   freeO(self);
  32589   setTopSO(self, "$qwe$");
  32590   setValO(delim2, "$");
  32591   r = icExtractCharSmallStringO(self, '$', delim2);
  32592   ck_assert_ptr_eq(r, NULL);
  32593   // non json object
  32594   terminateO(delim2);
  32595   delim2 = (smallStringt*) allocSmallInt(1);
  32596   r = icExtractCharSmallStringO(self, ';', delim2);
  32597   ck_assert_ptr_eq(r, NULL);
  32598   terminateO(delim2);
  32599   delim2 = allocSmallString(",");
  32600   // NULL string
  32601   freeO(self);
  32602   ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', delim2), NULL);
  32603   // NULL delimiter
  32604   freeO(self);
  32605   setTopSO(self, "test");
  32606   ck_assert_ptr_eq(icExtractCharSmallStringO(self, ';', NULL), NULL);
  32607   terminateO(delim2);
  32608   terminateO(self);
  32609 
  32610 }
  32611 
  32612 
  32613 void colorSmallJsonT(CuTest *tc UNUSED) {
  32614 
  32615   smallJsont* r;
  32616   smallJsont *self = allocSmallJson();
  32617   setTopSO(self, "qwe");
  32618 
  32619   r = colorO(self, RED);
  32620   ck_assert_ptr_ne(r, null);
  32621   char *s = toStringO(r);
  32622   ck_assert_str_eq(s, RED"qwe"RST);
  32623   free(s);
  32624   // null color
  32625   r = colorO(self, null);
  32626   ck_assert_ptr_eq(r, NULL);
  32627   // empty self
  32628   freeO(self);
  32629   r = colorO(self, RED);
  32630   ck_assert_ptr_eq(r, NULL);
  32631   terminateO(self);
  32632 
  32633 }
  32634 
  32635 
  32636 void colordSmallJsonT(CuTest *tc UNUSED) {
  32637 
  32638   char* r;
  32639   smallJsont *self = allocSmallJson();
  32640   setTopSO(self, "qwe");
  32641 
  32642   r = colordO(self, RED);
  32643   ck_assert_ptr_ne(r, null);
  32644   ck_assert_str_eq(r, RED"qwe"RST);
  32645   free(r);
  32646   // empty string
  32647   emptyO(self);
  32648   r = colordO(self, RED);
  32649   ck_assert_ptr_ne(r, null);
  32650   ck_assert_str_eq(r, "");
  32651   free(r);
  32652   // null color
  32653   r = colordO(self, null);
  32654   ck_assert_ptr_eq(r, NULL);
  32655   // empty self
  32656   freeO(self);
  32657   r = colordO(self, RED);
  32658   ck_assert_ptr_eq(r, NULL);
  32659   terminateO(self);
  32660 
  32661 }
  32662 
  32663 
  32664 void zipSmallJsonT(CuTest *tc UNUSED) {
  32665 
  32666   smallJsont* r;
  32667   smallJsont *self   = allocSmallJson();
  32668   smallArrayt *array1 = allocSmallArray();
  32669   smallArrayt *array2 = allocSmallArray();
  32670 
  32671   // non json array or dict
  32672   setTypeBoolO(self);
  32673   r = zipO(self, array1, array2);
  32674   ck_assert_ptr_eq(r, NULL);
  32675   // json array
  32676   // zip arrays
  32677   //   empty self
  32678   freeO(self);
  32679   array1->f->pushS(array1, "a");
  32680   array2->f->pushInt(array2, 1);
  32681   r = zipO(self, array1, array2);
  32682   ck_assert_ptr_ne(r, NULL);
  32683   char *s = toStringO(r);
  32684   ck_assert_str_eq(s, "[[\"a\",1]]");
  32685   free(s);
  32686   disposeO(array1);
  32687   disposeO(array2);
  32688   freeO(self);
  32689   // add an element to self
  32690   // array1 has 2 elements
  32691   // array2 has 3 elements
  32692   // only 2 elements are zipped
  32693   self->f->pushS(self, "qwe");
  32694   array1->f->pushS(array1, "a");
  32695   array1->f->pushS(array1, "b");
  32696   array2->f->pushInt(array2, 1);
  32697   array2->f->pushInt(array2, 2);
  32698   array2->f->pushInt(array2, 3);
  32699   r = zipO(self, array1, array2);
  32700   ck_assert_ptr_ne(r, NULL);
  32701   s = toStringO(r);
  32702   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32703   free(s);
  32704   //    delete the element not in self
  32705   delElemO(array2, 2);
  32706   // empty arrays
  32707   disposeO(array2);
  32708   r = zipO(self, array1, array2);
  32709   ck_assert_ptr_ne(r, NULL);
  32710   s = toStringO(r);
  32711   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32712   free(s);
  32713   disposeO(array1);
  32714   r = zipO(self, array1, array2);
  32715   ck_assert_ptr_ne(r, NULL);
  32716   s = toStringO(r);
  32717   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32718   free(s);
  32719   // array1 and array2 same element count
  32720   array1->f->pushS(array1, "aa");
  32721   array1->f->pushS(array1, "bb");
  32722   array2->f->pushInt(array2, 11);
  32723   array2->f->pushInt(array2, 22);
  32724   delElemO(array1, 1);
  32725   r = zipO(self, array1, array2);
  32726   delElemO(array2, 1);
  32727   ck_assert_ptr_ne(r, NULL);
  32728   //  some elements were zipped
  32729   s = toStringO(self);
  32730   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32731   free(s);
  32732   // but an element is NULL
  32733   // non smallArray objects
  32734   smashO(array1);
  32735   array1 = (smallArrayt*) allocSmallInt(2);
  32736   r = zipO(self, array1, array2);
  32737   ck_assert_ptr_eq(r, NULL);
  32738   terminateO(array1);
  32739   array1 = allocSmallArray();
  32740   smashO(array2);
  32741   array2 = (smallArrayt*) allocSmallInt(2);
  32742   r = zipO(self, array1, array2);
  32743   ck_assert_ptr_eq(r, NULL);
  32744   terminateO(array2);
  32745   array2 = allocSmallArray();
  32746   // NULL arrays
  32747   r = zipO(self, NULL, array2);
  32748   ck_assert_ptr_eq(r, NULL);
  32749   r = zipO(self, array1, NULL);
  32750   ck_assert_ptr_eq(r, NULL);
  32751   terminateO(self);
  32752   smashO(array1);
  32753   smashO(array2);
  32754   // json dict
  32755   self = allocSmallJson();
  32756   setTypeDictO(self);
  32757   smallArrayt *keys   = allocSmallArray();
  32758   smallArrayt *values = allocSmallArray();
  32759   self->f->setInt(self, "", 1);
  32760   // 3 elements in keys
  32761   // 2 elements in values
  32762   // only 2 key/values are zipped
  32763   keys->f->pushS(keys, "a");
  32764   keys->f->pushS(keys, "b");
  32765   keys->f->pushS(keys, "c");
  32766   values->f->pushInt(values, 1);
  32767   values->f->pushInt(values, 2);
  32768   r = zipO(self, keys, values);
  32769   terminateO(keys);
  32770   smashO(values);
  32771   ck_assert_ptr_ne(r, NULL);
  32772   s = toStringO(r);
  32773   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  32774   free(s);
  32775   // keys array with non string objects
  32776   keys   = allocSmallArray();
  32777   values = allocSmallArray();
  32778   keys->f->pushInt(keys, 1);
  32779   values->f->pushInt(values, 1);
  32780   r = zipO(self, keys, values);
  32781   ck_assert_ptr_eq(r, NULL);
  32782   terminateO(keys);
  32783   terminateO(values);
  32784   // empty values
  32785   keys   = allocSmallArray();
  32786   values = allocSmallArray();
  32787   keys->f->pushInt(keys, 1);
  32788   r = zipO(self, keys, values);
  32789   ck_assert_ptr_eq(r, self);
  32790   terminateO(keys);
  32791   terminateO(values);
  32792   terminateO(self);
  32793 
  32794 }
  32795 
  32796 
  32797 void zipArraySmallJsonT(CuTest *tc UNUSED) {
  32798 
  32799   smallJsont* r;
  32800   smallJsont *self = allocSmallJson();
  32801   char** array1;
  32802   smallArrayt *array2 = allocSmallArray();
  32803 
  32804   // non json array or dict
  32805   setTypeBoolO(self);
  32806   array1 = listCreateS("a");
  32807   r = zipArrayO(self, array1, array2);
  32808   ck_assert_ptr_eq(r, NULL);
  32809   // json array
  32810   // zip arrays
  32811   //   empty self
  32812   freeO(self);
  32813   array2->f->pushInt(array2, 1);
  32814   r       = zipArrayO(self, array1, array2);
  32815   ck_assert_ptr_ne(r, NULL);
  32816   char *s = toStringO(r);
  32817   ck_assert_str_eq(s, "[[\"a\",1]]");
  32818   free(s);
  32819   freen(array1);
  32820   disposeO(array2);
  32821   freeO(self);
  32822   // add an element to self
  32823   // array1 has 2 elements
  32824   // array2 has 3 elements
  32825   // only 2 elements are zipped
  32826   self->f->pushS(self, "qwe");
  32827   array1  = listCreateS("a", "b");
  32828   array2->f->pushInt(array2, 1);
  32829   array2->f->pushInt(array2, 2);
  32830   array2->f->pushInt(array2, 3);
  32831   r = zipArrayO(self, array1, array2);
  32832   ck_assert_ptr_ne(r, NULL);
  32833   s = toStringO(r);
  32834   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32835   free(s);
  32836   //    delete the element not in self
  32837   delElemO(array2, 2);
  32838   // empty arrays
  32839   disposeO(array2);
  32840   r = zipArrayO(self, array1, array2);
  32841   ck_assert_ptr_ne(r, NULL);
  32842   s = toStringO(r);
  32843   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32844   free(s);
  32845   iListRemoveS(&array1, 0, 2);
  32846   r = zipArrayO(self, array1, array2);
  32847   free(array1);
  32848   ck_assert_ptr_ne(r, NULL);
  32849   s = toStringO(r);
  32850   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32851   free(s);
  32852   // array1 and array2 same element count
  32853   array1 = listCreateS("aa", "bb");
  32854   array2->f->pushInt(array2, 11);
  32855   array2->f->pushInt(array2, 22);
  32856   iListDelElemS(&array1, 1);
  32857   r = zipArrayO(self, array1, array2);
  32858   delElemO(array2, 1);
  32859   ck_assert_ptr_ne(r, NULL);
  32860   //  some elements were zipped
  32861   s = toStringO(self);
  32862   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32863   free(s);
  32864   // but an element is NULL
  32865   // non smallArray objects
  32866   smashO(array2);
  32867   array2 = (smallArrayt*) allocSmallInt(2);
  32868   r = zipArrayO(self, array1, array2);
  32869   ck_assert_ptr_eq(r, NULL);
  32870   terminateO(array2);
  32871   array2 = allocSmallArray();
  32872   // NULL arrays
  32873   r = zipArrayO(self, NULL, array2);
  32874   ck_assert_ptr_eq(r, NULL);
  32875   r = zipArrayO(self, array1, NULL);
  32876   ck_assert_ptr_eq(r, NULL);
  32877   terminateO(self);
  32878   free(array1);
  32879   smashO(array2);
  32880   // json dict
  32881   self = allocSmallJson();
  32882   char** keys;
  32883   smallArrayt *values = allocSmallArray();
  32884   self->f->setInt(self, "", 1);
  32885   // 3 elements in keys
  32886   // 2 elements in values
  32887   // only 2 key/values are zipped
  32888   keys = listCreateS("a", "b", "c");
  32889   values->f->pushInt(values, 1);
  32890   values->f->pushInt(values, 2);
  32891   r = zipArrayO(self, keys, values);
  32892   listFreeS(keys);
  32893   smashO(values);
  32894   ck_assert_ptr_ne(r, NULL);
  32895   s = toStringO(r);
  32896   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  32897   free(s);
  32898   // empty values
  32899   keys   = listCreateS("a");
  32900   values = allocSmallArray();
  32901   r = zipArrayO(self, keys, values);
  32902   ck_assert_ptr_eq(r, self);
  32903   listFreeS(keys);
  32904   terminateO(values);
  32905   terminateO(self);
  32906 
  32907 }
  32908 
  32909 
  32910 void zipCArraySmallJsonT(CuTest *tc UNUSED) {
  32911 
  32912   smallJsont* r;
  32913   smallJsont *self    = allocSmallJson();
  32914   const char* array1[] = {"a", "b", null};
  32915   smallArrayt *array2  = allocSmallArray();
  32916 
  32917   // non json array or dict
  32918   setTypeBoolO(self);
  32919   r = zipCArrayO(self, array1, array2);
  32920   ck_assert_ptr_eq(r, NULL);
  32921   // json array
  32922   // zip arrays
  32923   //   empty self
  32924   freeO(self);
  32925   array2->f->pushInt(array2, 1);
  32926   r       = zipCArrayO(self, array1, array2);
  32927   ck_assert_ptr_ne(r, NULL);
  32928   char *s = toStringO(r);
  32929   ck_assert_str_eq(s, "[[\"a\",1]]");
  32930   free(s);
  32931   disposeO(array2);
  32932   freeO(self);
  32933   // add an element to self
  32934   // array1 has 2 elements
  32935   // array2 has 3 elements
  32936   // only 2 elements are zipped
  32937   self->f->pushS(self, "qwe");
  32938   array2->f->pushInt(array2, 1);
  32939   array2->f->pushInt(array2, 2);
  32940   array2->f->pushInt(array2, 3);
  32941   r = zipCArrayO(self, array1, array2);
  32942   ck_assert_ptr_ne(r, NULL);
  32943   s = toStringO(r);
  32944   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32945   free(s);
  32946   //    delete the element not in self
  32947   delElemO(array2, 2);
  32948   // empty arrays
  32949   disposeO(array2);
  32950   r = zipCArrayO(self, array1, array2);
  32951   ck_assert_ptr_ne(r, NULL);
  32952   s = toStringO(r);
  32953   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32954   free(s);
  32955   array1[0] = null;
  32956   r = zipCArrayO(self, array1, array2);
  32957   ck_assert_ptr_ne(r, NULL);
  32958   s = toStringO(r);
  32959   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  32960   free(s);
  32961   // array1 and array2 same element count
  32962   array1[0] = "aa";
  32963   array1[1] = null;
  32964   array2->f->pushInt(array2, 11);
  32965   array2->f->pushInt(array2, 22);
  32966   r = zipCArrayO(self, array1, array2);
  32967   delElemO(array2, 1);
  32968   ck_assert_ptr_ne(r, NULL);
  32969   //  some elements were zipped
  32970   s = toStringO(self);
  32971   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  32972   free(s);
  32973   // but an element is NULL
  32974   // non smallArray objects
  32975   smashO(array2);
  32976   array2 = (smallArrayt*) allocSmallInt(2);
  32977   r = zipCArrayO(self, array1, array2);
  32978   ck_assert_ptr_eq(r, NULL);
  32979   terminateO(array2);
  32980   array2 = allocSmallArray();
  32981   // NULL arrays
  32982   r = zipCArrayO(self, NULL, array2);
  32983   ck_assert_ptr_eq(r, NULL);
  32984   r = zipCArrayO(self, array1, NULL);
  32985   ck_assert_ptr_eq(r, NULL);
  32986   terminateO(self);
  32987   smashO(array2);
  32988   // json dict
  32989   self = allocSmallJson();
  32990   const char* keys[] = {"a", "b", "c", null};
  32991   smallArrayt *values = allocSmallArray();
  32992   self->f->setInt(self, "", 1);
  32993   // 3 elements in keys
  32994   // 2 elements in values
  32995   // only 2 key/values are zipped
  32996   values->f->pushInt(values, 1);
  32997   values->f->pushInt(values, 2);
  32998   r = zipCArrayO(self, keys, values);
  32999   smashO(values);
  33000   ck_assert_ptr_ne(r, NULL);
  33001   s = toStringO(r);
  33002   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  33003   free(s);
  33004   // empty values
  33005   values = allocSmallArray();
  33006   r = zipCArrayO(self, keys, values);
  33007   ck_assert_ptr_eq(r, self);
  33008   terminateO(values);
  33009   terminateO(self);
  33010 
  33011 }
  33012 
  33013 
  33014 void zipCharSmallJsonT(CuTest *tc UNUSED) {
  33015 
  33016   smallJsont* r;
  33017   smallJsont *self   = allocSmallJson();
  33018   smallArrayt *array1 = allocSmallArray();
  33019   char** array2;
  33020 
  33021   // non json array or dict
  33022   setTypeBoolO(self);
  33023   array2 = listCreateS("1");
  33024   r = zipCharO(self, array1, array2);
  33025   ck_assert_ptr_eq(r, NULL);
  33026   // json array
  33027   // zip arrays
  33028   //   empty self
  33029   freeO(self);
  33030   array1->f->pushS(array1, "a");
  33031   r       = zipCharO(self, array1, array2);
  33032   ck_assert_ptr_ne(r, NULL);
  33033   char *s = toStringO(r);
  33034   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33035   free(s);
  33036   disposeO(array1);
  33037   freen(array2);
  33038   freeO(self);
  33039   // add an element to self
  33040   // array1 has 2 elements
  33041   // array2 has 3 elements
  33042   // only 2 elements are zipped
  33043   self->f->pushS(self, "qwe");
  33044   array1->f->pushS(array1, "a");
  33045   array1->f->pushS(array1, "b");
  33046   array2  = listCreateS("1", "2", "3");
  33047   r = zipCharO(self, array1, array2);
  33048   ck_assert_ptr_ne(r, NULL);
  33049   s = toStringO(r);
  33050   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33051   free(s);
  33052   //    delete the element not in self
  33053   iListDelElemS(&array2, 2);
  33054   // empty arrays
  33055   iListRemoveS(&array2, 0, 2);
  33056   r = zipCharO(self, array1, array2);
  33057   ck_assert_ptr_ne(r, NULL);
  33058   s = toStringO(r);
  33059   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33060   free(s);
  33061   disposeO(array1);
  33062   r = zipCharO(self, array1, array2);
  33063   ck_assert_ptr_ne(r, NULL);
  33064   s = toStringO(r);
  33065   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33066   free(s);
  33067   free(array2);
  33068   // array1 and array2 same element count
  33069   array1->f->pushS(array1, "aa");
  33070   array1->f->pushS(array1, "bb");
  33071   array2  = listCreateS("11", "22");
  33072   delElemO(array1, 1);
  33073   r = zipCharO(self, array1, array2);
  33074   iListDelElemS(&array2, 1);
  33075   ck_assert_ptr_ne(r, NULL);
  33076   //  some elements were zipped
  33077   s = toStringO(self);
  33078   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33079   free(s);
  33080   // but an element is NULL
  33081   // non smallJson objects
  33082   smashO(array1);
  33083   array1 = (smallArrayt*) allocSmallInt(2);
  33084   r = zipCharO(self, array1, array2);
  33085   ck_assert_ptr_eq(r, NULL);
  33086   terminateO(array1);
  33087   array1 = allocSmallArray();
  33088   // NULL arrays
  33089   r = zipCharO(self, NULL, array2);
  33090   ck_assert_ptr_eq(r, NULL);
  33091   r = zipCharO(self, array1, NULL);
  33092   ck_assert_ptr_eq(r, NULL);
  33093   terminateO(self);
  33094   smashO(array1);
  33095   free(array2);
  33096   // json dict
  33097   self = allocSmallJson();
  33098   smallArrayt *keys = allocSmallArray();
  33099   char** values;
  33100   self->f->setInt(self, "", 1);
  33101   // 3 elements in keys
  33102   // 2 elements in values
  33103   // only 2 key/values are zipped
  33104   keys->f->pushS(keys, "a");
  33105   keys->f->pushS(keys, "b");
  33106   keys->f->pushS(keys, "c");
  33107   values = listCreateS("1", "2");
  33108   r = zipCharO(self, keys, values);
  33109   terminateO(keys);
  33110   listFreeS(values);
  33111   ck_assert_ptr_ne(r, NULL);
  33112   s = toStringO(r);
  33113   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33114   free(s);
  33115   // keys array with non string objects
  33116   keys   = allocSmallArray();
  33117   keys->f->pushInt(keys, 1);
  33118   values = listCreateS("1");
  33119   r = zipCharO(self, keys, values);
  33120   ck_assert_ptr_eq(r, NULL);
  33121   terminateO(keys);
  33122   listFreeS(values);
  33123   // empty values
  33124   keys   = allocSmallArray();
  33125   keys->f->pushInt(keys, 1);
  33126   listEmptyS(values);
  33127   r = zipCharO(self, keys, values);
  33128   ck_assert_ptr_eq(r, self);
  33129   terminateO(keys);
  33130   listFreeS(values);
  33131   terminateO(self);
  33132 
  33133 }
  33134 
  33135 
  33136 void zipCCharSmallJsonT(CuTest *tc UNUSED) {
  33137 
  33138   smallJsont* r;
  33139   smallJsont *self     = allocSmallJson();
  33140   smallArrayt *array1  = allocSmallArray();
  33141   const char* array2[] = {"1", "2", "3", null};
  33142 
  33143   // non json array or dict
  33144   setTypeBoolO(self);
  33145   r = zipCCharO(self, array1, array2);
  33146   ck_assert_ptr_eq(r, NULL);
  33147   // json array
  33148   // zip arrays
  33149   //   empty self
  33150   freeO(self);
  33151   array1->f->pushS(array1, "a");
  33152   r       = zipCCharO(self, array1, array2);
  33153   ck_assert_ptr_ne(r, NULL);
  33154   char *s = toStringO(r);
  33155   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33156   free(s);
  33157   disposeO(array1);
  33158   freeO(self);
  33159   // add an element to self
  33160   // array1 has 2 elements
  33161   // array2 has 3 elements
  33162   // only 2 elements are zipped
  33163   self->f->pushS(self, "qwe");
  33164   array1->f->pushS(array1, "a");
  33165   array1->f->pushS(array1, "b");
  33166   r = zipCCharO(self, array1, array2);
  33167   ck_assert_ptr_ne(r, NULL);
  33168   s = toStringO(r);
  33169   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33170   free(s);
  33171   // empty arrays
  33172   array2[0] = null;
  33173   r = zipCCharO(self, array1, array2);
  33174   ck_assert_ptr_ne(r, NULL);
  33175   s = toStringO(r);
  33176   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33177   free(s);
  33178   disposeO(array1);
  33179   array2[0] = "1";
  33180   r = zipCCharO(self, array1, array2);
  33181   ck_assert_ptr_ne(r, NULL);
  33182   s = toStringO(r);
  33183   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33184   free(s);
  33185   // array1 and array2 same element count
  33186   array1->f->pushS(array1, "aa");
  33187   array1->f->pushS(array1, "bb");
  33188   array2[0] = "11";
  33189   array2[1] = "22";
  33190   array2[2] = null;
  33191   delElemO(array1, 1);
  33192   r = zipCCharO(self, array1, array2);
  33193   ck_assert_ptr_ne(r, NULL);
  33194   //  some elements were zipped
  33195   s = toStringO(self);
  33196   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33197   free(s);
  33198   // but an element is NULL
  33199   // non smallJson objects
  33200   smashO(array1);
  33201   array1 = (smallArrayt*) allocSmallInt(2);
  33202   r = zipCCharO(self, array1, array2);
  33203   ck_assert_ptr_eq(r, NULL);
  33204   terminateO(array1);
  33205   array1 = allocSmallArray();
  33206   // NULL arrays
  33207   r = zipCCharO(self, NULL, array2);
  33208   ck_assert_ptr_eq(r, NULL);
  33209   r = zipCCharO(self, array1, NULL);
  33210   ck_assert_ptr_eq(r, NULL);
  33211   terminateO(self);
  33212   smashO(array1);
  33213   // json dict
  33214   self = allocSmallJson();
  33215   smallArrayt *keys = allocSmallArray();
  33216   const char* values[] = {"1", "2", null};
  33217   self->f->setInt(self, "", 1);
  33218   // 3 elements in keys
  33219   // 2 elements in values
  33220   // only 2 key/values are zipped
  33221   keys->f->pushS(keys, "a");
  33222   keys->f->pushS(keys, "b");
  33223   keys->f->pushS(keys, "c");
  33224   r = zipCCharO(self, keys, values);
  33225   terminateO(keys);
  33226   ck_assert_ptr_ne(r, NULL);
  33227   s = toStringO(r);
  33228   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33229   free(s);
  33230   // keys array with non string objects
  33231   keys   = allocSmallArray();
  33232   keys->f->pushInt(keys, 1);
  33233   r = zipCCharO(self, keys, values);
  33234   ck_assert_ptr_eq(r, NULL);
  33235   terminateO(keys);
  33236   // empty values
  33237   keys   = allocSmallArray();
  33238   keys->f->pushInt(keys, 1);
  33239   values[0] = null;
  33240   r = zipCCharO(self, keys, values);
  33241   ck_assert_ptr_eq(r, self);
  33242   terminateO(keys);
  33243   terminateO(self);
  33244 
  33245 }
  33246 
  33247 
  33248 void zipArrayCharSmallJsonT(CuTest *tc UNUSED) {
  33249 
  33250   smallJsont* r;
  33251   smallJsont *self = allocSmallJson();
  33252   char** array1;
  33253   char** array2;
  33254 
  33255   // non json array or dict
  33256   setTypeBoolO(self);
  33257   array1 = listCreateS("a");
  33258   array2 = listCreateS("1");
  33259   r = zipArrayCharO(self, array1, array2);
  33260   ck_assert_ptr_eq(r, NULL);
  33261   // json array
  33262   // zip arrays
  33263   //   empty self
  33264   freeO(self);
  33265   r       = zipArrayCharO(self, array1, array2);
  33266   ck_assert_ptr_ne(r, NULL);
  33267   char *s = toStringO(r);
  33268   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33269   free(s);
  33270   freen(array1);
  33271   freen(array2);
  33272   freeO(self);
  33273   // add an element to self
  33274   // array1 has 2 elements
  33275   // array2 has 3 elements
  33276   // only 2 elements are zipped
  33277   self->f->pushS(self, "qwe");
  33278   array1  = listCreateS("a", "b");
  33279   array2  = listCreateS("1", "2", "3");
  33280   r = zipArrayCharO(self, array1, array2);
  33281   ck_assert_ptr_ne(r, NULL);
  33282   s = toStringO(r);
  33283   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33284   free(s);
  33285   //    delete the element not in self
  33286   iListDelElemS(&array2, 2);
  33287   // empty arrays
  33288   iListRemoveS(&array2, 0, 2);
  33289   r = zipArrayCharO(self, array1, array2);
  33290   ck_assert_ptr_ne(r, NULL);
  33291   s = toStringO(r);
  33292   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33293   free(s);
  33294   iListRemoveS(&array1, 0, 2);
  33295   r = zipArrayCharO(self, array1, array2);
  33296   ck_assert_ptr_ne(r, NULL);
  33297   s = toStringO(r);
  33298   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33299   free(s);
  33300   free(array1);
  33301   free(array2);
  33302   // array1 and array2 same element count
  33303   array1 = listCreateS("aa", "bb");
  33304   array2 = listCreateS("11", "22");
  33305   iListDelElemS(&array1, 1);
  33306   r = zipArrayCharO(self, array1, array2);
  33307   iListDelElemS(&array2, 1);
  33308   ck_assert_ptr_ne(r, NULL);
  33309   //  some elements were zipped
  33310   s = toStringO(self);
  33311   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33312   free(s);
  33313   // but an element is NULL
  33314   // NULL arrays
  33315   r = zipArrayCharO(self, NULL, array2);
  33316   ck_assert_ptr_eq(r, NULL);
  33317   r = zipArrayCharO(self, array1, NULL);
  33318   ck_assert_ptr_eq(r, NULL);
  33319   terminateO(self);
  33320   free(array1);
  33321   free(array2);
  33322   // json dict
  33323   self = allocSmallJson();
  33324   char** keys;
  33325   char** values;
  33326   self->f->setInt(self, "", 1);
  33327   // 3 elements in keys
  33328   // 2 elements in values
  33329   // only 2 key/values are zipped
  33330   keys   = listCreateS("a", "b", "c");
  33331   values = listCreateS("1", "2");
  33332   r = zipArrayCharO(self, keys, values);
  33333   listFreeS(keys);
  33334   listFreeS(values);
  33335   ck_assert_ptr_ne(r, NULL);
  33336   s = toStringO(r);
  33337   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33338   free(s);
  33339   // empty values
  33340   keys = listCreateS("a", "b", "c");
  33341   listEmptyS(values);
  33342   r = zipArrayCharO(self, keys, values);
  33343   ck_assert_ptr_eq(r, self);
  33344   listFreeS(keys);
  33345   listFreeS(values);
  33346   terminateO(self);
  33347 
  33348 }
  33349 
  33350 
  33351 void zipCArrayCharSmallJsonT(CuTest *tc UNUSED) {
  33352 
  33353   smallJsont* r;
  33354   smallJsont *self = allocSmallJson();
  33355   const char* array1[] = {"a", "b", null};
  33356   char** array2;
  33357 
  33358   // non json array or dict
  33359   setTypeBoolO(self);
  33360   array2 = listCreateS("1");
  33361   r = zipCArrayCharO(self, array1, array2);
  33362   ck_assert_ptr_eq(r, NULL);
  33363   // json array
  33364   // zip arrays
  33365   //   empty self
  33366   freeO(self);
  33367   r       = zipCArrayCharO(self, array1, array2);
  33368   ck_assert_ptr_ne(r, NULL);
  33369   char *s = toStringO(r);
  33370   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33371   free(s);
  33372   freen(array2);
  33373   freeO(self);
  33374   // add an element to self
  33375   // array1 has 2 elements
  33376   // array2 has 3 elements
  33377   // only 2 elements are zipped
  33378   self->f->pushS(self, "qwe");
  33379   array2  = listCreateS("1", "2", "3");
  33380   r = zipCArrayCharO(self, array1, array2);
  33381   ck_assert_ptr_ne(r, NULL);
  33382   s = toStringO(r);
  33383   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33384   free(s);
  33385   //    delete the element not in self
  33386   iListDelElemS(&array2, 2);
  33387   // empty arrays
  33388   iListRemoveS(&array2, 0, 2);
  33389   r = zipCArrayCharO(self, array1, array2);
  33390   ck_assert_ptr_ne(r, NULL);
  33391   s = toStringO(r);
  33392   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33393   free(s);
  33394   array1[0] = null;
  33395   r = zipCArrayCharO(self, array1, array2);
  33396   ck_assert_ptr_ne(r, NULL);
  33397   s = toStringO(r);
  33398   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33399   free(s);
  33400   free(array2);
  33401   // array1 and array2 same element count
  33402   array1[0] = "aa";
  33403   array1[1] = null;
  33404   array2 = listCreateS("11", "22");
  33405   r = zipCArrayCharO(self, array1, array2);
  33406   iListDelElemS(&array2, 1);
  33407   ck_assert_ptr_ne(r, NULL);
  33408   //  some elements were zipped
  33409   s = toStringO(self);
  33410   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33411   free(s);
  33412   // but an element is NULL
  33413   // NULL arrays
  33414   r = zipCArrayCharO(self, NULL, array2);
  33415   ck_assert_ptr_eq(r, NULL);
  33416   r = zipCArrayCharO(self, array1, NULL);
  33417   ck_assert_ptr_eq(r, NULL);
  33418   terminateO(self);
  33419   free(array2);
  33420   // json dict
  33421   self = allocSmallJson();
  33422   const char* keys[] = {"a", "b", "c", null};
  33423   char** values;
  33424   self->f->setInt(self, "", 1);
  33425   // 3 elements in keys
  33426   // 2 elements in values
  33427   // only 2 key/values are zipped
  33428   values = listCreateS("1", "2");
  33429   r = zipCArrayCharO(self, keys, values);
  33430   listFreeS(values);
  33431   ck_assert_ptr_ne(r, NULL);
  33432   s = toStringO(r);
  33433   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33434   free(s);
  33435   // empty values
  33436   listEmptyS(values);
  33437   r = zipCArrayCharO(self, keys, values);
  33438   ck_assert_ptr_eq(r, self);
  33439   listFreeS(values);
  33440   terminateO(self);
  33441 
  33442 }
  33443 
  33444 
  33445 void zipArrayCCharSmallJsonT(CuTest *tc UNUSED) {
  33446 
  33447   smallJsont* r;
  33448   smallJsont *self = allocSmallJson();
  33449   char** array1;
  33450   const char* array2[] = {"1", "2", "3", null};
  33451 
  33452   // non json array or dict
  33453   setTypeBoolO(self);
  33454   array1 = listCreateS("a");
  33455   r = zipArrayCCharO(self, array1, array2);
  33456   ck_assert_ptr_eq(r, NULL);
  33457   // json array
  33458   // zip arrays
  33459   //   empty self
  33460   freeO(self);
  33461   r       = zipArrayCCharO(self, array1, array2);
  33462   ck_assert_ptr_ne(r, NULL);
  33463   char *s = toStringO(r);
  33464   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33465   free(s);
  33466   freen(array1);
  33467   freeO(self);
  33468   // add an element to self
  33469   // array1 has 2 elements
  33470   // array2 has 3 elements
  33471   // only 2 elements are zipped
  33472   self->f->pushS(self, "qwe");
  33473   array1  = listCreateS("a", "b");
  33474   r = zipArrayCCharO(self, array1, array2);
  33475   ck_assert_ptr_ne(r, NULL);
  33476   s = toStringO(r);
  33477   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33478   free(s);
  33479   // empty arrays
  33480   array2[0] = null;
  33481   r = zipArrayCCharO(self, array1, array2);
  33482   ck_assert_ptr_ne(r, NULL);
  33483   s = toStringO(r);
  33484   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33485   free(s);
  33486   iListRemoveS(&array1, 0, 2);
  33487   array2[0] = "11";
  33488   r = zipArrayCCharO(self, array1, array2);
  33489   ck_assert_ptr_ne(r, NULL);
  33490   s = toStringO(r);
  33491   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33492   free(s);
  33493   free(array1);
  33494   // array1 and array2 same element count
  33495   array1 = listCreateS("aa", "bb");
  33496   array2[1] = "22";
  33497   iListDelElemS(&array1, 1);
  33498   r = zipArrayCCharO(self, array1, array2);
  33499   ck_assert_ptr_ne(r, NULL);
  33500   //  some elements were zipped
  33501   s = toStringO(self);
  33502   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33503   free(s);
  33504   // but an element is NULL
  33505   // NULL arrays
  33506   r = zipArrayCCharO(self, NULL, array2);
  33507   ck_assert_ptr_eq(r, NULL);
  33508   r = zipArrayCCharO(self, array1, NULL);
  33509   ck_assert_ptr_eq(r, NULL);
  33510   terminateO(self);
  33511   free(array1);
  33512   // json dict
  33513   self = allocSmallJson();
  33514   char** keys;
  33515   const char* values[] = {"1", "2", null};
  33516   self->f->setInt(self, "", 1);
  33517   // 3 elements in keys
  33518   // 2 elements in values
  33519   // only 2 key/values are zipped
  33520   keys   = listCreateS("a", "b", "c");
  33521   r = zipArrayCCharO(self, keys, values);
  33522   listFreeS(keys);
  33523   ck_assert_ptr_ne(r, NULL);
  33524   s = toStringO(r);
  33525   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33526   free(s);
  33527   // empty values
  33528   keys = listCreateS("a", "b", "c");
  33529   values[0] = null;
  33530   r = zipArrayCCharO(self, keys, values);
  33531   ck_assert_ptr_eq(r, self);
  33532   listFreeS(keys);
  33533   terminateO(self);
  33534 
  33535 }
  33536 
  33537 
  33538 void zipCArrayCCharSmallJsonT(CuTest *tc UNUSED) {
  33539 
  33540   smallJsont* r;
  33541   smallJsont *self = allocSmallJson();
  33542   const char* array1[] = {"a", "b", null};
  33543   const char* array2[] = {"1", "2", "3", null};
  33544 
  33545   // non json array or dict
  33546   setTypeBoolO(self);
  33547   r = zipCArrayCCharO(self, array1, array2);
  33548   ck_assert_ptr_eq(r, NULL);
  33549   // json array
  33550   // zip arrays
  33551   //   empty self
  33552   freeO(self);
  33553   array1[1] = null;
  33554   r       = zipCArrayCCharO(self, array1, array2);
  33555   ck_assert_ptr_ne(r, NULL);
  33556   char *s = toStringO(r);
  33557   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33558   free(s);
  33559   freeO(self);
  33560   // add an element to self
  33561   // array1 has 2 elements
  33562   // array2 has 3 elements
  33563   // only 2 elements are zipped
  33564   self->f->pushS(self, "qwe");
  33565   array1[1] = "b";
  33566   r = zipCArrayCCharO(self, array1, array2);
  33567   ck_assert_ptr_ne(r, NULL);
  33568   s = toStringO(r);
  33569   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33570   free(s);
  33571   // empty arrays
  33572   array2[0] = null;
  33573   r = zipCArrayCCharO(self, array1, array2);
  33574   ck_assert_ptr_ne(r, NULL);
  33575   s = toStringO(r);
  33576   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33577   free(s);
  33578   array1[0] = null;
  33579   array2[0] = "11";
  33580   r = zipCArrayCCharO(self, array1, array2);
  33581   ck_assert_ptr_ne(r, NULL);
  33582   s = toStringO(r);
  33583   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33584   free(s);
  33585   // array1 and array2 same element count
  33586   array1[0] = "aa";
  33587   array1[1] = null;
  33588   array2[1] = "22";
  33589   r = zipCArrayCCharO(self, array1, array2);
  33590   ck_assert_ptr_ne(r, NULL);
  33591   //  some elements were zipped
  33592   s = toStringO(self);
  33593   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  33594   free(s);
  33595   // but an element is NULL
  33596   // NULL arrays
  33597   r = zipCArrayCCharO(self, NULL, array2);
  33598   ck_assert_ptr_eq(r, NULL);
  33599   r = zipCArrayCCharO(self, array1, NULL);
  33600   ck_assert_ptr_eq(r, NULL);
  33601   terminateO(self);
  33602   // json dict
  33603   self = allocSmallJson();
  33604   const char* keys[]   = {"a", "b", "c", null};
  33605   const char* values[] = {"1", "2", null};
  33606   self->f->setInt(self, "", 1);
  33607   // 3 elements in keys
  33608   // 2 elements in values
  33609   // only 2 key/values are zipped
  33610   r = zipCArrayCCharO(self, keys, values);
  33611   ck_assert_ptr_ne(r, NULL);
  33612   s = toStringO(r);
  33613   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  33614   free(s);
  33615   // empty values
  33616   values[0] = null;
  33617   r = zipCArrayCCharO(self, keys, values);
  33618   ck_assert_ptr_eq(r, self);
  33619   terminateO(self);
  33620 
  33621 }
  33622 
  33623 
  33624 void zipJsonSmallJsonT(CuTest *tc UNUSED) {
  33625 
  33626   smallJsont* r;
  33627   smallJsont *self   = allocSmallJson();
  33628   smallJsont *keys   = allocSmallJson();
  33629   smallJsont *values = allocSmallJson();
  33630 
  33631   // non json array or dict
  33632   setTypeBoolO(self);
  33633   r = self->f->zipJson(self, keys, values);
  33634   ck_assert_ptr_eq(r, NULL);
  33635   freeO(self);
  33636   // json array
  33637   smallJsont *array1 = allocSmallJson();
  33638   smallJsont *array2 = allocSmallJson();
  33639   // zip arrays
  33640   //   empty self
  33641   array1->f->pushS(array1, "a");
  33642   array2->f->pushInt(array2, 1);
  33643   r = self->f->zipJson(self, array1, array2);
  33644   ck_assert_ptr_ne(r, NULL);
  33645   char *s = toStringO(r);
  33646   ck_assert_str_eq(s, "[[\"a\",1]]");
  33647   free(s);
  33648   disposeO(array1);
  33649   disposeO(array2);
  33650   freeO(self);
  33651   // add an element to self
  33652   // array1 has 2 elements
  33653   // array2 has 3 elements
  33654   // only 2 elements are zipped
  33655   self->f->pushS(self, "qwe");
  33656   array1->f->pushS(array1, "a");
  33657   array1->f->pushS(array1, "b");
  33658   array2->f->pushInt(array2, 1);
  33659   array2->f->pushInt(array2, 2);
  33660   array2->f->pushInt(array2, 3);
  33661   r       = self->f->zipJson(self, array1, array2);
  33662   ck_assert_ptr_ne(r, NULL);
  33663   s = toStringO(r);
  33664   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33665   free(s);
  33666   //    delete the element not in self
  33667   delElemIndexO(array2, 2);
  33668   // empty arrays
  33669   disposeO(array1);
  33670   r = self->f->zipJson(self, array1, array2);
  33671   ck_assert_ptr_eq(r, NULL);
  33672   disposeO(array2);
  33673   array1->f->pushS(array1, "a");
  33674   r = self->f->zipJson(self, array1, array2);
  33675   ck_assert_ptr_eq(r, NULL);
  33676   array2->f->pushInt(array2, 1);
  33677   delElemIndexO(array2, 0);
  33678   r = self->f->zipJson(self, array1, array2);
  33679   ck_assert_ptr_ne(r, NULL);
  33680   s = toStringO(r);
  33681   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"]]");
  33682   free(s);
  33683   disposeO(array1);
  33684   trimO(array2);
  33685   // array1 and array2 same element count
  33686   array1->f->pushS(array1, "aa");
  33687   array1->f->pushS(array1, "bb");
  33688   array2->f->pushInt(array2, 11);
  33689   array2->f->pushInt(array2, 22);
  33690   delElemIndexO(array1, 1);
  33691   r = self->f->zipJson(self, array1, array2);
  33692   delElemIndexO(array2, 1);
  33693   ck_assert_ptr_ne(r, NULL);
  33694   //  some elements were zipped
  33695   s = toStringO(self);
  33696   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"],[\"aa\",11]]");
  33697   free(s);
  33698   // but an element is NULL
  33699   // non smallJson objects
  33700   smashO(array1);
  33701   array1 = (smallJsont*) allocSmallInt(2);
  33702   r = self->f->zipJson(self, array1, array2);
  33703   ck_assert_ptr_eq(r, NULL);
  33704   terminateO(array1);
  33705   array1 = allocSmallJson();
  33706   smashO(array2);
  33707   array2 = (smallJsont*) allocSmallInt(2);
  33708   r = self->f->zipJson(self, array1, array2);
  33709   ck_assert_ptr_eq(r, NULL);
  33710   terminateO(array2);
  33711   array2 = allocSmallJson();
  33712   // NULL arrays
  33713   r = self->f->zipJson(self, NULL, array2);
  33714   ck_assert_ptr_eq(r, NULL);
  33715   r = self->f->zipJson(self, array1, NULL);
  33716   ck_assert_ptr_eq(r, NULL);
  33717   terminateO(self);
  33718   smashO(array1);
  33719   smashO(array2);
  33720   // json dict
  33721   self = allocSmallJson();
  33722   // zip arrays
  33723   self->f->setInt(self, "", 1);
  33724   // 3 elements in keys
  33725   // 2 elements in values
  33726   // only 2 key/values are zipped
  33727   keys->f->pushS(keys, "a");
  33728   keys->f->pushS(keys, "b");
  33729   keys->f->pushS(keys, "c");
  33730   values->f->pushInt(values, 1);
  33731   values->f->pushInt(values, 2);
  33732   r = self->f->zipJson(self, keys, values);
  33733   terminateO(keys);
  33734   smashO(values);
  33735   ck_assert_ptr_ne(r, NULL);
  33736   s = toStringO(r);
  33737   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  33738   free(s);
  33739   // keys array with non string objects
  33740   keys   = allocSmallJson();
  33741   values = allocSmallJson();
  33742   keys->f->pushInt(keys, 1);
  33743   values->f->pushInt(values, 1);
  33744   r = self->f->zipJson(self, keys, values);
  33745   ck_assert_ptr_eq(r, NULL);
  33746   terminateO(keys);
  33747   terminateO(values);
  33748   // empty values
  33749   keys   = allocSmallJson();
  33750   values = allocSmallJson();
  33751   keys->f->pushInt(keys, 1);
  33752   values->f->pushInt(values, 1);
  33753   delElemIndexO(values, 0);
  33754   trimO(values);
  33755   r = self->f->zipJson(self, keys, values);
  33756   ck_assert_ptr_eq(r, self);
  33757   terminateO(keys);
  33758   // non json array keys
  33759   keys   = allocSmallJson();
  33760   setTopIntO(keys, 1);
  33761   r = self->f->zipJson(self, keys, values);
  33762   ck_assert_ptr_eq(r, null);
  33763   terminateO(keys);
  33764   // non json array values
  33765   keys   = allocSmallJson();
  33766   keys->f->pushInt(keys, 1);
  33767   freeO(values);
  33768   setTopIntO(values, 1);
  33769   r = self->f->zipJson(self, keys, values);
  33770   ck_assert_ptr_eq(r, null);
  33771   terminateO(keys);
  33772   terminateO(values);
  33773   // non smallJson object
  33774   keys = (smallJsont*) allocSmallInt(1);
  33775   values = allocSmallJson();
  33776   r = self->f->zipJson(self, keys, values);
  33777   ck_assert_ptr_eq(r, null);
  33778   terminateO(keys);
  33779   keys   = allocSmallJson();
  33780   terminateO(values);
  33781   values = (smallJsont*) allocSmallInt(2);
  33782   r = self->f->zipJson(self, keys, values);
  33783   ck_assert_ptr_eq(r, null);
  33784   // null
  33785   r = self->f->zipJson(self, null, values);
  33786   ck_assert_ptr_eq(r, null);
  33787   r = self->f->zipJson(self, keys, null);
  33788   ck_assert_ptr_eq(r, null);
  33789   terminateO(keys);
  33790   terminateO(values);
  33791   terminateO(self);
  33792 
  33793 }
  33794 
  33795 
  33796 void zipJsonSmallArraySmallJsonT(CuTest *tc UNUSED) {
  33797 
  33798   smallJsont* r;
  33799   smallJsont *self    = allocSmallJson();
  33800   smallJsont *keys    = allocSmallJson();
  33801   smallArrayt *values = allocSmallArray();
  33802   smallJsont *array1  = allocSmallJson();
  33803   smallArrayt *array2 = allocSmallArray();
  33804 
  33805   // non json array or dict
  33806   setTypeBoolO(self);
  33807   r = self->f->zipJsonSmallArray(self, array1, array2);
  33808   ck_assert_ptr_eq(r, NULL);
  33809   // json array
  33810   // zip arrays
  33811   //   empty self
  33812   freeO(self);
  33813   array1->f->pushS(array1, "a");
  33814   array2->f->pushInt(array2, 1);
  33815   r = self->f->zipJsonSmallArray(self, array1, array2);
  33816   ck_assert_ptr_ne(r, NULL);
  33817   char *s = toStringO(r);
  33818   ck_assert_str_eq(s, "[[\"a\",1]]");
  33819   free(s);
  33820   disposeO(array1);
  33821   disposeO(array2);
  33822   freeO(self);
  33823   // add an element to self
  33824   // array1 has 2 elements
  33825   // array2 has 3 elements
  33826   // only 2 elements are zipped
  33827   self->f->pushS(self, "qwe");
  33828   array1->f->pushS(array1, "a");
  33829   array1->f->pushS(array1, "b");
  33830   array2->f->pushInt(array2, 1);
  33831   array2->f->pushInt(array2, 2);
  33832   array2->f->pushInt(array2, 3);
  33833   r = self->f->zipJsonSmallArray(self, array1, array2);
  33834   ck_assert_ptr_ne(r, NULL);
  33835   s = toStringO(r);
  33836   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33837   free(s);
  33838   //    delete the element not in self
  33839   delElemO(array2, 2);
  33840   // empty arrays
  33841   disposeO(array2);
  33842   r = self->f->zipJsonSmallArray(self, array1, array2);
  33843   ck_assert_ptr_ne(r, NULL);
  33844   s = toStringO(r);
  33845   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33846   free(s);
  33847   disposeO(array1);
  33848   setTypeArrayO(array1);
  33849   r = self->f->zipJsonSmallArray(self, array1, array2);
  33850   ck_assert_ptr_ne(r, NULL);
  33851   s = toStringO(r);
  33852   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  33853   free(s);
  33854   // array1 and array2 same element count
  33855   array1->f->pushS(array1, "aa");
  33856   array1->f->pushS(array1, "bb");
  33857   array2->f->pushInt(array2, 11);
  33858   array2->f->pushInt(array2, 22);
  33859   delElemIndexO(array1, 1);
  33860   r = self->f->zipJsonSmallArray(self, array1, array2);
  33861   delElemO(array2, 1);
  33862   ck_assert_ptr_ne(r, NULL);
  33863   //  some elements were zipped
  33864   s = toStringO(self);
  33865   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  33866   free(s);
  33867   // but an element is NULL
  33868   // non smallArray objects
  33869   smashO(array1);
  33870   array1 = (smallJsont*) allocSmallInt(2);
  33871   r = self->f->zipJsonSmallArray(self, array1, array2);
  33872   ck_assert_ptr_eq(r, NULL);
  33873   terminateO(array1);
  33874   array1 = allocSmallJson();
  33875   setTypeArrayO(array1);
  33876   smashO(array2);
  33877   array2 = (smallArrayt*) allocSmallInt(2);
  33878   r = self->f->zipJsonSmallArray(self, array1, array2);
  33879   ck_assert_ptr_eq(r, NULL);
  33880   terminateO(array2);
  33881   array2 = allocSmallArray();
  33882   // NULL arrays
  33883   r = self->f->zipJsonSmallArray(self, NULL, array2);
  33884   ck_assert_ptr_eq(r, NULL);
  33885   r = self->f->zipJsonSmallArray(self, array1, NULL);
  33886   ck_assert_ptr_eq(r, NULL);
  33887   terminateO(self);
  33888   smashO(array1);
  33889   smashO(array2);
  33890   // json dict
  33891   self = allocSmallJson();
  33892   self->f->setInt(self, "", 1);
  33893   // 3 elements in keys
  33894   // 2 elements in values
  33895   // only 2 key/values are zipped
  33896   keys->f->pushS(keys, "a");
  33897   keys->f->pushS(keys, "b");
  33898   keys->f->pushS(keys, "c");
  33899   values->f->pushInt(values, 1);
  33900   values->f->pushInt(values, 2);
  33901   r = self->f->zipJsonSmallArray(self, keys, values);
  33902   terminateO(keys);
  33903   smashO(values);
  33904   ck_assert_ptr_ne(r, NULL);
  33905   s = toStringO(r);
  33906   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  33907   free(s);
  33908   // keys array with non string objects
  33909   keys   = allocSmallJson();
  33910   values = allocSmallArray();
  33911   keys->f->pushInt(keys, 1);
  33912   values->f->pushInt(values, 1);
  33913   r = self->f->zipJsonSmallArray(self, keys, values);
  33914   ck_assert_ptr_eq(r, NULL);
  33915   terminateO(keys);
  33916   terminateO(values);
  33917   // empty values
  33918   keys   = allocSmallJson();
  33919   values = allocSmallArray();
  33920   keys->f->pushInt(keys, 1);
  33921   r = self->f->zipJsonSmallArray(self, keys, values);
  33922   ck_assert_ptr_eq(r, self);
  33923   terminateO(keys);
  33924   // non json array keys
  33925   keys   = allocSmallJson();
  33926   setTopIntO(keys, 1);
  33927   r = self->f->zipJsonSmallArray(self, keys, values);
  33928   ck_assert_ptr_eq(r, null);
  33929   terminateO(keys);
  33930   // non smallArray object
  33931   keys = (smallJsont*) allocSmallInt(1);
  33932   r = self->f->zipJsonSmallArray(self, keys, values);
  33933   ck_assert_ptr_eq(r, null);
  33934   terminateO(keys);
  33935   keys   = allocSmallJson();
  33936   terminateO(values);
  33937   values = (smallArrayt*) allocSmallInt(2);
  33938   r = self->f->zipJsonSmallArray(self, keys, values);
  33939   ck_assert_ptr_eq(r, null);
  33940   // null
  33941   r = self->f->zipJsonSmallArray(self, null, values);
  33942   ck_assert_ptr_eq(r, null);
  33943   r = self->f->zipJsonSmallArray(self, keys, null);
  33944   ck_assert_ptr_eq(r, null);
  33945   terminateO(keys);
  33946   terminateO(values);
  33947   terminateO(self);
  33948 
  33949 }
  33950 
  33951 
  33952 void zipJsonArraySmallJsonT(CuTest *tc UNUSED) {
  33953 
  33954   smallJsont* r;
  33955   smallJsont *self = allocSmallJson();
  33956   smallJsont *keys = allocSmallJson();
  33957   char** values;
  33958   smallJsont *array1 = allocSmallJson();
  33959   char** array2;
  33960 
  33961   // non json array or dict
  33962   setTypeBoolO(self);
  33963   setTypeArrayO(array1);
  33964   array2 = listCreateS("1");
  33965   r = self->f->zipJsonArray(self, array1, array2);
  33966   ck_assert_ptr_eq(r, NULL);
  33967   // json array
  33968   // zip arrays
  33969   //   empty self
  33970   freeO(self);
  33971   array1->f->pushS(array1, "a");
  33972   r       = self->f->zipJsonArray(self, array1, array2);
  33973   ck_assert_ptr_ne(r, NULL);
  33974   char *s = toStringO(r);
  33975   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  33976   free(s);
  33977   disposeO(array1);
  33978   freen(array2);
  33979   freeO(self);
  33980   // add an element to self
  33981   // array1 has 2 elements
  33982   // array2 has 3 elements
  33983   // only 2 elements are zipped
  33984   self->f->pushS(self, "qwe");
  33985   array1->f->pushS(array1, "a");
  33986   array1->f->pushS(array1, "b");
  33987   array2  = listCreateS("1", "2", "3");
  33988   r = self->f->zipJsonArray(self, array1, array2);
  33989   ck_assert_ptr_ne(r, NULL);
  33990   s = toStringO(r);
  33991   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  33992   free(s);
  33993   //    delete the element not in self
  33994   iListDelElemS(&array2, 2);
  33995   // empty arrays
  33996   iListRemoveS(&array2, 0, 2);
  33997   r = self->f->zipJsonArray(self, array1, array2);
  33998   ck_assert_ptr_ne(r, NULL);
  33999   s = toStringO(r);
  34000   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34001   free(s);
  34002   disposeO(array1);
  34003   setTypeArrayO(array1);
  34004   r = self->f->zipJsonArray(self, array1, array2);
  34005   ck_assert_ptr_ne(r, NULL);
  34006   s = toStringO(r);
  34007   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34008   free(s);
  34009   free(array2);
  34010   // array1 and array2 same element count
  34011   array1->f->pushS(array1, "aa");
  34012   array1->f->pushS(array1, "bb");
  34013   array2  = listCreateS("11", "22");
  34014   delElemIndexO(array1, 1);
  34015   r = self->f->zipJsonArray(self, array1, array2);
  34016   iListDelElemS(&array2, 1);
  34017   ck_assert_ptr_ne(r, NULL);
  34018   //  some elements were zipped
  34019   s = toStringO(self);
  34020   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  34021   free(s);
  34022   // but an element is NULL
  34023   // non smallJson objects
  34024   smashO(array1);
  34025   array1 = (smallJsont*) allocSmallInt(2);
  34026   r = self->f->zipJsonArray(self, array1, array2);
  34027   ck_assert_ptr_eq(r, NULL);
  34028   terminateO(array1);
  34029   array1 = allocSmallJson();
  34030   setTypeArrayO(array1);
  34031   // NULL arrays
  34032   r = self->f->zipJsonArray(self, NULL, array2);
  34033   ck_assert_ptr_eq(r, NULL);
  34034   r = self->f->zipJsonArray(self, array1, NULL);
  34035   ck_assert_ptr_eq(r, NULL);
  34036   terminateO(self);
  34037   smashO(array1);
  34038   free(array2);
  34039   // json dict
  34040   self = allocSmallJson();
  34041   self->f->setInt(self, "", 1);
  34042   // 3 elements in keys
  34043   // 2 elements in values
  34044   // only 2 key/values are zipped
  34045   keys->f->pushS(keys, "a");
  34046   keys->f->pushS(keys, "b");
  34047   keys->f->pushS(keys, "c");
  34048   values = listCreateS("1", "2");
  34049   r = self->f->zipJsonArray(self, keys, values);
  34050   terminateO(keys);
  34051   listFreeS(values);
  34052   ck_assert_ptr_ne(r, NULL);
  34053   s = toStringO(r);
  34054   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  34055   free(s);
  34056   // keys array with non string objects
  34057   keys   = allocSmallJson();
  34058   keys->f->pushInt(keys, 1);
  34059   values = listCreateS("1");
  34060   r = self->f->zipJsonArray(self, keys, values);
  34061   ck_assert_ptr_eq(r, NULL);
  34062   terminateO(keys);
  34063   listFreeS(values);
  34064   // empty values
  34065   keys   = allocSmallJson();
  34066   keys->f->pushInt(keys, 1);
  34067   listEmptyS(values);
  34068   r = self->f->zipJsonArray(self, keys, values);
  34069   ck_assert_ptr_eq(r, self);
  34070   terminateO(keys);
  34071   // non json array keys
  34072   keys   = allocSmallJson();
  34073   setTopIntO(keys, 1);
  34074   r = self->f->zipJsonArray(self, keys, values);
  34075   ck_assert_ptr_eq(r, null);
  34076   terminateO(keys);
  34077   // non smallArray object
  34078   keys = (smallJsont*) allocSmallInt(1);
  34079   r = self->f->zipJsonArray(self, keys, values);
  34080   ck_assert_ptr_eq(r, null);
  34081   terminateO(keys);
  34082   keys   = allocSmallJson();
  34083   // null
  34084   r = self->f->zipJsonArray(self, null, values);
  34085   ck_assert_ptr_eq(r, null);
  34086   r = self->f->zipJsonArray(self, keys, null);
  34087   ck_assert_ptr_eq(r, null);
  34088   terminateO(keys);
  34089   listFreeS(values);
  34090   terminateO(self);
  34091 
  34092 }
  34093 
  34094 
  34095 void zipJsonCArraySmallJsonT(CuTest *tc UNUSED) {
  34096 
  34097   smallJsont* r;
  34098   smallJsont *self     = allocSmallJson();
  34099   smallJsont *keys     = allocSmallJson();
  34100   const char* values[] = {"1", "2", null};
  34101   smallJsont *array1   = allocSmallJson();
  34102   const char* array2[] = {"1", "2", "3", null};
  34103 
  34104   // non json array or dict
  34105   setTypeBoolO(self);
  34106   setTypeArrayO(array1);
  34107   r = self->f->zipJsonCArray(self, array1, array2);
  34108   ck_assert_ptr_eq(r, NULL);
  34109   // json array
  34110   // zip arrays
  34111   //   empty self
  34112   freeO(self);
  34113   array1->f->pushS(array1, "a");
  34114   r       = self->f->zipJsonCArray(self, array1, array2);
  34115   ck_assert_ptr_ne(r, NULL);
  34116   char *s = toStringO(r);
  34117   ck_assert_str_eq(s, "[[\"a\",\"1\"]]");
  34118   free(s);
  34119   disposeO(array1);
  34120   freeO(self);
  34121   // add an element to self
  34122   // array1 has 2 elements
  34123   // array2 has 3 elements
  34124   // only 2 elements are zipped
  34125   self->f->pushS(self, "qwe");
  34126   array1->f->pushS(array1, "a");
  34127   array1->f->pushS(array1, "b");
  34128   r = self->f->zipJsonCArray(self, array1, array2);
  34129   ck_assert_ptr_ne(r, NULL);
  34130   s = toStringO(r);
  34131   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34132   free(s);
  34133   // empty arrays
  34134   array2[0] = null;
  34135   r = self->f->zipJsonCArray(self, array1, array2);
  34136   ck_assert_ptr_ne(r, NULL);
  34137   s = toStringO(r);
  34138   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34139   free(s);
  34140   disposeO(array1);
  34141   setTypeArrayO(array1);
  34142   array2[0] = "11";
  34143   r = self->f->zipJsonCArray(self, array1, array2);
  34144   ck_assert_ptr_ne(r, NULL);
  34145   s = toStringO(r);
  34146   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  34147   free(s);
  34148   // array1 and array2 same element count
  34149   array1->f->pushS(array1, "aa");
  34150   array1->f->pushS(array1, "bb");
  34151   array2[1] = "22";
  34152   delElemIndexO(array1, 1);
  34153   r = self->f->zipJsonCArray(self, array1, array2);
  34154   ck_assert_ptr_ne(r, NULL);
  34155   //  some elements were zipped
  34156   s = toStringO(self);
  34157   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"],[\"aa\",\"11\"]]");
  34158   free(s);
  34159   // but an element is NULL
  34160   // non smallJson objects
  34161   smashO(array1);
  34162   array1 = (smallJsont*) allocSmallInt(2);
  34163   r = self->f->zipJsonCArray(self, array1, array2);
  34164   ck_assert_ptr_eq(r, NULL);
  34165   terminateO(array1);
  34166   array1 = allocSmallJson();
  34167   setTypeArrayO(array1);
  34168   // NULL arrays
  34169   r = self->f->zipJsonCArray(self, NULL, array2);
  34170   ck_assert_ptr_eq(r, NULL);
  34171   r = self->f->zipJsonCArray(self, array1, NULL);
  34172   ck_assert_ptr_eq(r, NULL);
  34173   terminateO(self);
  34174   smashO(array1);
  34175   // json dict
  34176   self = allocSmallJson();
  34177   self->f->setInt(self, "", 1);
  34178   // 3 elements in keys
  34179   // 2 elements in values
  34180   // only 2 key/values are zipped
  34181   keys->f->pushS(keys, "a");
  34182   keys->f->pushS(keys, "b");
  34183   keys->f->pushS(keys, "c");
  34184   r = self->f->zipJsonCArray(self, keys, values);
  34185   terminateO(keys);
  34186   ck_assert_ptr_ne(r, NULL);
  34187   s = toStringO(r);
  34188   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  34189   free(s);
  34190   // keys array with non string objects
  34191   keys   = allocSmallJson();
  34192   keys->f->pushInt(keys, 1);
  34193   r = self->f->zipJsonCArray(self, keys, values);
  34194   ck_assert_ptr_eq(r, NULL);
  34195   terminateO(keys);
  34196   // empty values
  34197   keys   = allocSmallJson();
  34198   keys->f->pushInt(keys, 1);
  34199   values[0] = null;
  34200   r = self->f->zipJsonCArray(self, keys, values);
  34201   ck_assert_ptr_eq(r, self);
  34202   values[0] = "1";
  34203   terminateO(keys);
  34204   // non json array keys
  34205   keys   = allocSmallJson();
  34206   setTopIntO(keys, 1);
  34207   r = self->f->zipJsonCArray(self, keys, values);
  34208   ck_assert_ptr_eq(r, null);
  34209   terminateO(keys);
  34210   // non smallArray object
  34211   keys = (smallJsont*) allocSmallInt(1);
  34212   r = self->f->zipJsonCArray(self, keys, values);
  34213   ck_assert_ptr_eq(r, null);
  34214   terminateO(keys);
  34215   keys   = allocSmallJson();
  34216   // null
  34217   r = self->f->zipJsonCArray(self, null, values);
  34218   ck_assert_ptr_eq(r, null);
  34219   r = self->f->zipJsonCArray(self, keys, null);
  34220   ck_assert_ptr_eq(r, null);
  34221   terminateO(keys);
  34222   terminateO(self);
  34223 
  34224 }
  34225 
  34226 
  34227 void zipSmallArrayJsonSmallJsonT(CuTest *tc UNUSED) {
  34228 
  34229   smallJsont* r;
  34230   smallJsont *self   = allocSmallJson();
  34231   smallArrayt *keys  = allocSmallArray();
  34232   smallJsont *values = allocSmallJson();
  34233 
  34234   // non json array or dict
  34235   setTypeBoolO(self);
  34236   r = self->f->zipSmallArrayJson(self, keys, values);
  34237   ck_assert_ptr_eq(r, NULL);
  34238   freeO(self);
  34239   // json array
  34240   smallArrayt *array1 = allocSmallArray();
  34241   smallJsont *array2  = allocSmallJson();
  34242   // zip arrays
  34243   //   empty self
  34244   array1->f->pushS(array1, "a");
  34245   array2->f->pushInt(array2, 1);
  34246   r = self->f->zipSmallArrayJson(self, array1, array2);
  34247   ck_assert_ptr_ne(r, NULL);
  34248   char *s = toStringO(r);
  34249   ck_assert_str_eq(s, "[[\"a\",1]]");
  34250   free(s);
  34251   disposeO(array1);
  34252   disposeO(array2);
  34253   freeO(self);
  34254   // add an element to self
  34255   // array1 has 2 elements
  34256   // array2 has 3 elements
  34257   // only 2 elements are zipped
  34258   self->f->pushS(self, "qwe");
  34259   array1->f->pushS(array1, "a");
  34260   array1->f->pushS(array1, "b");
  34261   array2->f->pushInt(array2, 1);
  34262   array2->f->pushInt(array2, 2);
  34263   array2->f->pushInt(array2, 3);
  34264   r       = self->f->zipSmallArrayJson(self, array1, array2);
  34265   ck_assert_ptr_ne(r, NULL);
  34266   s = toStringO(r);
  34267   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34268   free(s);
  34269   //    delete the element not in self
  34270   delElemIndexO(array2, 2);
  34271   // empty arrays
  34272   disposeO(array1);
  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]]");
  34277   free(s);
  34278   disposeO(array2);
  34279   array1->f->pushS(array1, "a");
  34280   r = self->f->zipSmallArrayJson(self, array1, array2);
  34281   ck_assert_ptr_eq(r, NULL);
  34282   array2->f->pushInt(array2, 1);
  34283   delElemIndexO(array2, 0);
  34284   r = self->f->zipSmallArrayJson(self, array1, array2);
  34285   ck_assert_ptr_ne(r, NULL);
  34286   s = toStringO(r);
  34287   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"]]");
  34288   free(s);
  34289   disposeO(array1);
  34290   trimO(array2);
  34291   // array1 and array2 same element count
  34292   array1->f->pushS(array1, "aa");
  34293   array1->f->pushS(array1, "bb");
  34294   array2->f->pushInt(array2, 11);
  34295   array2->f->pushInt(array2, 22);
  34296   delElemO(array1, 1);
  34297   r = self->f->zipSmallArrayJson(self, array1, array2);
  34298   delElemIndexO(array2, 1);
  34299   ck_assert_ptr_ne(r, NULL);
  34300   //  some elements were zipped
  34301   s = toStringO(self);
  34302   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"a\"],[\"aa\",11]]");
  34303   free(s);
  34304   // but an element is NULL
  34305   // non smallJson objects
  34306   smashO(array1);
  34307   array1 = (smallArrayt*) allocSmallInt(2);
  34308   r = self->f->zipSmallArrayJson(self, array1, array2);
  34309   ck_assert_ptr_eq(r, NULL);
  34310   terminateO(array1);
  34311   array1 = allocSmallArray();
  34312   smashO(array2);
  34313   array2 = (smallJsont*) allocSmallInt(2);
  34314   r = self->f->zipSmallArrayJson(self, array1, array2);
  34315   ck_assert_ptr_eq(r, NULL);
  34316   terminateO(array2);
  34317   array2 = allocSmallJson();
  34318   // NULL arrays
  34319   r = self->f->zipSmallArrayJson(self, NULL, array2);
  34320   ck_assert_ptr_eq(r, NULL);
  34321   r = self->f->zipSmallArrayJson(self, array1, NULL);
  34322   ck_assert_ptr_eq(r, NULL);
  34323   terminateO(self);
  34324   smashO(array1);
  34325   smashO(array2);
  34326   // json dict
  34327   self = allocSmallJson();
  34328   // zip arrays
  34329   self->f->setInt(self, "", 1);
  34330   // 3 elements in keys
  34331   // 2 elements in values
  34332   // only 2 key/values are zipped
  34333   keys->f->pushS(keys, "a");
  34334   keys->f->pushS(keys, "b");
  34335   keys->f->pushS(keys, "c");
  34336   values->f->pushInt(values, 1);
  34337   values->f->pushInt(values, 2);
  34338   r = self->f->zipSmallArrayJson(self, keys, values);
  34339   terminateO(keys);
  34340   smashO(values);
  34341   ck_assert_ptr_ne(r, NULL);
  34342   s = toStringO(r);
  34343   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34344   free(s);
  34345   // keys array with non string objects
  34346   keys   = allocSmallArray();
  34347   values = allocSmallJson();
  34348   keys->f->pushInt(keys, 1);
  34349   values->f->pushInt(values, 1);
  34350   r = self->f->zipSmallArrayJson(self, keys, values);
  34351   ck_assert_ptr_eq(r, NULL);
  34352   terminateO(keys);
  34353   terminateO(values);
  34354   // empty values
  34355   keys   = allocSmallArray();
  34356   values = allocSmallJson();
  34357   keys->f->pushInt(keys, 1);
  34358   values->f->pushInt(values, 1);
  34359   delElemIndexO(values, 0);
  34360   trimO(values);
  34361   r = self->f->zipSmallArrayJson(self, keys, values);
  34362   ck_assert_ptr_eq(r, self);
  34363   terminateO(keys);
  34364   // non smallArray object
  34365   keys = (smallArrayt*) allocSmallInt(1);
  34366   r = self->f->zipSmallArrayJson(self, keys, values);
  34367   ck_assert_ptr_eq(r, null);
  34368   terminateO(keys);
  34369   keys   = allocSmallArray();
  34370   terminateO(values);
  34371   // non json array
  34372   values = allocSmallJson();
  34373   setTopIntO(values, 1);
  34374   r = self->f->zipSmallArrayJson(self, keys, values);
  34375   ck_assert_ptr_eq(r, null);
  34376   terminateO(values);
  34377   // non smallJson values
  34378   values = (smallJsont*) allocSmallInt(2);
  34379   r = self->f->zipSmallArrayJson(self, keys, values);
  34380   ck_assert_ptr_eq(r, null);
  34381   // null
  34382   r = self->f->zipSmallArrayJson(self, null, values);
  34383   ck_assert_ptr_eq(r, null);
  34384   r = self->f->zipSmallArrayJson(self, keys, null);
  34385   ck_assert_ptr_eq(r, null);
  34386   terminateO(keys);
  34387   terminateO(values);
  34388   terminateO(self);
  34389 
  34390 }
  34391 
  34392 
  34393 void zipArrayJsonSmallJsonT(CuTest *tc UNUSED) {
  34394 
  34395   smallJsont* r;
  34396   smallJsont *self   = allocSmallJson();
  34397   char** keys;
  34398   smallJsont *values = allocSmallJson();
  34399   char** array1;
  34400   smallJsont *array2 = allocSmallJson();
  34401 
  34402   // non json array or dict
  34403   setTypeBoolO(self);
  34404   array1 = listCreateS("a");
  34405   r = self->f->zipArrayJson(self, array1, array2);
  34406   ck_assert_ptr_eq(r, NULL);
  34407   // json array
  34408   // zip arrays
  34409   //   empty self
  34410   freeO(self);
  34411   array2->f->pushInt(array2, 1);
  34412   r       = self->f->zipArrayJson(self, array1, array2);
  34413   ck_assert_ptr_ne(r, NULL);
  34414   char *s = toStringO(r);
  34415   ck_assert_str_eq(s, "[[\"a\",1]]");
  34416   free(s);
  34417   freen(array1);
  34418   disposeO(array2);
  34419   freeO(self);
  34420   // add an element to self
  34421   // array1 has 2 elements
  34422   // array2 has 3 elements
  34423   // only 2 elements are zipped
  34424   self->f->pushS(self, "qwe");
  34425   array1  = listCreateS("a", "b");
  34426   array2->f->pushInt(array2, 1);
  34427   array2->f->pushInt(array2, 2);
  34428   array2->f->pushInt(array2, 3);
  34429   r = self->f->zipArrayJson(self, array1, array2);
  34430   ck_assert_ptr_ne(r, NULL);
  34431   s = toStringO(r);
  34432   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34433   free(s);
  34434   //    delete the element not in self
  34435   delElemIndexO(array2, 2);
  34436   // empty arrays
  34437   disposeO(array2);
  34438   setTypeArrayO(array2);
  34439   r = self->f->zipArrayJson(self, array1, array2);
  34440   ck_assert_ptr_ne(r, NULL);
  34441   s = toStringO(r);
  34442   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34443   free(s);
  34444   iListRemoveS(&array1, 0, 2);
  34445   r = self->f->zipArrayJson(self, array1, array2);
  34446   free(array1);
  34447   ck_assert_ptr_ne(r, NULL);
  34448   s = toStringO(r);
  34449   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34450   free(s);
  34451   // array1 and array2 same element count
  34452   array1 = listCreateS("aa", "bb");
  34453   array2->f->pushInt(array2, 11);
  34454   array2->f->pushInt(array2, 22);
  34455   iListDelElemS(&array1, 1);
  34456   r = self->f->zipArrayJson(self, array1, array2);
  34457   delElemIndexO(array2, 1);
  34458   ck_assert_ptr_ne(r, NULL);
  34459   //  some elements were zipped
  34460   s = toStringO(self);
  34461   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  34462   free(s);
  34463   // but an element is NULL
  34464   // non smallArray objects
  34465   smashO(array2);
  34466   array2 = (smallJsont*) allocSmallInt(2);
  34467   r = self->f->zipArrayJson(self, array1, array2);
  34468   ck_assert_ptr_eq(r, NULL);
  34469   terminateO(array2);
  34470   array2 = allocSmallJson();
  34471   // NULL arrays
  34472   r = self->f->zipArrayJson(self, NULL, array2);
  34473   ck_assert_ptr_eq(r, NULL);
  34474   r = self->f->zipArrayJson(self, array1, NULL);
  34475   ck_assert_ptr_eq(r, NULL);
  34476   terminateO(self);
  34477   free(array1);
  34478   smashO(array2);
  34479   // json dict
  34480   self = allocSmallJson();
  34481   self->f->setInt(self, "", 1);
  34482   // 3 elements in keys
  34483   // 2 elements in values
  34484   // only 2 key/values are zipped
  34485   keys = listCreateS("a", "b", "c");
  34486   values->f->pushInt(values, 1);
  34487   values->f->pushInt(values, 2);
  34488   r = self->f->zipArrayJson(self, keys, values);
  34489   listFreeS(keys);
  34490   smashO(values);
  34491   ck_assert_ptr_ne(r, NULL);
  34492   s = toStringO(r);
  34493   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34494   free(s);
  34495   // empty values
  34496   keys   = listCreateS("a");
  34497   values = allocSmallJson();
  34498   values->f->pushInt(values, 1);
  34499   delElemIndexO(values, 0);
  34500   trimO(values);
  34501   r = self->f->zipArrayJson(self, keys, values);
  34502   ck_assert_ptr_eq(r, self);
  34503   terminateO(values);
  34504   // non json array
  34505   values = allocSmallJson();
  34506   setTopIntO(values, 1);
  34507   r = self->f->zipArrayJson(self, keys, values);
  34508   ck_assert_ptr_eq(r, null);
  34509   terminateO(values);
  34510   // non smallJson values
  34511   values = (smallJsont*) allocSmallInt(2);
  34512   r = self->f->zipArrayJson(self, keys, values);
  34513   ck_assert_ptr_eq(r, null);
  34514   // null
  34515   r = self->f->zipArrayJson(self, null, values);
  34516   ck_assert_ptr_eq(r, null);
  34517   r = self->f->zipArrayJson(self, keys, null);
  34518   ck_assert_ptr_eq(r, null);
  34519   listFreeS(keys);
  34520   terminateO(values);
  34521   terminateO(self);
  34522 
  34523 }
  34524 
  34525 
  34526 void zipCArrayJsonSmallJsonT(CuTest *tc UNUSED) {
  34527 
  34528   smallJsont* r;
  34529   smallJsont *self   = allocSmallJson();
  34530   const char* keys[] = {"a", "b", "c", null};
  34531   smallJsont *values = allocSmallJson();
  34532   const char* array1[] = {"a", "b", null};
  34533   smallJsont *array2 = allocSmallJson();
  34534 
  34535   // non json array or dict
  34536   setTypeBoolO(self);
  34537   r = self->f->zipCArrayJson(self, array1, array2);
  34538   ck_assert_ptr_eq(r, NULL);
  34539   // json array
  34540   // zip arrays
  34541   //   empty self
  34542   freeO(self);
  34543   array2->f->pushInt(array2, 1);
  34544   r       = self->f->zipCArrayJson(self, array1, array2);
  34545   ck_assert_ptr_ne(r, NULL);
  34546   char *s = toStringO(r);
  34547   ck_assert_str_eq(s, "[[\"a\",1]]");
  34548   free(s);
  34549   disposeO(array2);
  34550   freeO(self);
  34551   // add an element to self
  34552   // array1 has 2 elements
  34553   // array2 has 3 elements
  34554   // only 2 elements are zipped
  34555   self->f->pushS(self, "qwe");
  34556   array2->f->pushInt(array2, 1);
  34557   array2->f->pushInt(array2, 2);
  34558   array2->f->pushInt(array2, 3);
  34559   r = self->f->zipCArrayJson(self, array1, array2);
  34560   ck_assert_ptr_ne(r, NULL);
  34561   s = toStringO(r);
  34562   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34563   free(s);
  34564   //    delete the element not in self
  34565   delElemIndexO(array2, 2);
  34566   // empty arrays
  34567   disposeO(array2);
  34568   setTypeArrayO(array2);
  34569   r = self->f->zipCArrayJson(self, array1, array2);
  34570   ck_assert_ptr_ne(r, NULL);
  34571   s = toStringO(r);
  34572   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34573   free(s);
  34574   array1[0] = null;
  34575   r = self->f->zipCArrayJson(self, array1, array2);
  34576   ck_assert_ptr_ne(r, NULL);
  34577   s = toStringO(r);
  34578   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  34579   free(s);
  34580   // array1 and array2 same element count
  34581   array1[0] = "aa";
  34582   array1[1] = null;
  34583   array2->f->pushInt(array2, 11);
  34584   array2->f->pushInt(array2, 22);
  34585   r = self->f->zipCArrayJson(self, array1, array2);
  34586   delElemIndexO(array2, 1);
  34587   ck_assert_ptr_ne(r, NULL);
  34588   //  some elements were zipped
  34589   s = toStringO(self);
  34590   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2],[\"aa\",11]]");
  34591   free(s);
  34592   // but an element is NULL
  34593   // non smallArray objects
  34594   smashO(array2);
  34595   array2 = (smallJsont*) allocSmallInt(2);
  34596   r = self->f->zipCArrayJson(self, array1, array2);
  34597   ck_assert_ptr_eq(r, NULL);
  34598   terminateO(array2);
  34599   array2 = allocSmallJson();
  34600   // NULL arrays
  34601   r = self->f->zipCArrayJson(self, NULL, array2);
  34602   ck_assert_ptr_eq(r, NULL);
  34603   r = self->f->zipCArrayJson(self, array1, NULL);
  34604   ck_assert_ptr_eq(r, NULL);
  34605   terminateO(self);
  34606   smashO(array2);
  34607   // json dict
  34608   self = allocSmallJson();
  34609   self->f->setInt(self, "", 1);
  34610   // 3 elements in keys
  34611   // 2 elements in values
  34612   // only 2 key/values are zipped
  34613   values->f->pushInt(values, 1);
  34614   values->f->pushInt(values, 2);
  34615   r = self->f->zipCArrayJson(self, keys, values);
  34616   smashO(values);
  34617   ck_assert_ptr_ne(r, NULL);
  34618   s = toStringO(r);
  34619   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  34620   free(s);
  34621   // empty values
  34622   values = allocSmallJson();
  34623   values->f->pushInt(values, 1);
  34624   delElemIndexO(values, 0);
  34625   trimO(values);
  34626   r = self->f->zipCArrayJson(self, keys, values);
  34627   ck_assert_ptr_eq(r, self);
  34628   terminateO(values);
  34629   // non json array
  34630   values = allocSmallJson();
  34631   setTopIntO(values, 1);
  34632   r = self->f->zipCArrayJson(self, keys, values);
  34633   ck_assert_ptr_eq(r, null);
  34634   terminateO(values);
  34635   // non smallJson values
  34636   values = (smallJsont*) allocSmallInt(2);
  34637   r = self->f->zipCArrayJson(self, keys, values);
  34638   ck_assert_ptr_eq(r, null);
  34639   // null
  34640   r = self->f->zipCArrayJson(self, null, values);
  34641   ck_assert_ptr_eq(r, null);
  34642   r = self->f->zipCArrayJson(self, keys, null);
  34643   ck_assert_ptr_eq(r, null);
  34644   terminateO(values);
  34645   terminateO(self);
  34646 
  34647 }
  34648 
  34649 
  34650 void iterStartSmallJsonT(CuTest *tc UNUSED) {
  34651 
  34652   baset* r;
  34653   smallJsont *self = allocSmallJson();
  34654 
  34655   // non json array or dict
  34656   setTypeBoolO(self);
  34657   r = iterStartO(self);
  34658   ck_assert_ptr_eq(r, NULL);
  34659   freeO(self);
  34660   // json array
  34661   // array with sObjects
  34662   self->f->pushUndefined(self);
  34663   self->f->pushBool(self, true);
  34664   r = iterStartO(self);
  34665   ck_assert_ptr_ne(r, NULL);
  34666   ck_assert(isOUndefined(r));
  34667   // start again
  34668   r = iterStartO(self);
  34669   ck_assert_ptr_ne(r, NULL);
  34670   ck_assert(isOUndefined(r));
  34671   // array with objects from other classes
  34672   emptyO(self);
  34673   createAllocateSmallInt(ip);
  34674   ip->type = "anothertype";
  34675   setValG(ip, 11);
  34676   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34677   ck_assert_ptr_ne(r2, NULL);
  34678   r = iterStartO(self);
  34679   ck_assert_ptr_ne(r, NULL);
  34680   // array with all deleted elements
  34681   emptyO(self);
  34682   self->f->pushUndefined(self);
  34683   delElemIndexO(self, 0);
  34684   r = iterStartO(self);
  34685   ck_assert_ptr_eq(r, NULL);
  34686   // empty array
  34687   emptyO(self);
  34688   r = iterStartO(self);
  34689   ck_assert_ptr_eq(r, NULL);
  34690   terminateO(self);
  34691   // json dict
  34692   self = allocSmallJson();
  34693   // dict with keys and values
  34694   self->f->setInt(self, "a", 1);
  34695   self->f->setInt(self, "b", 2);
  34696   r = iterStartO(self);
  34697   ck_assert_ptr_ne(r, NULL);
  34698   ck_assert(isOSmallInt(r));
  34699   // dict with objects from other classes
  34700   emptyO(self);
  34701   ip = allocSmallInt(2);
  34702   ip->type = "anothertype";
  34703   self->f->set(self, "d", (baset*)ip);
  34704   r = iterStartO(self);
  34705   ck_assert_ptr_ne(r, NULL);
  34706   // dict with deleted elements
  34707   self->f->setInt(self, "a", 1);
  34708   self->f->delElem(self, "d");
  34709   r = iterStartO(self);
  34710   ck_assert_ptr_ne(r, NULL);
  34711   // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement);
  34712   r = iterStartO(self);
  34713   ck_assert_ptr_ne(r, NULL);
  34714   // empty self
  34715   emptyO(self);
  34716   r = iterStartO(self);
  34717   ck_assert_ptr_eq(r, NULL);
  34718   emptyO(self);
  34719   r = iterStartO(self);
  34720   ck_assert_ptr_eq(r, NULL);
  34721   terminateO(self);
  34722 
  34723 }
  34724 
  34725 
  34726 void iterStartKeySmallJsonT(CuTest *tc UNUSED) {
  34727 
  34728   const char* r;
  34729   smallJsont *self = allocSmallJson();
  34730 
  34731   // non json dict
  34732   r = iterStartKeyO(self);
  34733   ck_assert_ptr_eq(r, NULL);
  34734   // json dict
  34735   // dict with keys and values
  34736   self->f->setInt(self, "a", 1);
  34737   self->f->setInt(self, "b", 2);
  34738   r = iterStartKeyO(self);
  34739   ck_assert_ptr_ne(r, NULL);
  34740   ck_assert_str_eq(r, "a");
  34741   // dict with objects from other classes
  34742   emptyO(self);
  34743   smallIntt *ip = allocSmallInt(2);
  34744   ip->type = "anothertype";
  34745   self->f->set(self, "d", (baset*)ip);
  34746   r = iterStartKeyO(self);
  34747   ck_assert_ptr_ne(r, NULL);
  34748   ck_assert_str_eq(r, "d");
  34749   // dict with deleted elements
  34750   self->f->setInt(self, "a", 1);
  34751   self->f->delElem(self, "d");
  34752   r = iterStartKeyO(self);
  34753   ck_assert_ptr_ne(r, NULL);
  34754   ck_assert_str_eq(r, "a");
  34755   // call iterStart again to trigger if (self->iterElementDataType != SH_DT_BASET) finishO(self->iterElement);
  34756   r = iterStartKeyO(self);
  34757   ck_assert_ptr_ne(r, NULL);
  34758   ck_assert_str_eq(r, "a");
  34759   // empty self
  34760   emptyO(self);
  34761   r = iterStartKeyO(self);
  34762   ck_assert_ptr_eq(r, NULL);
  34763   terminateO(self);
  34764 
  34765 }
  34766 
  34767 
  34768 void iterStartLastSmallJsonT(CuTest *tc UNUSED) {
  34769 
  34770   baset* r;
  34771   smallJsont *self = allocSmallJson();
  34772 
  34773   // non json array
  34774   r = iterStartLastO(self);
  34775   ck_assert_ptr_eq(r, NULL);
  34776   // array with sObjects
  34777   self->f->pushUndefined(self);
  34778   self->f->pushBool(self, true);
  34779   r = iterStartLastO(self);
  34780   ck_assert_ptr_ne(r, NULL);
  34781   ck_assert(isOSmallBool(r));
  34782   // start again
  34783   r = iterStartLastO(self);
  34784   ck_assert_ptr_ne(r, NULL);
  34785   ck_assert(isOSmallBool(r));
  34786   // array with objects from other classes
  34787   emptyO(self);
  34788   createAllocateSmallInt(ip);
  34789   ip->type = "anothertype";
  34790   setValG(ip, 11);
  34791   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34792   ck_assert_ptr_ne(r2, NULL);
  34793   r = iterStartLastO(self);
  34794   ck_assert_ptr_ne(r, NULL);
  34795   ck_assert(isOType(r, "anothertype"));
  34796   // array with all deleted elements
  34797   emptyO(self);
  34798   self->f->pushUndefined(self);
  34799   delElemIndexO(self, 0);
  34800   r = iterStartLastO(self);
  34801   ck_assert_ptr_eq(r, NULL);
  34802   // empty array
  34803   emptyO(self);
  34804   r = iterStartLastO(self);
  34805   ck_assert_ptr_eq(r, NULL);
  34806   terminateO(self);
  34807 
  34808 }
  34809 
  34810 
  34811 void iterStartFromSmallJsonT(CuTest *tc UNUSED) {
  34812 
  34813   baset* r;
  34814   smallJsont *self = allocSmallJson();
  34815 
  34816   // non json array
  34817   r = iterStartFromO(self, 0);
  34818   ck_assert_ptr_eq(r, NULL);
  34819   // array with sObjects
  34820   self->f->pushUndefined(self);
  34821   self->f->pushBool(self, true);
  34822   r = iterStartFromO(self, 1);
  34823   ck_assert_ptr_ne(r, NULL);
  34824   ck_assert(isOSmallBool(r));
  34825   // start again
  34826   r = iterStartFromO(self, 1);
  34827   ck_assert_ptr_ne(r, NULL);
  34828   ck_assert(isOSmallBool(r));
  34829   // array with objects from other classes
  34830   emptyO(self);
  34831   self->f->pushUndefined(self);
  34832   createAllocateSmallInt(ip);
  34833   ip->type = "anothertype";
  34834   setValG(ip, 11);
  34835   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34836   ck_assert_ptr_ne(r2, NULL);
  34837   r = iterStartFromO(self, -1);
  34838   ck_assert_ptr_ne(r, NULL);
  34839   ck_assert(isOType(r, "anothertype"));
  34840   // index outside array
  34841   r = iterStartFromO(self, 2);
  34842   ck_assert_ptr_eq(r, NULL);
  34843   r = iterStartFromO(self, -3);
  34844   ck_assert_ptr_eq(r, NULL);
  34845   // array with all deleted elements
  34846   // except the ones before the start index
  34847   emptyO(self);
  34848   self->f->pushUndefined(self);
  34849   self->f->pushUndefined(self);
  34850   self->f->pushUndefined(self);
  34851   delElemIndexO(self, 1);
  34852   delElemIndexO(self, 2);
  34853   r = iterStartFromO(self, 1);
  34854   ck_assert_ptr_eq(r, NULL);
  34855   // array with all deleted elements
  34856   emptyO(self);
  34857   self->f->pushUndefined(self);
  34858   self->f->pushUndefined(self);
  34859   self->f->pushUndefined(self);
  34860   delElemIndexO(self, 0);
  34861   delElemIndexO(self, 1);
  34862   delElemIndexO(self, 2);
  34863   r = iterStartFromO(self, 1);
  34864   ck_assert_ptr_eq(r, NULL);
  34865   // empty array
  34866   emptyO(self);
  34867   r = iterStartFromO(self, 1);
  34868   ck_assert_ptr_eq(r, NULL);
  34869   terminateO(self);
  34870 
  34871 }
  34872 
  34873 
  34874 void iterStartFromStepSmallJsonT(CuTest *tc UNUSED) {
  34875 
  34876   baset* r;
  34877   smallJsont *self = allocSmallJson();
  34878 
  34879   // non json array
  34880   r = iterStartFromStepO(self, 0, 1);
  34881   ck_assert_ptr_eq(r, NULL);
  34882   // array with sObjects
  34883   self->f->pushUndefined(self);
  34884   self->f->pushBool(self, true);
  34885   r = iterStartFromStepO(self, 1, 2);
  34886   ck_assert_ptr_ne(r, NULL);
  34887   ck_assert(isOSmallBool(r));
  34888   // start again
  34889   r = iterStartFromStepO(self, 1, 2);
  34890   ck_assert_ptr_ne(r, NULL);
  34891   ck_assert(isOSmallBool(r));
  34892   // array with objects from other classes
  34893   emptyO(self);
  34894   self->f->pushUndefined(self);
  34895   createAllocateSmallInt(ip);
  34896   ip->type = "anothertype";
  34897   setValG(ip, 11);
  34898   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34899   ck_assert_ptr_ne(r2, NULL);
  34900   r = iterStartFromStepO(self, -1, 2);
  34901   ck_assert_ptr_ne(r, NULL);
  34902   ck_assert(isOType(r, "anothertype"));
  34903   // index outside array
  34904   r = iterStartFromStepO(self, 2, 1);
  34905   ck_assert_ptr_eq(r, NULL);
  34906   r = iterStartFromStepO(self, -3, 1);
  34907   ck_assert_ptr_eq(r, NULL);
  34908   // array with all deleted elements
  34909   // except the ones before the start index
  34910   emptyO(self);
  34911   self->f->pushUndefined(self);
  34912   self->f->pushUndefined(self);
  34913   self->f->pushUndefined(self);
  34914   delElemIndexO(self, 1);
  34915   delElemIndexO(self, 2);
  34916   r = iterStartFromStepO(self, 1, 1);
  34917   ck_assert_ptr_eq(r, NULL);
  34918   //    negative step
  34919   r = iterStartFromStepO(self, 1, -1);
  34920   ck_assert_ptr_ne(r, NULL);
  34921   ck_assert(isOUndefined(r));
  34922   // array with all deleted elements
  34923   emptyO(self);
  34924   self->f->pushUndefined(self);
  34925   self->f->pushUndefined(self);
  34926   self->f->pushUndefined(self);
  34927   delElemIndexO(self, 0);
  34928   delElemIndexO(self, 1);
  34929   delElemIndexO(self, 2);
  34930   r = iterStartFromStepO(self, 1, 2);
  34931   ck_assert_ptr_eq(r, NULL);
  34932   // empty array
  34933   emptyO(self);
  34934   r = iterStartFromStepO(self, 1, 1);
  34935   ck_assert_ptr_eq(r, NULL);
  34936   // step 0
  34937   self->f->pushUndefined(self);
  34938   r = iterStartFromStepO(self, 0, 0);
  34939   ck_assert_ptr_eq(r, NULL);
  34940   terminateO(self);
  34941 
  34942 }
  34943 
  34944 
  34945 void iterNextSmallJsonT(CuTest *tc UNUSED) {
  34946 
  34947   baset* r;
  34948   smallJsont *self = allocSmallJson();
  34949 
  34950   // json array
  34951   // array with sObjects
  34952   self->f->pushUndefined(self);
  34953   self->f->pushBool(self, true);
  34954   r = iterStartO(self);
  34955   ck_assert_ptr_ne(r, NULL);
  34956   ck_assert(isOUndefined(r));
  34957   r = iterNextO(self);
  34958   ck_assert(isOSmallBool(r));
  34959   // array with objects from other classes
  34960   emptyO(self);
  34961   createAllocateSmallInt(ip);
  34962   ip->type = "anothertype";
  34963   setValG(ip, 11);
  34964   smallJsont *r2 = self->f->push(self, (baset*)ip);
  34965   ck_assert_ptr_ne(r2, NULL);
  34966   createAllocateSmallInt(ip2);
  34967   ip2->type = "anothertype2";
  34968   setValG(ip2, 11);
  34969   r2        = self->f->push(self, (baset*)ip2);
  34970   ck_assert_ptr_ne(r2, NULL);
  34971   r = iterStartO(self);
  34972   ck_assert_ptr_ne(r, NULL);
  34973   ck_assert(isOType(r, "anothertype"));
  34974   r = iterNextO(self);
  34975   ck_assert_ptr_ne(r, NULL);
  34976   ck_assert_str_eq(r->type, "anothertype2");
  34977   //    iteration ended
  34978   r = iterNextO(self);
  34979   ck_assert_ptr_eq(r, NULL);
  34980   // array with all deleted elements
  34981   emptyO(self);
  34982   self->f->pushUndefined(self);
  34983   delElemIndexO(self, 0);
  34984   r = iterStartO(self);
  34985   ck_assert_ptr_eq(r, NULL);
  34986   // empty array
  34987   emptyO(self);
  34988   r = iterStartO(self);
  34989   ck_assert_ptr_eq(r, NULL);
  34990   // empty array, uninitialized iterator
  34991   emptyO(self);
  34992   r = iterNextO(self);
  34993   ck_assert_ptr_eq(r, NULL);
  34994   terminateO(self);
  34995   // json dict
  34996   self = allocSmallJson();
  34997   // dict with keys and values
  34998   self->f->setInt(self, "a", 1);
  34999   self->f->setInt(self, "b", 2);
  35000   r = iterStartO(self);
  35001   ck_assert_ptr_ne(r, NULL);
  35002   ck_assert(isOSmallInt(r));
  35003   smallIntt *i = (smallIntt*)r;
  35004   ck_assert_int_eq(getValO(i), 1);
  35005   r = iterNextO(self);
  35006   ck_assert_ptr_ne(r, NULL);
  35007   ck_assert(isOSmallInt(r));
  35008   i = (smallIntt*)r;
  35009   ck_assert_int_eq(getValO(i), 2);
  35010   // dict with objects from other classes
  35011   emptyO(self);
  35012   ip = allocSmallInt(2);
  35013   ip->type = "anothertype";
  35014   self->f->set(self, "d", (baset*)ip);
  35015   self->f->setInt(self, "a", 1);
  35016   ip = allocSmallInt(3);
  35017   ip->type = "anothertype2";
  35018   self->f->set(self, "e", (baset*)ip);
  35019   self->f->setInt(self, "b", 2);
  35020   self->f->delElem(self, "a");
  35021   self->f->delElem(self, "b");
  35022   r = iterStartO(self);
  35023   ck_assert_ptr_ne(r, NULL);
  35024   ck_assert(isOType(r, "anothertype"));
  35025   r = iterNextO(self);
  35026   ck_assert_ptr_ne(r, NULL);
  35027   ck_assert(isOType(r, "anothertype2"));
  35028   //    iteration ended
  35029   r = iterNextO(self);
  35030   ck_assert_ptr_eq(r, NULL);
  35031   // empty self, uninitialized iterator
  35032   emptyO(self);
  35033   r = iterNextO(self);
  35034   ck_assert_ptr_eq(r, NULL);
  35035   terminateO(self);
  35036 
  35037 }
  35038 
  35039 
  35040 void iterNextKeySmallJsonT(CuTest *tc UNUSED) {
  35041 
  35042   const char* r;
  35043   smallJsont *self = allocSmallJson();
  35044 
  35045   // non json dict
  35046   r = iterNextKeyO(self);
  35047   ck_assert_ptr_eq(r, NULL);
  35048   // json dict
  35049   // dict with keys and values
  35050   self->f->setInt(self, "a", 1);
  35051   self->f->setInt(self, "b", 2);
  35052   r = iterStartKeyO(self);
  35053   ck_assert_ptr_ne(r, NULL);
  35054   ck_assert_str_eq(r, "a");
  35055   r = iterNextKeyO(self);
  35056   ck_assert_ptr_ne(r, NULL);
  35057   ck_assert_str_eq(r, "b");
  35058   // dict with objects from other classes
  35059   emptyO(self);
  35060   smallIntt *ip = allocSmallInt(2);
  35061   ip->type = "anothertype";
  35062   self->f->set(self, "d", (baset*)ip);
  35063   self->f->setInt(self, "a", 1);
  35064   ip = allocSmallInt(3);
  35065   ip->type = "anothertype2";
  35066   self->f->set(self, "e", (baset*)ip);
  35067   self->f->setInt(self, "b", 2);
  35068   self->f->delElem(self, "a");
  35069   self->f->delElem(self, "b");
  35070   r = iterStartKeyO(self);
  35071   ck_assert_ptr_ne(r, NULL);
  35072   ck_assert_str_eq(r, "d");
  35073   r = iterNextKeyO(self);
  35074   ck_assert_ptr_ne(r, NULL);
  35075   ck_assert_str_eq(r, "e");
  35076   //    iteration ended
  35077   r = iterNextKeyO(self);
  35078   ck_assert_ptr_eq(r, NULL);
  35079   // empty self
  35080   emptyO(self);
  35081   r = iterNextKeyO(self);
  35082   ck_assert_ptr_eq(r, NULL);
  35083   terminateO(self);
  35084 
  35085 }
  35086 
  35087 
  35088 void iterElementSmallJsonT(CuTest *tc UNUSED) {
  35089 
  35090   baset* r;
  35091   smallJsont *self = allocSmallJson();
  35092 
  35093   // start iteration
  35094   self->f->pushUndefined(self);
  35095   r         = iterStartO(self);
  35096   ck_assert_ptr_ne(r, NULL);
  35097   baset *r2 = iterElementO(self);
  35098   ck_assert_ptr_eq(r, r2);
  35099   ck_assert_str_eq(r->type, "undefined");
  35100   // end iteration
  35101   r = iterNextO(self);
  35102   ck_assert_ptr_eq(r, NULL);
  35103   r = iterElementO(self);
  35104   ck_assert_ptr_eq(r, NULL);
  35105   terminateO(self);
  35106 
  35107 }
  35108 
  35109 
  35110 void iterKeySmallJsonT(CuTest *tc UNUSED) {
  35111 
  35112   const char* r;
  35113   smallJsont *self = allocSmallJson();
  35114 
  35115   self->f->setInt(self, "a", 1);
  35116   baset *r2 = iterStartO(self);
  35117   ck_assert_ptr_ne(r2, NULL);
  35118   r = iterKeyO(self);
  35119   ck_assert_ptr_ne(r, NULL);
  35120   ck_assert_str_eq(r, "a");
  35121   // empty self
  35122   freeO(self);
  35123   r = iterKeyO(self);
  35124   ck_assert_ptr_eq(r, NULL);
  35125   terminateO(self);
  35126 
  35127 }
  35128 
  35129 
  35130 void iterIndexSmallJsonT(CuTest *tc UNUSED) {
  35131 
  35132   ssize_t r;
  35133   baset* r2;
  35134   smallJsont *self = allocSmallJson();
  35135 
  35136   // start iteration
  35137   self->f->pushUndefined(self);
  35138   r2 = iterStartO(self);
  35139   ck_assert_ptr_ne(r2, NULL);
  35140   ck_assert_str_eq(r2->type, "undefined");
  35141   r  = iterIndexO(self);
  35142   ck_assert_int_eq(r, 0);
  35143   // end iteration
  35144   r2 = iterNextO(self);
  35145   ck_assert_ptr_eq(r2, NULL);
  35146   r = iterIndexO(self);
  35147   ck_assert_int_eq(r, -1);
  35148   // empty self
  35149   freeO(self);
  35150   r = iterIndexO(self);
  35151   ck_assert_int_eq(r, -1);
  35152   terminateO(self);
  35153 
  35154 }
  35155 
  35156 
  35157 void iterStepSmallJsonT(CuTest *tc UNUSED) {
  35158 
  35159   int64_t r;
  35160   baset* r2;
  35161   smallJsont *self = allocSmallJson();
  35162 
  35163   // start iteration
  35164   self->f->pushUndefined(self);
  35165   r2 = iterStartO(self);
  35166   ck_assert_ptr_ne(r2, NULL);
  35167   ck_assert_str_eq(r2->type, "undefined");
  35168   r  = iterStepO(self);
  35169   ck_assert_int_eq(r, 1);
  35170   // start iterator twice and
  35171   // set step
  35172   r2 =iterStartFromStepO(self, 0, 10);
  35173   ck_assert_ptr_ne(r2, NULL);
  35174   ck_assert_str_eq(r2->type, "undefined");
  35175   r  = iterStepO(self);
  35176   ck_assert_int_eq(r, 10);
  35177   // empty self
  35178   freeO(self);
  35179   r = iterStepO(self);
  35180   ck_assert_int_eq(r, -1);
  35181   terminateO(self);
  35182 
  35183 }
  35184 
  35185 
  35186 void getUndefinedSmallJsonT(CuTest *tc UNUSED) {
  35187 
  35188   undefinedt* r;
  35189   smallJsont *self = allocSmallJson();
  35190 
  35191   smallJsont *r2 = self->f->setUndefined(self, "1");
  35192   ck_assert_ptr_ne(r2, null);
  35193   r = self->f->getUndefined(self, "1");
  35194   ck_assert_ptr_ne(r, null);
  35195   finishO(r);
  35196   // path
  35197   createSmallArray(a);
  35198   createSmallDict(d);
  35199   a.f->pushDict(&a, &d);
  35200   self->f->setArray(self, "array", &a);
  35201   r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  35202   ck_assert_ptr_ne(r2, null);
  35203   r = self->f->getUndefined(self, "\"array\"[0].\"key\"");
  35204   ck_assert_ptr_ne(r, null);
  35205   finishO(r);
  35206   // json bool
  35207   freeO(self);
  35208   setTypeBoolO(self);
  35209   r = self->f->getUndefined(self, "1");
  35210   ck_assert_ptr_eq(r, null);
  35211   // json array
  35212   freeO(self);
  35213   setTypeArrayO(self);
  35214   r = self->f->getUndefined(self, "1");
  35215   ck_assert_ptr_eq(r, null);
  35216   // non existing dict path
  35217   freeO(self);
  35218   r = self->f->getUndefined(self, "\"1\"[1]");
  35219   ck_assert_ptr_eq(r, null);
  35220   //   dict path but the object is an array
  35221   resetO(&a);
  35222   self->f->setArray(self, "1", &a);
  35223   r = self->f->getUndefined(self, "\"1\".\"1\"");
  35224   ck_assert_ptr_eq(r, null);
  35225   //   dict object in path but the key doesn't exists
  35226   resetO(&d);
  35227   self->f->setDict(self, "2", &d);
  35228   r = self->f->getUndefined(self, "\"2\".\"1\".[12]");
  35229   ck_assert_ptr_eq(r, null);
  35230   // non undefined object
  35231   r2 = self->f->setInt(self, "1", 2);
  35232   ck_assert_ptr_ne(r2, null);
  35233   r = self->f->getUndefined(self, "1");
  35234   ck_assert_ptr_eq(r, null);
  35235   // null key
  35236   r = self->f->getUndefined(self, null);
  35237   ck_assert_ptr_eq(r, null);
  35238 	// empty self
  35239   freeO(self);
  35240   r = self->f->getUndefined(self, "1");
  35241   ck_assert_ptr_eq(r, null);
  35242   terminateO(self);
  35243 
  35244 }
  35245 
  35246 
  35247 void getBoolSmallJsonT(CuTest *tc UNUSED) {
  35248 
  35249   bool r;
  35250   smallJsont *self = allocSmallJson();
  35251 
  35252   smallJsont *r2 = self->f->setBool(self, "1", true);
  35253   ck_assert_ptr_ne(r2, null);
  35254   r = self->f->getBool(self, "1");
  35255   ck_assert(r);
  35256   // non bool object
  35257   r2 = self->f->setInt(self, "1", 2);
  35258   ck_assert_ptr_ne(r2, null);
  35259   r = self->f->getBool(self, "1");
  35260   ck_assert(!r);
  35261   // null key
  35262   r = self->f->getBool(self, null);
  35263   ck_assert(!r);
  35264 	// empty self
  35265   freeO(self);
  35266   r = self->f->getBool(self, "1");
  35267   ck_assert(!r);
  35268   terminateO(self);
  35269 
  35270 }
  35271 
  35272 
  35273 void getBoolPSmallJsonT(CuTest *tc UNUSED) {
  35274 
  35275   bool* r;
  35276   smallJsont *self = allocSmallJson();
  35277 
  35278   smallJsont *r2 = self->f->setBool(self, "1", true);
  35279   ck_assert_ptr_ne(r2, null);
  35280   r = self->f->getBoolP(self, "1");
  35281   ck_assert_ptr_ne(r, null);
  35282   ck_assert(*r);
  35283   // non bool object
  35284   r2 = self->f->setInt(self, "1", 2);
  35285   ck_assert_ptr_ne(r2, null);
  35286   r = self->f->getBoolP(self, "1");
  35287   ck_assert_ptr_eq(r, null);
  35288   // null key
  35289   r = self->f->getBoolP(self, null);
  35290   ck_assert_ptr_eq(r, null);
  35291 	// empty self
  35292   freeO(self);
  35293   r = self->f->getBoolP(self, "1");
  35294   ck_assert_ptr_eq(r, null);
  35295   terminateO(self);
  35296 
  35297 }
  35298 
  35299 
  35300 void getDoubleSmallJsonT(CuTest *tc UNUSED) {
  35301 
  35302   double r;
  35303   smallJsont *self = allocSmallJson();
  35304 
  35305   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  35306   ck_assert_ptr_ne(r2, null);
  35307   r = self->f->getDouble(self, "1");
  35308   ck_assert(r == 2.2);
  35309   // non double object
  35310   r2 = self->f->setInt(self, "1", 2);
  35311   ck_assert_ptr_ne(r2, null);
  35312   r = self->f->getDouble(self, "1");
  35313   ck_assert(r == 0);
  35314   // null key
  35315   r = self->f->getDouble(self, null);
  35316   ck_assert(!r);
  35317 	// empty self
  35318   freeO(self);
  35319   r = self->f->getDouble(self, "1");
  35320   ck_assert(!r);
  35321   terminateO(self);
  35322 
  35323 }
  35324 
  35325 
  35326 void getDoublePSmallJsonT(CuTest *tc UNUSED) {
  35327 
  35328   double* r;
  35329   smallJsont *self = allocSmallJson();
  35330 
  35331   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  35332   ck_assert_ptr_ne(r2, null);
  35333   r = self->f->getDoubleP(self, "1");
  35334   ck_assert_ptr_ne(r, null);
  35335   ck_assert(*r == 2.2);
  35336   // non double object
  35337   r2 = self->f->setInt(self, "1", 2);
  35338   ck_assert_ptr_ne(r2, null);
  35339   r = self->f->getDoubleP(self, "1");
  35340   ck_assert_ptr_eq(r, null);
  35341   // null key
  35342   r = self->f->getDoubleP(self, null);
  35343   ck_assert_ptr_eq(r, null);
  35344 	// empty self
  35345   freeO(self);
  35346   r = self->f->getDoubleP(self, "1");
  35347   ck_assert_ptr_eq(r, null);
  35348   terminateO(self);
  35349 
  35350 }
  35351 
  35352 
  35353 void getIntSmallJsonT(CuTest *tc UNUSED) {
  35354 
  35355   int64_t r;
  35356   smallJsont *self = allocSmallJson();
  35357 
  35358   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35359   ck_assert_ptr_ne(r2, null);
  35360   r = self->f->getInt(self, "1");
  35361   ck_assert_int_eq(r, 2);
  35362   // non int object
  35363   r2 = self->f->setBool(self, "1", true);
  35364   ck_assert_ptr_ne(r2, null);
  35365   r = self->f->getInt(self, "1");
  35366   ck_assert(!r);
  35367   // null key
  35368   r = self->f->getInt(self, null);
  35369   ck_assert(!r);
  35370 	// empty self
  35371   freeO(self);
  35372   r = self->f->getInt(self, "1");
  35373   ck_assert(!r);
  35374   terminateO(self);
  35375 
  35376 }
  35377 
  35378 
  35379 void getIntPSmallJsonT(CuTest *tc UNUSED) {
  35380 
  35381   int64_t* r;
  35382   smallJsont *self = allocSmallJson();
  35383 
  35384   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35385   ck_assert_ptr_ne(r2, null);
  35386   r = self->f->getIntP(self, "1");
  35387   ck_assert_ptr_ne(r, null);
  35388   ck_assert_int_eq(*r, 2);
  35389   // non int object
  35390   r2 = self->f->setBool(self, "1", true);
  35391   ck_assert_ptr_ne(r2, null);
  35392   r = self->f->getIntP(self, "1");
  35393   ck_assert_ptr_eq(r, null);
  35394   // null key
  35395   r = self->f->getIntP(self, null);
  35396   ck_assert_ptr_eq(r, null);
  35397 	// empty self
  35398   freeO(self);
  35399   r = self->f->getIntP(self, "1");
  35400   ck_assert_ptr_eq(r, null);
  35401   terminateO(self);
  35402 
  35403 }
  35404 
  35405 
  35406 void getInt32SmallJsonT(CuTest *tc UNUSED) {
  35407 
  35408   int32_t r;
  35409   smallJsont *self = allocSmallJson();
  35410 
  35411   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35412   ck_assert_ptr_ne(r2, null);
  35413   r = self->f->getInt32(self, "1");
  35414   ck_assert_int_eq(r, 2);
  35415   // non int object
  35416   r2 = self->f->setBool(self, "1", true);
  35417   ck_assert_ptr_ne(r2, null);
  35418   r = self->f->getInt32(self, "1");
  35419   ck_assert(!r);
  35420   // null key
  35421   r = self->f->getInt32(self, null);
  35422   ck_assert(!r);
  35423 	// empty self
  35424   freeO(self);
  35425   r = self->f->getInt32(self, "1");
  35426   ck_assert(!r);
  35427   terminateO(self);
  35428 
  35429 }
  35430 
  35431 
  35432 void getInt32PSmallJsonT(CuTest *tc UNUSED) {
  35433 
  35434   int32_t* r;
  35435   smallJsont *self = allocSmallJson();
  35436 
  35437   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35438   ck_assert_ptr_ne(r2, null);
  35439   r = self->f->getInt32P(self, "1");
  35440   ck_assert_ptr_ne(r, null);
  35441   ck_assert_int_eq(*r, 2);
  35442   // non int object
  35443   r2 = self->f->setBool(self, "1", true);
  35444   ck_assert_ptr_ne(r2, null);
  35445   r = self->f->getInt32P(self, "1");
  35446   ck_assert_ptr_eq(r, null);
  35447   // null key
  35448   r = self->f->getInt32P(self, null);
  35449   ck_assert_ptr_eq(r, null);
  35450 	// empty self
  35451   freeO(self);
  35452   r = self->f->getInt32P(self, "1");
  35453   ck_assert_ptr_eq(r, null);
  35454   terminateO(self);
  35455 
  35456 }
  35457 
  35458 
  35459 void getUintSmallJsonT(CuTest *tc UNUSED) {
  35460 
  35461   uint64_t r;
  35462   smallJsont *self = allocSmallJson();
  35463 
  35464   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35465   ck_assert_ptr_ne(r2, null);
  35466   r = self->f->getUint(self, "1");
  35467   ck_assert_int_eq(r, 2);
  35468   // non int object
  35469   r2 = self->f->setBool(self, "1", true);
  35470   ck_assert_ptr_ne(r2, null);
  35471   r = self->f->getUint(self, "1");
  35472   ck_assert(!r);
  35473   // null key
  35474   r = self->f->getUint(self, null);
  35475   ck_assert(!r);
  35476 	// empty self
  35477   freeO(self);
  35478   r = self->f->getUint(self, "1");
  35479   ck_assert(!r);
  35480   terminateO(self);
  35481 
  35482 }
  35483 
  35484 
  35485 void getUintPSmallJsonT(CuTest *tc UNUSED) {
  35486 
  35487   uint64_t* r;
  35488   smallJsont *self = allocSmallJson();
  35489 
  35490   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35491   ck_assert_ptr_ne(r2, null);
  35492   r = self->f->getUintP(self, "1");
  35493   ck_assert_ptr_ne(r, null);
  35494   ck_assert_int_eq(*r, 2);
  35495   // non int object
  35496   r2 = self->f->setBool(self, "1", true);
  35497   ck_assert_ptr_ne(r2, null);
  35498   r = self->f->getUintP(self, "1");
  35499   ck_assert_ptr_eq(r, null);
  35500   // null key
  35501   r = self->f->getUintP(self, null);
  35502   ck_assert_ptr_eq(r, null);
  35503 	// empty self
  35504   freeO(self);
  35505   r = self->f->getUintP(self, "1");
  35506   ck_assert_ptr_eq(r, null);
  35507   terminateO(self);
  35508 
  35509 }
  35510 
  35511 
  35512 void getUint32SmallJsonT(CuTest *tc UNUSED) {
  35513 
  35514   uint32_t r;
  35515   smallJsont *self = allocSmallJson();
  35516 
  35517   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35518   ck_assert_ptr_ne(r2, null);
  35519   r = self->f->getUint32(self, "1");
  35520   ck_assert_int_eq(r, 2);
  35521   // non int object
  35522   r2 = self->f->setBool(self, "1", true);
  35523   ck_assert_ptr_ne(r2, null);
  35524   r = self->f->getUint32(self, "1");
  35525   ck_assert(!r);
  35526   // null key
  35527   r = self->f->getUint32(self, null);
  35528   ck_assert(!r);
  35529 	// empty self
  35530   freeO(self);
  35531   r = self->f->getUint32(self, "1");
  35532   ck_assert(!r);
  35533   terminateO(self);
  35534 
  35535 }
  35536 
  35537 
  35538 void getUint32PSmallJsonT(CuTest *tc UNUSED) {
  35539 
  35540   uint32_t* r;
  35541   smallJsont *self = allocSmallJson();
  35542 
  35543   smallJsont *r2 = self->f->setInt(self, "1", 2);
  35544   ck_assert_ptr_ne(r2, null);
  35545   r = self->f->getUint32P(self, "1");
  35546   ck_assert_ptr_ne(r, null);
  35547   ck_assert_int_eq(*r, 2);
  35548   // non int object
  35549   r2 = self->f->setBool(self, "1", true);
  35550   ck_assert_ptr_ne(r2, null);
  35551   r = self->f->getUint32P(self, "1");
  35552   ck_assert_ptr_eq(r, null);
  35553   // null key
  35554   r = self->f->getUint32P(self, null);
  35555   ck_assert_ptr_eq(r, null);
  35556 	// empty self
  35557   freeO(self);
  35558   r = self->f->getUint32P(self, "1");
  35559   ck_assert_ptr_eq(r, null);
  35560   terminateO(self);
  35561 
  35562 }
  35563 
  35564 
  35565 void getSSmallJsonT(CuTest *tc UNUSED) {
  35566 
  35567   char* r;
  35568   smallJsont *self = allocSmallJson();
  35569 
  35570   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  35571   ck_assert_ptr_ne(r2, null);
  35572   r = self->f->getS(self, "1");
  35573   ck_assert_ptr_ne(r, null);
  35574   ck_assert_str_eq(r, "qwe");
  35575   // non string object
  35576   r2 = self->f->setBool(self, "1", true);
  35577   ck_assert_ptr_ne(r2, null);
  35578   r = self->f->getS(self, "1");
  35579   ck_assert_ptr_eq(r, null);
  35580   // null key
  35581   r = self->f->getS(self, null);
  35582   ck_assert_ptr_eq(r, null);
  35583 	// empty self
  35584   freeO(self);
  35585   r = self->f->getS(self, "1");
  35586   ck_assert_ptr_eq(r, null);
  35587   terminateO(self);
  35588 
  35589 }
  35590 
  35591 
  35592 void getDictSmallJsonT(CuTest *tc UNUSED) {
  35593 
  35594   smallDictt* r;
  35595   smallJsont *self = allocSmallJson();
  35596 
  35597   createAllocateSmallDict(D);
  35598   smallJsont *r2 = self->f->setNFreeDict(self, "1", D);
  35599   ck_assert_ptr_ne(r2, null);
  35600   r = self->f->getDict(self, "1");
  35601   ck_assert_ptr_ne(r, null);
  35602   char *s = toStringO(r);
  35603   finishO(r);
  35604   ck_assert_str_eq(s, "{}");
  35605   free(s);
  35606   // non dict object
  35607   r2 = self->f->setBool(self, "1", true);
  35608   ck_assert_ptr_ne(r2, null);
  35609   r = self->f->getDict(self, "1");
  35610   ck_assert_ptr_eq(r, null);
  35611   // path
  35612   smallDictt *dict = allocSmallDict();
  35613   createSmallArray(a);
  35614   createSmallDict(d);
  35615   a.f->pushDict(&a, &d);
  35616   self->f->setArray(self, "array", &a);
  35617   r2 = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
  35618   ck_assert_ptr_ne(r2, null);
  35619   finishO(dict);
  35620   r = self->f->getDict(self, "\"array\"[0].\"key\"");
  35621   ck_assert_ptr_ne(r, null);
  35622   finishO(r);
  35623   // json bool
  35624   freeO(self);
  35625   setTypeBoolO(self);
  35626   r = self->f->getDict(self, "1");
  35627   ck_assert_ptr_eq(r, null);
  35628   // json array
  35629   freeO(self);
  35630   setTypeArrayO(self);
  35631   r = self->f->getDict(self, "1");
  35632   ck_assert_ptr_eq(r, null);
  35633   // non existing dict path
  35634   freeO(self);
  35635   r = self->f->getDict(self, "\"1\"[1]");
  35636   ck_assert_ptr_eq(r, null);
  35637   //   dict path but the object is an array
  35638   resetO(&a);
  35639   self->f->setArray(self, "1", &a);
  35640   r = self->f->getDict(self, "\"1\".\"1\"");
  35641   ck_assert_ptr_eq(r, null);
  35642   //   dict object in path but the key doesn't exists
  35643   resetO(&d);
  35644   self->f->setDict(self, "2", &d);
  35645   r = self->f->getDict(self, "\"2\".\"1\".[12]");
  35646   ck_assert_ptr_eq(r, null);
  35647   // null key
  35648   r = self->f->getDict(self, null);
  35649   ck_assert_ptr_eq(r, null);
  35650 	// empty self
  35651   freeO(self);
  35652   r = self->f->getDict(self, "1");
  35653   ck_assert_ptr_eq(r, null);
  35654   terminateO(self);
  35655 
  35656 }
  35657 
  35658 
  35659 void getArraySmallJsonT(CuTest *tc UNUSED) {
  35660 
  35661   smallArrayt* r;
  35662   smallJsont *self = allocSmallJson();
  35663 
  35664   createAllocateSmallArray(D);
  35665   smallJsont *r2 = self->f->setNFreeArray(self, "1", D);
  35666   ck_assert_ptr_ne(r2, null);
  35667   r = self->f->getArray(self, "1");
  35668   ck_assert_ptr_ne(r, null);
  35669   char *s = toStringO(r);
  35670   finishO(r);
  35671   ck_assert_str_eq(s, "[]");
  35672   free(s);
  35673   // non Array object
  35674   r2 = self->f->setBool(self, "1", true);
  35675   ck_assert_ptr_ne(r2, null);
  35676   r = self->f->getArray(self, "1");
  35677   ck_assert_ptr_eq(r, null);
  35678   // path
  35679   smallArrayt *array = allocSmallArray();
  35680   createSmallArray(a);
  35681   createSmallDict(d);
  35682   a.f->pushDict(&a, &d);
  35683   self->f->setArray(self, "array", &a);
  35684   r2 = self->f->setArray(self, "\"array\"[0].\"key\"", array);
  35685   ck_assert_ptr_ne(r2, null);
  35686   finishO(array);
  35687   r = self->f->getArray(self, "\"array\"[0].\"key\"");
  35688   ck_assert_ptr_ne(r, null);
  35689   finishO(r);
  35690   // json bool
  35691   freeO(self);
  35692   setTypeBoolO(self);
  35693   r = self->f->getArray(self, "1");
  35694   ck_assert_ptr_eq(r, null);
  35695   // json array
  35696   freeO(self);
  35697   setTypeArrayO(self);
  35698   r = self->f->getArray(self, "1");
  35699   ck_assert_ptr_eq(r, null);
  35700   // non existing dict path
  35701   freeO(self);
  35702   r = self->f->getArray(self, "\"1\"[1]");
  35703   ck_assert_ptr_eq(r, null);
  35704   //   dict path but the object is an array
  35705   resetO(&a);
  35706   self->f->setArray(self, "1", &a);
  35707   r = self->f->getArray(self, "\"1\".\"1\"");
  35708   ck_assert_ptr_eq(r, null);
  35709   //   dict object in path but the key doesn't exists
  35710   resetO(&d);
  35711   self->f->setDict(self, "2", &d);
  35712   r = self->f->getArray(self, "\"2\".\"1\".[12]");
  35713   ck_assert_ptr_eq(r, null);
  35714   // null key
  35715   r = self->f->getArray(self, null);
  35716   ck_assert_ptr_eq(r, null);
  35717 	// empty self
  35718   freeO(self);
  35719   r = self->f->getArray(self, "1");
  35720   ck_assert_ptr_eq(r, null);
  35721   terminateO(self);
  35722 
  35723 }
  35724 
  35725 
  35726 void getSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  35727 
  35728   smallBoolt* r;
  35729   smallJsont *self = allocSmallJson();
  35730 
  35731   createAllocateSmallBool(D);
  35732   smallJsont *r2 = self->f->setNFreeSmallBool(self, "1", D);
  35733   ck_assert_ptr_ne(r2, null);
  35734   r = self->f->getSmallBool(self, "1");
  35735   ck_assert_ptr_ne(r, null);
  35736   char *s = toStringO(r);
  35737   finishO(r);
  35738   ck_assert_str_eq(s, "false");
  35739   free(s);
  35740   // non SmallBool object
  35741   r2 = self->f->setInt(self, "1", 0);
  35742   ck_assert_ptr_ne(r2, null);
  35743   r = self->f->getSmallBool(self, "1");
  35744   ck_assert_ptr_eq(r, null);
  35745   // path
  35746   smallBoolt *value = allocSmallBool(true);
  35747   createSmallArray(a);
  35748   createSmallDict(d);
  35749   a.f->pushDict(&a, &d);
  35750   self->f->setArray(self, "array", &a);
  35751   r2 = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
  35752   ck_assert_ptr_ne(r2, null);
  35753   finishO(value);
  35754   r = self->f->getSmallBool(self, "\"array\"[0].\"key\"");
  35755   ck_assert_ptr_ne(r, null);
  35756   finishO(r);
  35757   // json bool
  35758   freeO(self);
  35759   setTypeBoolO(self);
  35760   r = self->f->getSmallBool(self, "1");
  35761   ck_assert_ptr_eq(r, null);
  35762   // json array
  35763   freeO(self);
  35764   setTypeArrayO(self);
  35765   r = self->f->getSmallBool(self, "1");
  35766   ck_assert_ptr_eq(r, null);
  35767   // non existing dict path
  35768   freeO(self);
  35769   r = self->f->getSmallBool(self, "\"1\"[1]");
  35770   ck_assert_ptr_eq(r, null);
  35771   //   dict path but the object is an array
  35772   resetO(&a);
  35773   self->f->setArray(self, "1", &a);
  35774   r = self->f->getSmallBool(self, "\"1\".\"1\"");
  35775   ck_assert_ptr_eq(r, null);
  35776   //   dict object in path but the key doesn't exists
  35777   resetO(&d);
  35778   self->f->setDict(self, "2", &d);
  35779   r = self->f->getSmallBool(self, "\"2\".\"1\".[12]");
  35780   ck_assert_ptr_eq(r, null);
  35781   // null key
  35782   r = self->f->getSmallBool(self, null);
  35783   ck_assert_ptr_eq(r, null);
  35784 	// empty self
  35785   freeO(self);
  35786   r = self->f->getSmallBool(self, "1");
  35787   ck_assert_ptr_eq(r, null);
  35788   terminateO(self);
  35789 
  35790 }
  35791 
  35792 
  35793 void getSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  35794 
  35795   smallBytest* r;
  35796   smallJsont *self = allocSmallJson();
  35797 
  35798   createAllocateSmallBytes(D);
  35799   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", D);
  35800   ck_assert_ptr_ne(r2, null);
  35801   r = self->f->getSmallBytes(self, "1");
  35802   ck_assert_ptr_ne(r, null);
  35803   char *s = toStringO(r);
  35804   finishO(r);
  35805   ck_assert_str_eq(s, "[]");
  35806   free(s);
  35807   // non SmallBytes object
  35808   r2 = self->f->setBool(self, "1", true);
  35809   ck_assert_ptr_ne(r2, null);
  35810   r = self->f->getSmallBytes(self, "1");
  35811   ck_assert_ptr_eq(r, null);
  35812   // path
  35813   smallBytest *value = allocSmallBytes("qwf", sizeof("qwf"));
  35814   createSmallArray(a);
  35815   createSmallDict(d);
  35816   a.f->pushDict(&a, &d);
  35817   self->f->setArray(self, "array", &a);
  35818   r2 = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
  35819   ck_assert_ptr_ne(r2, null);
  35820   finishO(value);
  35821   r = self->f->getSmallBytes(self, "\"array\"[0].\"key\"");
  35822   ck_assert_ptr_ne(r, null);
  35823   finishO(r);
  35824   // json bool
  35825   freeO(self);
  35826   setTypeBoolO(self);
  35827   r = self->f->getSmallBytes(self, "1");
  35828   ck_assert_ptr_eq(r, null);
  35829   // json array
  35830   freeO(self);
  35831   setTypeArrayO(self);
  35832   r = self->f->getSmallBytes(self, "1");
  35833   ck_assert_ptr_eq(r, null);
  35834   // non existing dict path
  35835   freeO(self);
  35836   r = self->f->getSmallBytes(self, "\"1\"[1]");
  35837   ck_assert_ptr_eq(r, null);
  35838   //   dict path but the object is an array
  35839   resetO(&a);
  35840   self->f->setArray(self, "1", &a);
  35841   r = self->f->getSmallBytes(self, "\"1\".\"1\"");
  35842   ck_assert_ptr_eq(r, null);
  35843   //   dict object in path but the key doesn't exists
  35844   resetO(&d);
  35845   self->f->setDict(self, "2", &d);
  35846   r = self->f->getSmallBytes(self, "\"2\".\"1\".[12]");
  35847   ck_assert_ptr_eq(r, null);
  35848   // null key
  35849   r = self->f->getSmallBytes(self, null);
  35850   ck_assert_ptr_eq(r, null);
  35851 	// empty self
  35852   freeO(self);
  35853   r = self->f->getSmallBytes(self, "1");
  35854   ck_assert_ptr_eq(r, null);
  35855   terminateO(self);
  35856 
  35857 }
  35858 
  35859 
  35860 void getSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  35861 
  35862   smallDoublet* r;
  35863   smallJsont *self = allocSmallJson();
  35864 
  35865   createAllocateSmallDouble(D);
  35866   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "1", D);
  35867   ck_assert_ptr_ne(r2, null);
  35868   r = self->f->getSmallDouble(self, "1");
  35869   ck_assert_ptr_ne(r, null);
  35870   char *s = toStringO(r);
  35871   finishO(r);
  35872   ck_assert_str_eq(s, "0.000000e+00");
  35873   free(s);
  35874   // non SmallDouble object
  35875   r2 = self->f->setBool(self, "1", true);
  35876   ck_assert_ptr_ne(r2, null);
  35877   r = self->f->getSmallDouble(self, "1");
  35878   ck_assert_ptr_eq(r, null);
  35879   // path
  35880   smallDoublet *value = allocSmallDouble(1.2);
  35881   createSmallArray(a);
  35882   createSmallDict(d);
  35883   a.f->pushDict(&a, &d);
  35884   self->f->setArray(self, "array", &a);
  35885   r2 = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
  35886   ck_assert_ptr_ne(r2, null);
  35887   finishO(value);
  35888   r = self->f->getSmallDouble(self, "\"array\"[0].\"key\"");
  35889   ck_assert_ptr_ne(r, null);
  35890   finishO(r);
  35891   // json bool
  35892   freeO(self);
  35893   setTypeBoolO(self);
  35894   r = self->f->getSmallDouble(self, "1");
  35895   ck_assert_ptr_eq(r, null);
  35896   // json array
  35897   freeO(self);
  35898   setTypeArrayO(self);
  35899   r = self->f->getSmallDouble(self, "1");
  35900   ck_assert_ptr_eq(r, null);
  35901   // non existing dict path
  35902   freeO(self);
  35903   r = self->f->getSmallDouble(self, "\"1\"[1]");
  35904   ck_assert_ptr_eq(r, null);
  35905   //   dict path but the object is an array
  35906   resetO(&a);
  35907   self->f->setArray(self, "1", &a);
  35908   r = self->f->getSmallDouble(self, "\"1\".\"1\"");
  35909   ck_assert_ptr_eq(r, null);
  35910   //   dict object in path but the key doesn't exists
  35911   resetO(&d);
  35912   self->f->setDict(self, "2", &d);
  35913   r = self->f->getSmallDouble(self, "\"2\".\"1\".[12]");
  35914   ck_assert_ptr_eq(r, null);
  35915   // null key
  35916   r = self->f->getSmallDouble(self, null);
  35917   ck_assert_ptr_eq(r, null);
  35918 	// empty self
  35919   freeO(self);
  35920   r = self->f->getSmallDouble(self, "1");
  35921   ck_assert_ptr_eq(r, null);
  35922   terminateO(self);
  35923 
  35924 }
  35925 
  35926 
  35927 void getSmallIntSmallJsonT(CuTest *tc UNUSED) {
  35928 
  35929   smallIntt* r;
  35930   smallJsont *self = allocSmallJson();
  35931 
  35932   createAllocateSmallInt(D);
  35933   smallJsont *r2 = self->f->setNFreeSmallInt(self, "1", D);
  35934   ck_assert_ptr_ne(r2, null);
  35935   r = self->f->getSmallInt(self, "1");
  35936   ck_assert_ptr_ne(r, null);
  35937   char *s = toStringO(r);
  35938   finishO(r);
  35939   ck_assert_str_eq(s, "0");
  35940   free(s);
  35941   // non SmallInt object
  35942   r2 = self->f->setBool(self, "1", true);
  35943   ck_assert_ptr_ne(r2, null);
  35944   r = self->f->getSmallInt(self, "1");
  35945   ck_assert_ptr_eq(r, null);
  35946   // path
  35947   smallIntt *value = allocSmallInt(1);
  35948   createSmallArray(a);
  35949   createSmallDict(d);
  35950   a.f->pushDict(&a, &d);
  35951   self->f->setArray(self, "array", &a);
  35952   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  35953   ck_assert_ptr_ne(r2, null);
  35954   finishO(value);
  35955   r = self->f->getSmallInt(self, "\"array\"[0].\"key\"");
  35956   ck_assert_ptr_ne(r, null);
  35957   finishO(r);
  35958   // json bool
  35959   freeO(self);
  35960   setTypeBoolO(self);
  35961   r = self->f->getSmallInt(self, "1");
  35962   ck_assert_ptr_eq(r, null);
  35963   // json array
  35964   freeO(self);
  35965   setTypeArrayO(self);
  35966   r = self->f->getSmallInt(self, "1");
  35967   ck_assert_ptr_eq(r, null);
  35968   // non existing dict path
  35969   freeO(self);
  35970   r = self->f->getSmallInt(self, "\"1\"[1]");
  35971   ck_assert_ptr_eq(r, null);
  35972   //   dict path but the object is an array
  35973   resetO(&a);
  35974   self->f->setArray(self, "1", &a);
  35975   r = self->f->getSmallInt(self, "\"1\".\"1\"");
  35976   ck_assert_ptr_eq(r, null);
  35977   //   dict object in path but the key doesn't exists
  35978   resetO(&d);
  35979   self->f->setDict(self, "2", &d);
  35980   r = self->f->getSmallInt(self, "\"2\".\"1\".[12]");
  35981   ck_assert_ptr_eq(r, null);
  35982   // null key
  35983   r = self->f->getSmallInt(self, null);
  35984   ck_assert_ptr_eq(r, null);
  35985 	// empty self
  35986   freeO(self);
  35987   r = self->f->getSmallInt(self, "1");
  35988   ck_assert_ptr_eq(r, null);
  35989   terminateO(self);
  35990 
  35991 }
  35992 
  35993 
  35994 void getSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  35995 
  35996   smallJsont* r;
  35997   smallJsont *self = allocSmallJson();
  35998 
  35999   createAllocateSmallJson(D);
  36000   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", D);
  36001   ck_assert_ptr_ne(r2, null);
  36002   r = self->f->getSmallJson(self, "1");
  36003   ck_assert_ptr_ne(r, null);
  36004   char *s = toStringO(r);
  36005   finishO(r);
  36006   ck_assert_str_eq(s, "{}");
  36007   free(s);
  36008   r2 = self->f->setBool(self, "1", true);
  36009   ck_assert_ptr_ne(r2, null);
  36010   r = self->f->getSmallJson(self, "1");
  36011   ck_assert_ptr_ne(r, null);
  36012   s = toStringO(r);
  36013   finishO(r);
  36014   ck_assert_str_eq(s, "true");
  36015   free(s);
  36016   // non SmallJson object
  36017   smallContainert *c = allocSmallContainer(NULL);
  36018   r2 = self->f->setNFreeSmallContainer(self, "1", c);
  36019   ck_assert_ptr_ne(r2, null);
  36020   r = self->f->getSmallJson(self, "1");
  36021   ck_assert_ptr_eq(r, null);
  36022   // path
  36023   smallJsont *value = allocSmallJson();
  36024   createSmallArray(a);
  36025   createSmallDict(d);
  36026   a.f->pushDict(&a, &d);
  36027   self->f->setArray(self, "array", &a);
  36028   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
  36029   ck_assert_ptr_ne(r, null);
  36030   finishO(value);
  36031   r = self->f->getSmallJson(self, "\"array\"[0].\"key\"");
  36032   ck_assert_ptr_ne(r, null);
  36033   finishO(r);
  36034   // json bool
  36035   freeO(self);
  36036   setTypeBoolO(self);
  36037   r = self->f->getSmallJson(self, "1");
  36038   ck_assert_ptr_eq(r, null);
  36039   // json array
  36040   freeO(self);
  36041   setTypeArrayO(self);
  36042   r = self->f->getSmallJson(self, "1");
  36043   ck_assert_ptr_eq(r, null);
  36044   // non existing dict path
  36045   freeO(self);
  36046   r = self->f->getSmallJson(self, "\"1\"[1]");
  36047   ck_assert_ptr_eq(r, null);
  36048   //   dict path but the object is an array
  36049   resetO(&a);
  36050   self->f->setArray(self, "1", &a);
  36051   r = self->f->getSmallJson(self, "\"1\".\"1\"");
  36052   ck_assert_ptr_eq(r, null);
  36053   //   dict object in path but the key doesn't exists
  36054   resetO(&d);
  36055   self->f->setDict(self, "2", &d);
  36056   r = self->f->getSmallJson(self, "\"2\".\"1\".[12]");
  36057   ck_assert_ptr_eq(r, null);
  36058   // null key
  36059   r = self->f->getSmallJson(self, null);
  36060   ck_assert_ptr_eq(r, null);
  36061 	// empty self
  36062   freeO(self);
  36063   r = self->f->getSmallJson(self, "1");
  36064   ck_assert_ptr_eq(r, null);
  36065   terminateO(self);
  36066 
  36067 }
  36068 
  36069 
  36070 void getSmallStringSmallJsonT(CuTest *tc UNUSED) {
  36071 
  36072   smallStringt* r;
  36073   smallJsont *self = allocSmallJson();
  36074 
  36075   createAllocateSmallString(D);
  36076   smallJsont *r2 = self->f->setNFreeSmallString(self, "1", D);
  36077   ck_assert_ptr_ne(r2, null);
  36078   r = self->f->getSmallString(self, "1");
  36079   ck_assert_ptr_ne(r, null);
  36080   char *s = toStringO(r);
  36081   finishO(r);
  36082   ck_assert_str_eq(s, "");
  36083   free(s);
  36084   // non SmallString object
  36085   r2 = self->f->setBool(self, "1", true);
  36086   ck_assert_ptr_ne(r2, null);
  36087   r = self->f->getSmallString(self, "1");
  36088   ck_assert_ptr_eq(r, null);
  36089   // path
  36090   smallStringt *value = allocSmallString("asd");
  36091   createSmallArray(a);
  36092   createSmallDict(d);
  36093   a.f->pushDict(&a, &d);
  36094   self->f->setArray(self, "array", &a);
  36095   r2 = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
  36096   ck_assert_ptr_ne(r2, null);
  36097   finishO(value);
  36098   r = self->f->getSmallString(self, "\"array\"[0].\"key\"");
  36099   ck_assert_ptr_ne(r, null);
  36100   finishO(r);
  36101   // json bool
  36102   freeO(self);
  36103   setTypeBoolO(self);
  36104   r = self->f->getSmallString(self, "1");
  36105   ck_assert_ptr_eq(r, null);
  36106   // json array
  36107   freeO(self);
  36108   setTypeArrayO(self);
  36109   r = self->f->getSmallString(self, "1");
  36110   ck_assert_ptr_eq(r, null);
  36111   // non existing dict path
  36112   freeO(self);
  36113   r = self->f->getSmallString(self, "\"1\"[1]");
  36114   ck_assert_ptr_eq(r, null);
  36115   //   dict path but the object is an array
  36116   resetO(&a);
  36117   self->f->setArray(self, "1", &a);
  36118   r = self->f->getSmallString(self, "\"1\".\"1\"");
  36119   ck_assert_ptr_eq(r, null);
  36120   //   dict object in path but the key doesn't exists
  36121   resetO(&d);
  36122   self->f->setDict(self, "2", &d);
  36123   r = self->f->getSmallString(self, "\"2\".\"1\".[12]");
  36124   ck_assert_ptr_eq(r, null);
  36125   // null key
  36126   r = self->f->getSmallString(self, null);
  36127   ck_assert_ptr_eq(r, null);
  36128 	// empty self
  36129   freeO(self);
  36130   r = self->f->getSmallString(self, "1");
  36131   ck_assert_ptr_eq(r, null);
  36132   terminateO(self);
  36133 
  36134 }
  36135 
  36136 
  36137 void getVoidSmallJsonT(CuTest *tc UNUSED) {
  36138 
  36139   void* r;
  36140   smallJsont *self = allocSmallJson();
  36141 
  36142   smallContainert* D = allocSmallContainer(&r);
  36143   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  36144   ck_assert_ptr_ne(r2, null);
  36145   r = self->f->getVoid(self, "1");
  36146   ck_assert_ptr_eq(r, &r);
  36147   // non container object
  36148   r2 = self->f->setBool(self, "1", true);
  36149   ck_assert_ptr_ne(r2, null);
  36150   r = self->f->getVoid(self, "1");
  36151   ck_assert_ptr_eq(r, null);
  36152   // path
  36153   smallContainert *value = allocSmallContainer(&r);
  36154   createSmallArray(a);
  36155   createSmallDict(d);
  36156   a.f->pushDict(&a, &d);
  36157   self->f->setArray(self, "array", &a);
  36158   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  36159   ck_assert_ptr_ne(r2, null);
  36160   finishO(value);
  36161   r = self->f->getVoid(self, "\"array\"[0].\"key\"");
  36162   ck_assert_ptr_ne(r, null);
  36163   // json bool
  36164   freeO(self);
  36165   setTypeBoolO(self);
  36166   r = self->f->getVoid(self, "1");
  36167   ck_assert_ptr_eq(r, null);
  36168   // json array
  36169   freeO(self);
  36170   setTypeArrayO(self);
  36171   r = self->f->getVoid(self, "1");
  36172   ck_assert_ptr_eq(r, null);
  36173   // non existing dict path
  36174   freeO(self);
  36175   r = self->f->getVoid(self, "\"1\"[1]");
  36176   ck_assert_ptr_eq(r, null);
  36177   //   dict path but the object is an array
  36178   resetO(&a);
  36179   self->f->setArray(self, "1", &a);
  36180   r = self->f->getVoid(self, "\"1\".\"1\"");
  36181   ck_assert_ptr_eq(r, null);
  36182   //   dict object in path but the key doesn't exists
  36183   resetO(&d);
  36184   self->f->setDict(self, "2", &d);
  36185   r = self->f->getVoid(self, "\"2\".\"1\".[12]");
  36186   ck_assert_ptr_eq(r, null);
  36187   // null key
  36188   r = self->f->getVoid(self, null);
  36189   ck_assert_ptr_eq(r, null);
  36190 	// empty self
  36191   freeO(self);
  36192   r = self->f->getVoid(self, "1");
  36193   ck_assert_ptr_eq(r, null);
  36194   terminateO(self);
  36195 
  36196 }
  36197 
  36198 
  36199 void getSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  36200 
  36201   smallContainert* r;
  36202   smallJsont *self = allocSmallJson();
  36203 
  36204   createAllocateSmallContainer(D);
  36205   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  36206   ck_assert_ptr_ne(r2, null);
  36207   r = self->f->getSmallContainer(self, "1");
  36208   ck_assert_ptr_ne(r, null);
  36209   char *s = toStringO(r);
  36210   finishO(r);
  36211   ck_assert_str_eq(s, "<data smallContainer>");
  36212   free(s);
  36213   // other base class
  36214   smallIntt *t = allocSmallInt(2);
  36215   t->type = "randomClass";
  36216   r2 = self->f->setNFree(self, "1", (baset*)t);
  36217   ck_assert_ptr_ne(r2, null);
  36218   r = self->f->getSmallContainer(self, "1");
  36219   ck_assert_ptr_eq(r, null);
  36220   // non SmallContainer object
  36221   r2 = self->f->setBool(self, "1", true);
  36222   ck_assert_ptr_ne(r2, null);
  36223   r = self->f->getSmallContainer(self, "1");
  36224   ck_assert_ptr_eq(r, null);
  36225   // path
  36226   smallContainert *value = allocSmallContainer(null);
  36227   createSmallArray(a);
  36228   createSmallDict(d);
  36229   a.f->pushDict(&a, &d);
  36230   self->f->setArray(self, "array", &a);
  36231   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  36232   ck_assert_ptr_ne(r2, null);
  36233   finishO(value);
  36234   r = self->f->getSmallContainer(self, "\"array\"[0].\"key\"");
  36235   ck_assert_ptr_ne(r, null);
  36236   finishO(r);
  36237   // json bool
  36238   freeO(self);
  36239   setTypeBoolO(self);
  36240   r = self->f->getSmallContainer(self, "1");
  36241   ck_assert_ptr_eq(r, null);
  36242   // json array
  36243   freeO(self);
  36244   setTypeArrayO(self);
  36245   r = self->f->getSmallContainer(self, "1");
  36246   ck_assert_ptr_eq(r, null);
  36247   // non existing dict path
  36248   freeO(self);
  36249   r = self->f->getSmallContainer(self, "\"1\"[1]");
  36250   ck_assert_ptr_eq(r, null);
  36251   //   dict path but the object is an array
  36252   resetO(&a);
  36253   self->f->setArray(self, "1", &a);
  36254   r = self->f->getSmallContainer(self, "\"1\".\"1\"");
  36255   ck_assert_ptr_eq(r, null);
  36256   //   dict object in path but the key doesn't exists
  36257   resetO(&d);
  36258   self->f->setDict(self, "2", &d);
  36259   r = self->f->getSmallContainer(self, "\"2\".\"1\".[12]");
  36260   ck_assert_ptr_eq(r, null);
  36261   // null key
  36262   r = self->f->getSmallContainer(self, null);
  36263   ck_assert_ptr_eq(r, null);
  36264 	// empty self
  36265   freeO(self);
  36266   r = self->f->getSmallContainer(self, "1");
  36267   ck_assert_ptr_eq(r, null);
  36268   terminateO(self);
  36269 
  36270 }
  36271 
  36272 
  36273 void getNDupSmallJsonT(CuTest *tc UNUSED) {
  36274 
  36275   baset* r;
  36276   smallJsont *self = allocSmallJson();
  36277 
  36278   smallIntt *c   = allocSmallInt(2);
  36279   smallJsont *r2 = self->f->setNFree(self, "1", (baset*) c);
  36280   ck_assert_ptr_ne(r2, null);
  36281   r = self->f->getNDup(self, "1");
  36282   ck_assert_ptr_ne(r, null);
  36283   char *s = toStringO(r);
  36284   terminateO(r);
  36285   ck_assert_str_eq(s, "2");
  36286   free(s);
  36287   // other base class
  36288   smallIntt *t = allocSmallInt(3);
  36289   t->type = "randomClass";
  36290   r2 = self->f->setNFree(self, "1", (baset*)t);
  36291   ck_assert_ptr_ne(r2, null);
  36292   r = self->f->getNDup(self, "1");
  36293   ck_assert_ptr_ne(r, null);
  36294   s = toStringO(r);
  36295   terminateO(r);
  36296   ck_assert_str_eq(s, "3");
  36297   free(s);
  36298   // path
  36299   smallIntt *value = allocSmallInt(1);
  36300   createSmallArray(a);
  36301   createSmallDict(d);
  36302   a.f->pushDict(&a, &d);
  36303   self->f->setArray(self, "array", &a);
  36304   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  36305   ck_assert_ptr_ne(r2, null);
  36306   finishO(value);
  36307   r = self->f->getNDup(self, "\"array\"[0].\"key\"");
  36308   ck_assert_ptr_ne(r, null);
  36309   terminateO(r);
  36310   // json bool
  36311   freeO(self);
  36312   setTypeBoolO(self);
  36313   r = self->f->getNDup(self, "1");
  36314   ck_assert_ptr_eq(r, null);
  36315   // json array
  36316   freeO(self);
  36317   setTypeArrayO(self);
  36318   r = self->f->getNDup(self, "1");
  36319   ck_assert_ptr_eq(r, null);
  36320   // non existing dict path
  36321   freeO(self);
  36322   r = self->f->getNDup(self, "\"1\"[1]");
  36323   ck_assert_ptr_eq(r, null);
  36324   //   dict path but the object is an array
  36325   resetO(&a);
  36326   self->f->setArray(self, "1", &a);
  36327   r = self->f->getNDup(self, "\"1\".\"1\"");
  36328   ck_assert_ptr_eq(r, null);
  36329   //   dict object in path but the key doesn't exists
  36330   resetO(&d);
  36331   self->f->setDict(self, "2", &d);
  36332   r = self->f->getNDup(self, "\"2\".\"1\".[12]");
  36333   ck_assert_ptr_eq(r, null);
  36334   // null key
  36335   r = self->f->getNDup(self, null);
  36336   ck_assert_ptr_eq(r, null);
  36337 	// empty self
  36338   freeO(self);
  36339   r = self->f->getNDup(self, "1");
  36340   ck_assert_ptr_eq(r, null);
  36341   terminateO(self);
  36342 
  36343 }
  36344 
  36345 
  36346 void getNDupUndefinedSmallJsonT(CuTest *tc UNUSED) {
  36347 
  36348   undefinedt* r;
  36349   smallJsont *self = allocSmallJson();
  36350 
  36351   smallJsont *r2 = self->f->setUndefined(self, "1");
  36352   ck_assert_ptr_ne(r2, null);
  36353   r = self->f->getNDupUndefined(self, "1");
  36354   ck_assert_ptr_ne(r, null);
  36355   terminateO(r);
  36356   // non undefined object
  36357   r2 = self->f->setInt(self, "1", 2);
  36358   ck_assert_ptr_ne(r2, null);
  36359   r = self->f->getNDupUndefined(self, "1");
  36360   ck_assert_ptr_eq(r, null);
  36361   // path
  36362   createSmallArray(a);
  36363   createSmallDict(d);
  36364   a.f->pushDict(&a, &d);
  36365   self->f->setArray(self, "array", &a);
  36366   r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  36367   ck_assert_ptr_ne(r2, null);
  36368   r = self->f->getNDupUndefined(self, "\"array\"[0].\"key\"");
  36369   ck_assert_ptr_ne(r, null);
  36370   terminateO(r);
  36371   // json bool
  36372   freeO(self);
  36373   setTypeBoolO(self);
  36374   r = self->f->getNDupUndefined(self, "1");
  36375   ck_assert_ptr_eq(r, null);
  36376   // json array
  36377   freeO(self);
  36378   setTypeArrayO(self);
  36379   r = self->f->getNDupUndefined(self, "1");
  36380   ck_assert_ptr_eq(r, null);
  36381   // non existing dict path
  36382   freeO(self);
  36383   r = self->f->getNDupUndefined(self, "\"1\"[1]");
  36384   ck_assert_ptr_eq(r, null);
  36385   //   dict path but the object is an array
  36386   resetO(&a);
  36387   self->f->setArray(self, "1", &a);
  36388   r = self->f->getNDupUndefined(self, "\"1\".\"1\"");
  36389   ck_assert_ptr_eq(r, null);
  36390   //   dict object in path but the key doesn't exists
  36391   resetO(&d);
  36392   self->f->setDict(self, "2", &d);
  36393   r = self->f->getNDupUndefined(self, "\"2\".\"1\".[12]");
  36394   ck_assert_ptr_eq(r, null);
  36395   // null key
  36396   r = self->f->getNDupUndefined(self, null);
  36397   ck_assert_ptr_eq(r, null);
  36398 	// empty self
  36399   freeO(self);
  36400   r = self->f->getNDupUndefined(self, "1");
  36401   ck_assert_ptr_eq(r, null);
  36402   terminateO(self);
  36403 
  36404 }
  36405 
  36406 
  36407 void getNDupBoolSmallJsonT(CuTest *tc UNUSED) {
  36408 
  36409   bool r;
  36410   smallJsont *self = allocSmallJson();
  36411 
  36412   smallJsont *r2 = self->f->setBool(self, "1", true);
  36413   ck_assert_ptr_ne(r2, null);
  36414   r = self->f->getNDupBool(self, "1");
  36415   ck_assert(r);
  36416   // non bool object
  36417   r2 = self->f->setInt(self, "1", 2);
  36418   ck_assert_ptr_ne(r2, null);
  36419   r = self->f->getNDupBool(self, "1");
  36420   ck_assert(!r);
  36421   // null key
  36422   r = self->f->getNDupBool(self, null);
  36423   ck_assert(!r);
  36424 	// empty self
  36425   freeO(self);
  36426   r = self->f->getNDupBool(self, "1");
  36427   ck_assert(!r);
  36428   terminateO(self);
  36429 
  36430 }
  36431 
  36432 
  36433 void getNDupDoubleSmallJsonT(CuTest *tc UNUSED) {
  36434 
  36435   double r;
  36436   smallJsont *self = allocSmallJson();
  36437 
  36438   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  36439   ck_assert_ptr_ne(r2, null);
  36440   r = self->f->getNDupDouble(self, "1");
  36441   ck_assert(r == 2.2);
  36442   // non double object
  36443   r2 = self->f->setInt(self, "1", 2);
  36444   ck_assert_ptr_ne(r2, null);
  36445   r = self->f->getNDupDouble(self, "1");
  36446   ck_assert(r == 0);
  36447   // null key
  36448   r = self->f->getNDupDouble(self, null);
  36449   ck_assert(r == 0);
  36450 	// empty self
  36451   freeO(self);
  36452   r = self->f->getNDupDouble(self, "1");
  36453   ck_assert(!r);
  36454   terminateO(self);
  36455 
  36456 }
  36457 
  36458 
  36459 void getNDupIntSmallJsonT(CuTest *tc UNUSED) {
  36460 
  36461   int64_t r;
  36462   smallJsont *self = allocSmallJson();
  36463 
  36464   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36465   ck_assert_ptr_ne(r2, null);
  36466   r = self->f->getNDupInt(self, "1");
  36467   ck_assert_int_eq(r, 2);
  36468   // non int object
  36469   r2 = self->f->setBool(self, "1", true);
  36470   ck_assert_ptr_ne(r2, null);
  36471   r = self->f->getNDupInt(self, "1");
  36472   ck_assert(!r);
  36473   // null key
  36474   r = self->f->getNDupInt(self, null);
  36475   ck_assert_int_eq(r, 0);
  36476 	// empty self
  36477   freeO(self);
  36478   r = self->f->getNDupInt(self, "1");
  36479   ck_assert(!r);
  36480   terminateO(self);
  36481 
  36482 }
  36483 
  36484 
  36485 void getNDupInt32SmallJsonT(CuTest *tc UNUSED) {
  36486 
  36487   int32_t r;
  36488   smallJsont *self = allocSmallJson();
  36489 
  36490   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36491   ck_assert_ptr_ne(r2, null);
  36492   r = self->f->getNDupInt32(self, "1");
  36493   ck_assert_int_eq(r, 2);
  36494   // non int object
  36495   r2 = self->f->setBool(self, "1", true);
  36496   ck_assert_ptr_ne(r2, null);
  36497   r = self->f->getNDupInt32(self, "1");
  36498   ck_assert(!r);
  36499   // null key
  36500   r = self->f->getNDupInt32(self, null);
  36501   ck_assert_int_eq(r, 0);
  36502 	// empty self
  36503   freeO(self);
  36504   r = self->f->getNDupInt32(self, "1");
  36505   ck_assert(!r);
  36506   terminateO(self);
  36507 
  36508 }
  36509 
  36510 
  36511 void getNDupUintSmallJsonT(CuTest *tc UNUSED) {
  36512 
  36513   uint64_t r;
  36514   smallJsont *self = allocSmallJson();
  36515 
  36516   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36517   ck_assert_ptr_ne(r2, null);
  36518   r = self->f->getNDupUint(self, "1");
  36519   ck_assert_int_eq(r, 2);
  36520   // non int object
  36521   r2 = self->f->setBool(self, "1", true);
  36522   ck_assert_ptr_ne(r2, null);
  36523   r = self->f->getNDupUint(self, "1");
  36524   ck_assert(!r);
  36525   // null key
  36526   r = self->f->getNDupUint(self, null);
  36527   ck_assert_int_eq(r, 0);
  36528 	// empty self
  36529   freeO(self);
  36530   r = self->f->getNDupUint(self, "1");
  36531   ck_assert(!r);
  36532   terminateO(self);
  36533 
  36534 }
  36535 
  36536 
  36537 void getNDupUint32SmallJsonT(CuTest *tc UNUSED) {
  36538 
  36539   uint32_t r;
  36540   smallJsont *self = allocSmallJson();
  36541 
  36542   smallJsont *r2 = self->f->setInt(self, "1", 2);
  36543   ck_assert_ptr_ne(r2, null);
  36544   r = self->f->getNDupUint32(self, "1");
  36545   ck_assert_int_eq(r, 2);
  36546   // non int object
  36547   r2 = self->f->setBool(self, "1", true);
  36548   ck_assert_ptr_ne(r2, null);
  36549   r = self->f->getNDupUint32(self, "1");
  36550   ck_assert(!r);
  36551   // null key
  36552   r = self->f->getNDupUint32(self, null);
  36553   ck_assert_int_eq(r, 0);
  36554 	// empty self
  36555   freeO(self);
  36556   r = self->f->getNDupUint32(self, "1");
  36557   ck_assert(!r);
  36558   terminateO(self);
  36559 
  36560 }
  36561 
  36562 
  36563 void getNDupSSmallJsonT(CuTest *tc UNUSED) {
  36564 
  36565   char* r;
  36566   smallJsont *self = allocSmallJson();
  36567 
  36568   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  36569   ck_assert_ptr_ne(r2, null);
  36570   r = self->f->getNDupS(self, "1");
  36571   ck_assert_ptr_ne(r, null);
  36572   ck_assert_str_eq(r, "qwe");
  36573   free(r);
  36574   // non string object
  36575   r2 = self->f->setBool(self, "1", true);
  36576   ck_assert_ptr_ne(r2, null);
  36577   r = self->f->getNDupS(self, "1");
  36578   ck_assert_ptr_eq(r, null);
  36579   // null key
  36580   r = self->f->getNDupS(self, null);
  36581   ck_assert_ptr_eq(r, null);
  36582 	// empty self
  36583   freeO(self);
  36584   r = self->f->getNDupS(self, "1");
  36585   ck_assert_ptr_eq(r, null);
  36586   terminateO(self);
  36587 
  36588 }
  36589 
  36590 
  36591 void getNDupDictSmallJsonT(CuTest *tc UNUSED) {
  36592 
  36593   smallDictt* r;
  36594   smallJsont *self = allocSmallJson();
  36595 
  36596   createAllocateSmallDict(D);
  36597   smallJsont *r2 = self->f->setNFreeDict(self, "1", D);
  36598   ck_assert_ptr_ne(r2, null);
  36599   r = self->f->getNDupDict(self, "1");
  36600   ck_assert_ptr_ne(r, null);
  36601   char *s = toStringO(r);
  36602   terminateO(r);
  36603   ck_assert_str_eq(s, "{}");
  36604   free(s);
  36605   // non dict object
  36606   r2 = self->f->setBool(self, "1", true);
  36607   ck_assert_ptr_ne(r2, null);
  36608   r = self->f->getNDupDict(self, "1");
  36609   ck_assert_ptr_eq(r, null);
  36610   // path
  36611   smallDictt *dict = allocSmallDict();
  36612   createSmallArray(a);
  36613   createSmallDict(d);
  36614   a.f->pushDict(&a, &d);
  36615   self->f->setArray(self, "array", &a);
  36616   r2 = self->f->setDict(self, "\"array\"[0].\"key\"", dict);
  36617   ck_assert_ptr_ne(r2, null);
  36618   finishO(dict);
  36619   r = self->f->getNDupDict(self, "\"array\"[0].\"key\"");
  36620   ck_assert_ptr_ne(r, null);
  36621   terminateO(r);
  36622   // json bool
  36623   freeO(self);
  36624   setTypeBoolO(self);
  36625   r = self->f->getNDupDict(self, "1");
  36626   ck_assert_ptr_eq(r, null);
  36627   // json array
  36628   freeO(self);
  36629   setTypeArrayO(self);
  36630   r = self->f->getNDupDict(self, "1");
  36631   ck_assert_ptr_eq(r, null);
  36632   // non existing dict path
  36633   freeO(self);
  36634   r = self->f->getNDupDict(self, "\"1\"[1]");
  36635   ck_assert_ptr_eq(r, null);
  36636   //   dict path but the object is an array
  36637   resetO(&a);
  36638   self->f->setArray(self, "1", &a);
  36639   r = self->f->getNDupDict(self, "\"1\".\"1\"");
  36640   ck_assert_ptr_eq(r, null);
  36641   //   dict object in path but the key doesn't exists
  36642   resetO(&d);
  36643   self->f->setDict(self, "2", &d);
  36644   r = self->f->getNDupDict(self, "\"2\".\"1\".[12]");
  36645   ck_assert_ptr_eq(r, null);
  36646   // null key
  36647   r = self->f->getNDupDict(self, null);
  36648   ck_assert_ptr_eq(r, null);
  36649 	// empty self
  36650   freeO(self);
  36651   r = self->f->getNDupDict(self, "1");
  36652   ck_assert_ptr_eq(r, null);
  36653   terminateO(self);
  36654 
  36655 }
  36656 
  36657 
  36658 void getNDupArraySmallJsonT(CuTest *tc UNUSED) {
  36659 
  36660   smallArrayt* r;
  36661   smallJsont *self = allocSmallJson();
  36662 
  36663   createAllocateSmallArray(D);
  36664   smallJsont *r2 = self->f->setNFreeArray(self, "1", D);
  36665   ck_assert_ptr_ne(r2, null);
  36666   r = self->f->getNDupArray(self, "1");
  36667   ck_assert_ptr_ne(r, null);
  36668   char *s = toStringO(r);
  36669   terminateO(r);
  36670   ck_assert_str_eq(s, "[]");
  36671   free(s);
  36672   // non Array object
  36673   r2 = self->f->setBool(self, "1", true);
  36674   ck_assert_ptr_ne(r2, null);
  36675   r = self->f->getNDupArray(self, "1");
  36676   ck_assert_ptr_eq(r, null);
  36677   // path
  36678   smallArrayt *array = allocSmallArray();
  36679   createSmallArray(a);
  36680   createSmallDict(d);
  36681   a.f->pushDict(&a, &d);
  36682   self->f->setArray(self, "array", &a);
  36683   r2 = self->f->setArray(self, "\"array\"[0].\"key\"", array);
  36684   ck_assert_ptr_ne(r2, null);
  36685   finishO(array);
  36686   r = self->f->getNDupArray(self, "\"array\"[0].\"key\"");
  36687   ck_assert_ptr_ne(r, null);
  36688   terminateO(r);
  36689   // json bool
  36690   freeO(self);
  36691   setTypeBoolO(self);
  36692   r = self->f->getNDupArray(self, "1");
  36693   ck_assert_ptr_eq(r, null);
  36694   // json array
  36695   freeO(self);
  36696   setTypeArrayO(self);
  36697   r = self->f->getNDupArray(self, "1");
  36698   ck_assert_ptr_eq(r, null);
  36699   // non existing dict path
  36700   freeO(self);
  36701   r = self->f->getNDupArray(self, "\"1\"[1]");
  36702   ck_assert_ptr_eq(r, null);
  36703   //   dict path but the object is an array
  36704   resetO(&a);
  36705   self->f->setArray(self, "1", &a);
  36706   r = self->f->getNDupArray(self, "\"1\".\"1\"");
  36707   ck_assert_ptr_eq(r, null);
  36708   //   dict object in path but the key doesn't exists
  36709   resetO(&d);
  36710   self->f->setDict(self, "2", &d);
  36711   r = self->f->getNDupArray(self, "\"2\".\"1\".[12]");
  36712   ck_assert_ptr_eq(r, null);
  36713   // null key
  36714   r = self->f->getNDupArray(self, null);
  36715   ck_assert_ptr_eq(r, null);
  36716 	// empty self
  36717   freeO(self);
  36718   r = self->f->getNDupArray(self, "1");
  36719   ck_assert_ptr_eq(r, null);
  36720   terminateO(self);
  36721 
  36722 }
  36723 
  36724 
  36725 void getNDupSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  36726 
  36727   smallBoolt* r;
  36728   smallJsont *self = allocSmallJson();
  36729 
  36730   createAllocateSmallBool(D);
  36731   smallJsont *r2 = self->f->setNFreeSmallBool(self, "1", D);
  36732   ck_assert_ptr_ne(r2, null);
  36733   r = self->f->getNDupSmallBool(self, "1");
  36734   ck_assert_ptr_ne(r, null);
  36735   char *s = toStringO(r);
  36736   terminateO(r);
  36737   ck_assert_str_eq(s, "false");
  36738   free(s);
  36739   // non SmallBool object
  36740   r2 = self->f->setInt(self, "1", 0);
  36741   ck_assert_ptr_ne(r2, null);
  36742   r = self->f->getNDupSmallBool(self, "1");
  36743   ck_assert_ptr_eq(r, null);
  36744   // path
  36745   smallBoolt *value = allocSmallBool(true);
  36746   createSmallArray(a);
  36747   createSmallDict(d);
  36748   a.f->pushDict(&a, &d);
  36749   self->f->setArray(self, "array", &a);
  36750   r2 = self->f->setSmallBool(self, "\"array\"[0].\"key\"", value);
  36751   ck_assert_ptr_ne(r2, null);
  36752   finishO(value);
  36753   r = self->f->getNDupSmallBool(self, "\"array\"[0].\"key\"");
  36754   ck_assert_ptr_ne(r, null);
  36755   terminateO(r);
  36756   // json bool
  36757   freeO(self);
  36758   setTypeBoolO(self);
  36759   r = self->f->getNDupSmallBool(self, "1");
  36760   ck_assert_ptr_eq(r, null);
  36761   // json array
  36762   freeO(self);
  36763   setTypeArrayO(self);
  36764   r = self->f->getNDupSmallBool(self, "1");
  36765   ck_assert_ptr_eq(r, null);
  36766   // non existing dict path
  36767   freeO(self);
  36768   r = self->f->getNDupSmallBool(self, "\"1\"[1]");
  36769   ck_assert_ptr_eq(r, null);
  36770   //   dict path but the object is an array
  36771   resetO(&a);
  36772   self->f->setArray(self, "1", &a);
  36773   r = self->f->getNDupSmallBool(self, "\"1\".\"1\"");
  36774   ck_assert_ptr_eq(r, null);
  36775   //   dict object in path but the key doesn't exists
  36776   resetO(&d);
  36777   self->f->setDict(self, "2", &d);
  36778   r = self->f->getNDupSmallBool(self, "\"2\".\"1\".[12]");
  36779   ck_assert_ptr_eq(r, null);
  36780   // null key
  36781   r = self->f->getNDupSmallBool(self, null);
  36782   ck_assert_ptr_eq(r, null);
  36783 	// empty self
  36784   freeO(self);
  36785   r = self->f->getNDupSmallBool(self, "1");
  36786   ck_assert_ptr_eq(r, null);
  36787   terminateO(self);
  36788 
  36789 }
  36790 
  36791 
  36792 void getNDupSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  36793 
  36794   smallBytest* r;
  36795   smallJsont *self = allocSmallJson();
  36796 
  36797   createAllocateSmallBytes(D);
  36798   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", D);
  36799   ck_assert_ptr_ne(r2, null);
  36800   r = self->f->getNDupSmallBytes(self, "1");
  36801   ck_assert_ptr_ne(r, null);
  36802   char *s = toStringO(r);
  36803   terminateO(r);
  36804   ck_assert_str_eq(s, "[]");
  36805   free(s);
  36806   // non SmallBytes object
  36807   r2 = self->f->setBool(self, "1", true);
  36808   ck_assert_ptr_ne(r2, null);
  36809   r = self->f->getNDupSmallBytes(self, "1");
  36810   ck_assert_ptr_eq(r, null);
  36811   // path
  36812   smallBytest *value = allocSmallBytes("qwf", sizeof("qwf"));
  36813   createSmallArray(a);
  36814   createSmallDict(d);
  36815   a.f->pushDict(&a, &d);
  36816   self->f->setArray(self, "array", &a);
  36817   r2 = self->f->setSmallBytes(self, "\"array\"[0].\"key\"", value);
  36818   ck_assert_ptr_ne(r2, null);
  36819   finishO(value);
  36820   r = self->f->getNDupSmallBytes(self, "\"array\"[0].\"key\"");
  36821   ck_assert_ptr_ne(r, null);
  36822   terminateO(r);
  36823   // json bool
  36824   freeO(self);
  36825   setTypeBoolO(self);
  36826   r = self->f->getNDupSmallBytes(self, "1");
  36827   ck_assert_ptr_eq(r, null);
  36828   // json array
  36829   freeO(self);
  36830   setTypeArrayO(self);
  36831   r = self->f->getNDupSmallBytes(self, "1");
  36832   ck_assert_ptr_eq(r, null);
  36833   // non existing dict path
  36834   freeO(self);
  36835   r = self->f->getNDupSmallBytes(self, "\"1\"[1]");
  36836   ck_assert_ptr_eq(r, null);
  36837   //   dict path but the object is an array
  36838   resetO(&a);
  36839   self->f->setArray(self, "1", &a);
  36840   r = self->f->getNDupSmallBytes(self, "\"1\".\"1\"");
  36841   ck_assert_ptr_eq(r, null);
  36842   //   dict object in path but the key doesn't exists
  36843   resetO(&d);
  36844   self->f->setDict(self, "2", &d);
  36845   r = self->f->getNDupSmallBytes(self, "\"2\".\"1\".[12]");
  36846   ck_assert_ptr_eq(r, null);
  36847   // null key
  36848   r = self->f->getNDupSmallBytes(self, null);
  36849   ck_assert_ptr_eq(r, null);
  36850 	// empty self
  36851   freeO(self);
  36852   r = self->f->getNDupSmallBytes(self, "1");
  36853   ck_assert_ptr_eq(r, null);
  36854   terminateO(self);
  36855 
  36856 }
  36857 
  36858 
  36859 void getNDupSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  36860 
  36861   smallDoublet* r;
  36862   smallJsont *self = allocSmallJson();
  36863 
  36864   createAllocateSmallDouble(D);
  36865   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "1", D);
  36866   ck_assert_ptr_ne(r2, null);
  36867   r = self->f->getNDupSmallDouble(self, "1");
  36868   ck_assert_ptr_ne(r, null);
  36869   char *s = toStringO(r);
  36870   terminateO(r);
  36871   ck_assert_str_eq(s, "0.000000e+00");
  36872   free(s);
  36873   // non SmallDouble object
  36874   r2 = self->f->setBool(self, "1", true);
  36875   ck_assert_ptr_ne(r2, null);
  36876   r = self->f->getNDupSmallDouble(self, "1");
  36877   ck_assert_ptr_eq(r, null);
  36878   // path
  36879   smallDoublet *value = allocSmallDouble(1.2);
  36880   createSmallArray(a);
  36881   createSmallDict(d);
  36882   a.f->pushDict(&a, &d);
  36883   self->f->setArray(self, "array", &a);
  36884   r2 = self->f->setSmallDouble(self, "\"array\"[0].\"key\"", value);
  36885   ck_assert_ptr_ne(r2, null);
  36886   finishO(value);
  36887   r = self->f->getNDupSmallDouble(self, "\"array\"[0].\"key\"");
  36888   ck_assert_ptr_ne(r, null);
  36889   terminateO(r);
  36890   // json bool
  36891   freeO(self);
  36892   setTypeBoolO(self);
  36893   r = self->f->getNDupSmallDouble(self, "1");
  36894   ck_assert_ptr_eq(r, null);
  36895   // json array
  36896   freeO(self);
  36897   setTypeArrayO(self);
  36898   r = self->f->getNDupSmallDouble(self, "1");
  36899   ck_assert_ptr_eq(r, null);
  36900   // non existing dict path
  36901   freeO(self);
  36902   r = self->f->getNDupSmallDouble(self, "\"1\"[1]");
  36903   ck_assert_ptr_eq(r, null);
  36904   //   dict path but the object is an array
  36905   resetO(&a);
  36906   self->f->setArray(self, "1", &a);
  36907   r = self->f->getNDupSmallDouble(self, "\"1\".\"1\"");
  36908   ck_assert_ptr_eq(r, null);
  36909   //   dict object in path but the key doesn't exists
  36910   resetO(&d);
  36911   self->f->setDict(self, "2", &d);
  36912   r = self->f->getNDupSmallDouble(self, "\"2\".\"1\".[12]");
  36913   ck_assert_ptr_eq(r, null);
  36914   // null key
  36915   r = self->f->getNDupSmallDouble(self, null);
  36916   ck_assert_ptr_eq(r, null);
  36917 	// empty self
  36918   freeO(self);
  36919   r = self->f->getNDupSmallDouble(self, "1");
  36920   ck_assert_ptr_eq(r, null);
  36921   terminateO(self);
  36922 
  36923 }
  36924 
  36925 
  36926 void getNDupSmallIntSmallJsonT(CuTest *tc UNUSED) {
  36927 
  36928   smallIntt* r;
  36929   smallJsont *self = allocSmallJson();
  36930 
  36931   createAllocateSmallInt(D);
  36932   smallJsont *r2 = self->f->setNFreeSmallInt(self, "1", D);
  36933   ck_assert_ptr_ne(r2, null);
  36934   r = self->f->getNDupSmallInt(self, "1");
  36935   ck_assert_ptr_ne(r, null);
  36936   char *s = toStringO(r);
  36937   terminateO(r);
  36938   ck_assert_str_eq(s, "0");
  36939   free(s);
  36940   // non SmallInt object
  36941   r2 = self->f->setBool(self, "1", true);
  36942   ck_assert_ptr_ne(r2, null);
  36943   r = self->f->getNDupSmallInt(self, "1");
  36944   ck_assert_ptr_eq(r, null);
  36945   // path
  36946   smallIntt *value = allocSmallInt(1);
  36947   createSmallArray(a);
  36948   createSmallDict(d);
  36949   a.f->pushDict(&a, &d);
  36950   self->f->setArray(self, "array", &a);
  36951   r2 = self->f->setSmallInt(self, "\"array\"[0].\"key\"", value);
  36952   ck_assert_ptr_ne(r2, null);
  36953   finishO(value);
  36954   r = self->f->getNDupSmallInt(self, "\"array\"[0].\"key\"");
  36955   ck_assert_ptr_ne(r, null);
  36956   terminateO(r);
  36957   // json bool
  36958   freeO(self);
  36959   setTypeBoolO(self);
  36960   r = self->f->getNDupSmallInt(self, "1");
  36961   ck_assert_ptr_eq(r, null);
  36962   // json array
  36963   freeO(self);
  36964   setTypeArrayO(self);
  36965   r = self->f->getNDupSmallInt(self, "1");
  36966   ck_assert_ptr_eq(r, null);
  36967   // non existing dict path
  36968   freeO(self);
  36969   r = self->f->getNDupSmallInt(self, "\"1\"[1]");
  36970   ck_assert_ptr_eq(r, null);
  36971   //   dict path but the object is an array
  36972   resetO(&a);
  36973   self->f->setArray(self, "1", &a);
  36974   r = self->f->getNDupSmallInt(self, "\"1\".\"1\"");
  36975   ck_assert_ptr_eq(r, null);
  36976   //   dict object in path but the key doesn't exists
  36977   resetO(&d);
  36978   self->f->setDict(self, "2", &d);
  36979   r = self->f->getNDupSmallInt(self, "\"2\".\"1\".[12]");
  36980   ck_assert_ptr_eq(r, null);
  36981   // null key
  36982   r = self->f->getNDupSmallInt(self, null);
  36983   ck_assert_ptr_eq(r, null);
  36984 	// empty self
  36985   freeO(self);
  36986   r = self->f->getNDupSmallInt(self, "1");
  36987   ck_assert_ptr_eq(r, null);
  36988   terminateO(self);
  36989 
  36990 }
  36991 
  36992 
  36993 void getNDupSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  36994 
  36995   smallJsont* r;
  36996   smallJsont *self = allocSmallJson();
  36997 
  36998   createAllocateSmallJson(D);
  36999   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", D);
  37000   ck_assert_ptr_ne(r2, null);
  37001   r = self->f->getNDupSmallJson(self, "1");
  37002   ck_assert_ptr_ne(r, null);
  37003   char *s = toStringO(r);
  37004   terminateO(r);
  37005   ck_assert_str_eq(s, "{}");
  37006   free(s);
  37007   r2 = self->f->setBool(self, "1", true);
  37008   ck_assert_ptr_ne(r2, null);
  37009   r = self->f->getNDupSmallJson(self, "1");
  37010   ck_assert_ptr_ne(r, null);
  37011   s = toStringO(r);
  37012   terminateO(r);
  37013   ck_assert_str_eq(s, "true");
  37014   free(s);
  37015   // non SmallJson object
  37016   smallContainert *c = allocSmallContainer(NULL);
  37017   r2 = self->f->setNFreeSmallContainer(self, "1", c);
  37018   ck_assert_ptr_ne(r2, null);
  37019   r = self->f->getNDupSmallJson(self, "1");
  37020   ck_assert_ptr_eq(r, null);
  37021   // path
  37022   smallJsont *value = allocSmallJson();
  37023   createSmallArray(a);
  37024   createSmallDict(d);
  37025   a.f->pushDict(&a, &d);
  37026   self->f->setArray(self, "array", &a);
  37027   r = self->f->setSmallJson(self, "\"array\"[0].\"key\"", value);
  37028   ck_assert_ptr_ne(r, null);
  37029   finishO(value);
  37030   r = self->f->getNDupSmallJson(self, "\"array\"[0].\"key\"");
  37031   ck_assert_ptr_ne(r, null);
  37032   terminateO(r);
  37033   // json bool
  37034   freeO(self);
  37035   setTypeBoolO(self);
  37036   r = self->f->getNDupSmallJson(self, "1");
  37037   ck_assert_ptr_eq(r, null);
  37038   // json array
  37039   freeO(self);
  37040   setTypeArrayO(self);
  37041   r = self->f->getNDupSmallJson(self, "1");
  37042   ck_assert_ptr_eq(r, null);
  37043   // non existing dict path
  37044   freeO(self);
  37045   r = self->f->getNDupSmallJson(self, "\"1\"[1]");
  37046   ck_assert_ptr_eq(r, null);
  37047   //   dict path but the object is an array
  37048   resetO(&a);
  37049   self->f->setArray(self, "1", &a);
  37050   r = self->f->getNDupSmallJson(self, "\"1\".\"1\"");
  37051   ck_assert_ptr_eq(r, null);
  37052   //   dict object in path but the key doesn't exists
  37053   resetO(&d);
  37054   self->f->setDict(self, "2", &d);
  37055   r = self->f->getNDupSmallJson(self, "\"2\".\"1\".[12]");
  37056   ck_assert_ptr_eq(r, null);
  37057   // null key
  37058   r = self->f->getNDupSmallJson(self, null);
  37059   ck_assert_ptr_eq(r, null);
  37060 	// empty self
  37061   freeO(self);
  37062   r = self->f->getNDupSmallJson(self, "1");
  37063   ck_assert_ptr_eq(r, null);
  37064   terminateO(self);
  37065 
  37066 }
  37067 
  37068 
  37069 void getNDupSmallStringSmallJsonT(CuTest *tc UNUSED) {
  37070 
  37071   smallStringt* r;
  37072   smallJsont *self = allocSmallJson();
  37073 
  37074   createAllocateSmallString(D);
  37075   smallJsont *r2 = self->f->setNFreeSmallString(self, "1", D);
  37076   ck_assert_ptr_ne(r2, null);
  37077   r = self->f->getNDupSmallString(self, "1");
  37078   ck_assert_ptr_ne(r, null);
  37079   char *s = toStringO(r);
  37080   terminateO(r);
  37081   ck_assert_str_eq(s, "");
  37082   free(s);
  37083   // non SmallString object
  37084   r2 = self->f->setBool(self, "1", true);
  37085   ck_assert_ptr_ne(r2, null);
  37086   r = self->f->getNDupSmallString(self, "1");
  37087   ck_assert_ptr_eq(r, null);
  37088   // path
  37089   smallStringt *value = allocSmallString("asd");
  37090   createSmallArray(a);
  37091   createSmallDict(d);
  37092   a.f->pushDict(&a, &d);
  37093   self->f->setArray(self, "array", &a);
  37094   r2 = self->f->setSmallString(self, "\"array\"[0].\"key\"", value);
  37095   ck_assert_ptr_ne(r2, null);
  37096   finishO(value);
  37097   r = self->f->getNDupSmallString(self, "\"array\"[0].\"key\"");
  37098   ck_assert_ptr_ne(r, null);
  37099   terminateO(r);
  37100   // json bool
  37101   freeO(self);
  37102   setTypeBoolO(self);
  37103   r = self->f->getNDupSmallString(self, "1");
  37104   ck_assert_ptr_eq(r, null);
  37105   // json array
  37106   freeO(self);
  37107   setTypeArrayO(self);
  37108   r = self->f->getNDupSmallString(self, "1");
  37109   ck_assert_ptr_eq(r, null);
  37110   // non existing dict path
  37111   freeO(self);
  37112   r = self->f->getNDupSmallString(self, "\"1\"[1]");
  37113   ck_assert_ptr_eq(r, null);
  37114   //   dict path but the object is an array
  37115   resetO(&a);
  37116   self->f->setArray(self, "1", &a);
  37117   r = self->f->getNDupSmallString(self, "\"1\".\"1\"");
  37118   ck_assert_ptr_eq(r, null);
  37119   //   dict object in path but the key doesn't exists
  37120   resetO(&d);
  37121   self->f->setDict(self, "2", &d);
  37122   r = self->f->getNDupSmallString(self, "\"2\".\"1\".[12]");
  37123   ck_assert_ptr_eq(r, null);
  37124   // null key
  37125   r = self->f->getNDupSmallString(self, null);
  37126   ck_assert_ptr_eq(r, null);
  37127 	// empty self
  37128   freeO(self);
  37129   r = self->f->getNDupSmallString(self, "1");
  37130   ck_assert_ptr_eq(r, null);
  37131   terminateO(self);
  37132 
  37133 }
  37134 
  37135 
  37136 void getNDupVoidSmallJsonT(CuTest *tc UNUSED) {
  37137 
  37138   void* r;
  37139   smallJsont *self = allocSmallJson();
  37140 
  37141   smallContainert* D = allocSmallContainer(&r);
  37142   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  37143   ck_assert_ptr_ne(r2, null);
  37144   r = self->f->getNDupVoid(self, "1");
  37145   // result is null because the duplicate function in the container
  37146   // is not set.
  37147   ck_assert_ptr_eq(r, null);
  37148   // non container object
  37149   r2 = self->f->setBool(self, "1", true);
  37150   ck_assert_ptr_ne(r2, null);
  37151   r = self->f->getNDupVoid(self, "1");
  37152   ck_assert_ptr_eq(r, null);
  37153   // path
  37154   smallContainert *value = allocSmallContainer(&r);
  37155   createSmallArray(a);
  37156   createSmallDict(d);
  37157   a.f->pushDict(&a, &d);
  37158   self->f->setArray(self, "array", &a);
  37159   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  37160   ck_assert_ptr_ne(r2, null);
  37161   finishO(value);
  37162   r = self->f->getNDupVoid(self, "\"array\"[0].\"key\"");
  37163   // result is null because the duplicate function in the container
  37164   // is not set.
  37165   ck_assert_ptr_eq(r, null);
  37166   // json bool
  37167   freeO(self);
  37168   setTypeBoolO(self);
  37169   r = self->f->getNDupVoid(self, "1");
  37170   ck_assert_ptr_eq(r, null);
  37171   // json array
  37172   freeO(self);
  37173   setTypeArrayO(self);
  37174   r = self->f->getNDupVoid(self, "1");
  37175   ck_assert_ptr_eq(r, null);
  37176   // non existing dict path
  37177   freeO(self);
  37178   r = self->f->getNDupVoid(self, "\"1\"[1]");
  37179   ck_assert_ptr_eq(r, null);
  37180   //   dict path but the object is an array
  37181   resetO(&a);
  37182   self->f->setArray(self, "1", &a);
  37183   r = self->f->getNDupVoid(self, "\"1\".\"1\"");
  37184   ck_assert_ptr_eq(r, null);
  37185   //   dict object in path but the key doesn't exists
  37186   resetO(&d);
  37187   self->f->setDict(self, "2", &d);
  37188   r = self->f->getNDupVoid(self, "\"2\".\"1\".[12]");
  37189   ck_assert_ptr_eq(r, null);
  37190   // null key
  37191   r = self->f->getNDupVoid(self, null);
  37192   ck_assert_ptr_eq(r, null);
  37193 	// empty self
  37194   freeO(self);
  37195   r = self->f->getNDupVoid(self, "1");
  37196   ck_assert_ptr_eq(r, null);
  37197   terminateO(self);
  37198 
  37199 }
  37200 
  37201 
  37202 void getNDupSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  37203 
  37204   smallContainert* r;
  37205   smallJsont *self = allocSmallJson();
  37206 
  37207   createAllocateSmallContainer(D);
  37208   smallJsont *r2 = self->f->setNFreeSmallContainer(self, "1", D);
  37209   ck_assert_ptr_ne(r2, null);
  37210   r = self->f->getNDupSmallContainer(self, "1");
  37211   ck_assert_ptr_ne(r, null);
  37212   char *s = toStringO(r);
  37213   terminateO(r);
  37214   ck_assert_str_eq(s, "<data smallContainer>");
  37215   free(s);
  37216   // other base class
  37217   smallIntt *t = allocSmallInt(2);
  37218   t->type = "randomClass";
  37219   r2 = self->f->setNFree(self, "1", (baset*)t);
  37220   ck_assert_ptr_ne(r2, null);
  37221   r = self->f->getNDupSmallContainer(self, "1");
  37222   ck_assert_ptr_eq(r, null);
  37223   // non SmallContainer object
  37224   r2 = self->f->setBool(self, "1", true);
  37225   ck_assert_ptr_ne(r2, null);
  37226   r = self->f->getNDupSmallContainer(self, "1");
  37227   ck_assert_ptr_eq(r, null);
  37228   // path
  37229   smallContainert *value = allocSmallContainer(null);
  37230   createSmallArray(a);
  37231   createSmallDict(d);
  37232   a.f->pushDict(&a, &d);
  37233   self->f->setArray(self, "array", &a);
  37234   r2 = self->f->setSmallContainer(self, "\"array\"[0].\"key\"", value);
  37235   ck_assert_ptr_ne(r2, null);
  37236   finishO(value);
  37237   r = self->f->getNDupSmallContainer(self, "\"array\"[0].\"key\"");
  37238   ck_assert_ptr_ne(r, null);
  37239   terminateO(r);
  37240   // json bool
  37241   freeO(self);
  37242   setTypeBoolO(self);
  37243   r = self->f->getNDupSmallContainer(self, "1");
  37244   ck_assert_ptr_eq(r, null);
  37245   // json array
  37246   freeO(self);
  37247   setTypeArrayO(self);
  37248   r = self->f->getNDupSmallContainer(self, "1");
  37249   ck_assert_ptr_eq(r, null);
  37250   // non existing dict path
  37251   freeO(self);
  37252   r = self->f->getNDupSmallContainer(self, "\"1\"[1]");
  37253   ck_assert_ptr_eq(r, null);
  37254   //   dict path but the object is an array
  37255   resetO(&a);
  37256   self->f->setArray(self, "1", &a);
  37257   r = self->f->getNDupSmallContainer(self, "\"1\".\"1\"");
  37258   ck_assert_ptr_eq(r, null);
  37259   //   dict object in path but the key doesn't exists
  37260   resetO(&d);
  37261   self->f->setDict(self, "2", &d);
  37262   r = self->f->getNDupSmallContainer(self, "\"2\".\"1\".[12]");
  37263   ck_assert_ptr_eq(r, null);
  37264   // null key
  37265   r = self->f->getNDupSmallContainer(self, null);
  37266   ck_assert_ptr_eq(r, null);
  37267 	// empty self
  37268   freeO(self);
  37269   r = self->f->getNDupSmallContainer(self, "1");
  37270   ck_assert_ptr_eq(r, null);
  37271   terminateO(self);
  37272 
  37273 }
  37274 
  37275 
  37276 void getAtSmallJsonT(CuTest *tc UNUSED) {
  37277 
  37278   baset* r;
  37279   smallJsont *self = allocG(rtSmallJsont);
  37280   smallJsont *r2;
  37281 
  37282   // non json array
  37283   ck_assert_ptr_eq(getAtO(self, 0), null);
  37284   // add elements to self
  37285   r2 = self->f->pushInt(self, 1);
  37286   ck_assert_ptr_ne(r2, null);
  37287   createSmallDict(e2);
  37288   r2 = self->f->pushDict(self, &e2);
  37289   ck_assert_ptr_ne(r2, null);
  37290   r2 = self->f->pushInt(self, 3);
  37291   ck_assert_ptr_ne(r2, null);
  37292   createSmallDict(e4);
  37293   r2 = self->f->pushDict(self, &e4);
  37294   ck_assert_ptr_ne(r2, null);
  37295   // positive index
  37296   r       = getAtO(self,1);
  37297   ck_assert_ptr_ne(r, null);
  37298   char *s = toStringO(r);
  37299   finishO(r);
  37300   ck_assert_str_eq(s, "{}");
  37301   free(s);
  37302   s = toStringO(self);
  37303   ck_assert_str_eq(s, "[1,{},3,{}]");
  37304   free(s);
  37305   // negative index
  37306   r = getAtO(self,-1);
  37307   ck_assert_ptr_ne(r, null);
  37308   s = toStringO(r);
  37309   finishO(r);
  37310   ck_assert_str_eq(s, "{}");
  37311   free(s);
  37312   s = toStringO(self);
  37313   ck_assert_str_eq(s, "[1,{},3,{}]");
  37314   free(s);
  37315   // index outside
  37316   ck_assert_ptr_eq(getAtO(self, 20), NULL);
  37317   ck_assert_ptr_eq(getAtO(self, -7), NULL);
  37318   // empty list
  37319   emptyO(self);
  37320   ck_assert_ptr_eq(getAtO(self, 0), NULL);
  37321   ck_assert_ptr_eq(getAtO(self, -1), NULL);
  37322   terminateO(self);
  37323 
  37324 }
  37325 
  37326 
  37327 void getAtUndefinedSmallJsonT(CuTest *tc UNUSED) {
  37328 
  37329   undefinedt* r;
  37330   smallJsont *self = allocSmallJson();
  37331   smallJsont *r2;
  37332 
  37333   // non json array
  37334   ck_assert_ptr_eq(self->f->getAtUndefined(self, 0), null);
  37335   // add elements to self
  37336   r2 = self->f->pushInt(self, 1);
  37337   ck_assert_ptr_ne(r2, null);
  37338   r2 = self->f->pushUndefined(self);
  37339   ck_assert_ptr_ne(r2, null);
  37340   r2 = self->f->pushInt(self, 3);
  37341   ck_assert_ptr_ne(r2, null);
  37342   r2 = self->f->pushUndefined(self);
  37343   ck_assert_ptr_ne(r2, null);
  37344 
  37345   // positive index
  37346   r       = self->f->getAtUndefined(self,1);
  37347   ck_assert_ptr_ne(r, null);
  37348   char *s = toStringO(r);
  37349   finishO(r);
  37350   ck_assert_str_eq(s, "null");
  37351   free(s);
  37352   s = toStringO(self);
  37353   ck_assert_str_eq(s, "[1,null,3,null]");
  37354   free(s);
  37355   // negative index
  37356   r = self->f->getAtUndefined(self,-1);
  37357   ck_assert_ptr_ne(r, null);
  37358   s = toStringO(r);
  37359   finishO(r);
  37360   ck_assert_str_eq(s, "null");
  37361   free(s);
  37362   s = toStringO(self);
  37363   ck_assert_str_eq(s, "[1,null,3,null]");
  37364   free(s);
  37365   // wrong object type
  37366   createSmallInt(I);
  37367   setValG(&I, 11);
  37368   r2 = self->f->pushSmallInt(self, &I);
  37369   ck_assert_ptr_ne(r2, null);
  37370   r = self->f->getAtUndefined(self,-1);
  37371   ck_assert_ptr_eq(r, null);
  37372   s = toStringO(self);
  37373   ck_assert_str_eq(s, "[1,null,3,null,11]");
  37374   free(s);
  37375   // index outside
  37376   ck_assert_ptr_eq(self->f->getAtUndefined(self, 20), NULL);
  37377   ck_assert_ptr_eq(self->f->getAtUndefined(self, -6), NULL);
  37378   // empty list
  37379   emptyO(self);
  37380   ck_assert_ptr_eq(self->f->getAtUndefined(self, 0), NULL);
  37381   ck_assert_ptr_eq(self->f->getAtUndefined(self, -1), NULL);
  37382   terminateO(self);
  37383 
  37384 }
  37385 
  37386 
  37387 void getAtBoolSmallJsonT(CuTest *tc UNUSED) {
  37388 
  37389   bool r;
  37390   smallJsont *self = allocSmallJson();
  37391   smallJsont *r2;
  37392 
  37393   // add elements to self
  37394   r2 = self->f->pushInt(self, 1);
  37395   ck_assert_ptr_ne(r2, null);
  37396   r2 = self->f->pushBool(self, TRUE);
  37397   ck_assert_ptr_ne(r2, null);
  37398   r2 = self->f->pushInt(self, 3);
  37399   ck_assert_ptr_ne(r2, null);
  37400   r2 = self->f->pushBool(self, TRUE);
  37401   ck_assert_ptr_ne(r2, null);
  37402 
  37403   // positive index
  37404   r       = self->f->getAtBool(self,1);
  37405   ck_assert(r);
  37406   char *s = toStringO(self);
  37407   ck_assert_str_eq(s, "[1,true,3,true]");
  37408   free(s);
  37409   // negative index
  37410   r = self->f->getAtBool(self,-1);
  37411   ck_assert(r);
  37412   s = toStringO(self);
  37413   ck_assert_str_eq(s, "[1,true,3,true]");
  37414   free(s);
  37415   // wrong object type
  37416   createSmallInt(I);
  37417   setValG(&I, 11);
  37418   r2 = self->f->pushSmallInt(self, &I);
  37419   r = self->f->getAtBool(self,-1);
  37420   ck_assert(!r);
  37421   s = toStringO(self);
  37422   ck_assert_str_eq(s, "[1,true,3,true,11]");
  37423   free(s);
  37424   // wrong object type of another user class
  37425   //   User classes are stored in containers transparently
  37426   createAllocateSmallInt(ip);
  37427   ip->type = "anothertype";
  37428   setValG(ip, 11);
  37429   r2 = self->f->push(self, (baset*)ip);
  37430   ck_assert_ptr_ne(r2, null);
  37431   r = self->f->getAtBool(self,-1);
  37432   ck_assert(!r);
  37433   s = toStringO(self);
  37434   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  37435   free(s);
  37436   // index outside
  37437   ck_assert(!self->f->getAtBool(self, 20));
  37438   ck_assert(!self->f->getAtBool(self, -7));
  37439   // empty list
  37440   emptyO(self);
  37441   ck_assert(!self->f->getAtBool(self, 0));
  37442   ck_assert(!self->f->getAtBool(self, -1));
  37443   terminateO(self);
  37444 
  37445 }
  37446 
  37447 
  37448 void getAtBoolPSmallJsonT(CuTest *tc UNUSED) {
  37449 
  37450   bool* r;
  37451   smallJsont *self = allocSmallJson();
  37452   smallJsont *r2;
  37453 
  37454   // add elements to self
  37455   r2 = self->f->pushInt(self, 1);
  37456   ck_assert_ptr_ne(r2, null);
  37457   r2 = self->f->pushBool(self, TRUE);
  37458   ck_assert_ptr_ne(r2, null);
  37459   r2 = self->f->pushInt(self, 3);
  37460   ck_assert_ptr_ne(r2, null);
  37461   r2 = self->f->pushBool(self, TRUE);
  37462   ck_assert_ptr_ne(r2, null);
  37463 
  37464   // positive index
  37465   r       = self->f->getAtBoolP(self,1);
  37466   ck_assert_ptr_ne(r, null);
  37467   ck_assert(*r);
  37468   char *s = toStringO(self);
  37469   ck_assert_str_eq(s, "[1,true,3,true]");
  37470   free(s);
  37471   // negative index
  37472   r = self->f->getAtBoolP(self,-1);
  37473   ck_assert_ptr_ne(r, null);
  37474   ck_assert(*r);
  37475   s = toStringO(self);
  37476   ck_assert_str_eq(s, "[1,true,3,true]");
  37477   free(s);
  37478   // wrong object type
  37479   createSmallInt(I);
  37480   setValG(&I, 11);
  37481   r2 = self->f->pushSmallInt(self, &I);
  37482   r = self->f->getAtBoolP(self,-1);
  37483   ck_assert_ptr_eq(r, null);
  37484   s = toStringO(self);
  37485   ck_assert_str_eq(s, "[1,true,3,true,11]");
  37486   free(s);
  37487   // wrong object type of another user class
  37488   //   User classes are stored in containers transparently
  37489   createAllocateSmallInt(ip);
  37490   ip->type = "anothertype";
  37491   setValG(ip, 11);
  37492   r2 = self->f->push(self, (baset*)ip);
  37493   ck_assert_ptr_ne(r2, null);
  37494   r = self->f->getAtBoolP(self,-1);
  37495   ck_assert_ptr_eq(r, null);
  37496   s = toStringO(self);
  37497   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  37498   free(s);
  37499   // index outside
  37500   ck_assert(!self->f->getAtBoolP(self, 20));
  37501   ck_assert(!self->f->getAtBoolP(self, -7));
  37502   // empty list
  37503   emptyO(self);
  37504   ck_assert(!self->f->getAtBoolP(self, 0));
  37505   ck_assert(!self->f->getAtBoolP(self, -1));
  37506   terminateO(self);
  37507 
  37508 }
  37509 
  37510 
  37511 void getAtDoubleSmallJsonT(CuTest *tc UNUSED) {
  37512 
  37513   double r;
  37514   smallJsont *self = allocSmallJson();
  37515   smallJsont *r2;
  37516 
  37517   // add elements to self
  37518   r2 = self->f->pushInt(self, 1);
  37519   ck_assert_ptr_ne(r2, null);
  37520   r2 = self->f->pushDouble(self, 2);
  37521   ck_assert_ptr_ne(r2, null);
  37522   r2 = self->f->pushInt(self, 3);
  37523   ck_assert_ptr_ne(r2, null);
  37524   r2 = self->f->pushDouble(self, 4);
  37525   ck_assert_ptr_ne(r2, null);
  37526 
  37527   // positive index
  37528   r       = self->f->getAtDouble(self,1);
  37529   ck_assert(r==2);
  37530   char *s = toStringO(self);
  37531   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37532   free(s);
  37533   // negative index
  37534   r = self->f->getAtDouble(self,-1);
  37535   ck_assert(r==4);
  37536   s = toStringO(self);
  37537   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37538   free(s);
  37539   // wrong object type
  37540   createSmallInt(I);
  37541   setValG(&I, 11);
  37542   r2 = self->f->pushSmallInt(self, &I);
  37543   r = self->f->getAtDouble(self,-1);
  37544   ck_assert(!r);
  37545   s = toStringO(self);
  37546   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  37547   free(s);
  37548   // wrong object type of another user class
  37549   //   User classes are stored in containers transparently
  37550   createAllocateSmallInt(ip);
  37551   ip->type = "anothertype";
  37552   setValG(ip, 11);
  37553   r2 = self->f->push(self, (baset*)ip);
  37554   ck_assert_ptr_ne(r2, null);
  37555   r = self->f->getAtDouble(self,-1);
  37556   ck_assert(!r);
  37557   s = toStringO(self);
  37558   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  37559   free(s);
  37560   // index outside
  37561   ck_assert(!self->f->getAtDouble(self, 20));
  37562   ck_assert(!self->f->getAtDouble(self, -7));
  37563   // empty list
  37564   emptyO(self);
  37565   ck_assert(!self->f->getAtDouble(self, 0));
  37566   ck_assert(!self->f->getAtDouble(self, -1));
  37567   terminateO(self);
  37568 
  37569 }
  37570 
  37571 
  37572 void getAtDoublePSmallJsonT(CuTest *tc UNUSED) {
  37573 
  37574   double* r;
  37575   smallJsont *self = allocSmallJson();
  37576   smallJsont *r2;
  37577 
  37578   // add elements to self
  37579   r2 = self->f->pushInt(self, 1);
  37580   ck_assert_ptr_ne(r2, null);
  37581   r2 = self->f->pushDouble(self, 2);
  37582   ck_assert_ptr_ne(r2, null);
  37583   r2 = self->f->pushInt(self, 3);
  37584   ck_assert_ptr_ne(r2, null);
  37585   r2 = self->f->pushDouble(self, 4);
  37586   ck_assert_ptr_ne(r2, null);
  37587 
  37588   // positive index
  37589   r       = self->f->getAtDoubleP(self,1);
  37590   ck_assert_ptr_ne(r, null);
  37591   ck_assert(*r==2);
  37592   char *s = toStringO(self);
  37593   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37594   free(s);
  37595   // negative index
  37596   r = self->f->getAtDoubleP(self,-1);
  37597   ck_assert_ptr_ne(r, null);
  37598   ck_assert(*r==4);
  37599   s = toStringO(self);
  37600   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  37601   free(s);
  37602   // wrong object type
  37603   createSmallInt(I);
  37604   setValG(&I, 11);
  37605   r2 = self->f->pushSmallInt(self, &I);
  37606   r = self->f->getAtDoubleP(self,-1);
  37607   ck_assert_ptr_eq(r, null);
  37608   s = toStringO(self);
  37609   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  37610   free(s);
  37611   // wrong object type of another user class
  37612   //   User classes are stored in containers transparently
  37613   createAllocateSmallInt(ip);
  37614   ip->type = "anothertype";
  37615   setValG(ip, 11);
  37616   r2 = self->f->push(self, (baset*)ip);
  37617   ck_assert_ptr_ne(r2, null);
  37618   r = self->f->getAtDoubleP(self,-1);
  37619   ck_assert_ptr_eq(r, null);
  37620   s = toStringO(self);
  37621   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  37622   free(s);
  37623   // index outside
  37624   ck_assert(!self->f->getAtDoubleP(self, 20));
  37625   ck_assert(!self->f->getAtDoubleP(self, -7));
  37626   // empty list
  37627   emptyO(self);
  37628   ck_assert(!self->f->getAtDoubleP(self, 0));
  37629   ck_assert(!self->f->getAtDoubleP(self, -1));
  37630   terminateO(self);
  37631 
  37632 }
  37633 
  37634 
  37635 void getAtIntSmallJsonT(CuTest *tc UNUSED) {
  37636 
  37637   int64_t r;
  37638   smallJsont *self = allocSmallJson();
  37639   smallJsont *r2;
  37640 
  37641   // add elements to self
  37642   r2 = self->f->pushInt(self, 1);
  37643   ck_assert_ptr_ne(r2, null);
  37644   r2 = self->f->pushInt(self, 2);
  37645   ck_assert_ptr_ne(r2, null);
  37646   r2 = self->f->pushInt(self, 3);
  37647   ck_assert_ptr_ne(r2, null);
  37648   r2 = self->f->pushInt(self, 4);
  37649   ck_assert_ptr_ne(r2, null);
  37650 
  37651   // positive index
  37652   r       = self->f->getAtInt(self,1);
  37653   ck_assert(r==2);
  37654   char *s = toStringO(self);
  37655   ck_assert_str_eq(s, "[1,2,3,4]");
  37656   free(s);
  37657   // negative index
  37658   r = self->f->getAtInt(self,-1);
  37659   ck_assert(r==4);
  37660   s = toStringO(self);
  37661   ck_assert_str_eq(s, "[1,2,3,4]");
  37662   free(s);
  37663   // wrong object type
  37664   createSmallDouble(I);
  37665   setValG(&I, 11);
  37666   r2 = self->f->pushSmallDouble(self, &I);
  37667   r = self->f->getAtInt(self,-1);
  37668   ck_assert(!r);
  37669   s = toStringO(self);
  37670   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37671   free(s);
  37672   // wrong object type of another user class
  37673   //   User classes are stored in containers transparently
  37674   createAllocateSmallInt(ip);
  37675   ip->type = "anothertype";
  37676   setValG(ip, 11);
  37677   r2 = self->f->push(self, (baset*)ip);
  37678   ck_assert_ptr_ne(r2, null);
  37679   r = self->f->getAtInt(self,-1);
  37680   ck_assert(!r);
  37681   s = toStringO(self);
  37682   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37683   free(s);
  37684   // index outside
  37685   ck_assert(!self->f->getAtInt(self, 20));
  37686   ck_assert(!self->f->getAtInt(self, -7));
  37687   // empty list
  37688   emptyO(self);
  37689   ck_assert(!self->f->getAtInt(self, 0));
  37690   ck_assert(!self->f->getAtInt(self, -1));
  37691   terminateO(self);
  37692 
  37693 }
  37694 
  37695 
  37696 void getAtIntPSmallJsonT(CuTest *tc UNUSED) {
  37697 
  37698   int64_t* r;
  37699   smallJsont *self = allocSmallJson();
  37700   smallJsont *r2;
  37701 
  37702   // add elements to self
  37703   r2 = self->f->pushInt(self, 1);
  37704   ck_assert_ptr_ne(r2, null);
  37705   r2 = self->f->pushInt(self, 2);
  37706   ck_assert_ptr_ne(r2, null);
  37707   r2 = self->f->pushInt(self, 3);
  37708   ck_assert_ptr_ne(r2, null);
  37709   r2 = self->f->pushInt(self, 4);
  37710   ck_assert_ptr_ne(r2, null);
  37711 
  37712   // positive index
  37713   r       = self->f->getAtIntP(self,1);
  37714   ck_assert_ptr_ne(r, null);
  37715   ck_assert(*r==2);
  37716   char *s = toStringO(self);
  37717   ck_assert_str_eq(s, "[1,2,3,4]");
  37718   free(s);
  37719   // negative index
  37720   r = self->f->getAtIntP(self,-1);
  37721   ck_assert_ptr_ne(r, null);
  37722   ck_assert(*r==4);
  37723   s = toStringO(self);
  37724   ck_assert_str_eq(s, "[1,2,3,4]");
  37725   free(s);
  37726   // wrong object type
  37727   createSmallDouble(I);
  37728   setValG(&I, 11);
  37729   r2 = self->f->pushSmallDouble(self, &I);
  37730   r = self->f->getAtIntP(self,-1);
  37731   ck_assert_ptr_eq(r, null);
  37732   s = toStringO(self);
  37733   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37734   free(s);
  37735   // wrong object type of another user class
  37736   //   User classes are stored in containers transparently
  37737   createAllocateSmallInt(ip);
  37738   ip->type = "anothertype";
  37739   setValG(ip, 11);
  37740   r2 = self->f->push(self, (baset*)ip);
  37741   ck_assert_ptr_ne(r2, null);
  37742   r = self->f->getAtIntP(self,-1);
  37743   ck_assert_ptr_eq(r, null);
  37744   s = toStringO(self);
  37745   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37746   free(s);
  37747   // index outside
  37748   ck_assert(!self->f->getAtIntP(self, 20));
  37749   ck_assert(!self->f->getAtIntP(self, -7));
  37750   // empty list
  37751   emptyO(self);
  37752   ck_assert(!self->f->getAtIntP(self, 0));
  37753   ck_assert(!self->f->getAtIntP(self, -1));
  37754   terminateO(self);
  37755 
  37756 }
  37757 
  37758 
  37759 void getAtInt32SmallJsonT(CuTest *tc UNUSED) {
  37760 
  37761   int32_t r;
  37762   smallJsont *self = allocSmallJson();
  37763   smallJsont *r2;
  37764 
  37765   // add elements to self
  37766   r2 = self->f->pushInt(self, 1);
  37767   ck_assert_ptr_ne(r2, null);
  37768   r2 = self->f->pushInt(self, 2);
  37769   ck_assert_ptr_ne(r2, null);
  37770   r2 = self->f->pushInt(self, 3);
  37771   ck_assert_ptr_ne(r2, null);
  37772   r2 = self->f->pushInt(self, 4);
  37773   ck_assert_ptr_ne(r2, null);
  37774 
  37775   // positive index
  37776   r       = self->f->getAtInt32(self,1);
  37777   ck_assert(r==2);
  37778   char *s = toStringO(self);
  37779   ck_assert_str_eq(s, "[1,2,3,4]");
  37780   free(s);
  37781   // negative index
  37782   r = self->f->getAtInt32(self,-1);
  37783   ck_assert(r==4);
  37784   s = toStringO(self);
  37785   ck_assert_str_eq(s, "[1,2,3,4]");
  37786   free(s);
  37787   // wrong object type
  37788   createSmallDouble(I);
  37789   setValG(&I, 11);
  37790   r2 = self->f->pushSmallDouble(self, &I);
  37791   r = self->f->getAtInt32(self,-1);
  37792   ck_assert(!r);
  37793   s = toStringO(self);
  37794   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37795   free(s);
  37796   // wrong object type of another user class
  37797   //   User classes are stored in containers transparently
  37798   createAllocateSmallInt(ip);
  37799   ip->type = "anothertype";
  37800   setValG(ip, 11);
  37801   r2 = self->f->push(self, (baset*)ip);
  37802   ck_assert_ptr_ne(r2, null);
  37803   r = self->f->getAtInt32(self,-1);
  37804   ck_assert(!r);
  37805   s = toStringO(self);
  37806   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37807   free(s);
  37808   // index outside
  37809   ck_assert(!self->f->getAtInt32(self, 20));
  37810   ck_assert(!self->f->getAtInt32(self, -7));
  37811   // empty list
  37812   emptyO(self);
  37813   ck_assert(!self->f->getAtInt32(self, 0));
  37814   ck_assert(!self->f->getAtInt32(self, -1));
  37815   terminateO(self);
  37816 
  37817 }
  37818 
  37819 
  37820 void getAtInt32PSmallJsonT(CuTest *tc UNUSED) {
  37821 
  37822   int32_t* r;
  37823   smallJsont *self = allocSmallJson();
  37824   smallJsont *r2;
  37825 
  37826   // add elements to self
  37827   r2 = self->f->pushInt(self, 1);
  37828   ck_assert_ptr_ne(r2, null);
  37829   r2 = self->f->pushInt(self, 2);
  37830   ck_assert_ptr_ne(r2, null);
  37831   r2 = self->f->pushInt(self, 3);
  37832   ck_assert_ptr_ne(r2, null);
  37833   r2 = self->f->pushInt(self, 4);
  37834   ck_assert_ptr_ne(r2, null);
  37835 
  37836   // positive index
  37837   r       = self->f->getAtInt32P(self,1);
  37838   ck_assert_ptr_ne(r, null);
  37839   ck_assert(*r==2);
  37840   char *s = toStringO(self);
  37841   ck_assert_str_eq(s, "[1,2,3,4]");
  37842   free(s);
  37843   // negative index
  37844   r = self->f->getAtInt32P(self,-1);
  37845   ck_assert_ptr_ne(r, null);
  37846   ck_assert(*r==4);
  37847   s = toStringO(self);
  37848   ck_assert_str_eq(s, "[1,2,3,4]");
  37849   free(s);
  37850   // wrong object type
  37851   createSmallDouble(I);
  37852   setValG(&I, 11);
  37853   r2 = self->f->pushSmallDouble(self, &I);
  37854   r = self->f->getAtInt32P(self,-1);
  37855   ck_assert_ptr_eq(r, null);
  37856   s = toStringO(self);
  37857   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37858   free(s);
  37859   // wrong object type of another user class
  37860   //   User classes are stored in containers transparently
  37861   createAllocateSmallInt(ip);
  37862   ip->type = "anothertype";
  37863   setValG(ip, 11);
  37864   r2 = self->f->push(self, (baset*)ip);
  37865   ck_assert_ptr_ne(r2, null);
  37866   r = self->f->getAtInt32P(self,-1);
  37867   ck_assert_ptr_eq(r, null);
  37868   s = toStringO(self);
  37869   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37870   free(s);
  37871   // index outside
  37872   ck_assert(!self->f->getAtInt32P(self, 20));
  37873   ck_assert(!self->f->getAtInt32P(self, -7));
  37874   // empty list
  37875   emptyO(self);
  37876   ck_assert(!self->f->getAtInt32P(self, 0));
  37877   ck_assert(!self->f->getAtInt32P(self, -1));
  37878   terminateO(self);
  37879 
  37880 }
  37881 
  37882 
  37883 void getAtUintSmallJsonT(CuTest *tc UNUSED) {
  37884 
  37885   uint64_t r;
  37886   smallJsont *self = allocSmallJson();
  37887   smallJsont *r2;
  37888 
  37889   // add elements to self
  37890   r2 = self->f->pushInt(self, 1);
  37891   ck_assert_ptr_ne(r2, null);
  37892   r2 = self->f->pushInt(self, 2);
  37893   ck_assert_ptr_ne(r2, null);
  37894   r2 = self->f->pushInt(self, 3);
  37895   ck_assert_ptr_ne(r2, null);
  37896   r2 = self->f->pushInt(self, 4);
  37897   ck_assert_ptr_ne(r2, null);
  37898 
  37899   // positive index
  37900   r       = self->f->getAtUint(self,1);
  37901   ck_assert(r==2);
  37902   char *s = toStringO(self);
  37903   ck_assert_str_eq(s, "[1,2,3,4]");
  37904   free(s);
  37905   // negative index
  37906   r = self->f->getAtUint(self,-1);
  37907   ck_assert(r==4);
  37908   s = toStringO(self);
  37909   ck_assert_str_eq(s, "[1,2,3,4]");
  37910   free(s);
  37911   // wrong object type
  37912   createSmallDouble(I);
  37913   setValG(&I, 11);
  37914   r2 = self->f->pushSmallDouble(self, &I);
  37915   r = self->f->getAtUint(self,-1);
  37916   ck_assert(!r);
  37917   s = toStringO(self);
  37918   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37919   free(s);
  37920   // wrong object type of another user class
  37921   //   User classes are stored in containers transparently
  37922   createAllocateSmallInt(ip);
  37923   ip->type = "anothertype";
  37924   setValG(ip, 11);
  37925   r2 = self->f->push(self, (baset*)ip);
  37926   ck_assert_ptr_ne(r2, null);
  37927   r = self->f->getAtUint(self,-1);
  37928   ck_assert(!r);
  37929   s = toStringO(self);
  37930   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37931   free(s);
  37932   // index outside
  37933   ck_assert(!self->f->getAtUint(self, 20));
  37934   ck_assert(!self->f->getAtUint(self, -7));
  37935   // empty list
  37936   emptyO(self);
  37937   ck_assert(!self->f->getAtUint(self, 0));
  37938   ck_assert(!self->f->getAtUint(self, -1));
  37939   terminateO(self);
  37940 
  37941 }
  37942 
  37943 
  37944 void getAtUintPSmallJsonT(CuTest *tc UNUSED) {
  37945 
  37946   uint64_t* r;
  37947   smallJsont *self = allocSmallJson();
  37948   smallJsont *r2;
  37949 
  37950   // add elements to self
  37951   r2 = self->f->pushInt(self, 1);
  37952   ck_assert_ptr_ne(r2, null);
  37953   r2 = self->f->pushInt(self, 2);
  37954   ck_assert_ptr_ne(r2, null);
  37955   r2 = self->f->pushInt(self, 3);
  37956   ck_assert_ptr_ne(r2, null);
  37957   r2 = self->f->pushInt(self, 4);
  37958   ck_assert_ptr_ne(r2, null);
  37959 
  37960   // positive index
  37961   r       = self->f->getAtUintP(self,1);
  37962   ck_assert_ptr_ne(r, null);
  37963   ck_assert(*r==2);
  37964   char *s = toStringO(self);
  37965   ck_assert_str_eq(s, "[1,2,3,4]");
  37966   free(s);
  37967   // negative index
  37968   r = self->f->getAtUintP(self,-1);
  37969   ck_assert_ptr_ne(r, null);
  37970   ck_assert(*r==4);
  37971   s = toStringO(self);
  37972   ck_assert_str_eq(s, "[1,2,3,4]");
  37973   free(s);
  37974   // wrong object type
  37975   createSmallDouble(I);
  37976   setValG(&I, 11);
  37977   r2 = self->f->pushSmallDouble(self, &I);
  37978   r = self->f->getAtUintP(self,-1);
  37979   ck_assert_ptr_eq(r, null);
  37980   s = toStringO(self);
  37981   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  37982   free(s);
  37983   // wrong object type of another user class
  37984   //   User classes are stored in containers transparently
  37985   createAllocateSmallInt(ip);
  37986   ip->type = "anothertype";
  37987   setValG(ip, 11);
  37988   r2 = self->f->push(self, (baset*)ip);
  37989   ck_assert_ptr_ne(r2, null);
  37990   r = self->f->getAtUintP(self,-1);
  37991   ck_assert_ptr_eq(r, null);
  37992   s = toStringO(self);
  37993   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  37994   free(s);
  37995   // index outside
  37996   ck_assert(!self->f->getAtUintP(self, 20));
  37997   ck_assert(!self->f->getAtUintP(self, -7));
  37998   // empty list
  37999   emptyO(self);
  38000   ck_assert(!self->f->getAtUintP(self, 0));
  38001   ck_assert(!self->f->getAtUintP(self, -1));
  38002   terminateO(self);
  38003 
  38004 }
  38005 
  38006 
  38007 void getAtUint32SmallJsonT(CuTest *tc UNUSED) {
  38008 
  38009   uint32_t r;
  38010   smallJsont *self = allocSmallJson();
  38011   smallJsont *r2;
  38012 
  38013   // add elements to self
  38014   r2 = self->f->pushInt(self, 1);
  38015   ck_assert_ptr_ne(r2, null);
  38016   r2 = self->f->pushInt(self, 2);
  38017   ck_assert_ptr_ne(r2, null);
  38018   r2 = self->f->pushInt(self, 3);
  38019   ck_assert_ptr_ne(r2, null);
  38020   r2 = self->f->pushInt(self, 4);
  38021   ck_assert_ptr_ne(r2, null);
  38022 
  38023   // positive index
  38024   r       = self->f->getAtUint32(self,1);
  38025   ck_assert(r==2);
  38026   char *s = toStringO(self);
  38027   ck_assert_str_eq(s, "[1,2,3,4]");
  38028   free(s);
  38029   // negative index
  38030   r = self->f->getAtUint32(self,-1);
  38031   ck_assert(r==4);
  38032   s = toStringO(self);
  38033   ck_assert_str_eq(s, "[1,2,3,4]");
  38034   free(s);
  38035   // wrong object type
  38036   createSmallDouble(I);
  38037   setValG(&I, 11);
  38038   r2 = self->f->pushSmallDouble(self, &I);
  38039   r = self->f->getAtUint32(self,-1);
  38040   ck_assert(!r);
  38041   s = toStringO(self);
  38042   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  38043   free(s);
  38044   // wrong object type of another user class
  38045   //   User classes are stored in containers transparently
  38046   createAllocateSmallInt(ip);
  38047   ip->type = "anothertype";
  38048   setValG(ip, 11);
  38049   r2 = self->f->push(self, (baset*)ip);
  38050   ck_assert_ptr_ne(r2, null);
  38051   r = self->f->getAtUint32(self,-1);
  38052   ck_assert(!r);
  38053   s = toStringO(self);
  38054   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  38055   free(s);
  38056   // index outside
  38057   ck_assert(!self->f->getAtUint32(self, 20));
  38058   ck_assert(!self->f->getAtUint32(self, -7));
  38059   // empty list
  38060   emptyO(self);
  38061   ck_assert(!self->f->getAtUint32(self, 0));
  38062   ck_assert(!self->f->getAtUint32(self, -1));
  38063   terminateO(self);
  38064 
  38065 }
  38066 
  38067 
  38068 void getAtUint32PSmallJsonT(CuTest *tc UNUSED) {
  38069 
  38070   uint32_t* r;
  38071   smallJsont *self = allocSmallJson();
  38072   smallJsont *r2;
  38073 
  38074   // add elements to self
  38075   r2 = self->f->pushInt(self, 1);
  38076   ck_assert_ptr_ne(r2, null);
  38077   r2 = self->f->pushInt(self, 2);
  38078   ck_assert_ptr_ne(r2, null);
  38079   r2 = self->f->pushInt(self, 3);
  38080   ck_assert_ptr_ne(r2, null);
  38081   r2 = self->f->pushInt(self, 4);
  38082   ck_assert_ptr_ne(r2, null);
  38083 
  38084   // positive index
  38085   r       = self->f->getAtUint32P(self,1);
  38086   ck_assert_ptr_ne(r, null);
  38087   ck_assert(*r==2);
  38088   char *s = toStringO(self);
  38089   ck_assert_str_eq(s, "[1,2,3,4]");
  38090   free(s);
  38091   // negative index
  38092   r = self->f->getAtUint32P(self,-1);
  38093   ck_assert_ptr_ne(r, null);
  38094   ck_assert(*r==4);
  38095   s = toStringO(self);
  38096   ck_assert_str_eq(s, "[1,2,3,4]");
  38097   free(s);
  38098   // wrong object type
  38099   createSmallDouble(I);
  38100   setValG(&I, 11);
  38101   r2 = self->f->pushSmallDouble(self, &I);
  38102   r = self->f->getAtUint32P(self,-1);
  38103   ck_assert_ptr_eq(r, null);
  38104   s = toStringO(self);
  38105   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  38106   free(s);
  38107   // wrong object type of another user class
  38108   //   User classes are stored in containers transparently
  38109   createAllocateSmallInt(ip);
  38110   ip->type = "anothertype";
  38111   setValG(ip, 11);
  38112   r2 = self->f->push(self, (baset*)ip);
  38113   ck_assert_ptr_ne(r2, null);
  38114   r = self->f->getAtUint32P(self,-1);
  38115   ck_assert_ptr_eq(r, null);
  38116   s = toStringO(self);
  38117   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  38118   free(s);
  38119   // index outside
  38120   ck_assert(!self->f->getAtUint32P(self, 20));
  38121   ck_assert(!self->f->getAtUint32P(self, -7));
  38122   // empty list
  38123   emptyO(self);
  38124   ck_assert(!self->f->getAtUint32P(self, 0));
  38125   ck_assert(!self->f->getAtUint32P(self, -1));
  38126   terminateO(self);
  38127 
  38128 }
  38129 
  38130 
  38131 void getAtSSmallJsonT(CuTest *tc UNUSED) {
  38132 
  38133   char* r;
  38134   smallJsont *self = allocSmallJson();
  38135   smallJsont *r2;
  38136 
  38137   // add elements to self
  38138   r2 = self->f->pushInt(self, 1);
  38139   ck_assert_ptr_ne(r2, null);
  38140   r2 = self->f->pushS(self, "2");
  38141   ck_assert_ptr_ne(r2, null);
  38142   r2 = self->f->pushInt(self, 3);
  38143   ck_assert_ptr_ne(r2, null);
  38144   r2 = self->f->pushS(self, "4");
  38145   ck_assert_ptr_ne(r2, null);
  38146 
  38147   // positive index
  38148   r       = self->f->getAtS(self,1);
  38149   ck_assert_ptr_ne(r, null);
  38150   ck_assert_str_eq(r, "2");
  38151   char *s = toStringO(self);
  38152   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  38153   free(s);
  38154   // negative index
  38155   r = self->f->getAtS(self,-1);
  38156   ck_assert_ptr_ne(r, null);
  38157   ck_assert_str_eq(r, "4");
  38158   s = toStringO(self);
  38159   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  38160   free(s);
  38161   // wrong object type
  38162   createSmallInt(I);
  38163   setValG(&I, 11);
  38164   r2 = self->f->pushSmallInt(self, &I);
  38165   r = self->f->getAtS(self,-1);
  38166   ck_assert_ptr_eq(r, NULL);
  38167   s = toStringO(self);
  38168   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11]");
  38169   free(s);
  38170   // wrong object type of another user class
  38171   //   User classes are stored in containers transparently
  38172   createAllocateSmallInt(ip);
  38173   ip->type = "anothertype";
  38174   setValG(ip, 11);
  38175   r2 = self->f->push(self, (baset*)ip);
  38176   ck_assert_ptr_ne(r2, null);
  38177   r = self->f->getAtS(self,-1);
  38178   ck_assert_ptr_eq(r, NULL);
  38179   s = toStringO(self);
  38180   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11,\"<data container>\"]");
  38181   free(s);
  38182   // index outside
  38183   ck_assert_ptr_eq(self->f->getAtS(self, 20), NULL);
  38184   ck_assert_ptr_eq(self->f->getAtS(self, -7), NULL);
  38185   // empty list
  38186   emptyO(self);
  38187   ck_assert_ptr_eq(self->f->getAtS(self, 0), NULL);
  38188   ck_assert_ptr_eq(self->f->getAtS(self, -1), NULL);
  38189   terminateO(self);
  38190 
  38191 }
  38192 
  38193 
  38194 void getAtDictSmallJsonT(CuTest *tc UNUSED) {
  38195 
  38196   smallDictt* r;
  38197   smallJsont *self = allocSmallJson();
  38198   smallJsont *r2;
  38199 
  38200   // non json array
  38201   ck_assert_ptr_eq(self->f->getAtDict(self, 0), null);
  38202   // add elements to self
  38203   r2 = self->f->pushInt(self, 1);
  38204   ck_assert_ptr_ne(r2, null);
  38205   createSmallDict(e2);
  38206   r2 = self->f->pushDict(self, &e2);
  38207   ck_assert_ptr_ne(r2, null);
  38208   r2 = self->f->pushInt(self, 3);
  38209   ck_assert_ptr_ne(r2, null);
  38210   createSmallDict(e4);
  38211   r2 = self->f->pushDict(self, &e4);
  38212   ck_assert_ptr_ne(r2, null);
  38213 
  38214   // positive index
  38215   r       = self->f->getAtDict(self,1);
  38216   ck_assert_ptr_ne(r, null);
  38217   char *s = toStringO(r);
  38218   finishO(r);
  38219   ck_assert_str_eq(s, "{}");
  38220   free(s);
  38221   s = toStringO(self);
  38222   ck_assert_str_eq(s, "[1,{},3,{}]");
  38223   free(s);
  38224   // negative index
  38225   r = self->f->getAtDict(self,-1);
  38226   ck_assert_ptr_ne(r, null);
  38227   s = toStringO(r);
  38228   finishO(r);
  38229   ck_assert_str_eq(s, "{}");
  38230   free(s);
  38231   s = toStringO(self);
  38232   ck_assert_str_eq(s, "[1,{},3,{}]");
  38233   free(s);
  38234   // wrong object type
  38235   createSmallInt(I);
  38236   setValG(&I, 11);
  38237   r2 = self->f->pushSmallInt(self, &I);
  38238   r = self->f->getAtDict(self,-1);
  38239   ck_assert_ptr_eq(r, NULL);
  38240   s = toStringO(self);
  38241   ck_assert_str_eq(s, "[1,{},3,{},11]");
  38242   free(s);
  38243   // wrong object type of another user class
  38244   //   User classes are stored in containers transparently
  38245   createAllocateSmallInt(ip);
  38246   ip->type = "anothertype";
  38247   setValG(ip, 11);
  38248   r2 = self->f->push(self, (baset*)ip);
  38249   ck_assert_ptr_ne(r2, null);
  38250   r = self->f->getAtDict(self,-1);
  38251   ck_assert_ptr_eq(r, NULL);
  38252   s = toStringO(self);
  38253   ck_assert_str_eq(s, "[1,{},3,{},11,\"<data container>\"]");
  38254   free(s);
  38255   // index outside
  38256   ck_assert_ptr_eq(self->f->getAtDict(self, 20), NULL);
  38257   ck_assert_ptr_eq(self->f->getAtDict(self, -7), NULL);
  38258   // empty list
  38259   emptyO(self);
  38260   ck_assert_ptr_eq(self->f->getAtDict(self, 0), NULL);
  38261   ck_assert_ptr_eq(self->f->getAtDict(self, -1), NULL);
  38262   terminateO(self);
  38263 
  38264 }
  38265 
  38266 
  38267 void getAtArraySmallJsonT(CuTest *tc UNUSED) {
  38268 
  38269   smallArrayt* r;
  38270   smallJsont *self = allocSmallJson();
  38271   smallJsont *r2;
  38272 
  38273   // non json array
  38274   ck_assert_ptr_eq(self->f->getAtArray(self, 0), null);
  38275   // add elements to self
  38276   r2 = self->f->pushInt(self, 1);
  38277   ck_assert_ptr_ne(r2, null);
  38278   createSmallArray(e2);
  38279   r2 = self->f->pushArray(self, &e2);
  38280   ck_assert_ptr_ne(r2, null);
  38281   r2 = self->f->pushInt(self, 3);
  38282   ck_assert_ptr_ne(r2, null);
  38283   createSmallArray(e4);
  38284   r2 = self->f->pushArray(self, &e4);
  38285   ck_assert_ptr_ne(r2, null);
  38286 
  38287   // positive index
  38288   r       = self->f->getAtArray(self,1);
  38289   ck_assert_ptr_ne(r, null);
  38290   char *s = toStringO(r);
  38291   finishO(r);
  38292   ck_assert_str_eq(s, "[]");
  38293   free(s);
  38294   s = toStringO(self);
  38295   ck_assert_str_eq(s, "[1,[],3,[]]");
  38296   free(s);
  38297   // negative index
  38298   r = self->f->getAtArray(self,-1);
  38299   ck_assert_ptr_ne(r, null);
  38300   s = toStringO(r);
  38301   finishO(r);
  38302   ck_assert_str_eq(s, "[]");
  38303   free(s);
  38304   s = toStringO(self);
  38305   ck_assert_str_eq(s, "[1,[],3,[]]");
  38306   free(s);
  38307   // wrong object type
  38308   createSmallInt(I);
  38309   setValG(&I, 11);
  38310   r2 = self->f->pushSmallInt(self, &I);
  38311   r = self->f->getAtArray(self,-1);
  38312   ck_assert_ptr_eq(r, NULL);
  38313   s = toStringO(self);
  38314   ck_assert_str_eq(s, "[1,[],3,[],11]");
  38315   free(s);
  38316   // wrong object type of another user class
  38317   //   User classes are stored in containers transparently
  38318   createAllocateSmallInt(ip);
  38319   ip->type = "anothertype";
  38320   setValG(ip, 11);
  38321   r2 = self->f->push(self, (baset*)ip);
  38322   ck_assert_ptr_ne(r2, null);
  38323   r = self->f->getAtArray(self,-1);
  38324   ck_assert_ptr_eq(r, NULL);
  38325   s = toStringO(self);
  38326   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  38327   free(s);
  38328   // index outside
  38329   ck_assert_ptr_eq(self->f->getAtArray(self, 20), NULL);
  38330   ck_assert_ptr_eq(self->f->getAtArray(self, -7), NULL);
  38331   // empty list
  38332   emptyO(self);
  38333   ck_assert_ptr_eq(self->f->getAtArray(self, 0), NULL);
  38334   ck_assert_ptr_eq(self->f->getAtArray(self, -1), NULL);
  38335   terminateO(self);
  38336 
  38337 }
  38338 
  38339 
  38340 void getAtSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  38341 
  38342   smallBoolt* r;
  38343   smallJsont *self = allocSmallJson();
  38344   smallJsont *r2;
  38345 
  38346   // non json array
  38347   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 0), null);
  38348   // add elements to self
  38349   r2 = self->f->pushInt(self, 1);
  38350   ck_assert_ptr_ne(r2, null);
  38351   createSmallBool(e2);
  38352   r2 = self->f->pushBool(self, true);
  38353   ck_assert_ptr_ne(r2, null);
  38354   r2 = self->f->pushInt(self, 3);
  38355   ck_assert_ptr_ne(r2, null);
  38356   createSmallBool(e4);
  38357   r2 = self->f->pushBool(self, true);
  38358   ck_assert_ptr_ne(r2, null);
  38359 
  38360   // positive index
  38361   r       = self->f->getAtSmallBool(self,1);
  38362   ck_assert_ptr_ne(r, null);
  38363   char *s = toStringO(r);
  38364   finishO(r);
  38365   ck_assert_str_eq(s, "true");
  38366   free(s);
  38367   s = toStringO(self);
  38368   ck_assert_str_eq(s, "[1,true,3,true]");
  38369   free(s);
  38370   // negative index
  38371   r = self->f->getAtSmallBool(self,-1);
  38372   ck_assert_ptr_ne(r, null);
  38373   s = toStringO(r);
  38374   finishO(r);
  38375   ck_assert_str_eq(s, "true");
  38376   free(s);
  38377   s = toStringO(self);
  38378   ck_assert_str_eq(s, "[1,true,3,true]");
  38379   free(s);
  38380   // wrong object type
  38381   createSmallInt(I);
  38382   setValG(&I, 11);
  38383   r2 = self->f->pushSmallInt(self, &I);
  38384   r = self->f->getAtSmallBool(self,2);
  38385   ck_assert_ptr_eq(r, NULL);
  38386   s = toStringO(self);
  38387   ck_assert_str_eq(s, "[1,true,3,true,11]");
  38388   free(s);
  38389   // wrong object type of another user class
  38390   //   User classes are stored in containers transparently
  38391   createAllocateSmallInt(ip);
  38392   ip->type = "anothertype";
  38393   setValG(ip, 11);
  38394   r2 = self->f->push(self, (baset*)ip);
  38395   ck_assert_ptr_ne(r2, null);
  38396   r = self->f->getAtSmallBool(self,-1);
  38397   ck_assert_ptr_eq(r, NULL);
  38398   s = toStringO(self);
  38399   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  38400   free(s);
  38401   // index outside
  38402   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 20), NULL);
  38403   ck_assert_ptr_eq(self->f->getAtSmallBool(self, -7), NULL);
  38404   // empty list
  38405   emptyO(self);
  38406   ck_assert_ptr_eq(self->f->getAtSmallBool(self, 0), NULL);
  38407   ck_assert_ptr_eq(self->f->getAtSmallBool(self, -1), NULL);
  38408   terminateO(self);
  38409 
  38410 }
  38411 
  38412 
  38413 void getAtSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  38414 
  38415   smallBytest* r;
  38416   smallJsont *self = allocSmallJson();
  38417   smallJsont *r2;
  38418 
  38419   // non json array
  38420   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 0), null);
  38421   // add elements to self
  38422   r2 = self->f->pushInt(self, 1);
  38423   ck_assert_ptr_ne(r2, null);
  38424   createSmallBytes(e2);
  38425   r2 = self->f->pushSmallBytes(self, &e2);
  38426   ck_assert_ptr_ne(r2, null);
  38427   r2 = self->f->pushInt(self, 3);
  38428   ck_assert_ptr_ne(r2, null);
  38429   createSmallBytes(e4);
  38430   r2 = self->f->pushSmallBytes(self, &e4);
  38431   ck_assert_ptr_ne(r2, null);
  38432 
  38433   // positive index
  38434   r       = self->f->getAtSmallBytes(self,1);
  38435   ck_assert_ptr_ne(r, null);
  38436   char *s = toStringO(r);
  38437   finishO(r);
  38438   ck_assert_str_eq(s, "[]");
  38439   free(s);
  38440   s = toStringO(self);
  38441   ck_assert_str_eq(s, "[1,[],3,[]]");
  38442   free(s);
  38443   // negative index
  38444   r = self->f->getAtSmallBytes(self,-1);
  38445   ck_assert_ptr_ne(r, null);
  38446   s = toStringO(r);
  38447   finishO(r);
  38448   ck_assert_str_eq(s, "[]");
  38449   free(s);
  38450   s = toStringO(self);
  38451   ck_assert_str_eq(s, "[1,[],3,[]]");
  38452   free(s);
  38453   // wrong object type
  38454   createSmallInt(I);
  38455   setValG(&I, 11);
  38456   r2 = self->f->pushSmallInt(self, &I);
  38457   r = self->f->getAtSmallBytes(self,-1);
  38458   ck_assert_ptr_eq(r, NULL);
  38459   s = toStringO(self);
  38460   ck_assert_str_eq(s, "[1,[],3,[],11]");
  38461   free(s);
  38462   // wrong object type of another user class
  38463   //   User classes are stored in containers transparently
  38464   createAllocateSmallInt(ip);
  38465   ip->type = "anothertype";
  38466   setValG(ip, 11);
  38467   r2 = self->f->push(self, (baset*)ip);
  38468   ck_assert_ptr_ne(r2, null);
  38469   r = self->f->getAtSmallBytes(self,-1);
  38470   ck_assert_ptr_eq(r, NULL);
  38471   s = toStringO(self);
  38472   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  38473   free(s);
  38474   // index outside
  38475   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 20), NULL);
  38476   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, -7), NULL);
  38477   // empty list
  38478   emptyO(self);
  38479   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, 0), NULL);
  38480   ck_assert_ptr_eq(self->f->getAtSmallBytes(self, -1), NULL);
  38481   terminateO(self);
  38482 
  38483 }
  38484 
  38485 
  38486 void getAtSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  38487 
  38488   smallDoublet* r;
  38489   smallJsont *self = allocSmallJson();
  38490   smallJsont *r2;
  38491 
  38492   // non json array
  38493   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 0), null);
  38494   // add elements to self
  38495   r2 = self->f->pushInt(self, 1);
  38496   ck_assert_ptr_ne(r2, null);
  38497   createSmallDouble(e2);
  38498   r2 = self->f->pushSmallDouble(self, &e2);
  38499   ck_assert_ptr_ne(r2, null);
  38500   r2 = self->f->pushInt(self, 3);
  38501   ck_assert_ptr_ne(r2, null);
  38502   createSmallDouble(e4);
  38503   r2 = self->f->pushSmallDouble(self, &e4);
  38504   ck_assert_ptr_ne(r2, null);
  38505 
  38506   // positive index
  38507   r       = self->f->getAtSmallDouble(self,1);
  38508   ck_assert_ptr_ne(r, null);
  38509   char *s = toStringO(r);
  38510   finishO(r);
  38511   ck_assert_str_eq(s, "0.000000e+00");
  38512   free(s);
  38513   s = toStringO(self);
  38514   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  38515   free(s);
  38516   // negative index
  38517   r = self->f->getAtSmallDouble(self,-1);
  38518   ck_assert_ptr_ne(r, null);
  38519   s = toStringO(r);
  38520   finishO(r);
  38521   ck_assert_str_eq(s, "0.000000e+00");
  38522   free(s);
  38523   s = toStringO(self);
  38524   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  38525   free(s);
  38526   // wrong object type
  38527   createSmallInt(I);
  38528   setValG(&I, 11);
  38529   r2 = self->f->pushSmallInt(self, &I);
  38530   r = self->f->getAtSmallDouble(self,-1);
  38531   ck_assert_ptr_eq(r, NULL);
  38532   s = toStringO(self);
  38533   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11]");
  38534   free(s);
  38535   // wrong object type of another user class
  38536   //   User classes are stored in containers transparently
  38537   createAllocateSmallInt(ip);
  38538   ip->type = "anothertype";
  38539   setValG(ip, 11);
  38540   r2 = self->f->push(self, (baset*)ip);
  38541   ck_assert_ptr_ne(r2, null);
  38542   r = self->f->getAtSmallDouble(self,-1);
  38543   ck_assert_ptr_eq(r, NULL);
  38544   s = toStringO(self);
  38545   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11,\"<data container>\"]");
  38546   free(s);
  38547   // index outside
  38548   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 20), NULL);
  38549   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, -7), NULL);
  38550   // empty list
  38551   emptyO(self);
  38552   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, 0), NULL);
  38553   ck_assert_ptr_eq(self->f->getAtSmallDouble(self, -1), NULL);
  38554   terminateO(self);
  38555 
  38556 }
  38557 
  38558 
  38559 void getAtSmallIntSmallJsonT(CuTest *tc UNUSED) {
  38560 
  38561   smallIntt* r;
  38562   smallJsont *self = allocSmallJson();
  38563   smallJsont *r2;
  38564 
  38565   // non json array
  38566   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 0), null);
  38567   // add elements to self
  38568   r2 = self->f->pushBool(self, true);
  38569   ck_assert_ptr_ne(r2, null);
  38570   createSmallInt(e2);
  38571   r2 = self->f->pushSmallInt(self, &e2);
  38572   ck_assert_ptr_ne(r2, null);
  38573   r2 = self->f->pushBool(self, true);
  38574   ck_assert_ptr_ne(r2, null);
  38575   createSmallInt(e4);
  38576   r2 = self->f->pushSmallInt(self, &e4);
  38577   ck_assert_ptr_ne(r2, null);
  38578 
  38579   // positive index
  38580   r       = self->f->getAtSmallInt(self,1);
  38581   ck_assert_ptr_ne(r, null);
  38582   char *s = toStringO(r);
  38583   finishO(r);
  38584   ck_assert_str_eq(s, "0");
  38585   free(s);
  38586   s = toStringO(self);
  38587   ck_assert_str_eq(s, "[true,0,true,0]");
  38588   free(s);
  38589   // negative index
  38590   r = self->f->getAtSmallInt(self,-1);
  38591   ck_assert_ptr_ne(r, null);
  38592   s = toStringO(r);
  38593   finishO(r);
  38594   ck_assert_str_eq(s, "0");
  38595   free(s);
  38596   s = toStringO(self);
  38597   ck_assert_str_eq(s, "[true,0,true,0]");
  38598   free(s);
  38599   // wrong object type
  38600   createSmallDouble(I);
  38601   setValG(&I, 11);
  38602   r2 = self->f->pushSmallDouble(self, &I);
  38603   r = self->f->getAtSmallInt(self,-1);
  38604   ck_assert_ptr_eq(r, NULL);
  38605   s = toStringO(self);
  38606   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01]");
  38607   free(s);
  38608   // wrong object type of another user class
  38609   //   User classes are stored in containers transparently
  38610   createAllocateSmallInt(ip);
  38611   ip->type = "anothertype";
  38612   setValG(ip, 11);
  38613   r2 = self->f->push(self, (baset*)ip);
  38614   ck_assert_ptr_ne(r2, null);
  38615   r = self->f->getAtSmallInt(self,-1);
  38616   ck_assert_ptr_eq(r, NULL);
  38617   s = toStringO(self);
  38618   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01,\"<data container>\"]");
  38619   free(s);
  38620   // index outside
  38621   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 20), NULL);
  38622   ck_assert_ptr_eq(self->f->getAtSmallInt(self, -7), NULL);
  38623   // empty list
  38624   emptyO(self);
  38625   ck_assert_ptr_eq(self->f->getAtSmallInt(self, 0), NULL);
  38626   ck_assert_ptr_eq(self->f->getAtSmallInt(self, -1), NULL);
  38627   terminateO(self);
  38628 
  38629 }
  38630 
  38631 
  38632 void getAtSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  38633 
  38634   smallJsont* r;
  38635   smallJsont *self = allocSmallJson();
  38636   smallJsont *r2;
  38637 
  38638   // non json array
  38639   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 0), null);
  38640   // add elements to self
  38641   r2 = self->f->pushInt(self, 1);
  38642   ck_assert_ptr_ne(r2, null);
  38643   createSmallJson(e2);
  38644   r2 = self->f->pushSmallJson(self, &e2);
  38645   ck_assert_ptr_ne(r2, null);
  38646   r2 = self->f->pushInt(self, 3);
  38647   ck_assert_ptr_ne(r2, null);
  38648   createSmallJson(e4);
  38649   r2 = self->f->pushSmallJson(self, &e4);
  38650   ck_assert_ptr_ne(r2, null);
  38651 
  38652   // positive index
  38653   r       = self->f->getAtSmallJson(self,1);
  38654   ck_assert_ptr_ne(r, null);
  38655   char *s = toStringO(r);
  38656   finishO(r);
  38657   ck_assert_str_eq(s, "{}");
  38658   free(s);
  38659   s = toStringO(self);
  38660   ck_assert_str_eq(s, "[1,{},3,{}]");
  38661   free(s);
  38662   // negative index
  38663   r = self->f->getAtSmallJson(self,-1);
  38664   ck_assert_ptr_ne(r, null);
  38665   s = toStringO(r);
  38666   finishO(r);
  38667   ck_assert_str_eq(s, "{}");
  38668   free(s);
  38669   s = toStringO(self);
  38670   ck_assert_str_eq(s, "[1,{},3,{}]");
  38671   free(s);
  38672   // wrong object type
  38673   createSmallBytes(I);
  38674   r2 = self->f->pushSmallBytes(self, &I);
  38675   r = self->f->getAtSmallJson(self,-1);
  38676   ck_assert_ptr_eq(r, NULL);
  38677   s = toStringO(self);
  38678   ck_assert_str_eq(s, "[1,{},3,{},[]]");
  38679   free(s);
  38680   // wrong object type of another user class
  38681   //   User classes are stored in containers transparently
  38682   createAllocateSmallInt(ip);
  38683   ip->type = "anothertype";
  38684   setValG(ip, 11);
  38685   r2 = self->f->push(self, (baset*)ip);
  38686   ck_assert_ptr_ne(r2, null);
  38687   r = self->f->getAtSmallJson(self,-1);
  38688   ck_assert_ptr_eq(r, NULL);
  38689   s = toStringO(self);
  38690   ck_assert_str_eq(s, "[1,{},3,{},[],\"<data container>\"]");
  38691   free(s);
  38692   // index outside
  38693   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 20), NULL);
  38694   ck_assert_ptr_eq(self->f->getAtSmallJson(self, -7), NULL);
  38695   // empty list
  38696   emptyO(self);
  38697   ck_assert_ptr_eq(self->f->getAtSmallJson(self, 0), NULL);
  38698   ck_assert_ptr_eq(self->f->getAtSmallJson(self, -1), NULL);
  38699   terminateO(self);
  38700 
  38701 }
  38702 
  38703 
  38704 void getAtSmallStringSmallJsonT(CuTest *tc UNUSED) {
  38705 
  38706   smallStringt* r;
  38707   smallJsont *self = allocSmallJson();
  38708   smallJsont *r2;
  38709 
  38710   // non json array
  38711   ck_assert_ptr_eq(self->f->getAtSmallString(self, 0), null);
  38712   // add elements to self
  38713   r2 = self->f->pushInt(self, 1);
  38714   ck_assert_ptr_ne(r2, null);
  38715   createSmallString(e2);
  38716   r2 = self->f->pushSmallString(self, &e2);
  38717   ck_assert_ptr_ne(r2, null);
  38718   r2 = self->f->pushInt(self, 3);
  38719   ck_assert_ptr_ne(r2, null);
  38720   createSmallString(e4);
  38721   r2 = self->f->pushSmallString(self, &e4);
  38722   ck_assert_ptr_ne(r2, null);
  38723 
  38724   // positive index
  38725   r       = self->f->getAtSmallString(self,1);
  38726   ck_assert_ptr_ne(r, null);
  38727   char *s = toStringO(r);
  38728   finishO(r);
  38729   ck_assert_str_eq(s, "");
  38730   free(s);
  38731   s = toStringO(self);
  38732   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  38733   free(s);
  38734   // negative index
  38735   r = self->f->getAtSmallString(self,-1);
  38736   ck_assert_ptr_ne(r, null);
  38737   s = toStringO(r);
  38738   finishO(r);
  38739   ck_assert_str_eq(s, "");
  38740   free(s);
  38741   s = toStringO(self);
  38742   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  38743   free(s);
  38744   // wrong object type
  38745   createSmallInt(I);
  38746   setValG(&I, 11);
  38747   r2 = self->f->pushSmallInt(self, &I);
  38748   r = self->f->getAtSmallString(self,-1);
  38749   ck_assert_ptr_eq(r, NULL);
  38750   s = toStringO(self);
  38751   ck_assert_str_eq(s, "[1,\"\",3,\"\",11]");
  38752   free(s);
  38753   // wrong object type of another user class
  38754   //   User classes are stored in containers transparently
  38755   createAllocateSmallInt(ip);
  38756   ip->type = "anothertype";
  38757   setValG(ip, 11);
  38758   r2 = self->f->push(self, (baset*)ip);
  38759   ck_assert_ptr_ne(r2, null);
  38760   r = self->f->getAtSmallString(self,-1);
  38761   ck_assert_ptr_eq(r, NULL);
  38762   s = toStringO(self);
  38763   ck_assert_str_eq(s, "[1,\"\",3,\"\",11,\"<data container>\"]");
  38764   free(s);
  38765   // index outside
  38766   ck_assert_ptr_eq(self->f->getAtSmallString(self, 20), NULL);
  38767   ck_assert_ptr_eq(self->f->getAtSmallString(self, -7), NULL);
  38768   // empty list
  38769   emptyO(self);
  38770   ck_assert_ptr_eq(self->f->getAtSmallString(self, 0), NULL);
  38771   ck_assert_ptr_eq(self->f->getAtSmallString(self, -1), NULL);
  38772   terminateO(self);
  38773 
  38774 }
  38775 
  38776 
  38777 void getAtVoidSmallJsonT(CuTest *tc UNUSED) {
  38778 
  38779   void* r;
  38780   smallJsont *self = allocSmallJson();
  38781   smallJsont *r2;
  38782 
  38783   // non json array
  38784   ck_assert_ptr_eq(self->f->getAtVoid(self, 0), null);
  38785   // add elements to self
  38786   r2 = self->f->pushInt(self, 1);
  38787   ck_assert_ptr_ne(r2, null);
  38788   r2 = pushVoidSmallJsonG(self, &r);
  38789   ck_assert_ptr_ne(r2, null);
  38790   r2 = self->f->pushInt(self, 3);
  38791   ck_assert_ptr_ne(r2, null);
  38792   r2 = pushVoidSmallJsonG(self, &self);
  38793   ck_assert_ptr_ne(r2, null);
  38794 
  38795   // positive index
  38796   r       = self->f->getAtVoid(self,1);
  38797   ck_assert_ptr_eq(r, &r);
  38798   char *s = toStringO(self);
  38799   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38800   free(s);
  38801   // negative index
  38802   r = self->f->getAtVoid(self,-1);
  38803   ck_assert_ptr_eq(r, &self);
  38804   s = toStringO(self);
  38805   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38806   free(s);
  38807   // wrong object type
  38808   createSmallInt(I);
  38809   setValG(&I, 11);
  38810   r2 = self->f->pushSmallInt(self, &I);
  38811   r = self->f->getAtVoid(self,-1);
  38812   ck_assert_ptr_eq(r, NULL);
  38813   s = toStringO(self);
  38814   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  38815   free(s);
  38816   // wrong object type of another user class
  38817   //   User classes are stored in containers transparently
  38818   createAllocateSmallInt(ip);
  38819   ip->type = "anothertype";
  38820   setValG(ip, 11);
  38821   r2 = self->f->push(self, (baset*)ip);
  38822   ck_assert_ptr_ne(r2, null);
  38823   r = self->f->getAtVoid(self,-1);
  38824   ck_assert_ptr_eq(r, NULL);
  38825   s = toStringO(self);
  38826   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  38827   free(s);
  38828   // index outside
  38829   ck_assert_ptr_eq(self->f->getAtVoid(self, 20), NULL);
  38830   ck_assert_ptr_eq(self->f->getAtVoid(self, -7), NULL);
  38831   // empty list
  38832   emptyO(self);
  38833   ck_assert_ptr_eq(self->f->getAtVoid(self, 0), NULL);
  38834   ck_assert_ptr_eq(self->f->getAtVoid(self, -1), NULL);
  38835   terminateO(self);
  38836 
  38837 }
  38838 
  38839 
  38840 void getAtSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  38841 
  38842   smallContainert* r;
  38843   smallJsont *self = allocSmallJson();
  38844   smallJsont *r2;
  38845 
  38846   // non json array
  38847   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 0), null);
  38848   // add elements to self
  38849   r2 = self->f->pushInt(self, 1);
  38850   ck_assert_ptr_ne(r2, null);
  38851   createSmallContainer(e2);
  38852   r2 = self->f->pushSmallContainer(self, &e2);
  38853   ck_assert_ptr_ne(r2, null);
  38854   r2 = self->f->pushInt(self, 3);
  38855   ck_assert_ptr_ne(r2, null);
  38856   createSmallContainer(e4);
  38857   r2 = self->f->pushSmallContainer(self, &e4);
  38858   ck_assert_ptr_ne(r2, null);
  38859 
  38860   // positive index
  38861   r       = self->f->getAtSmallContainer(self,1);
  38862   ck_assert_ptr_ne(r, null);
  38863   char *s = toStringO(r);
  38864   finishO(r);
  38865   ck_assert_str_eq(s, "<data smallContainer>");
  38866   free(s);
  38867   s = toStringO(self);
  38868   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38869   free(s);
  38870   // negative index
  38871   r = self->f->getAtSmallContainer(self,-1);
  38872   ck_assert_ptr_ne(r, null);
  38873   s = toStringO(r);
  38874   finishO(r);
  38875   ck_assert_str_eq(s, "<data smallContainer>");
  38876   free(s);
  38877   s = toStringO(self);
  38878   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  38879   free(s);
  38880   // wrong object type
  38881   createSmallInt(I);
  38882   setValG(&I, 11);
  38883   r2 = self->f->pushSmallInt(self, &I);
  38884   r = self->f->getAtSmallContainer(self,-1);
  38885   ck_assert_ptr_eq(r, NULL);
  38886   s = toStringO(self);
  38887   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  38888   free(s);
  38889   // wrong object type of another user class
  38890   //   User classes are stored in containers transparently
  38891   createAllocateSmallInt(ip);
  38892   ip->type = "anothertype";
  38893   setValG(ip, 11);
  38894   r2 = self->f->push(self, (baset*)ip);
  38895   ck_assert_ptr_ne(r2, null);
  38896   r = self->f->getAtSmallContainer(self,-1);
  38897   ck_assert_ptr_eq(r, NULL);
  38898   s = toStringO(self);
  38899   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  38900   free(s);
  38901   // index outside
  38902   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 20), NULL);
  38903   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, -7), NULL);
  38904   // empty list
  38905   emptyO(self);
  38906   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, 0), NULL);
  38907   ck_assert_ptr_eq(self->f->getAtSmallContainer(self, -1), NULL);
  38908   terminateO(self);
  38909 
  38910 }
  38911 
  38912 
  38913 void getAtNDupSmallJsonT(CuTest *tc UNUSED) {
  38914 
  38915   baset* r;
  38916   smallJsont *self = allocSmallJson();
  38917   smallJsont *r2;
  38918 
  38919   // non json array
  38920   ck_assert_ptr_eq(self->f->getAtNDup(self, 0), null);
  38921   // add elements to self
  38922   r2 = self->f->pushInt(self, 1);
  38923   ck_assert_ptr_ne(r2, null);
  38924   r2 = self->f->pushInt(self, 2);
  38925   ck_assert_ptr_ne(r2, null);
  38926   r2 = self->f->pushInt(self, 3);
  38927   ck_assert_ptr_ne(r2, null);
  38928   r2 = self->f->pushInt(self, 4);
  38929   ck_assert_ptr_ne(r2, null);
  38930 
  38931   // positive index
  38932   r       = self->f->getAtNDup(self,1);
  38933   ck_assert_ptr_ne(r, null);
  38934   char *s = toStringO(r);
  38935   terminateO(r);
  38936   ck_assert_str_eq(s, "2");
  38937   free(s);
  38938   s = toStringO(self);
  38939   ck_assert_str_eq(s, "[1,2,3,4]");
  38940   free(s);
  38941   // negative index
  38942   r = self->f->getAtNDup(self,-1);
  38943   ck_assert_ptr_ne(r, null);
  38944   s = toStringO(r);
  38945   terminateO(r);
  38946   ck_assert_str_eq(s, "4");
  38947   free(s);
  38948   s = toStringO(self);
  38949   ck_assert_str_eq(s, "[1,2,3,4]");
  38950   free(s);
  38951   // undefined object
  38952   r2 = self->f->pushUndefined(self);
  38953   ck_assert_ptr_ne(r2, null);
  38954   r = self->f->getAtNDup(self,-1);
  38955   ck_assert_ptr_ne(r, null);
  38956   s = toStringO(r);
  38957   terminateO(r);
  38958   ck_assert_str_eq(s, "null");
  38959   free(s);
  38960   s = toStringO(self);
  38961   ck_assert_str_eq(s, "[1,2,3,4,null]");
  38962   free(s);
  38963   // container
  38964   createSmallContainer(c);
  38965   r2 = self->f->pushSmallContainer(self, &c);
  38966   r = self->f->getAtNDup(self,-1);
  38967   ck_assert_ptr_ne(r, null);
  38968   s = toStringO(r);
  38969   terminateO(r);
  38970   ck_assert_str_eq(s, "<data smallContainer>");
  38971   free(s);
  38972   s = toStringO(self);
  38973   ck_assert_str_eq(s, "[1,2,3,4,null,\"<data container>\"]");
  38974   free(s);
  38975   // base object in container
  38976   createAllocateSmallInt(I);
  38977   setValG(I, 11);
  38978   I->type = "anothertype";
  38979   r2 = self->f->push(self, (baset*)I);
  38980   r = self->f->getAtNDup(self,-1);
  38981   ck_assert_ptr_ne(r, null);
  38982   // r->type is not anothertype, because the duplicate function is from the smallInt class
  38983   ck_assert_str_eq(r->type, "smallInt");
  38984   s = toStringO(r);
  38985   terminateO(r);
  38986   ck_assert_str_eq(s, "11");
  38987   free(s);
  38988   s = toStringO(self);
  38989   ck_assert_str_eq(s, "[1,2,3,4,null,\"<data container>\",\"<data container>\"]");
  38990   free(s);
  38991   // index outside
  38992   ck_assert_ptr_eq(self->f->getAtNDup(self, 20), NULL);
  38993   ck_assert_ptr_eq(self->f->getAtNDup(self, -8), NULL);
  38994   // empty list
  38995   emptyO(self);
  38996   ck_assert_ptr_eq(self->f->getAtNDup(self, 0), NULL);
  38997   ck_assert_ptr_eq(self->f->getAtNDup(self, -1), NULL);
  38998   terminateO(self);
  38999 
  39000 }
  39001 
  39002 
  39003 void getAtNDupUndefinedSmallJsonT(CuTest *tc UNUSED) {
  39004 
  39005   undefinedt* r;
  39006   smallJsont *self = allocSmallJson();
  39007   smallJsont *r2;
  39008 
  39009   // non json array
  39010   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 0), null);
  39011   // add elements to self
  39012   r2 = self->f->pushInt(self, 1);
  39013   ck_assert_ptr_ne(r2, null);
  39014   r2 = self->f->pushUndefined(self);
  39015   ck_assert_ptr_ne(r2, null);
  39016   r2 = self->f->pushInt(self, 3);
  39017   ck_assert_ptr_ne(r2, null);
  39018   r2 = self->f->pushUndefined(self);
  39019   ck_assert_ptr_ne(r2, null);
  39020 
  39021   // positive index
  39022   r       = self->f->getAtNDupUndefined(self,1);
  39023   ck_assert_ptr_ne(r, null);
  39024   char *s = toStringO(r);
  39025   terminateO(r);
  39026   ck_assert_str_eq(s, "null");
  39027   free(s);
  39028   s = toStringO(self);
  39029   ck_assert_str_eq(s, "[1,null,3,null]");
  39030   free(s);
  39031   // negative index
  39032   r = self->f->getAtNDupUndefined(self,-1);
  39033   ck_assert_ptr_ne(r, null);
  39034   s = toStringO(r);
  39035   terminateO(r);
  39036   ck_assert_str_eq(s, "null");
  39037   free(s);
  39038   s = toStringO(self);
  39039   ck_assert_str_eq(s, "[1,null,3,null]");
  39040   free(s);
  39041   // wrong object type
  39042   createSmallInt(I);
  39043   setValG(&I, 11);
  39044   r2 = self->f->pushSmallInt(self, &I);
  39045   ck_assert_ptr_ne(r2, null);
  39046   r = self->f->getAtNDupUndefined(self,-1);
  39047   ck_assert_ptr_eq(r, null);
  39048   s = toStringO(self);
  39049   ck_assert_str_eq(s, "[1,null,3,null,11]");
  39050   free(s);
  39051   // index outside
  39052   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 20), NULL);
  39053   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, -6), NULL);
  39054   // empty list
  39055   emptyO(self);
  39056   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, 0), NULL);
  39057   ck_assert_ptr_eq(self->f->getAtNDupUndefined(self, -1), NULL);
  39058   terminateO(self);
  39059 
  39060 }
  39061 
  39062 
  39063 void getAtNDupBoolSmallJsonT(CuTest *tc UNUSED) {
  39064 
  39065   bool r;
  39066   smallJsont *self = allocSmallJson();
  39067   smallJsont *r2;
  39068 
  39069   // add elements to self
  39070   r2 = self->f->pushInt(self, 1);
  39071   ck_assert_ptr_ne(r2, null);
  39072   r2 = self->f->pushBool(self, TRUE);
  39073   ck_assert_ptr_ne(r2, null);
  39074   r2 = self->f->pushInt(self, 3);
  39075   ck_assert_ptr_ne(r2, null);
  39076   r2 = self->f->pushBool(self, TRUE);
  39077   ck_assert_ptr_ne(r2, null);
  39078 
  39079   // positive index
  39080   r       = self->f->getAtNDupBool(self,1);
  39081   ck_assert(r);
  39082   char *s = toStringO(self);
  39083   ck_assert_str_eq(s, "[1,true,3,true]");
  39084   free(s);
  39085   // negative index
  39086   r = self->f->getAtNDupBool(self,-1);
  39087   ck_assert(r);
  39088   s = toStringO(self);
  39089   ck_assert_str_eq(s, "[1,true,3,true]");
  39090   free(s);
  39091   // wrong object type
  39092   createSmallInt(I);
  39093   setValG(&I, 11);
  39094   r2 = self->f->pushSmallInt(self, &I);
  39095   r = self->f->getAtNDupBool(self,-1);
  39096   ck_assert(!r);
  39097   s = toStringO(self);
  39098   ck_assert_str_eq(s, "[1,true,3,true,11]");
  39099   free(s);
  39100   // wrong object type of another user class
  39101   //   User classes are stored in containers transparently
  39102   createAllocateSmallInt(ip);
  39103   ip->type = "anothertype";
  39104   setValG(ip, 11);
  39105   r2 = self->f->push(self, (baset*)ip);
  39106   ck_assert_ptr_ne(r2, null);
  39107   r = self->f->getAtNDupBool(self,-1);
  39108   ck_assert(!r);
  39109   s = toStringO(self);
  39110   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  39111   free(s);
  39112   // index outside
  39113   ck_assert(!self->f->getAtNDupBool(self, 20));
  39114   ck_assert(!self->f->getAtNDupBool(self, -7));
  39115   // empty list
  39116   emptyO(self);
  39117   ck_assert(!self->f->getAtNDupBool(self, 0));
  39118   ck_assert(!self->f->getAtNDupBool(self, -1));
  39119   terminateO(self);
  39120 
  39121 }
  39122 
  39123 
  39124 void getAtNDupDoubleSmallJsonT(CuTest *tc UNUSED) {
  39125 
  39126   double r;
  39127   smallJsont *self = allocSmallJson();
  39128   smallJsont *r2;
  39129 
  39130   // add elements to self
  39131   r2 = self->f->pushInt(self, 1);
  39132   ck_assert_ptr_ne(r2, null);
  39133   r2 = self->f->pushDouble(self, 2);
  39134   ck_assert_ptr_ne(r2, null);
  39135   r2 = self->f->pushInt(self, 3);
  39136   ck_assert_ptr_ne(r2, null);
  39137   r2 = self->f->pushDouble(self, 4);
  39138   ck_assert_ptr_ne(r2, null);
  39139 
  39140   // positive index
  39141   r       = self->f->getAtNDupDouble(self,1);
  39142   ck_assert(r==2);
  39143   char *s = toStringO(self);
  39144   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  39145   free(s);
  39146   // negative index
  39147   r = self->f->getAtNDupDouble(self,-1);
  39148   ck_assert(r==4);
  39149   s = toStringO(self);
  39150   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00]");
  39151   free(s);
  39152   // wrong object type
  39153   createSmallInt(I);
  39154   setValG(&I, 11);
  39155   r2 = self->f->pushSmallInt(self, &I);
  39156   r = self->f->getAtNDupDouble(self,-1);
  39157   ck_assert(!r);
  39158   s = toStringO(self);
  39159   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11]");
  39160   free(s);
  39161   // wrong object type of another user class
  39162   //   User classes are stored in containers transparently
  39163   createAllocateSmallInt(ip);
  39164   ip->type = "anothertype";
  39165   setValG(ip, 11);
  39166   r2 = self->f->push(self, (baset*)ip);
  39167   ck_assert_ptr_ne(r2, null);
  39168   r = self->f->getAtNDupDouble(self,-1);
  39169   ck_assert(!r);
  39170   s = toStringO(self);
  39171   ck_assert_str_eq(s, "[1,2.000000e+00,3,4.000000e+00,11,\"<data container>\"]");
  39172   free(s);
  39173   // index outside
  39174   ck_assert(!self->f->getAtNDupDouble(self, 20));
  39175   ck_assert(!self->f->getAtNDupDouble(self, -7));
  39176   // empty list
  39177   emptyO(self);
  39178   ck_assert(!self->f->getAtNDupDouble(self, 0));
  39179   ck_assert(!self->f->getAtNDupDouble(self, -1));
  39180   terminateO(self);
  39181 
  39182 }
  39183 
  39184 
  39185 void getAtNDupIntSmallJsonT(CuTest *tc UNUSED) {
  39186 
  39187   int64_t r;
  39188   smallJsont *self = allocSmallJson();
  39189   smallJsont *r2;
  39190 
  39191   // add elements to self
  39192   r2 = self->f->pushInt(self, 1);
  39193   ck_assert_ptr_ne(r2, null);
  39194   r2 = self->f->pushInt(self, 2);
  39195   ck_assert_ptr_ne(r2, null);
  39196   r2 = self->f->pushInt(self, 3);
  39197   ck_assert_ptr_ne(r2, null);
  39198   r2 = self->f->pushInt(self, 4);
  39199   ck_assert_ptr_ne(r2, null);
  39200 
  39201   // positive index
  39202   r       = self->f->getAtNDupInt(self,1);
  39203   ck_assert(r==2);
  39204   char *s = toStringO(self);
  39205   ck_assert_str_eq(s, "[1,2,3,4]");
  39206   free(s);
  39207   // negative index
  39208   r = self->f->getAtNDupInt(self,-1);
  39209   ck_assert(r==4);
  39210   s = toStringO(self);
  39211   ck_assert_str_eq(s, "[1,2,3,4]");
  39212   free(s);
  39213   // wrong object type
  39214   createSmallDouble(I);
  39215   setValG(&I, 11);
  39216   r2 = self->f->pushSmallDouble(self, &I);
  39217   r = self->f->getAtNDupInt(self,-1);
  39218   ck_assert(!r);
  39219   s = toStringO(self);
  39220   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39221   free(s);
  39222   // wrong object type of another user class
  39223   //   User classes are stored in containers transparently
  39224   createAllocateSmallInt(ip);
  39225   ip->type = "anothertype";
  39226   setValG(ip, 11);
  39227   r2 = self->f->push(self, (baset*)ip);
  39228   ck_assert_ptr_ne(r2, null);
  39229   r = self->f->getAtNDupInt(self,-1);
  39230   ck_assert(!r);
  39231   s = toStringO(self);
  39232   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39233   free(s);
  39234   // index outside
  39235   ck_assert(!self->f->getAtNDupInt(self, 20));
  39236   ck_assert(!self->f->getAtNDupInt(self, -7));
  39237   // empty list
  39238   emptyO(self);
  39239   ck_assert(!self->f->getAtNDupInt(self, 0));
  39240   ck_assert(!self->f->getAtNDupInt(self, -1));
  39241   terminateO(self);
  39242 
  39243 }
  39244 
  39245 
  39246 void getAtNDupInt32SmallJsonT(CuTest *tc UNUSED) {
  39247 
  39248   int32_t r;
  39249   smallJsont *self = allocSmallJson();
  39250   smallJsont *r2;
  39251 
  39252   // add elements to self
  39253   r2 = self->f->pushInt(self, 1);
  39254   ck_assert_ptr_ne(r2, null);
  39255   r2 = self->f->pushInt(self, 2);
  39256   ck_assert_ptr_ne(r2, null);
  39257   r2 = self->f->pushInt(self, 3);
  39258   ck_assert_ptr_ne(r2, null);
  39259   r2 = self->f->pushInt(self, 4);
  39260   ck_assert_ptr_ne(r2, null);
  39261 
  39262   // positive index
  39263   r       = self->f->getAtNDupInt32(self,1);
  39264   ck_assert(r==2);
  39265   char *s = toStringO(self);
  39266   ck_assert_str_eq(s, "[1,2,3,4]");
  39267   free(s);
  39268   // negative index
  39269   r = self->f->getAtNDupInt32(self,-1);
  39270   ck_assert(r==4);
  39271   s = toStringO(self);
  39272   ck_assert_str_eq(s, "[1,2,3,4]");
  39273   free(s);
  39274   // wrong object type
  39275   createSmallDouble(I);
  39276   setValG(&I, 11);
  39277   r2 = self->f->pushSmallDouble(self, &I);
  39278   r = self->f->getAtNDupInt32(self,-1);
  39279   ck_assert(!r);
  39280   s = toStringO(self);
  39281   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39282   free(s);
  39283   // wrong object type of another user class
  39284   //   User classes are stored in containers transparently
  39285   createAllocateSmallInt(ip);
  39286   ip->type = "anothertype";
  39287   setValG(ip, 11);
  39288   r2 = self->f->push(self, (baset*)ip);
  39289   ck_assert_ptr_ne(r2, null);
  39290   r = self->f->getAtNDupInt32(self,-1);
  39291   ck_assert(!r);
  39292   s = toStringO(self);
  39293   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39294   free(s);
  39295   // index outside
  39296   ck_assert(!self->f->getAtNDupInt32(self, 20));
  39297   ck_assert(!self->f->getAtNDupInt32(self, -7));
  39298   // empty list
  39299   emptyO(self);
  39300   ck_assert(!self->f->getAtNDupInt32(self, 0));
  39301   ck_assert(!self->f->getAtNDupInt32(self, -1));
  39302   terminateO(self);
  39303 
  39304 }
  39305 
  39306 
  39307 void getAtNDupUintSmallJsonT(CuTest *tc UNUSED) {
  39308 
  39309   uint64_t r;
  39310   smallJsont *self = allocSmallJson();
  39311   smallJsont *r2;
  39312 
  39313   // add elements to self
  39314   r2 = self->f->pushInt(self, 1);
  39315   ck_assert_ptr_ne(r2, null);
  39316   r2 = self->f->pushInt(self, 2);
  39317   ck_assert_ptr_ne(r2, null);
  39318   r2 = self->f->pushInt(self, 3);
  39319   ck_assert_ptr_ne(r2, null);
  39320   r2 = self->f->pushInt(self, 4);
  39321   ck_assert_ptr_ne(r2, null);
  39322 
  39323   // positive index
  39324   r       = self->f->getAtNDupUint(self,1);
  39325   ck_assert(r==2);
  39326   char *s = toStringO(self);
  39327   ck_assert_str_eq(s, "[1,2,3,4]");
  39328   free(s);
  39329   // negative index
  39330   r = self->f->getAtNDupUint(self,-1);
  39331   ck_assert(r==4);
  39332   s = toStringO(self);
  39333   ck_assert_str_eq(s, "[1,2,3,4]");
  39334   free(s);
  39335   // wrong object type
  39336   createSmallDouble(I);
  39337   setValG(&I, 11);
  39338   r2 = self->f->pushSmallDouble(self, &I);
  39339   r = self->f->getAtNDupUint(self,-1);
  39340   ck_assert(!r);
  39341   s = toStringO(self);
  39342   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39343   free(s);
  39344   // wrong object type of another user class
  39345   //   User classes are stored in containers transparently
  39346   createAllocateSmallInt(ip);
  39347   ip->type = "anothertype";
  39348   setValG(ip, 11);
  39349   r2 = self->f->push(self, (baset*)ip);
  39350   ck_assert_ptr_ne(r2, null);
  39351   r = self->f->getAtNDupUint(self,-1);
  39352   ck_assert(!r);
  39353   s = toStringO(self);
  39354   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39355   free(s);
  39356   // index outside
  39357   ck_assert(!self->f->getAtNDupUint(self, 20));
  39358   ck_assert(!self->f->getAtNDupUint(self, -7));
  39359   // empty list
  39360   emptyO(self);
  39361   ck_assert(!self->f->getAtNDupUint(self, 0));
  39362   ck_assert(!self->f->getAtNDupUint(self, -1));
  39363   terminateO(self);
  39364 
  39365 }
  39366 
  39367 
  39368 void getAtNDupUint32SmallJsonT(CuTest *tc UNUSED) {
  39369 
  39370   uint32_t r;
  39371   smallJsont *self = allocSmallJson();
  39372   smallJsont *r2;
  39373 
  39374   // add elements to self
  39375   r2 = self->f->pushInt(self, 1);
  39376   ck_assert_ptr_ne(r2, null);
  39377   r2 = self->f->pushInt(self, 2);
  39378   ck_assert_ptr_ne(r2, null);
  39379   r2 = self->f->pushInt(self, 3);
  39380   ck_assert_ptr_ne(r2, null);
  39381   r2 = self->f->pushInt(self, 4);
  39382   ck_assert_ptr_ne(r2, null);
  39383 
  39384   // positive index
  39385   r       = self->f->getAtNDupUint32(self,1);
  39386   ck_assert(r==2);
  39387   char *s = toStringO(self);
  39388   ck_assert_str_eq(s, "[1,2,3,4]");
  39389   free(s);
  39390   // negative index
  39391   r = self->f->getAtNDupUint32(self,-1);
  39392   ck_assert(r==4);
  39393   s = toStringO(self);
  39394   ck_assert_str_eq(s, "[1,2,3,4]");
  39395   free(s);
  39396   // wrong object type
  39397   createSmallDouble(I);
  39398   setValG(&I, 11);
  39399   r2 = self->f->pushSmallDouble(self, &I);
  39400   r = self->f->getAtNDupUint32(self,-1);
  39401   ck_assert(!r);
  39402   s = toStringO(self);
  39403   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01]");
  39404   free(s);
  39405   // wrong object type of another user class
  39406   //   User classes are stored in containers transparently
  39407   createAllocateSmallInt(ip);
  39408   ip->type = "anothertype";
  39409   setValG(ip, 11);
  39410   r2 = self->f->push(self, (baset*)ip);
  39411   ck_assert_ptr_ne(r2, null);
  39412   r = self->f->getAtNDupUint32(self,-1);
  39413   ck_assert(!r);
  39414   s = toStringO(self);
  39415   ck_assert_str_eq(s, "[1,2,3,4,1.100000e+01,\"<data container>\"]");
  39416   free(s);
  39417   // index outside
  39418   ck_assert(!self->f->getAtNDupUint32(self, 20));
  39419   ck_assert(!self->f->getAtNDupUint32(self, -7));
  39420   // empty list
  39421   emptyO(self);
  39422   ck_assert(!self->f->getAtNDupUint32(self, 0));
  39423   ck_assert(!self->f->getAtNDupUint32(self, -1));
  39424   terminateO(self);
  39425 
  39426 }
  39427 
  39428 
  39429 void getAtNDupSSmallJsonT(CuTest *tc UNUSED) {
  39430 
  39431   char* r;
  39432   smallJsont *self = allocSmallJson();
  39433   smallJsont *r2;
  39434 
  39435   // add elements to self
  39436   r2 = self->f->pushInt(self, 1);
  39437   ck_assert_ptr_ne(r2, null);
  39438   r2 = self->f->pushS(self, "2");
  39439   ck_assert_ptr_ne(r2, null);
  39440   r2 = self->f->pushInt(self, 3);
  39441   ck_assert_ptr_ne(r2, null);
  39442   r2 = self->f->pushS(self, "4");
  39443   ck_assert_ptr_ne(r2, null);
  39444 
  39445   // positive index
  39446   r       = self->f->getAtNDupS(self,1);
  39447   ck_assert_ptr_ne(r, null);
  39448   ck_assert_str_eq(r, "2");
  39449   free(r);
  39450   char *s = toStringO(self);
  39451   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  39452   free(s);
  39453   // negative index
  39454   r = self->f->getAtNDupS(self,-1);
  39455   ck_assert_ptr_ne(r, null);
  39456   ck_assert_str_eq(r, "4");
  39457   free(r);
  39458   s = toStringO(self);
  39459   ck_assert_str_eq(s, "[1,\"2\",3,\"4\"]");
  39460   free(s);
  39461   // wrong object type
  39462   createSmallInt(I);
  39463   setValG(&I, 11);
  39464   r2 = self->f->pushSmallInt(self, &I);
  39465   r = self->f->getAtNDupS(self,-1);
  39466   ck_assert_ptr_eq(r, NULL);
  39467   s = toStringO(self);
  39468   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11]");
  39469   free(s);
  39470   // wrong object type of another user class
  39471   //   User classes are stored in containers transparently
  39472   createAllocateSmallInt(ip);
  39473   ip->type = "anothertype";
  39474   setValG(ip, 11);
  39475   r2 = self->f->push(self, (baset*)ip);
  39476   ck_assert_ptr_ne(r2, null);
  39477   r = self->f->getAtNDupS(self,-1);
  39478   ck_assert_ptr_eq(r, NULL);
  39479   s = toStringO(self);
  39480   ck_assert_str_eq(s, "[1,\"2\",3,\"4\",11,\"<data container>\"]");
  39481   free(s);
  39482   // index outside
  39483   ck_assert_ptr_eq(self->f->getAtNDupS(self, 20), NULL);
  39484   ck_assert_ptr_eq(self->f->getAtNDupS(self, -7), NULL);
  39485   // empty list
  39486   emptyO(self);
  39487   ck_assert_ptr_eq(self->f->getAtNDupS(self, 0), NULL);
  39488   ck_assert_ptr_eq(self->f->getAtNDupS(self, -1), NULL);
  39489   terminateO(self);
  39490 
  39491 }
  39492 
  39493 
  39494 void getAtNDupDictSmallJsonT(CuTest *tc UNUSED) {
  39495 
  39496   smallDictt* r;
  39497   smallJsont *self = allocSmallJson();
  39498   smallJsont *r2;
  39499 
  39500   // non json array
  39501   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 0), null);
  39502   // add elements to self
  39503   r2 = self->f->pushInt(self, 1);
  39504   ck_assert_ptr_ne(r2, null);
  39505   createSmallDict(e2);
  39506   r2 = self->f->pushDict(self, &e2);
  39507   ck_assert_ptr_ne(r2, null);
  39508   r2 = self->f->pushInt(self, 3);
  39509   ck_assert_ptr_ne(r2, null);
  39510   createSmallDict(e4);
  39511   r2 = self->f->pushDict(self, &e4);
  39512   ck_assert_ptr_ne(r2, null);
  39513 
  39514   // positive index
  39515   r       = self->f->getAtNDupDict(self,1);
  39516   ck_assert_ptr_ne(r, null);
  39517   char *s = toStringO(r);
  39518   terminateO(r);
  39519   ck_assert_str_eq(s, "{}");
  39520   free(s);
  39521   s = toStringO(self);
  39522   ck_assert_str_eq(s, "[1,{},3,{}]");
  39523   free(s);
  39524   // negative index
  39525   r = self->f->getAtNDupDict(self,-1);
  39526   ck_assert_ptr_ne(r, null);
  39527   s = toStringO(r);
  39528   terminateO(r);
  39529   ck_assert_str_eq(s, "{}");
  39530   free(s);
  39531   s = toStringO(self);
  39532   ck_assert_str_eq(s, "[1,{},3,{}]");
  39533   free(s);
  39534   // wrong object type
  39535   createSmallInt(I);
  39536   setValG(&I, 11);
  39537   r2 = self->f->pushSmallInt(self, &I);
  39538   r = self->f->getAtNDupDict(self,-1);
  39539   ck_assert_ptr_eq(r, NULL);
  39540   s = toStringO(self);
  39541   ck_assert_str_eq(s, "[1,{},3,{},11]");
  39542   free(s);
  39543   // wrong object type of another user class
  39544   //   User classes are stored in containers transparently
  39545   createAllocateSmallInt(ip);
  39546   ip->type = "anothertype";
  39547   setValG(ip, 11);
  39548   r2 = self->f->push(self, (baset*)ip);
  39549   ck_assert_ptr_ne(r2, null);
  39550   r = self->f->getAtNDupDict(self,-1);
  39551   ck_assert_ptr_eq(r, NULL);
  39552   s = toStringO(self);
  39553   ck_assert_str_eq(s, "[1,{},3,{},11,\"<data container>\"]");
  39554   free(s);
  39555   // index outside
  39556   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 20), NULL);
  39557   ck_assert_ptr_eq(self->f->getAtNDupDict(self, -7), NULL);
  39558   // empty list
  39559   emptyO(self);
  39560   ck_assert_ptr_eq(self->f->getAtNDupDict(self, 0), NULL);
  39561   ck_assert_ptr_eq(self->f->getAtNDupDict(self, -1), NULL);
  39562   terminateO(self);
  39563 
  39564 }
  39565 
  39566 
  39567 void getAtNDupArraySmallJsonT(CuTest *tc UNUSED) {
  39568 
  39569   smallArrayt* r;
  39570   smallJsont *self = allocSmallJson();
  39571   smallJsont *r2;
  39572 
  39573   // non json array
  39574   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 0), null);
  39575   // add elements to self
  39576   r2 = self->f->pushInt(self, 1);
  39577   ck_assert_ptr_ne(r2, null);
  39578   createSmallArray(e2);
  39579   r2 = self->f->pushArray(self, &e2);
  39580   ck_assert_ptr_ne(r2, null);
  39581   r2 = self->f->pushInt(self, 3);
  39582   ck_assert_ptr_ne(r2, null);
  39583   createSmallArray(e4);
  39584   r2 = self->f->pushArray(self, &e4);
  39585   ck_assert_ptr_ne(r2, null);
  39586 
  39587   // positive index
  39588   r       = self->f->getAtNDupArray(self,1);
  39589   ck_assert_ptr_ne(r, null);
  39590   char *s = toStringO(r);
  39591   terminateO(r);
  39592   ck_assert_str_eq(s, "[]");
  39593   free(s);
  39594   s = toStringO(self);
  39595   ck_assert_str_eq(s, "[1,[],3,[]]");
  39596   free(s);
  39597   // negative index
  39598   r = self->f->getAtNDupArray(self,-1);
  39599   ck_assert_ptr_ne(r, null);
  39600   s = toStringO(r);
  39601   terminateO(r);
  39602   ck_assert_str_eq(s, "[]");
  39603   free(s);
  39604   s = toStringO(self);
  39605   ck_assert_str_eq(s, "[1,[],3,[]]");
  39606   free(s);
  39607   // wrong object type
  39608   createSmallInt(I);
  39609   setValG(&I, 11);
  39610   r2 = self->f->pushSmallInt(self, &I);
  39611   r = self->f->getAtNDupArray(self,-1);
  39612   ck_assert_ptr_eq(r, NULL);
  39613   s = toStringO(self);
  39614   ck_assert_str_eq(s, "[1,[],3,[],11]");
  39615   free(s);
  39616   // wrong object type of another user class
  39617   //   User classes are stored in containers transparently
  39618   createAllocateSmallInt(ip);
  39619   ip->type = "anothertype";
  39620   setValG(ip, 11);
  39621   r2 = self->f->push(self, (baset*)ip);
  39622   ck_assert_ptr_ne(r2, null);
  39623   r = self->f->getAtNDupArray(self,-1);
  39624   ck_assert_ptr_eq(r, NULL);
  39625   s = toStringO(self);
  39626   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  39627   free(s);
  39628   // index outside
  39629   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 20), NULL);
  39630   ck_assert_ptr_eq(self->f->getAtNDupArray(self, -7), NULL);
  39631   // empty list
  39632   emptyO(self);
  39633   ck_assert_ptr_eq(self->f->getAtNDupArray(self, 0), NULL);
  39634   ck_assert_ptr_eq(self->f->getAtNDupArray(self, -1), NULL);
  39635   terminateO(self);
  39636 
  39637 }
  39638 
  39639 
  39640 void getAtNDupSmallBoolSmallJsonT(CuTest *tc UNUSED) {
  39641 
  39642   smallBoolt* r;
  39643   smallJsont *self = allocSmallJson();
  39644   smallJsont *r2;
  39645 
  39646   // non json array
  39647   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 0), null);
  39648   // add elements to self
  39649   r2 = self->f->pushInt(self, 1);
  39650   ck_assert_ptr_ne(r2, null);
  39651   createSmallBool(e2);
  39652   r2 = self->f->pushBool(self, true);
  39653   ck_assert_ptr_ne(r2, null);
  39654   r2 = self->f->pushInt(self, 3);
  39655   ck_assert_ptr_ne(r2, null);
  39656   createSmallBool(e4);
  39657   r2 = self->f->pushBool(self, true);
  39658   ck_assert_ptr_ne(r2, null);
  39659 
  39660   // positive index
  39661   r       = self->f->getAtNDupSmallBool(self,1);
  39662   ck_assert_ptr_ne(r, null);
  39663   char *s = toStringO(r);
  39664   terminateO(r);
  39665   ck_assert_str_eq(s, "true");
  39666   free(s);
  39667   s = toStringO(self);
  39668   ck_assert_str_eq(s, "[1,true,3,true]");
  39669   free(s);
  39670   // negative index
  39671   r = self->f->getAtNDupSmallBool(self,-1);
  39672   ck_assert_ptr_ne(r, null);
  39673   s = toStringO(r);
  39674   terminateO(r);
  39675   ck_assert_str_eq(s, "true");
  39676   free(s);
  39677   s = toStringO(self);
  39678   ck_assert_str_eq(s, "[1,true,3,true]");
  39679   free(s);
  39680   // wrong object type
  39681   createSmallInt(I);
  39682   setValG(&I, 11);
  39683   r2 = self->f->pushSmallInt(self, &I);
  39684   r = self->f->getAtNDupSmallBool(self,2);
  39685   ck_assert_ptr_eq(r, NULL);
  39686   s = toStringO(self);
  39687   ck_assert_str_eq(s, "[1,true,3,true,11]");
  39688   free(s);
  39689   // wrong object type of another user class
  39690   //   User classes are stored in containers transparently
  39691   createAllocateSmallInt(ip);
  39692   ip->type = "anothertype";
  39693   setValG(ip, 11);
  39694   r2 = self->f->push(self, (baset*)ip);
  39695   ck_assert_ptr_ne(r2, null);
  39696   r = self->f->getAtNDupSmallBool(self,-1);
  39697   ck_assert_ptr_eq(r, NULL);
  39698   s = toStringO(self);
  39699   ck_assert_str_eq(s, "[1,true,3,true,11,\"<data container>\"]");
  39700   free(s);
  39701   // index outside
  39702   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 20), NULL);
  39703   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, -7), NULL);
  39704   // empty list
  39705   emptyO(self);
  39706   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, 0), NULL);
  39707   ck_assert_ptr_eq(self->f->getAtNDupSmallBool(self, -1), NULL);
  39708   terminateO(self);
  39709 
  39710 }
  39711 
  39712 
  39713 void getAtNDupSmallBytesSmallJsonT(CuTest *tc UNUSED) {
  39714 
  39715   smallBytest* r;
  39716   smallJsont *self = allocSmallJson();
  39717   smallJsont *r2;
  39718 
  39719   // non json array
  39720   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 0), null);
  39721   // add elements to self
  39722   r2 = self->f->pushInt(self, 1);
  39723   ck_assert_ptr_ne(r2, null);
  39724   createSmallBytes(e2);
  39725   r2 = self->f->pushSmallBytes(self, &e2);
  39726   ck_assert_ptr_ne(r2, null);
  39727   r2 = self->f->pushInt(self, 3);
  39728   ck_assert_ptr_ne(r2, null);
  39729   createSmallBytes(e4);
  39730   r2 = self->f->pushSmallBytes(self, &e4);
  39731   ck_assert_ptr_ne(r2, null);
  39732 
  39733   // positive index
  39734   r       = self->f->getAtNDupSmallBytes(self,1);
  39735   ck_assert_ptr_ne(r, null);
  39736   char *s = toStringO(r);
  39737   terminateO(r);
  39738   ck_assert_str_eq(s, "[]");
  39739   free(s);
  39740   s = toStringO(self);
  39741   ck_assert_str_eq(s, "[1,[],3,[]]");
  39742   free(s);
  39743   // negative index
  39744   r = self->f->getAtNDupSmallBytes(self,-1);
  39745   ck_assert_ptr_ne(r, null);
  39746   s = toStringO(r);
  39747   terminateO(r);
  39748   ck_assert_str_eq(s, "[]");
  39749   free(s);
  39750   s = toStringO(self);
  39751   ck_assert_str_eq(s, "[1,[],3,[]]");
  39752   free(s);
  39753   // wrong object type
  39754   createSmallInt(I);
  39755   setValG(&I, 11);
  39756   r2 = self->f->pushSmallInt(self, &I);
  39757   r = self->f->getAtNDupSmallBytes(self,-1);
  39758   ck_assert_ptr_eq(r, NULL);
  39759   s = toStringO(self);
  39760   ck_assert_str_eq(s, "[1,[],3,[],11]");
  39761   free(s);
  39762   // wrong object type of another user class
  39763   //   User classes are stored in containers transparently
  39764   createAllocateSmallInt(ip);
  39765   ip->type = "anothertype";
  39766   setValG(ip, 11);
  39767   r2 = self->f->push(self, (baset*)ip);
  39768   ck_assert_ptr_ne(r2, null);
  39769   r = self->f->getAtNDupSmallBytes(self,-1);
  39770   ck_assert_ptr_eq(r, NULL);
  39771   s = toStringO(self);
  39772   ck_assert_str_eq(s, "[1,[],3,[],11,\"<data container>\"]");
  39773   free(s);
  39774   // index outside
  39775   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 20), NULL);
  39776   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, -7), NULL);
  39777   // empty list
  39778   emptyO(self);
  39779   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, 0), NULL);
  39780   ck_assert_ptr_eq(self->f->getAtNDupSmallBytes(self, -1), NULL);
  39781   terminateO(self);
  39782 
  39783 }
  39784 
  39785 
  39786 void getAtNDupSmallDoubleSmallJsonT(CuTest *tc UNUSED) {
  39787 
  39788   smallDoublet* r;
  39789   smallJsont *self = allocSmallJson();
  39790   smallJsont *r2;
  39791 
  39792   // non json array
  39793   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 0), null);
  39794   // add elements to self
  39795   r2 = self->f->pushInt(self, 1);
  39796   ck_assert_ptr_ne(r2, null);
  39797   createSmallDouble(e2);
  39798   r2 = self->f->pushSmallDouble(self, &e2);
  39799   ck_assert_ptr_ne(r2, null);
  39800   r2 = self->f->pushInt(self, 3);
  39801   ck_assert_ptr_ne(r2, null);
  39802   createSmallDouble(e4);
  39803   r2 = self->f->pushSmallDouble(self, &e4);
  39804   ck_assert_ptr_ne(r2, null);
  39805 
  39806   // positive index
  39807   r       = self->f->getAtNDupSmallDouble(self,1);
  39808   ck_assert_ptr_ne(r, null);
  39809   char *s = toStringO(r);
  39810   terminateO(r);
  39811   ck_assert_str_eq(s, "0.000000e+00");
  39812   free(s);
  39813   s = toStringO(self);
  39814   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  39815   free(s);
  39816   // negative index
  39817   r = self->f->getAtNDupSmallDouble(self,-1);
  39818   ck_assert_ptr_ne(r, null);
  39819   s = toStringO(r);
  39820   terminateO(r);
  39821   ck_assert_str_eq(s, "0.000000e+00");
  39822   free(s);
  39823   s = toStringO(self);
  39824   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00]");
  39825   free(s);
  39826   // wrong object type
  39827   createSmallInt(I);
  39828   setValG(&I, 11);
  39829   r2 = self->f->pushSmallInt(self, &I);
  39830   r = self->f->getAtNDupSmallDouble(self,-1);
  39831   ck_assert_ptr_eq(r, NULL);
  39832   s = toStringO(self);
  39833   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11]");
  39834   free(s);
  39835   // wrong object type of another user class
  39836   //   User classes are stored in containers transparently
  39837   createAllocateSmallInt(ip);
  39838   ip->type = "anothertype";
  39839   setValG(ip, 11);
  39840   r2 = self->f->push(self, (baset*)ip);
  39841   ck_assert_ptr_ne(r2, null);
  39842   r = self->f->getAtNDupSmallDouble(self,-1);
  39843   ck_assert_ptr_eq(r, NULL);
  39844   s = toStringO(self);
  39845   ck_assert_str_eq(s, "[1,0.000000e+00,3,0.000000e+00,11,\"<data container>\"]");
  39846   free(s);
  39847   // index outside
  39848   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 20), NULL);
  39849   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, -7), NULL);
  39850   // empty list
  39851   emptyO(self);
  39852   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, 0), NULL);
  39853   ck_assert_ptr_eq(self->f->getAtNDupSmallDouble(self, -1), NULL);
  39854   terminateO(self);
  39855 
  39856 }
  39857 
  39858 
  39859 void getAtNDupSmallIntSmallJsonT(CuTest *tc UNUSED) {
  39860 
  39861   smallIntt* r;
  39862   smallJsont *self = allocSmallJson();
  39863   smallJsont *r2;
  39864 
  39865   // non json array
  39866   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 0), null);
  39867   // add elements to self
  39868   r2 = self->f->pushBool(self, true);
  39869   ck_assert_ptr_ne(r2, null);
  39870   createSmallInt(e2);
  39871   r2 = self->f->pushSmallInt(self, &e2);
  39872   ck_assert_ptr_ne(r2, null);
  39873   r2 = self->f->pushBool(self, true);
  39874   ck_assert_ptr_ne(r2, null);
  39875   createSmallInt(e4);
  39876   r2 = self->f->pushSmallInt(self, &e4);
  39877   ck_assert_ptr_ne(r2, null);
  39878 
  39879   // positive index
  39880   r       = self->f->getAtNDupSmallInt(self,1);
  39881   ck_assert_ptr_ne(r, null);
  39882   char *s = toStringO(r);
  39883   terminateO(r);
  39884   ck_assert_str_eq(s, "0");
  39885   free(s);
  39886   s = toStringO(self);
  39887   ck_assert_str_eq(s, "[true,0,true,0]");
  39888   free(s);
  39889   // negative index
  39890   r = self->f->getAtNDupSmallInt(self,-1);
  39891   ck_assert_ptr_ne(r, null);
  39892   s = toStringO(r);
  39893   terminateO(r);
  39894   ck_assert_str_eq(s, "0");
  39895   free(s);
  39896   s = toStringO(self);
  39897   ck_assert_str_eq(s, "[true,0,true,0]");
  39898   free(s);
  39899   // wrong object type
  39900   createSmallDouble(I);
  39901   setValG(&I, 11);
  39902   r2 = self->f->pushSmallDouble(self, &I);
  39903   r = self->f->getAtNDupSmallInt(self,-1);
  39904   ck_assert_ptr_eq(r, NULL);
  39905   s = toStringO(self);
  39906   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01]");
  39907   free(s);
  39908   // wrong object type of another user class
  39909   //   User classes are stored in containers transparently
  39910   createAllocateSmallInt(ip);
  39911   ip->type = "anothertype";
  39912   setValG(ip, 11);
  39913   r2 = self->f->push(self, (baset*)ip);
  39914   ck_assert_ptr_ne(r2, null);
  39915   r = self->f->getAtNDupSmallInt(self,-1);
  39916   ck_assert_ptr_eq(r, NULL);
  39917   s = toStringO(self);
  39918   ck_assert_str_eq(s, "[true,0,true,0,1.100000e+01,\"<data container>\"]");
  39919   free(s);
  39920   // index outside
  39921   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 20), NULL);
  39922   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, -7), NULL);
  39923   // empty list
  39924   emptyO(self);
  39925   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, 0), NULL);
  39926   ck_assert_ptr_eq(self->f->getAtNDupSmallInt(self, -1), NULL);
  39927   terminateO(self);
  39928 
  39929 }
  39930 
  39931 
  39932 void getAtNDupSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  39933 
  39934   smallJsont* r;
  39935   smallJsont *self = allocSmallJson();
  39936   smallJsont *r2;
  39937 
  39938   // non json array
  39939   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 0), null);
  39940   // add elements to self
  39941   r2 = self->f->pushInt(self, 1);
  39942   ck_assert_ptr_ne(r2, null);
  39943   createSmallJson(e2);
  39944   r2 = self->f->pushSmallJson(self, &e2);
  39945   ck_assert_ptr_ne(r2, null);
  39946   r2 = self->f->pushInt(self, 3);
  39947   ck_assert_ptr_ne(r2, null);
  39948   createSmallJson(e4);
  39949   r2 = self->f->pushSmallJson(self, &e4);
  39950   ck_assert_ptr_ne(r2, null);
  39951 
  39952   // positive index
  39953   r       = self->f->getAtNDupSmallJson(self,1);
  39954   ck_assert_ptr_ne(r, null);
  39955   char *s = toStringO(r);
  39956   terminateO(r);
  39957   ck_assert_str_eq(s, "{}");
  39958   free(s);
  39959   s = toStringO(self);
  39960   ck_assert_str_eq(s, "[1,{},3,{}]");
  39961   free(s);
  39962   // negative index
  39963   r = self->f->getAtNDupSmallJson(self,-1);
  39964   ck_assert_ptr_ne(r, null);
  39965   s = toStringO(r);
  39966   terminateO(r);
  39967   ck_assert_str_eq(s, "{}");
  39968   free(s);
  39969   s = toStringO(self);
  39970   ck_assert_str_eq(s, "[1,{},3,{}]");
  39971   free(s);
  39972   // wrong object type
  39973   createSmallBytes(I);
  39974   r2 = self->f->pushSmallBytes(self, &I);
  39975   r = self->f->getAtNDupSmallJson(self,-1);
  39976   ck_assert_ptr_eq(r, NULL);
  39977   s = toStringO(self);
  39978   ck_assert_str_eq(s, "[1,{},3,{},[]]");
  39979   free(s);
  39980   // wrong object type of another user class
  39981   //   User classes are stored in containers transparently
  39982   createAllocateSmallInt(ip);
  39983   ip->type = "anothertype";
  39984   setValG(ip, 11);
  39985   r2 = self->f->push(self, (baset*)ip);
  39986   ck_assert_ptr_ne(r2, null);
  39987   r = self->f->getAtNDupSmallJson(self,-1);
  39988   ck_assert_ptr_eq(r, NULL);
  39989   s = toStringO(self);
  39990   ck_assert_str_eq(s, "[1,{},3,{},[],\"<data container>\"]");
  39991   free(s);
  39992   // index outside
  39993   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 20), NULL);
  39994   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, -7), NULL);
  39995   // empty list
  39996   emptyO(self);
  39997   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, 0), NULL);
  39998   ck_assert_ptr_eq(self->f->getAtNDupSmallJson(self, -1), NULL);
  39999   terminateO(self);
  40000 
  40001 }
  40002 
  40003 
  40004 void getAtNDupSmallStringSmallJsonT(CuTest *tc UNUSED) {
  40005 
  40006   smallStringt* r;
  40007   smallJsont *self = allocSmallJson();
  40008   smallJsont *r2;
  40009 
  40010   // non json array
  40011   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 0), null);
  40012   // add elements to self
  40013   r2 = self->f->pushInt(self, 1);
  40014   ck_assert_ptr_ne(r2, null);
  40015   createSmallString(e2);
  40016   r2 = self->f->pushSmallString(self, &e2);
  40017   ck_assert_ptr_ne(r2, null);
  40018   r2 = self->f->pushInt(self, 3);
  40019   ck_assert_ptr_ne(r2, null);
  40020   createSmallString(e4);
  40021   r2 = self->f->pushSmallString(self, &e4);
  40022   ck_assert_ptr_ne(r2, null);
  40023 
  40024   // positive index
  40025   r       = self->f->getAtNDupSmallString(self,1);
  40026   ck_assert_ptr_ne(r, null);
  40027   char *s = toStringO(r);
  40028   terminateO(r);
  40029   ck_assert_str_eq(s, "");
  40030   free(s);
  40031   s = toStringO(self);
  40032   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  40033   free(s);
  40034   // negative index
  40035   r = self->f->getAtNDupSmallString(self,-1);
  40036   ck_assert_ptr_ne(r, null);
  40037   s = toStringO(r);
  40038   terminateO(r);
  40039   ck_assert_str_eq(s, "");
  40040   free(s);
  40041   s = toStringO(self);
  40042   ck_assert_str_eq(s, "[1,\"\",3,\"\"]");
  40043   free(s);
  40044   // wrong object type
  40045   createSmallInt(I);
  40046   setValG(&I, 11);
  40047   r2 = self->f->pushSmallInt(self, &I);
  40048   r = self->f->getAtNDupSmallString(self,-1);
  40049   ck_assert_ptr_eq(r, NULL);
  40050   s = toStringO(self);
  40051   ck_assert_str_eq(s, "[1,\"\",3,\"\",11]");
  40052   free(s);
  40053   // wrong object type of another user class
  40054   //   User classes are stored in containers transparently
  40055   createAllocateSmallInt(ip);
  40056   ip->type = "anothertype";
  40057   setValG(ip, 11);
  40058   r2 = self->f->push(self, (baset*)ip);
  40059   ck_assert_ptr_ne(r2, null);
  40060   r = self->f->getAtNDupSmallString(self,-1);
  40061   ck_assert_ptr_eq(r, NULL);
  40062   s = toStringO(self);
  40063   ck_assert_str_eq(s, "[1,\"\",3,\"\",11,\"<data container>\"]");
  40064   free(s);
  40065   // index outside
  40066   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 20), NULL);
  40067   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, -7), NULL);
  40068   // empty list
  40069   emptyO(self);
  40070   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, 0), NULL);
  40071   ck_assert_ptr_eq(self->f->getAtNDupSmallString(self, -1), NULL);
  40072   terminateO(self);
  40073 
  40074 }
  40075 
  40076 
  40077 void getAtNDupVoidSmallJsonT(CuTest *tc UNUSED) {
  40078 
  40079   void* r;
  40080   smallJsont *self = allocSmallJson();
  40081   smallJsont *r2;
  40082 
  40083   // non json array
  40084   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 0), null);
  40085   // add elements to self
  40086   r2 = self->f->pushInt(self, 1);
  40087   ck_assert_ptr_ne(r2, null);
  40088   r2 = pushVoidSmallJsonG(self, &r);
  40089   ck_assert_ptr_ne(r2, null);
  40090   r2 = self->f->pushInt(self, 3);
  40091   ck_assert_ptr_ne(r2, null);
  40092   r2 = pushVoidSmallJsonG(self, &self);
  40093   ck_assert_ptr_ne(r2, null);
  40094 
  40095   // positive index
  40096   r       = self->f->getAtNDupVoid(self,1);
  40097   // duplicate function is not set so the data is not duplicated
  40098   ck_assert_ptr_eq(r, NULL);
  40099   char *s = toStringO(self);
  40100   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40101   free(s);
  40102   // negative index
  40103   r = self->f->getAtNDupVoid(self,-1);
  40104   // duplicate function is not set so the data is not duplicated
  40105   ck_assert_ptr_eq(r, NULL);
  40106   s = toStringO(self);
  40107   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40108   free(s);
  40109   // wrong object type
  40110   createSmallInt(I);
  40111   setValG(&I, 11);
  40112   r2 = self->f->pushSmallInt(self, &I);
  40113   r = self->f->getAtNDupVoid(self,-1);
  40114   ck_assert_ptr_eq(r, NULL);
  40115   s = toStringO(self);
  40116   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  40117   free(s);
  40118   // wrong object type of another user class
  40119   //   User classes are stored in containers transparently
  40120   createAllocateSmallInt(ip);
  40121   ip->type = "anothertype";
  40122   setValG(ip, 11);
  40123   r2 = self->f->push(self, (baset*)ip);
  40124   ck_assert_ptr_ne(r2, null);
  40125   r = self->f->getAtNDupVoid(self,-1);
  40126   ck_assert_ptr_eq(r, NULL);
  40127   s = toStringO(self);
  40128   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  40129   free(s);
  40130   // index outside
  40131   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 20), NULL);
  40132   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, -7), NULL);
  40133   // empty list
  40134   emptyO(self);
  40135   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, 0), NULL);
  40136   ck_assert_ptr_eq(self->f->getAtNDupVoid(self, -1), NULL);
  40137   terminateO(self);
  40138 
  40139 }
  40140 
  40141 
  40142 void getAtNDupSmallContainerSmallJsonT(CuTest *tc UNUSED) {
  40143 
  40144   smallContainert* r;
  40145   smallJsont *self = allocSmallJson();
  40146   smallJsont *r2;
  40147 
  40148   // non json array
  40149   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 0), null);
  40150   // add elements to self
  40151   r2 = self->f->pushInt(self, 1);
  40152   ck_assert_ptr_ne(r2, null);
  40153   createSmallContainer(e2);
  40154   r2 = self->f->pushSmallContainer(self, &e2);
  40155   ck_assert_ptr_ne(r2, null);
  40156   r2 = self->f->pushInt(self, 3);
  40157   ck_assert_ptr_ne(r2, null);
  40158   createSmallContainer(e4);
  40159   r2 = self->f->pushSmallContainer(self, &e4);
  40160   ck_assert_ptr_ne(r2, null);
  40161 
  40162   // positive index
  40163   r       = self->f->getAtNDupSmallContainer(self,1);
  40164   ck_assert_ptr_ne(r, null);
  40165   char *s = toStringO(r);
  40166   terminateO(r);
  40167   ck_assert_str_eq(s, "<data smallContainer>");
  40168   free(s);
  40169   s = toStringO(self);
  40170   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40171   free(s);
  40172   // negative index
  40173   r = self->f->getAtNDupSmallContainer(self,-1);
  40174   ck_assert_ptr_ne(r, null);
  40175   s = toStringO(r);
  40176   terminateO(r);
  40177   ck_assert_str_eq(s, "<data smallContainer>");
  40178   free(s);
  40179   s = toStringO(self);
  40180   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\"]");
  40181   free(s);
  40182   // wrong object type
  40183   createSmallInt(I);
  40184   setValG(&I, 11);
  40185   r2 = self->f->pushSmallInt(self, &I);
  40186   r = self->f->getAtNDupSmallContainer(self,-1);
  40187   ck_assert_ptr_eq(r, NULL);
  40188   s = toStringO(self);
  40189   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11]");
  40190   free(s);
  40191   // wrong object type of another user class
  40192   //   User classes are stored in containers transparently
  40193   createAllocateSmallInt(ip);
  40194   ip->type = "anothertype";
  40195   setValG(ip, 11);
  40196   r2 = self->f->push(self, (baset*)ip);
  40197   ck_assert_ptr_ne(r2, null);
  40198   r = self->f->getAtNDupSmallContainer(self,-1);
  40199   ck_assert_ptr_eq(r, NULL);
  40200   s = toStringO(self);
  40201   ck_assert_str_eq(s, "[1,\"<data container>\",3,\"<data container>\",11,\"<data container>\"]");
  40202   free(s);
  40203   // index outside
  40204   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 20), NULL);
  40205   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, -7), NULL);
  40206   // empty list
  40207   emptyO(self);
  40208   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, 0), NULL);
  40209   ck_assert_ptr_eq(self->f->getAtNDupSmallContainer(self, -1), NULL);
  40210   terminateO(self);
  40211 
  40212 }
  40213 
  40214 
  40215 void getNumSmallJsonT(CuTest *tc UNUSED) {
  40216 
  40217   double r;
  40218   smallJsont *self = allocSmallJson();
  40219   smallJsont *r2;
  40220 
  40221   // non json array
  40222   ck_assert(getNumO(self, 0) == 0);
  40223   r2 = self->f->setInt(self, "1", 1);
  40224   ck_assert_ptr_ne(r2, null);
  40225   r2 = self->f->setDouble(self, "2", 2.2);
  40226   ck_assert_ptr_ne(r2, null);
  40227   r2 = self->f->setS(self, "3", "2");
  40228   ck_assert_ptr_ne(r2, null);
  40229   r = getNumO(self, "1");
  40230   ck_assert(r == 1);
  40231   r = getNumO(self, "2");
  40232   ck_assert(r == 2.2);
  40233   // not a number
  40234   r = getNumO(self, "3");
  40235   ck_assert(r == 0);
  40236   // path
  40237   createSmallArray(a);
  40238   createSmallDict(d);
  40239   a.f->pushDict(&a, &d);
  40240   self->f->setArray(self, "array", &a);
  40241   r2 = self->f->setInt(self, "\"array\"[0].\"key\"", 123);
  40242   ck_assert_ptr_ne(r2, null);
  40243   r = getNumO(self, "\"array\"[0].\"key\"");
  40244   ck_assert_int_eq(r, 123);
  40245   // json bool
  40246   freeO(self);
  40247   setTypeBoolO(self);
  40248   r = getNumO(self, "1");
  40249   ck_assert(r == 0);
  40250   // json array
  40251   freeO(self);
  40252   setTypeArrayO(self);
  40253   r = getNumO(self, "1");
  40254   ck_assert(r == 0);
  40255   // non existing dict path
  40256   freeO(self);
  40257   r = getNumO(self, "\"1\"[1]");
  40258   ck_assert(r == 0);
  40259   //   dict path but the object is an array
  40260   resetO(&a);
  40261   self->f->setArray(self, "1", &a);
  40262   r = getNumO(self, "\"1\".\"1\"");
  40263   ck_assert(r == 0);
  40264   //   dict object in path but the key doesn't exists
  40265   resetO(&d);
  40266   self->f->setDict(self, "2", &d);
  40267   r = getNumO(self, "\"2\".\"1\".[12]");
  40268   ck_assert(r == 0);
  40269   // null key
  40270   r = getNumO(self, null);
  40271   ck_assert(r == 0);
  40272 	// empty self
  40273   freeO(self);
  40274   r = getNumO(self, "1");
  40275   ck_assert(r == 0);
  40276   terminateO(self);
  40277 
  40278 }
  40279 
  40280 
  40281 void getNumAtSmallJsonT(CuTest *tc UNUSED) {
  40282 
  40283   double r;
  40284   smallJsont *self = allocSmallJson();
  40285   smallJsont *r2;
  40286 
  40287   // non json array
  40288   ck_assert(!getNumAtO(self, 0));
  40289   // add elements to self
  40290   r2 = self->f->pushInt(self, 1);
  40291   ck_assert_ptr_ne(r2, null);
  40292   r2 = self->f->pushDouble(self, 2);
  40293   ck_assert_ptr_ne(r2, null);
  40294   r2 = self->f->pushInt(self, 3);
  40295   ck_assert_ptr_ne(r2, null);
  40296   r2 = self->f->pushInt(self, 4);
  40297   ck_assert_ptr_ne(r2, null);
  40298 
  40299   // positive index
  40300   r       = getNumAtO(self,1);
  40301   ck_assert(r==2);
  40302   char *s = toStringO(self);
  40303   ck_assert_str_eq(s, "[1,2.000000e+00,3,4]");
  40304   free(s);
  40305   // negative index
  40306   r = getNumAtO(self,-1);
  40307   ck_assert(r==4);
  40308   s = toStringO(self);
  40309   ck_assert_str_eq(s, "[1,2.000000e+00,3,4]");
  40310   free(s);
  40311   // wrong object type of another user class
  40312   //   User classes are stored in containers transparently
  40313   createAllocateSmallInt(ip);
  40314   ip->type = "anothertype";
  40315   setValG(ip, 11);
  40316   r2 = self->f->push(self, (baset*)ip);
  40317   ck_assert_ptr_ne(r2, null);
  40318   r = getNumAtO(self,-1);
  40319   ck_assert(!r);
  40320   s = toStringO(self);
  40321   ck_assert_str_eq(s, "[1,2.000000e+00,3,4,\"<data container>\"]");
  40322   free(s);
  40323   // index outside
  40324   ck_assert(!getNumAtO(self, 20));
  40325   ck_assert(!getNumAtO(self, -7));
  40326   // empty list
  40327   emptyO(self);
  40328   ck_assert(!getNumAtO(self, 0));
  40329   ck_assert(!getNumAtO(self, -1));
  40330   terminateO(self);
  40331 
  40332 }
  40333 
  40334 
  40335 void delElemSmallJsonT(CuTest *tc UNUSED) {
  40336 
  40337   smallJsont* r;
  40338   smallJsont *self = allocG(rtSmallJsont);
  40339 
  40340   self->f->setBool(self, "lib", true);
  40341   // delete element
  40342   r = delElemO(self, "lib");
  40343   ck_assert_ptr_ne(r, null);
  40344   smallBoolt *oBool3 = (smallBoolt *)self->f->get(self, "lib");
  40345   ck_assert_ptr_eq(oBool3, NULL);
  40346   // path
  40347   baset *value = (baset*) allocSmallInt(2);
  40348   createSmallArray(a);
  40349   createSmallDict(d);
  40350   a.f->pushDict(&a, &d);
  40351   self->f->setArray(self, "array", &a);
  40352   r = self->f->set(self, "\"array\"[0].\"key\"", value);
  40353   ck_assert_ptr_ne(r, null);
  40354   finishO(value);
  40355   r = delElemO(self, "\"array\"[0].\"key\"");
  40356   ck_assert_ptr_ne(r, null);
  40357   // json bool
  40358   freeO(self);
  40359   setTypeBoolO(self);
  40360   r = delElemO(self, "1");
  40361   ck_assert_ptr_eq(r, null);
  40362   // json array
  40363   freeO(self);
  40364   setTypeArrayO(self);
  40365   r = delElemO(self, "1");
  40366   ck_assert_ptr_eq(r, null);
  40367   // non existing dict path
  40368   freeO(self);
  40369   r = delElemO(self, "\"1\"[1]");
  40370   ck_assert_ptr_eq(r, null);
  40371   //   dict path but the object is an array
  40372   resetO(&a);
  40373   self->f->setArray(self, "1", &a);
  40374   r = delElemO(self, "\"1\".\"1\"");
  40375   ck_assert_ptr_eq(r, null);
  40376   //   dict object in path but the key doesn't exists
  40377   resetO(&d);
  40378   self->f->setDict(self, "2", &d);
  40379   r = delElemO(self, "\"2\".\"1\".[12]");
  40380   ck_assert_ptr_eq(r, null);
  40381   // delete non existing element
  40382   r = delElemO(self, NULL);
  40383   ck_assert_ptr_eq(r, null);
  40384   r = delElemO(self, "non existing");
  40385   ck_assert_ptr_ne(r, null);
  40386   terminateO(self);
  40387 
  40388 }
  40389 
  40390 
  40391 void delSmallJsonT(CuTest *tc UNUSED) {
  40392 
  40393   smallJsont* r;
  40394   smallJsont *self = allocG(rtSmallJsont);
  40395 
  40396   // json string
  40397   // empty string
  40398   setTopSO(self, "");
  40399   r = delO(self, 0,1);
  40400   ck_assert_ptr_eq(r, null);
  40401   // del
  40402   freeO(self);
  40403   setTopSO(self, "sheepy");
  40404   r = delO(self, 0,2);
  40405   ck_assert_ptr_ne(r, null);
  40406   char *s = toStringO(r);
  40407   ck_assert_str_eq(s, "eepy");
  40408   free(s);
  40409   // negative index
  40410   freeO(self);
  40411   setTopSO(self, "sheepy");
  40412   r = delO(self, -2,0);
  40413   ck_assert_ptr_ne(r, null);
  40414   s = toStringO(r);
  40415   ck_assert_str_eq(s, "shee");
  40416   free(s);
  40417   // positive and negative indexes
  40418   freeO(self);
  40419   setTopSO(self, "sheepy");
  40420   r = delO(self, 2,-2);
  40421   ck_assert_ptr_ne(r, null);
  40422   s = toStringO(r);
  40423   ck_assert_str_eq(s, "shpy");
  40424   free(s);
  40425   // start = end
  40426   freeO(self);
  40427   setTopSO(self, "sheepy");
  40428   r = delO(self, 2,-4);
  40429   ck_assert_ptr_ne(r, null);
  40430   s = toStringO(r);
  40431   ck_assert_str_eq(s, "sheepy");
  40432   free(s);
  40433   // delete entire string
  40434   freeO(self);
  40435   setTopSO(self, "sheepy");
  40436   r = delO(self, 0,0);
  40437   ck_assert_ptr_ne(r, null);
  40438   s = toStringO(r);
  40439   ck_assert_str_eq(s, "");
  40440   free(s);
  40441   // end of string
  40442   freeO(self);
  40443   setTopSO(self, "sheepy");
  40444   r = delO(self, 2,6);
  40445   ck_assert_ptr_ne(r, null);
  40446   s = toStringO(r);
  40447   ck_assert_str_eq(s, "sh");
  40448   free(s);
  40449   // NULL string
  40450   freeO(self);
  40451   r = delO(self, 2,-4);
  40452   ck_assert_ptr_eq(r, NULL);
  40453   // start outside string
  40454   freeO(self);
  40455   setTopSO(self, "sheepy");
  40456   r = delO(self, 20,-4);
  40457   ck_assert_ptr_eq(r, null);
  40458   s = toStringO(self);
  40459   ck_assert_str_eq(s, "sheepy");
  40460   free(s);
  40461   r = delO(self, -20,-4);
  40462   ck_assert_ptr_ne(r, null);
  40463   s = toStringO(r);
  40464   ck_assert_str_eq(s, "eepy");
  40465   free(s);
  40466   // end outside string
  40467   freeO(self);
  40468   setTopSO(self, "sheepy");
  40469   r = delO(self, 2,40);
  40470   ck_assert_ptr_ne(r, null);
  40471   s = toStringO(r);
  40472   ck_assert_str_eq(s, "sh");
  40473   free(s);
  40474   freeO(self);
  40475   setTopSO(self, "sheepy");
  40476   r = delO(self, 2,-40);
  40477   ck_assert_ptr_eq(r, null);
  40478   s = toStringO(self);
  40479   ck_assert_str_eq(s, "sheepy");
  40480   free(s);
  40481   // end before start
  40482   freeO(self);
  40483   setTopSO(self, "sheepy");
  40484   r = delO(self, 4,2);
  40485   ck_assert_ptr_eq(r, null);
  40486   s = toStringO(self);
  40487   ck_assert_str_eq(s, "sheepy");
  40488   free(s);
  40489   terminateO(self);
  40490   // json array
  40491   self = allocSmallJson();
  40492   self->f->pushUndefined(self);
  40493   self->f->pushInt(self, 123);
  40494   self->f->pushS(self, "sheepy");
  40495   self->f->pushInt(self, 5345);
  40496   // del
  40497   r = delO(self,1,-1);
  40498   ck_assert_ptr_ne(r, null);
  40499   s = toStringO(self);
  40500   ck_assert_str_eq(s, "[null,5345]");
  40501   free(s);
  40502   terminateO(self);
  40503     // start outside
  40504   self = allocSmallJson();
  40505   self->f->pushUndefined(self);
  40506   self->f->pushInt(self, 123);
  40507   self->f->pushS(self, "sheepy");
  40508   self->f->pushInt(self, 5345);
  40509   r = delO(self,20,-1);
  40510   ck_assert_ptr_eq(r, null);
  40511   s = toStringO(self);
  40512   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40513   free(s);
  40514   terminateO(self);
  40515     // start negative and outside
  40516   self = allocSmallJson();
  40517   self->f->pushUndefined(self);
  40518   self->f->pushInt(self, 123);
  40519   self->f->pushS(self, "sheepy");
  40520   self->f->pushInt(self, 5345);
  40521   r = delO(self,-20,1);
  40522   ck_assert_ptr_ne(r, null);
  40523   s = toStringO(self);
  40524   ck_assert_str_eq(s, "[123,\"sheepy\",5345]");
  40525   free(s);
  40526   terminateO(self);
  40527     // end outside
  40528   self = allocSmallJson();
  40529   self->f->pushUndefined(self);
  40530   self->f->pushInt(self, 123);
  40531   self->f->pushS(self, "sheepy");
  40532   self->f->pushInt(self, 5345);
  40533   r = delO(self,2,40);
  40534   ck_assert_ptr_ne(r, null);
  40535   s = toStringO(self);
  40536   ck_assert_str_eq(s, "[null,123]");
  40537   free(s);
  40538   terminateO(self);
  40539     // end negative and outside
  40540   self = allocSmallJson();
  40541   self->f->pushUndefined(self);
  40542   self->f->pushInt(self, 123);
  40543   self->f->pushS(self, "sheepy");
  40544   self->f->pushInt(self, 5345);
  40545   r = delO(self,2,-40);
  40546   ck_assert_ptr_eq(r, null);
  40547   s = toStringO(self);
  40548   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40549   free(s);
  40550   terminateO(self);
  40551     // end before start
  40552   self = allocSmallJson();
  40553   self->f->pushUndefined(self);
  40554   self->f->pushInt(self, 123);
  40555   self->f->pushS(self, "sheepy");
  40556   self->f->pushInt(self, 5345);
  40557   r = delO(self,3,2);
  40558   ck_assert_ptr_eq(r, null);
  40559   s = toStringO(self);
  40560   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40561   free(s);
  40562   terminateO(self);
  40563     // negative start last element
  40564   self = allocSmallJson();
  40565   self->f->pushUndefined(self);
  40566   self->f->pushInt(self, 123);
  40567   self->f->pushS(self, "sheepy");
  40568   self->f->pushInt(self, 5345);
  40569   r = delO(self,-1,0);
  40570   ck_assert_ptr_ne(r, null);
  40571   s = toStringO(self);
  40572   ck_assert_str_eq(s, "[null,123,\"sheepy\"]");
  40573   free(s);
  40574   terminateO(self);
  40575     // start = end
  40576   self = allocSmallJson();
  40577   self->f->pushUndefined(self);
  40578   self->f->pushInt(self, 123);
  40579   self->f->pushS(self, "sheepy");
  40580   self->f->pushInt(self, 5345);
  40581   r = delO(self,1,1);
  40582   ck_assert_ptr_ne(r, null);
  40583   s = toStringO(self);
  40584   ck_assert_str_eq(s, "[null,123,\"sheepy\",5345]");
  40585   free(s);
  40586   terminateO(self);
  40587     // empty list
  40588   self = allocSmallJson();
  40589   r = delO(self,0,0);
  40590   ck_assert_ptr_eq(r, null);
  40591   setTypeArrayO(self);
  40592   r = delO(self,0,0);
  40593   ck_assert_ptr_eq(r, null);
  40594   terminateO(self);
  40595 
  40596 }
  40597 
  40598 
  40599 void delElemIndexSmallJsonT(CuTest *tc UNUSED) {
  40600 
  40601   smallJsont* r;
  40602   smallJsont *self = allocG(rtSmallJsont);
  40603 
  40604   // non json array
  40605   r = delElemIndexO(self, 0);
  40606   ck_assert_ptr_eq(r, null);
  40607   // json string
  40608   // del
  40609   freeO(self);
  40610   setTopSO(self, "sheepy");
  40611   r = delElemIndexO(self, 0);
  40612   ck_assert_ptr_ne(r, null);
  40613   char *s = toStringO(r);
  40614   ck_assert_str_eq(s, "heepy");
  40615   free(s);
  40616   freeO(self);
  40617   setTopSO(self, "sheepy");
  40618   r = delElemIndexO(self, 5);
  40619   ck_assert_ptr_ne(r, null);
  40620   s = toStringO(r);
  40621   ck_assert_str_eq(s, "sheep");
  40622   free(s);
  40623   // negative index
  40624   freeO(self);
  40625   setTopSO(self, "sheepy");
  40626   r = delElemIndexO(self, -1);
  40627   ck_assert_ptr_ne(r, null);
  40628   s = toStringO(r);
  40629   ck_assert_str_eq(s, "sheep");
  40630   free(s);
  40631   freeO(self);
  40632   setTopSO(self, "sheepy");
  40633   r = delElemIndexO(self, -6);
  40634   ck_assert_ptr_ne(r, null);
  40635   s = toStringO(r);
  40636   ck_assert_str_eq(s, "heepy");
  40637   free(s);
  40638   // index outside string
  40639   freeO(self);
  40640   setTopSO(self, "sheepy");
  40641   r = delElemIndexO(self, 6);
  40642   ck_assert_ptr_eq(r, null);
  40643   r = delElemIndexO(self, -7);
  40644   ck_assert_ptr_eq(r, null);
  40645   // empty string
  40646   freeO(self);
  40647   setTopSO(self, "");
  40648   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40649   // null string
  40650   freeO(self);
  40651   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40652   terminateO(self);
  40653   // json array
  40654   self = allocSmallJson();
  40655   setTypeArrayO(self);
  40656   // empty array
  40657   ck_assert_ptr_eq(delElemIndexO(self, 0), null);
  40658   // outside positive and negative
  40659   self->f->pushS(self, "");
  40660   ck_assert_ptr_eq(delElemIndexO(self, 1), null);
  40661   ck_assert_ptr_eq(delElemIndexO(self, -2), null);
  40662   // del
  40663   ck_assert_ptr_ne(delElemIndexO(self, -1), null);
  40664   s = toStringO(self);
  40665   ck_assert_str_eq(s, "[]");
  40666   free(s);
  40667   terminateO(self);
  40668 
  40669 }
  40670 
  40671 
  40672 void removeElemSmallJsonT(CuTest *tc UNUSED) {
  40673 
  40674   smallJsont* r;
  40675   smallJsont *self = allocSmallJson();
  40676 
  40677   smallIntt *i = allocSmallInt(1);
  40678   r = self->f->setSmallInt(self, "1", i);
  40679   ck_assert_ptr_ne(r, null);
  40680   r = self->f->removeElem(self, "1");
  40681   ck_assert_ptr_ne(r, null);
  40682   terminateO(i);
  40683   char *s = toStringO(r);
  40684   ck_assert_str_eq(s, "{}");
  40685   free(s);
  40686   // path
  40687   baset *value = (baset*) allocSmallInt(2);
  40688   createSmallArray(a);
  40689   createSmallDict(d);
  40690   a.f->pushDict(&a, &d);
  40691   self->f->setArray(self, "array", &a);
  40692   r = self->f->set(self, "\"array\"[0].\"key\"", value);
  40693   ck_assert_ptr_ne(r, null);
  40694   r = self->f->removeElem(self, "\"array\"[0].\"key\"");
  40695   ck_assert_ptr_ne(r, null);
  40696   terminateO(value);
  40697   // json bool
  40698   freeO(self);
  40699   setTypeBoolO(self);
  40700   r = self->f->removeElem(self, "1");
  40701   ck_assert_ptr_eq(r, null);
  40702   // json array
  40703   freeO(self);
  40704   setTypeArrayO(self);
  40705   r = self->f->removeElem(self, "1");
  40706   ck_assert_ptr_eq(r, null);
  40707   // non existing dict path
  40708   freeO(self);
  40709   r = self->f->removeElem(self, "\"1\"[1]");
  40710   ck_assert_ptr_eq(r, null);
  40711   //   dict path but the object is an array
  40712   resetO(&a);
  40713   self->f->setArray(self, "1", &a);
  40714   r = self->f->removeElem(self, "\"1\".\"1\"");
  40715   ck_assert_ptr_eq(r, null);
  40716   //   dict object in path but the key doesn't exists
  40717   resetO(&d);
  40718   self->f->setDict(self, "2", &d);
  40719   r = self->f->removeElem(self, "\"2\".\"1\".[12]");
  40720   ck_assert_ptr_eq(r, null);
  40721   delElemO(self, "2");
  40722   // non existing key
  40723   r = self->f->removeElem(self, "1");
  40724   ck_assert_ptr_ne(r, null);
  40725   freeO(&a); // self->f->setArray(self, "1", &a) above allocates an sArray
  40726   s = toStringO(r);
  40727   ck_assert_str_eq(s, "{}");
  40728   free(s);
  40729   // null key
  40730   r = self->f->removeElem(self, null);
  40731   ck_assert_ptr_eq(r, null);
  40732 	// empty self
  40733   freeO(self);
  40734   r = self->f->removeElem(self, "qwe");
  40735   ck_assert_ptr_eq(r, null);
  40736   terminateO(self);
  40737 
  40738 }
  40739 
  40740 
  40741 void removeSmallJsonT(CuTest *tc UNUSED) {
  40742 
  40743   smallJsont* r;
  40744   smallJsont *self = allocSmallJson();
  40745 
  40746   // non json array or string
  40747   ck_assert_ptr_eq(removeO(self, 0, 1), null);
  40748   // json string -> same code as delO json string
  40749   // empty string
  40750   setTopSO(self, "");
  40751   r = removeO(self, 0,1);
  40752   ck_assert_ptr_eq(r, null);
  40753   // del
  40754   freeO(self);
  40755   setTopSO(self, "sheepy");
  40756   r = removeO(self, 0,2);
  40757   ck_assert_ptr_ne(r, null);
  40758   char *s = toStringO(r);
  40759   ck_assert_str_eq(s, "eepy");
  40760   free(s);
  40761   // negative index
  40762   freeO(self);
  40763   setTopSO(self, "sheepy");
  40764   r = removeO(self, -2,0);
  40765   ck_assert_ptr_ne(r, null);
  40766   s = toStringO(r);
  40767   ck_assert_str_eq(s, "shee");
  40768   free(s);
  40769   // positive and negative indexes
  40770   freeO(self);
  40771   setTopSO(self, "sheepy");
  40772   r = removeO(self, 2,-2);
  40773   ck_assert_ptr_ne(r, null);
  40774   s = toStringO(r);
  40775   ck_assert_str_eq(s, "shpy");
  40776   free(s);
  40777   // start = end
  40778   freeO(self);
  40779   setTopSO(self, "sheepy");
  40780   r = removeO(self, 2,-4);
  40781   ck_assert_ptr_ne(r, null);
  40782   s = toStringO(r);
  40783   ck_assert_str_eq(s, "sheepy");
  40784   free(s);
  40785   // delete entire string
  40786   freeO(self);
  40787   setTopSO(self, "sheepy");
  40788   r = removeO(self, 0,0);
  40789   ck_assert_ptr_ne(r, null);
  40790   s = toStringO(r);
  40791   ck_assert_str_eq(s, "");
  40792   free(s);
  40793   // end of string
  40794   freeO(self);
  40795   setTopSO(self, "sheepy");
  40796   r = removeO(self, 2,6);
  40797   ck_assert_ptr_ne(r, null);
  40798   s = toStringO(r);
  40799   ck_assert_str_eq(s, "sh");
  40800   free(s);
  40801   // NULL string
  40802   freeO(self);
  40803   r = removeO(self, 2,-4);
  40804   ck_assert_ptr_eq(r, NULL);
  40805   // start outside string
  40806   freeO(self);
  40807   setTopSO(self, "sheepy");
  40808   r = removeO(self, 20,-4);
  40809   ck_assert_ptr_eq(r, null);
  40810   s = toStringO(self);
  40811   ck_assert_str_eq(s, "sheepy");
  40812   free(s);
  40813   r = removeO(self, -20,-4);
  40814   ck_assert_ptr_ne(r, null);
  40815   s = toStringO(r);
  40816   ck_assert_str_eq(s, "eepy");
  40817   free(s);
  40818   // end outside string
  40819   freeO(self);
  40820   setTopSO(self, "sheepy");
  40821   r = removeO(self, 2,40);
  40822   ck_assert_ptr_ne(r, null);
  40823   s = toStringO(r);
  40824   ck_assert_str_eq(s, "sh");
  40825   free(s);
  40826   freeO(self);
  40827   setTopSO(self, "sheepy");
  40828   r = removeO(self, 2,-40);
  40829   ck_assert_ptr_eq(r, null);
  40830   s = toStringO(self);
  40831   ck_assert_str_eq(s, "sheepy");
  40832   free(s);
  40833   // end before start
  40834   freeO(self);
  40835   setTopSO(self, "sheepy");
  40836   r = removeO(self, 4,2);
  40837   ck_assert_ptr_eq(r, null);
  40838   s = toStringO(self);
  40839   ck_assert_str_eq(s, "sheepy");
  40840   free(s);
  40841   terminateO(self);
  40842   // json array
  40843   self = allocSmallJson();
  40844   // add elements to self
  40845   r = self->f->pushInt(self, 1);
  40846   ck_assert_ptr_ne(r, null);
  40847   r = self->f->pushInt(self, 2);
  40848   ck_assert_ptr_ne(r, null);
  40849   r = self->f->pushInt(self, 3);
  40850   ck_assert_ptr_ne(r, null);
  40851   r = self->f->pushInt(self, 4);
  40852   ck_assert_ptr_ne(r, null);
  40853 
  40854   smallIntt *e[4];
  40855   arange(i,e) {
  40856     e[i] = self->f->getAtSmallInt(self, i);
  40857   }
  40858 
  40859   // negative index
  40860   r = removeO(self, 1, -1);
  40861   ck_assert_ptr_ne(r, null);
  40862   s = toStringO(self);
  40863   ck_assert_str_eq(s, "[1,4]");
  40864   free(s);
  40865   // start outside
  40866   ck_assert_ptr_eq(removeO(self, 20, -4), NULL);
  40867   // end outside
  40868   r = removeO(self, 0, 40);
  40869   ck_assert_ptr_ne(r, null);
  40870   s = toStringO(self);
  40871   ck_assert_str_eq(s, "[]");
  40872   free(s);
  40873   arange(i,e) {
  40874     terminateO(e[i]);
  40875   }
  40876   // end negative and outside
  40877   //   remove elements with NULL (set by removeO)
  40878   trimO(self);
  40879   //   add elements to self
  40880   r = self->f->pushInt(self, 1);
  40881   ck_assert_ptr_ne(r, null);
  40882   r = self->f->pushInt(self, 2);
  40883   ck_assert_ptr_ne(r, null);
  40884   r = self->f->pushInt(self, 3);
  40885   ck_assert_ptr_ne(r, null);
  40886   r = self->f->pushInt(self, 4);
  40887   ck_assert_ptr_ne(r, null);
  40888   arange(i,e) {
  40889     e[i] = self->f->getAtSmallInt(self, i);
  40890   }
  40891   ck_assert_ptr_eq(removeO(self, 2, -40), NULL);
  40892   s = toStringO(self);
  40893   ck_assert_str_eq(s, "[1,2,3,4]");
  40894   free(s);
  40895   // end before start
  40896   ck_assert_ptr_eq(removeO(self, 3, 2), NULL);
  40897   s = toStringO(self);
  40898   ck_assert_str_eq(s, "[1,2,3,4]");
  40899   free(s);
  40900   // negative start last element
  40901   r = removeO(self, -1, 0);
  40902   ck_assert_ptr_ne(r, null);
  40903   s = toStringO(self);
  40904   ck_assert_str_eq(s, "[1,2,3]");
  40905   free(s);
  40906   // negative start and outside
  40907   r = removeO(self, -10, 1);
  40908   ck_assert_ptr_ne(r, null);
  40909   s = toStringO(self);
  40910   ck_assert_str_eq(s, "[2,3]");
  40911   free(s);
  40912   // start = end
  40913   r = removeO(self, 1, 1);
  40914   ck_assert_ptr_ne(r, null);
  40915   s = toStringO(self);
  40916   ck_assert_str_eq(s, "[2,3]");
  40917   free(s);
  40918   // remove all
  40919   r = removeO(self, 0, 0);
  40920   ck_assert_ptr_ne(r, null);
  40921   s = toStringO(self);
  40922   ck_assert_str_eq(s, "[]");
  40923   free(s);
  40924   arange(i,e) {
  40925     terminateO(e[i]);
  40926   }
  40927   // empty list
  40928   emptyO(self);
  40929   ck_assert_ptr_eq(removeO(self, 0, 0), NULL);
  40930   ck_assert_ptr_eq(removeO(self, -1, 0), NULL);
  40931   terminateO(self);
  40932 
  40933 }
  40934 
  40935 
  40936 void removeElemIndexSmallJsonT(CuTest *tc UNUSED) {
  40937 
  40938   smallJsont* r;
  40939   smallJsont *self = allocSmallJson();
  40940 
  40941   // non json array
  40942   r = removeElemIndexO(self, 0);
  40943   ck_assert_ptr_eq(r, null);
  40944   // json string
  40945   // del
  40946   freeO(self);
  40947   setTopSO(self, "sheepy");
  40948   r = removeElemIndexO(self, 0);
  40949   ck_assert_ptr_ne(r, null);
  40950   char *s = toStringO(r);
  40951   ck_assert_str_eq(s, "heepy");
  40952   free(s);
  40953   freeO(self);
  40954   setTopSO(self, "sheepy");
  40955   r = removeElemIndexO(self, 5);
  40956   ck_assert_ptr_ne(r, null);
  40957   s = toStringO(r);
  40958   ck_assert_str_eq(s, "sheep");
  40959   free(s);
  40960   // negative index
  40961   freeO(self);
  40962   setTopSO(self, "sheepy");
  40963   r = removeElemIndexO(self, -1);
  40964   ck_assert_ptr_ne(r, null);
  40965   s = toStringO(r);
  40966   ck_assert_str_eq(s, "sheep");
  40967   free(s);
  40968   freeO(self);
  40969   setTopSO(self, "sheepy");
  40970   r = removeElemIndexO(self, -6);
  40971   ck_assert_ptr_ne(r, null);
  40972   s = toStringO(r);
  40973   ck_assert_str_eq(s, "heepy");
  40974   free(s);
  40975   // index outside string
  40976   freeO(self);
  40977   setTopSO(self, "sheepy");
  40978   r = removeElemIndexO(self, 6);
  40979   ck_assert_ptr_eq(r, null);
  40980   r = removeElemIndexO(self, -7);
  40981   ck_assert_ptr_eq(r, null);
  40982   // empty string
  40983   freeO(self);
  40984   setTopSO(self, "");
  40985   ck_assert_ptr_eq(removeElemIndexO(self, 0), null);
  40986   // null string
  40987   freeO(self);
  40988   ck_assert_ptr_eq(removeElemIndexO(self, 0), null);
  40989   terminateO(self);
  40990   // json array
  40991   self = allocSmallJson();
  40992   // add elements to self
  40993   r = self->f->pushInt(self, 1);
  40994   ck_assert_ptr_ne(r, null);
  40995   r = self->f->pushInt(self, 2);
  40996   ck_assert_ptr_ne(r, null);
  40997   r = self->f->pushInt(self, 3);
  40998   ck_assert_ptr_ne(r, null);
  40999   r = self->f->pushInt(self, 4);
  41000   ck_assert_ptr_ne(r, null);
  41001 
  41002   smallIntt *e[2];
  41003   e[0] = self->f->getAtSmallInt(self, 1);
  41004   e[1] = self->f->getAtSmallInt(self, 3);
  41005 
  41006   // positive index
  41007   r       = removeElemIndexO(self,1);
  41008   ck_assert_ptr_ne(r, null);
  41009   s = toStringO(self);
  41010   ck_assert_str_eq(s, "[1,3,4]");
  41011   free(s);
  41012   // negative index
  41013   r = removeElemIndexO(self,-1);
  41014   ck_assert_ptr_ne(r, null);
  41015   s = toStringO(self);
  41016   ck_assert_str_eq(s, "[1,3]");
  41017   free(s);
  41018   terminateO(e[0]);
  41019   terminateO(e[1]);
  41020   // index outside
  41021   ck_assert_ptr_eq(removeElemIndexO(self, 20), NULL);
  41022   ck_assert_ptr_eq(removeElemIndexO(self, -5), NULL);
  41023   // empty list
  41024   emptyO(self);
  41025   ck_assert_ptr_eq(removeElemIndexO(self, 0), NULL);
  41026   ck_assert_ptr_eq(removeElemIndexO(self, -1), NULL);
  41027   terminateO(self);
  41028 
  41029 }
  41030 
  41031 
  41032 void stringifySmallStringSmallJsonT(CuTest *tc UNUSED) {
  41033 
  41034   smallStringt* r;
  41035   smallJsont *self = allocG(rtSmallJsont);
  41036 
  41037   // stringifySmallJson is tested in cSmallJsonT
  41038   // this test checks the parts not tested in cSmallJsonT
  41039   // json dict
  41040   self->f->setS(self, "\\\\", "\\erw\\\"");
  41041   r = stringifySmallStringO(self, 2);
  41042   ck_assert_ptr_ne(r, null);
  41043   char *s = toStringO(r);
  41044   terminateO(r);
  41045   ck_assert_str_eq(s, "{\n  \"\\\\\": \"\\\\erw\\\\\\\"\"\n}\n");
  41046   free(s);
  41047   // json array
  41048   freeO(self);
  41049   self->f->pushS(self, "\\\\ewq\\\"");
  41050   r = stringifySmallStringO(self, 2);
  41051   ck_assert_ptr_ne(r, null);
  41052   s = toStringO(r);
  41053   terminateO(r);
  41054   ck_assert_str_eq(s, "[\n  \"\\\\\\\\ewq\\\\\\\"\"\n]\n");
  41055   free(s);
  41056   terminateO(self);
  41057 
  41058 }
  41059 
  41060 
  41061 void toYMLSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41062 
  41063   smallStringt* r;
  41064   smallJsont *self = allocG(rtSmallJsont);
  41065 
  41066   self->f->pushS(self, "qwe");
  41067   r = toYMLSmallStringO(self, 2);
  41068   ck_assert_ptr_ne(r, null);
  41069   char *s = toStringO(r);
  41070   ck_assert_str_eq(s, "---\n  - qwe\n");
  41071   free(s);
  41072   terminateO(r);
  41073   // blank and empty keys should have quotes
  41074   freeO(self);
  41075   self->f->setS(self, "", "empty");
  41076   self->f->setS(self, "  ", "blank");
  41077   r = toYMLSmallStringO(self, 2);
  41078   ck_assert_ptr_ne(r, null);
  41079   s = toStringO(r);
  41080   ck_assert_str_eq(s, "---\n  \"\": empty\n  \"  \": blank\n");
  41081   free(s);
  41082   terminateO(r);
  41083   terminateO(self);
  41084 
  41085 }
  41086 
  41087 
  41088 void parseSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  41089 
  41090   bool r;
  41091   smallJsont *self  = allocG(rtSmallJsont);
  41092   smallJsont *input = allocSmallJson();
  41093 
  41094   // non json string
  41095   r = self->f->parseSmallJson(self, input);
  41096   ck_assert(!r);
  41097   // json string
  41098   setTopSO(input, "true");
  41099   r = self->f->parseSmallJson(self, input);
  41100   ck_assert(r);
  41101   terminateO(input);
  41102   char *s = toStringO(self);
  41103   ck_assert_str_eq(s, "true");
  41104   free(s);
  41105   // non json object
  41106   input = (smallJsont*) allocSmallInt(123);
  41107   r = self->f->parseSmallJson(self, input);
  41108   ck_assert(!r);
  41109   terminateO(input);
  41110   // null
  41111   r = self->f->parseSmallJson(self, null);
  41112   ck_assert(!r);
  41113   terminateO(self);
  41114 
  41115 }
  41116 
  41117 
  41118 void parseSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41119 
  41120   bool r;
  41121   smallJsont *self    = allocG(rtSmallJsont);
  41122   smallStringt *input = allocSmallString("true");
  41123 
  41124   // string
  41125   r = self->f->parseSmallString(self, input);
  41126   ck_assert(r);
  41127   terminateO(input);
  41128   char *s = toStringO(self);
  41129   ck_assert_str_eq(s, "true");
  41130   free(s);
  41131   // non smallString object
  41132   input = (smallStringt*) allocSmallInt(123);
  41133   r = self->f->parseSmallString(self, input);
  41134   ck_assert(!r);
  41135   terminateO(input);
  41136   // null
  41137   r = self->f->parseSmallString(self, null);
  41138   ck_assert(!r);
  41139   terminateO(self);
  41140 
  41141 }
  41142 
  41143 
  41144 void parseYMLSmallJsonSmallJsonT(CuTest *tc UNUSED) {
  41145 
  41146   bool r;
  41147   smallJsont *self = allocG(rtSmallJsont);
  41148   smallJsont *input = allocSmallJson();
  41149 
  41150   // non json string
  41151   r = self->f->parseYMLSmallJson(self, input);
  41152   ck_assert(!r);
  41153   // json string
  41154   setTopSO(input, "---\n - qwe");
  41155   r = self->f->parseYMLSmallJson(self, input);
  41156   ck_assert(r);
  41157   terminateO(input);
  41158   char *s = toStringO(self);
  41159   ck_assert_str_eq(s, "[\"qwe\"]");
  41160   free(s);
  41161   // non json object
  41162   input = (smallJsont*) allocSmallInt(123);
  41163   r = self->f->parseYMLSmallJson(self, input);
  41164   ck_assert(!r);
  41165   terminateO(input);
  41166   // null
  41167   r = self->f->parseYMLSmallJson(self, null);
  41168   ck_assert(!r);
  41169   terminateO(self);
  41170 
  41171 }
  41172 
  41173 
  41174 void parseYMLSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41175 
  41176   bool r;
  41177   smallJsont *self = allocG(rtSmallJsont);
  41178   smallStringt *input = allocSmallString("---\n - qwe");
  41179 
  41180   // string
  41181   r = self->f->parseYMLSmallString(self, input);
  41182   ck_assert(r);
  41183   terminateO(input);
  41184   char *s = toStringO(self);
  41185   ck_assert_str_eq(s, "[\"qwe\"]");
  41186   free(s);
  41187   // non smallString object
  41188   input = (smallStringt*) allocSmallInt(123);
  41189   r = self->f->parseYMLSmallString(self, input);
  41190   ck_assert(!r);
  41191   terminateO(input);
  41192   // null
  41193   r = self->f->parseYMLSmallString(self, null);
  41194   ck_assert(!r);
  41195   terminateO(self);
  41196 
  41197 }
  41198 
  41199 
  41200 void logSmallJsonT(CuTest *tc UNUSED) {
  41201 
  41202   smallJsont *self = allocSmallJson();
  41203 
  41204   // only prints to stdout
  41205   logO(self);
  41206   terminateO(self);
  41207 
  41208 }
  41209 
  41210 
  41211 void readFileSmallJsonT(CuTest *tc UNUSED) {
  41212 
  41213   smallJsont *self = allocG(rtSmallJsont);
  41214 
  41215   self->f->setS(self, "key", "value");
  41216   writeFileO(self, "read.JSON");
  41217   writeFileO(self, "read.YML");
  41218   writeFileO(self, "read.BIN");
  41219   // read files
  41220   freeO(self);
  41221   ck_assert_ptr_ne(readFileO(self, "read.JSON"), null);
  41222   char *s = toStringO(self);
  41223   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41224   free(s);
  41225   freeO(self);
  41226   ck_assert_ptr_ne(readFileO(self, "read.YML"), null);
  41227   s = toStringO(self);
  41228   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41229   free(s);
  41230   freeO(self);
  41231   ck_assert_ptr_ne(readFileO(self, "read.BIN"), null);
  41232   s = toStringO(self);
  41233   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41234   free(s);
  41235   freeO(self);
  41236   rmAll("read.JSON");
  41237   rmAll("read.YML");
  41238   rmAll("read.BIN");
  41239   // non existing files
  41240   ck_assert_ptr_eq(readFileO(self, "nonexisting.json"), null);
  41241   ck_assert_ptr_eq(readFileO(self, "nonexisting.Yml"), null);
  41242   ck_assert_ptr_eq(readFileO(self, "nonexisting.Bin"), null);
  41243   // invalid extension, not json, yml or bin
  41244   ck_assert_ptr_eq(readFileO(self, "libsheepyCSmallArray.h"), null);
  41245   // null filename
  41246   ck_assert_ptr_eq(readFileO(self, null), null);
  41247   terminateO(self);
  41248 
  41249 }
  41250 
  41251 
  41252 void readFileSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41253 
  41254   smallJsont *self       = allocG(rtSmallJsont);
  41255   smallStringt *filePath = allocSmallString("read.json");
  41256 
  41257   self->f->setS(self, "key", "value");
  41258   writeFileO(self, "read.json");
  41259   freeO(self);
  41260   ck_assert_ptr_ne(self->f->readFileSmallString(self, filePath), null);
  41261   char *s = toStringO(self);
  41262   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41263   free(s);
  41264   freeO(self);
  41265   rmAll("read.json");
  41266   // non smallString object
  41267   terminateO(filePath);
  41268   filePath = (smallStringt*) allocSmallInt(123);
  41269   ck_assert_ptr_eq(self->f->readFileSmallString(self, filePath), null);
  41270   terminateO(filePath);
  41271   // null path
  41272   ck_assert_ptr_eq(self->f->readFileSmallString(self, null), null);
  41273   terminateO(self);
  41274 
  41275 }
  41276 
  41277 
  41278 void readFileJsonSmallJsonT(CuTest *tc UNUSED) {
  41279 
  41280   smallJsont *self     = allocG(rtSmallJsont);
  41281   smallJsont *filePath = allocSmallJson();
  41282 
  41283   setTopSO(filePath, "read.json");
  41284   self->f->setS(self, "key", "value");
  41285   writeFileO(self, "read.json");
  41286   freeO(self);
  41287   ck_assert_ptr_ne(readFileJsonO(self, filePath), null);
  41288   char *s = toStringO(self);
  41289   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  41290   free(s);
  41291   freeO(self);
  41292   rmAll("read.json");
  41293   // non json string
  41294   freeO(filePath);
  41295   setTypeBoolO(filePath);
  41296   ck_assert_ptr_eq(readFileJsonO(self, filePath), null);
  41297   // non smallJson object
  41298   terminateO(filePath);
  41299   filePath = (smallJsont*) allocSmallInt(123);
  41300   ck_assert_ptr_eq(readFileJsonO(self, filePath), null);
  41301   terminateO(filePath);
  41302   // null path
  41303   ck_assert_ptr_eq(readFileJsonO(self, null), null);
  41304   terminateO(self);
  41305 
  41306 }
  41307 
  41308 
  41309 void readStreamSmallJsonT(CuTest *tc UNUSED) {
  41310 
  41311   smallJsont* r;
  41312   smallJsont *self = allocSmallJson();
  41313   FILE *fp;
  41314 
  41315   // stream
  41316   fp = fopen("file.json", "r");
  41317   r = readStreamO(self, fp);
  41318   fclose(fp);
  41319   ck_assert_ptr_ne(r, NULL);
  41320   char *s = toStringO(r);
  41321   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  41322   free(s);
  41323   // empty stream, error because it is not valid json
  41324   emptyO(self);
  41325   fp = fopen("../chmodTest.null", "r");
  41326   r = readStreamO(self, fp);
  41327   fclose(fp);
  41328   ck_assert_ptr_eq(r, NULL);
  41329   ck_assert(isEmptyO(self));
  41330   // NULL stream
  41331   ck_assert_ptr_eq(readStreamO(self, NULL), NULL);
  41332   terminateO(self);
  41333 
  41334 }
  41335 
  41336 
  41337 void writeFileSmallJsonT(CuTest *tc UNUSED) {
  41338 
  41339   bool r;
  41340   smallJsont *self = allocSmallJson();
  41341 
  41342   self->f->setInt(self, "", 1);
  41343   self->f->setInt(self, "b", 2);
  41344   r = writeFileO(self, "smallDictFile.json");
  41345   ck_assert(r);
  41346   ck_assert(fileExists("smallDictFile.json"));
  41347   char *s = readFileToS("smallDictFile.json");
  41348   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41349   free(s);
  41350   rmAll("smallDictFile.json");
  41351   r = writeFileO(self, "smallDictFile.yml");
  41352   ck_assert(r);
  41353   ck_assert(fileExists("smallDictFile.yml"));
  41354   freeO(self);
  41355   ck_assert_ptr_ne(readFileO(self, "smallDictFile.yml"), null);
  41356   s = toStringO(self);
  41357   ck_assert_str_eq(s, "{\"\":1,\"b\":2}");
  41358   free(s);
  41359   rmAll("smallDictFile.yml");
  41360   r = writeFileO(self, "smallDictFile.bin");
  41361   ck_assert(r);
  41362   ck_assert(fileExists("smallDictFile.bin"));
  41363   freeO(self);
  41364   readFileO(self, "smallDictFile.bin");
  41365   s = toStringO(self);
  41366   ck_assert_str_eq(s, "{\"\":1,\"b\":2}");
  41367   free(s);
  41368   rmAll("smallDictFile.bin");
  41369   // write readonly path
  41370   ck_assert(!writeFileO(self, "/readOnlyFileTest.bin"));
  41371   // blank file path
  41372   r = writeFileO(self, "   ");
  41373   ck_assert(!r);
  41374   // null file path
  41375   r = writeFileO(self, null);
  41376   ck_assert(!r);
  41377   terminateO(self);
  41378 
  41379 }
  41380 
  41381 
  41382 void writeFileSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41383 
  41384   bool r;
  41385   smallJsont *self       = allocSmallJson();
  41386   smallStringt *filePath = allocSmallString("smallDictFile.json");
  41387 
  41388   self->f->setInt(self, "", 1);
  41389   self->f->setInt(self, "b", 2);
  41390   r = self->f->writeFileSmallString(self, filePath);
  41391   ck_assert(r);
  41392   ck_assert(fileExists("smallDictFile.json"));
  41393   char *s = readFileToS("smallDictFile.json");
  41394   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41395   free(s);
  41396   rmAll("smallDictFile.json");
  41397   // blank path
  41398   setValO(filePath, "   ");
  41399   r = self->f->writeFileSmallString(self, filePath);
  41400   ck_assert(!r);
  41401   // non smallString object
  41402   terminateO(filePath);
  41403   filePath = (smallStringt*) allocSmallInt(2);
  41404   r = self->f->writeFileSmallString(self, filePath);
  41405   ck_assert(!r);
  41406   // null path
  41407   r = self->f->writeFileSmallString(self, null);
  41408   ck_assert(!r);
  41409   terminateO(filePath);
  41410   terminateO(self);
  41411 
  41412 }
  41413 
  41414 
  41415 void writeFileJsonSmallJsonT(CuTest *tc UNUSED) {
  41416 
  41417   bool r;
  41418   smallJsont *self     = allocSmallJson();
  41419   smallJsont *filePath = allocSmallJson();
  41420 
  41421   self->f->setInt(self, "", 1);
  41422   self->f->setInt(self, "b", 2);
  41423   setTopSO(filePath, "smallDictFile.json");
  41424   r = self->f->writeFileJson(self, filePath);
  41425   ck_assert(r);
  41426   ck_assert(fileExists("smallDictFile.json"));
  41427   char *s = readFileToS("smallDictFile.json");
  41428   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41429   free(s);
  41430   rmAll("smallDictFile.json");
  41431   // blank path
  41432   freeO(filePath);
  41433   setTopSO(filePath, "   ");
  41434   r = self->f->writeFileJson(self, filePath);
  41435   ck_assert(!r);
  41436   // non json string
  41437   freeO(filePath);
  41438   setTopIntO(filePath, 2);
  41439   r = self->f->writeFileJson(self, filePath);
  41440   ck_assert(!r);
  41441   // non json object
  41442   terminateO(filePath);
  41443   filePath = (smallJsont*) allocSmallInt(2);
  41444   r = self->f->writeFileJson(self, filePath);
  41445   ck_assert(!r);
  41446   // null path
  41447   r = self->f->writeFileJson(self, null);
  41448   ck_assert(!r);
  41449   terminateO(filePath);
  41450   terminateO(self);
  41451 
  41452 }
  41453 
  41454 
  41455 void writeStreamSmallJsonT(CuTest *tc UNUSED) {
  41456 
  41457   bool r;
  41458   smallJsont *self = allocSmallJson();
  41459   FILE *fp;
  41460 
  41461   // write textOutTest.null
  41462   fp = fopen("file.json", "r");
  41463   smallJsont *r2 = readStreamO(self, fp);
  41464   fclose(fp);
  41465   ck_assert_ptr_ne(r2, NULL);
  41466   fp = fopen("outTest.json", "w");
  41467   r = writeStreamO(self, fp);
  41468   ck_assert(r);
  41469   fclose(fp);
  41470     // check textOutTest.null
  41471   fp = fopen("outTest.json", "r");
  41472   r2 = readStreamO(self, fp);
  41473   fclose(fp);
  41474   ck_assert_ptr_ne(r2, NULL);
  41475   char *s = toStringO(r2);
  41476   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  41477   free(s);
  41478   // wrong stream: read instead of write
  41479   fp = fopen("outTest.json", "r");
  41480   ck_assert(!writeStreamO(self, fp));
  41481   fclose(fp);
  41482   // null stream
  41483   ck_assert(!writeStreamO(self, null));
  41484   rmAll("outTest.json");
  41485   terminateO(self);
  41486 
  41487 }
  41488 
  41489 
  41490 void appendFileSmallJsonT(CuTest *tc UNUSED) {
  41491 
  41492   bool r;
  41493   smallJsont *self = allocSmallJson();
  41494 
  41495   self->f->setInt(self, "", 1);
  41496   self->f->setInt(self, "b", 2);
  41497   // append json
  41498   writeFileS("smallDictFile.json", "-");
  41499   r = appendFileO(self, "smallDictFile.json");
  41500   ck_assert(r);
  41501   ck_assert(fileExists("smallDictFile.json"));
  41502   char *s = readFileToS("smallDictFile.json");
  41503   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41504   free(s);
  41505   rmAll("smallDictFile.json");
  41506   // append yml
  41507   writeFileS("smallDictFile.yml", "-");
  41508   r = appendFileO(self, "smallDictFile.yml");
  41509   ck_assert(r);
  41510   ck_assert(fileExists("smallDictFile.yml"));
  41511   s = readFileToS("smallDictFile.yml");
  41512   ck_assert_str_eq(s, "----\n  \"\": 1\n  b: 2\n");
  41513   free(s);
  41514   rmAll("smallDictFile.yml");
  41515   // append json string
  41516   writeFileS("smallDictFile", "-");
  41517   freeO(self);
  41518   setTopSO(self, "qwe");
  41519   r = appendFileO(self, "smallDictFile");
  41520   ck_assert(r);
  41521   ck_assert(fileExists("smallDictFile"));
  41522   s = readFileToS("smallDictFile");
  41523   ck_assert_str_eq(s, "-qwe");
  41524   free(s);
  41525   rmAll("smallDictFile");
  41526   // append json array
  41527   writeFileS("smallDictFile", "-");
  41528   freeO(self);
  41529   self->f->pushS(self, "qwe");
  41530   self->f->pushS(self, "asd");
  41531   r = appendFileO(self, "smallDictFile");
  41532   ck_assert(r);
  41533   ck_assert(fileExists("smallDictFile"));
  41534   s = readFileToS("smallDictFile");
  41535   ck_assert_str_eq(s, "-qwe\nasd\n");
  41536   free(s);
  41537   rmAll("smallDictFile");
  41538   // read only path
  41539   r = appendFileO(self, "/readOnlyAppend");
  41540   ck_assert(!r);
  41541   // append json int should not work
  41542   // blank file path
  41543   r = appendFileO(self, "   ");
  41544   ck_assert(!r);
  41545   // null file path
  41546   r = appendFileO(self, null);
  41547   ck_assert(!r);
  41548   terminateO(self);
  41549 
  41550 }
  41551 
  41552 
  41553 void appendFileSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41554 
  41555   bool r;
  41556   smallJsont *self       = allocSmallJson();
  41557   smallStringt *filePath = allocSmallString("smallDictFile.json");
  41558 
  41559   self->f->setInt(self, "", 1);
  41560   self->f->setInt(self, "b", 2);
  41561   writeFileS("smallDictFile.json", "-");
  41562   r = self->f->appendFileSmallString(self, filePath);
  41563   ck_assert(r);
  41564   ck_assert(fileExists("smallDictFile.json"));
  41565   char *s = readFileToS("smallDictFile.json");
  41566   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41567   free(s);
  41568   rmAll("smallDictFile.json");
  41569   // blank path
  41570   setValO(filePath, "   ");
  41571   r = self->f->appendFileSmallString(self, filePath);
  41572   ck_assert(!r);
  41573   // non smallString object
  41574   terminateO(filePath);
  41575   filePath = (smallStringt*) allocSmallInt(2);
  41576   r = self->f->appendFileSmallString(self, filePath);
  41577   ck_assert(!r);
  41578   // null path
  41579   r = self->f->appendFileSmallString(self, null);
  41580   ck_assert(!r);
  41581   terminateO(filePath);
  41582   terminateO(self);
  41583 
  41584 }
  41585 
  41586 
  41587 void appendFileJsonSmallJsonT(CuTest *tc UNUSED) {
  41588 
  41589   int r;
  41590   smallJsont *self     = allocG(rtSmallJsont);
  41591   smallJsont *filePath = allocSmallJson();
  41592 
  41593   setTopSO(filePath, "smallDictFile.json");
  41594   self->f->setInt(self, "", 1);
  41595   self->f->setInt(self, "b", 2);
  41596   writeFileS("smallDictFile.json", "-");
  41597   r = appendFileJsonO(self, filePath);
  41598   ck_assert(r);
  41599   ck_assert(fileExists("smallDictFile.json"));
  41600   char *s = readFileToS("smallDictFile.json");
  41601   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  41602   free(s);
  41603   rmAll("smallDictFile.json");
  41604   // blank path
  41605   freeO(filePath);
  41606   setTopSO(filePath, "   ");
  41607   r = appendFileJsonO(self, filePath);
  41608   ck_assert(!r);
  41609   // non smallJson object
  41610   terminateO(filePath);
  41611   filePath = (smallJsont*) allocSmallInt(2);
  41612   r = appendFileJsonO(self, filePath);
  41613   ck_assert(!r);
  41614   // null path
  41615   r = appendFileJsonO(self, null);
  41616   ck_assert(!r);
  41617   terminateO(filePath);
  41618   terminateO(self);
  41619 
  41620 }
  41621 
  41622 
  41623 void readTextSmallJsonT(CuTest *tc UNUSED) {
  41624 
  41625   smallJsont* r;
  41626   smallJsont *self = allocSmallJson();
  41627 
  41628   // text
  41629   r = readTextO(self, "../textTest.null");
  41630   ck_assert_ptr_ne(r, NULL);
  41631   char *s = toStringO(r);
  41632   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41633   free(s);
  41634   // non empty and non json array
  41635   freeO(self);
  41636   setTypeIntO(self);
  41637   r = readTextO(self, "../textTest.null");
  41638   ck_assert_ptr_eq(r, NULL);
  41639   // empty text
  41640   setTypeArrayO(self);
  41641   emptyO(self);
  41642   r = readTextO(self, "../chmodTest.null");
  41643   ck_assert_ptr_ne(r, NULL);
  41644   ck_assert(isEmptyO(self));
  41645   // NULL path
  41646   r = readTextO(self, NULL);
  41647   ck_assert_ptr_eq(r, NULL);
  41648   // non existing path
  41649   if (fileExists("../nonExistingFile"))
  41650     rmAll("../nonExistingFile");
  41651   r = readTextO(self, "../nonExistingFile");
  41652   ck_assert_ptr_eq(r, NULL);
  41653   terminateO(self);
  41654 
  41655 }
  41656 
  41657 
  41658 void readTextSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41659 
  41660   smallJsont* r;
  41661   smallJsont *self       = allocSmallJson();
  41662   smallStringt *filePath = allocSmallString("");
  41663 
  41664   // text
  41665   setValO(filePath, "../textTest.null");
  41666   r = readTextSmallStringO(self, filePath);
  41667   ck_assert_ptr_ne(r, NULL);
  41668   char *s = toStringO(r);
  41669   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41670   free(s);
  41671   // empty text
  41672   emptyO(self);
  41673   setValO(filePath, "../chmodTest.null");
  41674   r = readTextSmallStringO(self, filePath);
  41675   ck_assert_ptr_ne(r, NULL);
  41676   ck_assert(isEmptyO(self));
  41677   // NULL path
  41678   r = readTextSmallStringO(self, NULL);
  41679   ck_assert_ptr_eq(r, NULL);
  41680   // non existing path
  41681   if (fileExists("../nonExistingFile"))
  41682     rmAll("../nonExistingFile");
  41683   setValO(filePath, "../nonExistingFile");
  41684   r = readTextSmallStringO(self, filePath);
  41685   ck_assert_ptr_eq(r, NULL);
  41686   // blank file path
  41687   setValO(filePath, "  ");
  41688   r = readTextSmallStringO(self, filePath);
  41689   ck_assert_ptr_eq(r, NULL);
  41690   // non smallString object
  41691   terminateO(filePath);
  41692   filePath = (smallStringt*) allocSmallInt(2);
  41693   r = readTextSmallStringO(self, filePath);
  41694   ck_assert_ptr_eq(r, NULL);
  41695   terminateO(self);
  41696   terminateO(filePath);
  41697 
  41698 }
  41699 
  41700 
  41701 void readTextJsonSmallJsonT(CuTest *tc UNUSED) {
  41702 
  41703   smallJsont* r;
  41704   smallJsont *self     = allocG(rtSmallJsont);
  41705   smallJsont *filePath = allocSmallJson();
  41706 
  41707   // text
  41708   freeO(filePath);
  41709   setTopSO(filePath, "../textTest.null");
  41710   r = readTextJsonO(self, filePath);
  41711   ck_assert_ptr_ne(r, NULL);
  41712   char *s = toStringO(r);
  41713   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41714   free(s);
  41715   // empty text
  41716   emptyO(self);
  41717   freeO(filePath);
  41718   setTopSO(filePath, "../chmodTest.null");
  41719   r = readTextJsonO(self, filePath);
  41720   ck_assert_ptr_ne(r, NULL);
  41721   ck_assert(isEmptyO(self));
  41722   // NULL path
  41723   r = readTextJsonO(self, NULL);
  41724   ck_assert_ptr_eq(r, NULL);
  41725   // non existing path
  41726   if (fileExists("../nonExistingFile"))
  41727     rmAll("../nonExistingFile");
  41728   freeO(filePath);
  41729   setTopSO(filePath, "../nonExistingFile");
  41730   r = readTextJsonO(self, filePath);
  41731   ck_assert_ptr_eq(r, NULL);
  41732   // blank file path
  41733   freeO(filePath);
  41734   setTopSO(filePath, "  ");
  41735   r = readTextJsonO(self, filePath);
  41736   ck_assert_ptr_eq(r, NULL);
  41737   // non smallString object
  41738   terminateO(filePath);
  41739   filePath = (smallJsont*) allocSmallInt(2);
  41740   r = readTextJsonO(self, filePath);
  41741   ck_assert_ptr_eq(r, NULL);
  41742   terminateO(self);
  41743   terminateO(filePath);
  41744 
  41745 }
  41746 
  41747 
  41748 void readTextStreamSmallJsonT(CuTest *tc UNUSED) {
  41749 
  41750   smallJsont* r;
  41751   smallJsont *self = allocG(rtSmallJsont);
  41752   FILE *fp;
  41753 
  41754   // stream
  41755   fp = fopen("../textTest.null", "r");
  41756   r = self->f->readTextStream(self, fp);
  41757   fclose(fp);
  41758   ck_assert_ptr_ne(r, NULL);
  41759   char *s = toStringO(r);
  41760   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41761   free(s);
  41762   // non empty and non json array
  41763   freeO(self);
  41764   setTypeIntO(self);
  41765   fp = fopen("../chmodTest.null", "r");
  41766   ck_assert_ptr_eq(self->f->readTextStream(self, fp), NULL);
  41767   // empty stream
  41768   setTypeArrayO(self);
  41769   r = self->f->readTextStream(self, fp);
  41770   fclose(fp);
  41771   ck_assert_ptr_ne(r, NULL);
  41772   ck_assert(isEmptyO(self));
  41773   // NULL stream
  41774   ck_assert_ptr_eq(self->f->readTextStream(self, NULL), NULL);
  41775   terminateO(self);
  41776 
  41777 }
  41778 
  41779 
  41780 void writeTextSmallJsonT(CuTest *tc UNUSED) {
  41781 
  41782   bool r;
  41783   smallJsont *self = allocSmallJson();
  41784 
  41785   // write textOutTest.null
  41786   smallJsont *r2 = readTextO(self, "../textTest.null");
  41787   ck_assert_ptr_ne(r2, NULL);
  41788   r = writeTextO(self, "../textOutTest.null");
  41789   ck_assert(r);
  41790     // check textOutTest.null
  41791   emptyO(self);
  41792   r2 = readTextO(self, "../textOutTest.null");
  41793   ck_assert_ptr_ne(r2, NULL);
  41794   char *s = toStringO(r2);
  41795   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41796   free(s);
  41797   // read only path
  41798   r = writeTextO(self, "/readOnlyPath");
  41799   ck_assert(!r);
  41800   // non empty and non json array
  41801   freeO(self);
  41802   setTypeIntO(self);
  41803   r = writeTextO(self, "../textOutTest.null");
  41804   ck_assert(!r);
  41805   // empty text
  41806   setTypeArrayO(self);
  41807   emptyO(self);
  41808   r = writeTextO(self, "../textOutTest.null");
  41809   ck_assert(!r);
  41810   r2 = readTextO(self, "../textOutTest.null");
  41811   ck_assert_ptr_ne(r2, NULL);
  41812   s  = toStringO(r2);
  41813   ck_assert_str_eq(s, "[]");
  41814   free(s);
  41815   // non existing file
  41816     // make sure the file doesnt exist
  41817   if (fileExists("../nonExistingFile"))
  41818     rmAll("../nonExistingFile");
  41819   self->f->pushS(self, "qwe");
  41820   ck_assert(writeTextO(self, "../nonExistingFile"));
  41821   if (fileExists("../nonExistingFile"))
  41822     rmAll("../nonExistingFile");
  41823   // NULL path
  41824   ck_assert(!writeTextO(self, NULL));
  41825   terminateO(self);
  41826 
  41827 }
  41828 
  41829 
  41830 void writeTextSmallStringSmallJsonT(CuTest *tc UNUSED) {
  41831 
  41832   bool r;
  41833   smallJsont *self       = allocSmallJson();
  41834   smallStringt *filePath = allocSmallString("");
  41835 
  41836   // write textOutTest.null
  41837   smallJsont *r2 = readTextO(self, "../textTest.null");
  41838   ck_assert_ptr_ne(r2, NULL);
  41839   setValO(filePath, "../textOutTest.null");
  41840   r = writeTextSmallStringO(self, filePath);
  41841   ck_assert(r);
  41842     // check textOutTest.null
  41843   emptyO(self);
  41844   r2 = readTextO(self, "../textOutTest.null");
  41845   ck_assert_ptr_ne(r2, NULL);
  41846   char *s = toStringO(r2);
  41847   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41848   free(s);
  41849   // empty array
  41850   emptyO(self);
  41851   setValO(filePath, "../textOutTest.null");
  41852   r = writeTextSmallStringO(self, filePath);
  41853   ck_assert(!r);
  41854   r2 = readTextO(self, "../textOutTest.null");
  41855   ck_assert_ptr_ne(r2, NULL);
  41856   s  = toStringO(r2);
  41857   ck_assert_str_eq(s, "[]");
  41858   free(s);
  41859   // non existing file
  41860     // make sure the file doesnt exist
  41861   if (fileExists("../nonExistingFile"))
  41862     rmAll("../nonExistingFile");
  41863   self->f->pushS(self, "qwe");
  41864   setValO(filePath, "../nonExistingFile");
  41865   ck_assert(writeTextSmallStringO(self, filePath));
  41866   if (fileExists("../nonExistingFile"))
  41867     rmAll("../nonExistingFile");
  41868   // non smallJson object
  41869   terminateO(filePath);
  41870   filePath = (smallStringt*) allocSmallInt(2);
  41871   r = writeTextSmallStringO(self, filePath);
  41872   ck_assert(!r);
  41873   // NULL path
  41874   ck_assert(!writeTextSmallStringO(self, NULL));
  41875   terminateO(self);
  41876   terminateO(filePath);
  41877 
  41878 }
  41879 
  41880 
  41881 void writeTextJsonSmallJsonT(CuTest *tc UNUSED) {
  41882 
  41883   bool r;
  41884   smallJsont *self     = allocG(rtSmallJsont);
  41885   smallJsont *filePath = allocSmallJson();
  41886 
  41887   // write textOutTest.null
  41888   smallJsont *r2 = readTextO(self, "../textTest.null");
  41889   ck_assert_ptr_ne(r2, NULL);
  41890   freeO(filePath);
  41891   setTopSO(filePath, "../textOutTest.null");
  41892   r = writeTextJsonO(self, filePath);
  41893   ck_assert(r);
  41894     // check textOutTest.null
  41895   emptyO(self);
  41896   r2 = readTextO(self, "../textOutTest.null");
  41897   ck_assert_ptr_ne(r2, NULL);
  41898   char *s = toStringO(r2);
  41899   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41900   free(s);
  41901   // empty array
  41902   emptyO(self);
  41903   freeO(filePath);
  41904   setTopSO(filePath, "../textOutTest.null");
  41905   r = writeTextJsonO(self, filePath);
  41906   ck_assert(!r);
  41907   r2 = readTextO(self, "../textOutTest.null");
  41908   ck_assert_ptr_ne(r2, NULL);
  41909   s  = toStringO(r2);
  41910   ck_assert_str_eq(s, "[]");
  41911   free(s);
  41912   // non existing file
  41913     // make sure the file doesnt exist
  41914   if (fileExists("../nonExistingFile"))
  41915     rmAll("../nonExistingFile");
  41916   self->f->pushS(self, "qwe");
  41917   freeO(filePath);
  41918   setTopSO(filePath, "../nonExistingFile");
  41919   ck_assert(writeTextJsonO(self, filePath));
  41920   if (fileExists("../nonExistingFile"))
  41921     rmAll("../nonExistingFile");
  41922   // non smallJson object
  41923   terminateO(filePath);
  41924   filePath = (smallJsont*) allocSmallInt(2);
  41925   r = writeTextJsonO(self, filePath);
  41926   ck_assert(!r);
  41927   // NULL path
  41928   ck_assert(!writeTextJsonO(self, NULL));
  41929   rmAll("../textOutTest.null");
  41930   terminateO(self);
  41931   terminateO(filePath);
  41932 
  41933 }
  41934 
  41935 
  41936 void writeTextStreamSmallJsonT(CuTest *tc UNUSED) {
  41937 
  41938   bool r;
  41939   smallJsont *self = allocG(rtSmallJsont);
  41940   FILE *fp;
  41941 
  41942   // non json array
  41943   fp = fopen("../textTest.null", "r");
  41944   r = self->f->writeTextStream(self, fp);
  41945   ck_assert(!r);
  41946   // write textOutTest.null
  41947   smallJsont *r2 = self->f->readTextStream(self, fp);
  41948   fclose(fp);
  41949   ck_assert_ptr_ne(r2, NULL);
  41950   fp = fopen("../textOutTest.null", "w");
  41951   r = self->f->writeTextStream(self, fp);
  41952   ck_assert(r);
  41953   // empty array
  41954   emptyO(self);
  41955   ck_assert(!self->f->writeTextStream(self, fp));
  41956   fclose(fp);
  41957     // check textOutTest.null
  41958   fp = fopen("../textOutTest.null", "r");
  41959   r2 = self->f->readTextStream(self, fp);
  41960   fclose(fp);
  41961   ck_assert_ptr_ne(r2, NULL);
  41962   char *s = toStringO(r2);
  41963   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  41964   free(s);
  41965   terminateO(self);
  41966 
  41967 }
  41968 
  41969 
  41970 void appendTextSmallJsonT(CuTest *tc UNUSED) {
  41971 
  41972   bool r;
  41973   smallJsont *self = allocSmallJson();
  41974 
  41975   // append to textOutTest.null
  41976   smallJsont *r2 = readTextO(self, "../textTest.null");
  41977   ck_assert_ptr_ne(r2, NULL);
  41978   r = writeTextO(self, "../textOutTest.null");
  41979   ck_assert(r);
  41980   emptyO(self);
  41981   self->f->pushS(self, "A");
  41982   self->f->pushS(self, "B");
  41983   r = appendTextO(self, "../textOutTest.null");
  41984     // check textOutTest.null
  41985   emptyO(self);
  41986   r2 = readTextO(self, "../textOutTest.null");
  41987   ck_assert_ptr_ne(r2, NULL);
  41988   char *s = toStringO(r2);
  41989   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  41990   free(s);
  41991   // non existing file
  41992     // make sure the file doesnt exist
  41993   if (fileExists("../nonExistingFile"))
  41994     rmAll("../nonExistingFile");
  41995   ck_assert(appendTextO(self, "../nonExistingFile"));
  41996   if (fileExists("../nonExistingFile"))
  41997     rmAll("../nonExistingFile");
  41998   // empty array
  41999   emptyO(self);
  42000   r = appendTextO(self, "../textOutTest.null");
  42001   ck_assert(!r);
  42002     // check textOutTest.null
  42003   emptyO(self);
  42004   r2 = readTextO(self, "../textOutTest.null");
  42005   ck_assert_ptr_ne(r2, NULL);
  42006   s  = toStringO(r2);
  42007   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42008   free(s);
  42009   // blank path
  42010   ck_assert(!appendTextO(self, "  "));
  42011   // NULL path
  42012   ck_assert(!appendTextO(self, NULL));
  42013   // non empty json and non json array
  42014   freeO(self);
  42015   setTypeBoolO(self);
  42016   ck_assert(!appendTextO(self, "appendTest.txt"));
  42017   terminateO(self);
  42018 
  42019 }
  42020 
  42021 
  42022 void appendTextSmallStringSmallJsonT(CuTest *tc UNUSED) {
  42023 
  42024   bool r;
  42025   smallJsont *self      = allocSmallJson();
  42026   smallStringt *filePath = allocSmallString("");
  42027 
  42028   // append to textOutTest.null
  42029   smallJsont *r2 = readTextO(self, "../textTest.null");
  42030   ck_assert_ptr_ne(r2, NULL);
  42031   r = writeTextO(self, "../textOutTest.null");
  42032   ck_assert(r);
  42033   emptyO(self);
  42034   self->f->pushS(self, "A");
  42035   self->f->pushS(self, "B");
  42036   setValO(filePath, "../textOutTest.null");
  42037   r = appendTextSmallStringO(self, filePath);
  42038     // check textOutTest.null
  42039   emptyO(self);
  42040   r2 = readTextO(self, "../textOutTest.null");
  42041   ck_assert_ptr_ne(r2, NULL);
  42042   char *s = toStringO(r2);
  42043   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42044   free(s);
  42045   // non existing file
  42046     // make sure the file doesnt exist
  42047   if (fileExists("../nonExistingFile"))
  42048     rmAll("../nonExistingFile");
  42049   setValO(filePath, "../nonExistingFile");
  42050   ck_assert(appendTextSmallStringO(self, filePath));
  42051   if (fileExists("../nonExistingFile"))
  42052     rmAll("../nonExistingFile");
  42053   // empty array
  42054   emptyO(self);
  42055   r = appendTextSmallStringO(self, filePath);
  42056   ck_assert(!r);
  42057     // check textOutTest.null
  42058   emptyO(self);
  42059   r2 = readTextO(self, "../textOutTest.null");
  42060   ck_assert_ptr_ne(r2, NULL);
  42061   s  = toStringO(r2);
  42062   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42063   free(s);
  42064   // blank path
  42065   setValO(filePath, "   ");
  42066   ck_assert(!appendTextSmallStringO(self, filePath));
  42067   // non smallString object
  42068   terminateO(filePath);
  42069   filePath = (smallStringt*) allocSmallInt(2);
  42070   r = appendTextSmallStringO(self, filePath);
  42071   ck_assert(!r);
  42072   // NULL path
  42073   ck_assert(!appendTextSmallStringO(self, NULL));
  42074   terminateO(self);
  42075   terminateO(filePath);
  42076 
  42077 }
  42078 
  42079 
  42080 void appendTextJsonSmallJsonT(CuTest *tc UNUSED) {
  42081 
  42082   bool r;
  42083   smallJsont *self     = allocG(rtSmallJsont);
  42084   smallJsont *filePath = allocSmallJson();
  42085 
  42086   // append to textOutTest.null
  42087   smallJsont *r2 = readTextO(self, "../textTest.null");
  42088   ck_assert_ptr_ne(r2, NULL);
  42089   r = writeTextO(self, "../textOutTest.null");
  42090   ck_assert(r);
  42091   emptyO(self);
  42092   self->f->pushS(self, "A");
  42093   self->f->pushS(self, "B");
  42094   freeO(filePath);
  42095   setTopSO(filePath, "../textOutTest.null");
  42096   r = appendTextJsonO(self, filePath);
  42097     // check textOutTest.null
  42098   emptyO(self);
  42099   r2 = readTextO(self, "../textOutTest.null");
  42100   ck_assert_ptr_ne(r2, NULL);
  42101   char *s = toStringO(r2);
  42102   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42103   free(s);
  42104   // non existing file
  42105     // make sure the file doesnt exist
  42106   if (fileExists("../nonExistingFile"))
  42107     rmAll("../nonExistingFile");
  42108   freeO(filePath);
  42109   setTopSO(filePath, "../nonExistingFile");
  42110   ck_assert(appendTextJsonO(self, filePath));
  42111   if (fileExists("../nonExistingFile"))
  42112     rmAll("../nonExistingFile");
  42113   // empty array
  42114   emptyO(self);
  42115   r = appendTextJsonO(self, filePath);
  42116   ck_assert(!r);
  42117     // check textOutTest.null
  42118   emptyO(self);
  42119   r2 = readTextO(self, "../textOutTest.null");
  42120   ck_assert_ptr_ne(r2, NULL);
  42121   s  = toStringO(r2);
  42122   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  42123   free(s);
  42124   // blank path
  42125   freeO(filePath);
  42126   setTopSO(filePath, "   ");
  42127   ck_assert(!appendTextJsonO(self, filePath));
  42128   // non smallString object
  42129   terminateO(filePath);
  42130   filePath = (smallJsont*) allocSmallInt(2);
  42131   r = appendTextJsonO(self, filePath);
  42132   ck_assert(!r);
  42133   // NULL path
  42134   ck_assert(!appendTextJsonO(self, NULL));
  42135   terminateO(self);
  42136   terminateO(filePath);
  42137 
  42138 }
  42139 
  42140 
  42141 void typeStringSmallJsonT(CuTest *tc UNUSED) {
  42142 
  42143   const char* r;
  42144   smallJsont *self = allocG(rtSmallJsont);
  42145 
  42146   self->f->setBool(self, "lib", true);
  42147   r = typeStringO(self, "lib");
  42148   ck_assert_ptr_ne(r, null);
  42149   ck_assert_str_eq(r, "bool");
  42150   // path
  42151   baset *value = (baset*) allocSmallInt(2);
  42152   createSmallArray(a);
  42153   createSmallDict(d);
  42154   a.f->pushDict(&a, &d);
  42155   self->f->setArray(self, "array", &a);
  42156   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42157   ck_assert_ptr_ne(r2, null);
  42158   finishO(value);
  42159   r = typeStringO(self, "\"array\"[0].\"key\"");
  42160   ck_assert_ptr_ne(r, null);
  42161   ck_assert_str_eq(r, "int");
  42162   // json bool
  42163   freeO(self);
  42164   setTypeBoolO(self);
  42165   r = typeStringO(self, "1");
  42166   ck_assert_ptr_eq(r, null);
  42167   // json array
  42168   freeO(self);
  42169   setTypeArrayO(self);
  42170   r = typeStringO(self, "1");
  42171   ck_assert_ptr_eq(r, null);
  42172   // non existing dict path
  42173   freeO(self);
  42174   r = typeStringO(self, "\"1\"[1]");
  42175   ck_assert_ptr_eq(r, null);
  42176   //   dict path but the object is an array
  42177   resetO(&a);
  42178   self->f->setArray(self, "1", &a);
  42179   r = typeStringO(self, "\"1\".\"1\"");
  42180   ck_assert_ptr_eq(r, null);
  42181   //   dict object in path but the key doesn't exists
  42182   resetO(&d);
  42183   self->f->setDict(self, "2", &d);
  42184   r = typeStringO(self, "\"2\".\"1\".[12]");
  42185   ck_assert_ptr_eq(r, null);
  42186   // non existing element
  42187   r = typeStringO(self, "randomKey");
  42188   ck_assert_ptr_eq(r, null);
  42189   // null key
  42190   r = typeStringO(self, null);
  42191   ck_assert_ptr_eq(r, null);
  42192   terminateO(self);
  42193 
  42194 }
  42195 
  42196 
  42197 void typeSmallStringSmallJsonT(CuTest *tc UNUSED) {
  42198 
  42199   smallStringt* r;
  42200   smallJsont *self = allocSmallJson();
  42201 
  42202   self->f->setInt(self, "", 1);
  42203   self->f->setInt(self, "b", 2);
  42204   r = typeSmallStringO(self, "");
  42205   ck_assert_str_eq(ssGet(r), "int");
  42206   terminateO(r);
  42207   // non existing key
  42208   r = typeSmallStringO(self, "asd");
  42209   ck_assert_ptr_eq(r, null);
  42210   terminateO(self);
  42211 
  42212 }
  42213 
  42214 
  42215 void typeAtStringSmallJsonT(CuTest *tc UNUSED) {
  42216 
  42217   const char* r;
  42218   smallJsont *self = allocG(rtSmallJsont);
  42219 
  42220   // empty self
  42221   r = typeAtStringO(self, 0);
  42222   ck_assert_str_eq(r, "not a sheepy object");
  42223   terminateO(self);
  42224 
  42225 }
  42226 
  42227 
  42228 void typeAtSmallStringSmallJsonT(CuTest *tc UNUSED) {
  42229 
  42230   smallStringt* r;
  42231   smallJsont *self = allocSmallJson();
  42232 
  42233   // empty array
  42234   r = typeAtSmallStringO(self, 0);
  42235   ck_assert_ptr_ne(r, NULL);
  42236   char *s = toStringO(r);
  42237   ck_assert_str_eq(s, "not a sheepy object");
  42238   free(s);
  42239   terminateO(self);
  42240   terminateO(r);
  42241 
  42242 }
  42243 
  42244 
  42245 void typeStringKCharSmallJsonT(CuTest *tc UNUSED) {
  42246 
  42247   const char* r;
  42248   smallJsont *self = allocSmallJson();
  42249 
  42250   self->f->setInt(self, "", 1);
  42251   self->f->setInt(self, "b", 2);
  42252   r = typeStringKCharO(self, 'b');
  42253   ck_assert_str_eq(r, "int");
  42254   terminateO(self);
  42255 
  42256 }
  42257 
  42258 
  42259 void typeSmallStringKCharSmallJsonT(CuTest *tc UNUSED) {
  42260 
  42261   smallStringt* r;
  42262   smallJsont *self = allocSmallJson();
  42263 
  42264   self->f->setInt(self, "", 1);
  42265   self->f->setInt(self, "b", 2);
  42266   r = typeSmallStringKCharO(self, 'b');
  42267   ck_assert_str_eq(ssGet(r), "int");
  42268   terminateO(r);
  42269   // non existing key
  42270   r = typeSmallStringKCharO(self, 'a');
  42271   ck_assert_ptr_eq(r, null);
  42272   terminateO(self);
  42273 
  42274 }
  42275 
  42276 
  42277 void typeSmallJsonT(CuTest *tc UNUSED) {
  42278 
  42279   char r;
  42280   smallJsont *self = allocG(rtSmallJsont);
  42281 
  42282   self->f->setBool(self, "lib", true);
  42283   r = typeO(self, "lib");
  42284   ck_assert_int_eq(r, 2);
  42285   // path
  42286   baset *value = (baset*) allocSmallInt(2);
  42287   createSmallArray(a);
  42288   createSmallDict(d);
  42289   a.f->pushDict(&a, &d);
  42290   self->f->setArray(self, "array", &a);
  42291   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42292   ck_assert_ptr_ne(r2, null);
  42293   finishO(value);
  42294   r = typeO(self, "\"array\"[0].\"key\"");
  42295   ck_assert_int_eq(r, 7);
  42296   // json bool
  42297   freeO(self);
  42298   setTypeBoolO(self);
  42299   r = typeO(self, "1");
  42300   ck_assert(!r);
  42301   // json array
  42302   freeO(self);
  42303   setTypeArrayO(self);
  42304   r = typeO(self, "1");
  42305   ck_assert(!r);
  42306   // non existing dict path
  42307   freeO(self);
  42308   r = typeO(self, "\"1\"[1]");
  42309   ck_assert(!r);
  42310   //   dict path but the object is an array
  42311   resetO(&a);
  42312   self->f->setArray(self, "1", &a);
  42313   r = typeO(self, "\"1\".\"1\"");
  42314   ck_assert(!r);
  42315   //   dict object in path but the key doesn't exists
  42316   resetO(&d);
  42317   self->f->setDict(self, "2", &d);
  42318   r = typeO(self, "\"2\".\"1\".[12]");
  42319   ck_assert(!r);
  42320   // non existing element
  42321   r = typeO(self, "randomKey");
  42322   ck_assert(!r);
  42323   // null key
  42324   r = typeO(self, null);
  42325   ck_assert(!r);
  42326   terminateO(self);
  42327 
  42328 }
  42329 
  42330 
  42331 void typeKCharSmallJsonT(CuTest *tc UNUSED) {
  42332 
  42333   char r;
  42334   smallJsont *self = allocSmallJson();
  42335 
  42336   self->f->setInt(self, "", 1);
  42337   self->f->setInt(self, "b", 2);
  42338   r = typeKCharO(self, 'b');
  42339   ck_assert_int_eq(r, 7);
  42340   terminateO(self);
  42341 
  42342 }
  42343 
  42344 
  42345 void typeAtSmallJsonT(CuTest *tc UNUSED) {
  42346 
  42347   smallJsont *self = allocG(rtSmallJsont);
  42348 
  42349   // non json array
  42350   ck_assert_int_eq(typeAtO(self, 0), 0);
  42351   // empty json array
  42352   setTypeArrayO(self);
  42353   ck_assert_int_eq(typeAtO(self, 0), 0);
  42354   // type
  42355   self->f->pushInt(self, 1);
  42356   ck_assert_int_eq(typeAtO(self, 0), 7);
  42357   // outside
  42358   ck_assert_int_eq(typeAtO(self, 1), 0);
  42359   ck_assert_int_eq(typeAtO(self, -2), 0);
  42360   terminateO(self);
  42361 
  42362 }
  42363 
  42364 
  42365 void typeStringsSmallJsonT(CuTest *tc UNUSED) {
  42366 
  42367   smallJsont* r;
  42368   smallJsont *self = allocG(rtSmallJsont);
  42369 
  42370   // non json array or dict
  42371   setTypeBoolO(self);
  42372   r = typeStringsO(self);
  42373   ck_assert_ptr_eq(r, null);
  42374   // json dict
  42375   freeO(self);
  42376   self->f->setUndefined(self, "u");
  42377   self->f->setS(self, "s", "s");
  42378   self->f->setInt(self, "i", 123);
  42379   r = typeStringsO(self);
  42380   ck_assert_ptr_ne(r, null);
  42381   char *s = toStringO(r);
  42382   ck_assert_str_eq(s, "{\"u\":\"undefined\",\"s\":\"string\",\"i\":\"int\"}");
  42383   free(s);
  42384   terminateO(r);
  42385   // json array
  42386   freeO(self);
  42387   self->f->pushUndefined(self);
  42388   self->f->pushS(self,"qwe");
  42389   self->f->pushInt(self,123);
  42390   r = typeStringsO(self);
  42391   ck_assert_ptr_ne(r, null);
  42392   s = toStringO(r);
  42393   ck_assert_str_eq(s, "[\"undefined\",\"string\",\"int\"]");
  42394   free(s);
  42395   terminateO(r);
  42396   terminateO(self);
  42397 
  42398 }
  42399 
  42400 
  42401 void typesSmallJsonT(CuTest *tc UNUSED) {
  42402 
  42403   smallBytest* r;
  42404   smallJsont *self = allocG(rtSmallJsont);
  42405 
  42406   // non json array
  42407   r = typesO(self);
  42408   ck_assert_ptr_eq(r, null);
  42409   // empty json array
  42410   setTypeArrayO(self);
  42411   r = typesO(self);
  42412   ck_assert_ptr_eq(r, null);
  42413   // json array with elements
  42414   self->f->pushUndefined(self);
  42415   self->f->pushS(self,"qwe");
  42416   self->f->pushInt(self,123);
  42417   r = typesO(self);
  42418   ck_assert_ptr_ne(r, null);
  42419   char *s = toStringO(r);
  42420   ck_assert_str_eq(s, "[0x01,0x08,0x07]");
  42421   free(s);
  42422   terminateO(r);
  42423   terminateO(self);
  42424 
  42425 }
  42426 
  42427 
  42428 void isETypeAtSmallJsonT(CuTest *tc UNUSED) {
  42429 
  42430   bool r;
  42431   smallJsont *self = allocSmallJson();
  42432 
  42433   // non json array
  42434   r = isETypeAtO(self, 0, "undefined");
  42435   ck_assert(!r);
  42436   // json array
  42437   self->f->pushUndefined(self);
  42438   r = isETypeAtO(self, 0, "undefined");
  42439   ck_assert(r);
  42440   // NULL type
  42441   emptyO(self);
  42442   r = isETypeAtO(self, 0, NULL);
  42443   ck_assert(!r);
  42444   terminateO(self);
  42445 
  42446 }
  42447 
  42448 
  42449 void isEUndefinedAtSmallJsonT(CuTest *tc UNUSED) {
  42450 
  42451   bool r;
  42452   smallJsont *self = allocSmallJson();
  42453 
  42454   // non json array
  42455   r = isEUndefinedAtO(self, 0);
  42456   ck_assert(!r);
  42457   // array
  42458   self->f->pushUndefined(self);
  42459   self->f->pushS(self, "");
  42460   r = isEUndefinedAtO(self, 0);
  42461   ck_assert(r);
  42462   r = isEUndefinedAtO(self, -1);
  42463   ck_assert(!r);
  42464   terminateO(self);
  42465 
  42466 }
  42467 
  42468 
  42469 void isEBoolAtSmallJsonT(CuTest *tc UNUSED) {
  42470 
  42471   bool r;
  42472   smallJsont *self = allocSmallJson();
  42473 
  42474   // non json array
  42475   r = isEBoolAtO(self, 0);
  42476   ck_assert(!r);
  42477   // array
  42478   self->f->pushBool(self, true);
  42479   self->f->pushS(self, "");
  42480   r = isEBoolAtO(self, 0);
  42481   ck_assert(r);
  42482   r = isEBoolAtO(self, -1);
  42483   ck_assert(!r);
  42484   terminateO(self);
  42485 
  42486 }
  42487 
  42488 
  42489 void isEContainerAtSmallJsonT(CuTest *tc UNUSED) {
  42490 
  42491   bool r;
  42492   smallJsont *self = allocSmallJson();
  42493 
  42494   // non json array
  42495   r = isEContainerAtO(self, 0);
  42496   ck_assert(!r);
  42497   // array
  42498   createSmallContainer(c);
  42499   self->f->pushSmallContainer(self, &c);
  42500   self->f->pushS(self, "");
  42501   r = isEContainerAtO(self, 0);
  42502   ck_assert(r);
  42503   r = isEContainerAtO(self, -1);
  42504   ck_assert(!r);
  42505   terminateO(self);
  42506 
  42507 }
  42508 
  42509 
  42510 void isEDictAtSmallJsonT(CuTest *tc UNUSED) {
  42511 
  42512   bool r;
  42513   smallJsont *self = allocSmallJson();
  42514 
  42515   // non json array
  42516   r = isEDictAtO(self, 0);
  42517   ck_assert(!r);
  42518   // array
  42519   createSmallDict(d);
  42520   self->f->pushDict(self, &d);
  42521   self->f->pushS(self, "");
  42522   r = isEDictAtO(self, 0);
  42523   ck_assert(r);
  42524   r = isEDictAtO(self, -1);
  42525   ck_assert(!r);
  42526   terminateO(self);
  42527 
  42528 }
  42529 
  42530 
  42531 void isEDoubleAtSmallJsonT(CuTest *tc UNUSED) {
  42532 
  42533   bool r;
  42534   smallJsont *self = allocSmallJson();
  42535 
  42536   // non json array
  42537   r = isEDoubleAtO(self, 0);
  42538   ck_assert(!r);
  42539   // array
  42540   self->f->pushDouble(self, 1);
  42541   self->f->pushS(self, "");
  42542   r = isEDoubleAtO(self, 0);
  42543   ck_assert(r);
  42544   r = isEDoubleAtO(self, -1);
  42545   ck_assert(!r);
  42546   terminateO(self);
  42547 
  42548 }
  42549 
  42550 
  42551 void isEIntAtSmallJsonT(CuTest *tc UNUSED) {
  42552 
  42553   bool r;
  42554   smallJsont *self = allocSmallJson();
  42555 
  42556   // non json array
  42557   r = isEIntAtO(self, 0);
  42558   ck_assert(!r);
  42559   // array
  42560   self->f->pushInt(self, 1);
  42561   self->f->pushS(self, "");
  42562   r = isEIntAtO(self, 0);
  42563   ck_assert(r);
  42564   r = isEIntAtO(self, -1);
  42565   ck_assert(!r);
  42566   terminateO(self);
  42567 
  42568 }
  42569 
  42570 
  42571 void isEStringAtSmallJsonT(CuTest *tc UNUSED) {
  42572 
  42573   bool r;
  42574   smallJsont *self = allocSmallJson();
  42575 
  42576   // non json array
  42577   r = isEStringAtO(self, 0);
  42578   ck_assert(!r);
  42579   // array
  42580   self->f->pushUndefined(self);
  42581   self->f->pushS(self, "");
  42582   r = isEStringAtO(self, -1);
  42583   ck_assert(r);
  42584   r = isEStringAtO(self, 0);
  42585   ck_assert(!r);
  42586   terminateO(self);
  42587 
  42588 }
  42589 
  42590 
  42591 void isEFaststringAtSmallJsonT(CuTest *tc UNUSED) {
  42592 
  42593   bool r;
  42594   smallJsont *self = allocG(rtSmallJsont);
  42595 
  42596   // non json array
  42597   r = isEFaststringAtO(self, 0);
  42598   ck_assert(!r);
  42599   // array
  42600   self->f->pushUndefined(self);
  42601   self->f->pushS(self, "");
  42602   r = isEFaststringAtO(self, -1);
  42603   ck_assert(!r);
  42604   r = isEFaststringAtO(self, 0);
  42605   ck_assert(!r);
  42606   terminateO(self);
  42607 
  42608 }
  42609 
  42610 
  42611 void isEArrayAtSmallJsonT(CuTest *tc UNUSED) {
  42612 
  42613   bool r;
  42614   smallJsont *self = allocSmallJson();
  42615 
  42616   // non json array
  42617   r = isEArrayAtO(self, 0);
  42618   ck_assert(!r);
  42619   // array
  42620   createSmallArray(a);
  42621   self->f->pushArray(self, &a);
  42622   self->f->pushS(self, "");
  42623   r = isEArrayAtO(self, 0);
  42624   ck_assert(r);
  42625   r = isEArrayAtO(self, -1);
  42626   ck_assert(!r);
  42627   terminateO(self);
  42628 
  42629 }
  42630 
  42631 
  42632 void isEBytesAtSmallJsonT(CuTest *tc UNUSED) {
  42633 
  42634   bool r;
  42635   smallJsont *self = allocSmallJson();
  42636 
  42637   // non json array
  42638   r = isEBytesAtO(self, 0);
  42639   ck_assert(!r);
  42640   // array
  42641   createSmallBytes(b);
  42642   self->f->pushSmallBytes(self, &b);
  42643   self->f->pushS(self, "");
  42644   r = isEBytesAtO(self, 0);
  42645   ck_assert(r);
  42646   r = isEBytesAtO(self, -1);
  42647   ck_assert(!r);
  42648   terminateO(self);
  42649 
  42650 }
  42651 
  42652 
  42653 void isETypeSmallJsonT(CuTest *tc UNUSED) {
  42654 
  42655   bool r;
  42656   smallJsont *self = allocSmallJson();
  42657 
  42658   self->f->setInt(self, "", 1);
  42659   r = isETypeO(self, "", "int");
  42660   ck_assert(r);
  42661   // path
  42662   baset *value = (baset*) allocSmallInt(2);
  42663   createSmallArray(a);
  42664   createSmallDict(d);
  42665   a.f->pushDict(&a, &d);
  42666   self->f->setArray(self, "array", &a);
  42667   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42668   ck_assert_ptr_ne(r2, null);
  42669   finishO(value);
  42670   r = isETypeO(self, "\"array\"[0].\"key\"", "int");
  42671   ck_assert(r);
  42672   r = isETypeO(self, "\"array\"[0].\"key\"", "bool");
  42673   ck_assert(!r);
  42674   // json bool
  42675   freeO(self);
  42676   setTypeBoolO(self);
  42677   r = isETypeO(self, "1", "bool");
  42678   ck_assert(!r);
  42679   // json array
  42680   freeO(self);
  42681   setTypeArrayO(self);
  42682   r = isETypeO(self, "1", "array");
  42683   ck_assert(!r);
  42684   // non existing dict path
  42685   freeO(self);
  42686   r = isETypeO(self, "\"1\"[1]", "int");
  42687   ck_assert(!r);
  42688   //   dict path but the object is an array
  42689   resetO(&a);
  42690   self->f->setArray(self, "1", &a);
  42691   r = isETypeO(self, "\"1\".\"1\"", "int");
  42692   ck_assert(!r);
  42693   //   dict object in path but the key doesn't exists
  42694   resetO(&d);
  42695   self->f->setDict(self, "2", &d);
  42696   r = isETypeO(self, "\"2\".\"1\".[12]", "int");
  42697   ck_assert(!r);
  42698   // non existing element
  42699   r = isETypeO(self, "randomKey", "int");
  42700   ck_assert(!r);
  42701   // null type
  42702   r = isETypeO(self, "", null);
  42703   ck_assert(!r);
  42704   // null key
  42705   r = isETypeO(self, null, "int");
  42706   ck_assert(!r);
  42707   // empty dict
  42708   freeO(self);
  42709   r = isETypeO(self, "", "int");
  42710   ck_assert(!r);
  42711   terminateO(self);
  42712 
  42713 }
  42714 
  42715 
  42716 void isEUndefinedSmallJsonT(CuTest *tc UNUSED) {
  42717 
  42718   bool r;
  42719   smallJsont *self = allocSmallJson();
  42720 
  42721   self->f->setInt(self, "", 1);
  42722   self->f->setUndefined(self, "b");
  42723   r = isEUndefinedO(self, "b");
  42724   ck_assert(r);
  42725   r = isEUndefinedO(self, "");
  42726   ck_assert(!r);
  42727   // path
  42728   createSmallArray(a);
  42729   createSmallDict(d);
  42730   a.f->pushDict(&a, &d);
  42731   self->f->setArray(self, "array", &a);
  42732   smallJsont *r2 = self->f->setUndefined(self, "\"array\"[0].\"key\"");
  42733   r2             = self->f->setS(self, "\"array\"[0].\"s\"", "asd");
  42734   ck_assert_ptr_ne(r2, null);
  42735   r = isEUndefinedO(self, "\"array\"[0].\"key\"");
  42736   ck_assert(r);
  42737   r = isEUndefinedO(self, "\"array\"[0].\"s\"");
  42738   ck_assert(!r);
  42739   // json bool
  42740   freeO(self);
  42741   setTypeBoolO(self);
  42742   r = isEUndefinedO(self, "1");
  42743   ck_assert(!r);
  42744   // json array
  42745   freeO(self);
  42746   setTypeArrayO(self);
  42747   r = isEUndefinedO(self, "1");
  42748   ck_assert(!r);
  42749   // non existing dict path
  42750   freeO(self);
  42751   r = isEUndefinedO(self, "\"1\"[1]");
  42752   ck_assert(!r);
  42753   //   dict path but the object is an array
  42754   resetO(&a);
  42755   self->f->setArray(self, "1", &a);
  42756   r = isEUndefinedO(self, "\"1\".\"1\"");
  42757   ck_assert(!r);
  42758   //   dict object in path but the key doesn't exists
  42759   resetO(&d);
  42760   self->f->setDict(self, "2", &d);
  42761   r = isEUndefinedO(self, "\"2\".\"1\".[12]");
  42762   ck_assert(!r);
  42763   // non existing key
  42764   r = isEUndefinedO(self, "qwe");
  42765   ck_assert(!r);
  42766   // empty dict
  42767   freeO(self);
  42768   r = isEUndefinedO(self, "");
  42769   ck_assert(!r);
  42770   terminateO(self);
  42771 
  42772 }
  42773 
  42774 
  42775 void isEBoolSmallJsonT(CuTest *tc UNUSED) {
  42776 
  42777   bool r;
  42778   smallJsont *self = allocSmallJson();
  42779 
  42780   self->f->setInt(self, "", 1);
  42781   self->f->setBool(self, "b", true);
  42782   r = isEBoolO(self, "b");
  42783   ck_assert(r);
  42784   r = isEBoolO(self, "");
  42785   ck_assert(!r);
  42786   // path
  42787   baset *value = (baset*) allocSmallBool(true);
  42788   createSmallArray(a);
  42789   createSmallDict(d);
  42790   a.f->pushDict(&a, &d);
  42791   self->f->setArray(self, "array", &a);
  42792   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42793   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42794   ck_assert_ptr_ne(r2, null);
  42795   finishO(value);
  42796   r = isEBoolO(self, "\"array\"[0].\"key\"");
  42797   ck_assert(r);
  42798   r = isEBoolO(self, "\"array\"[0].\"s\"");
  42799   ck_assert(!r);
  42800   // json bool
  42801   freeO(self);
  42802   setTypeBoolO(self);
  42803   r = isEBoolO(self, "1");
  42804   ck_assert(!r);
  42805   // json array
  42806   freeO(self);
  42807   setTypeArrayO(self);
  42808   r = isEBoolO(self, "1");
  42809   ck_assert(!r);
  42810   // non existing dict path
  42811   freeO(self);
  42812   r = isEBoolO(self, "\"1\"[1]");
  42813   ck_assert(!r);
  42814   //   dict path but the object is an array
  42815   resetO(&a);
  42816   self->f->setArray(self, "1", &a);
  42817   r = isEBoolO(self, "\"1\".\"1\"");
  42818   ck_assert(!r);
  42819   //   dict object in path but the key doesn't exists
  42820   resetO(&d);
  42821   self->f->setDict(self, "2", &d);
  42822   r = isEBoolO(self, "\"2\".\"1\".[12]");
  42823   ck_assert(!r);
  42824   // non existing key
  42825   r = isEBoolO(self, "qwe");
  42826   ck_assert(!r);
  42827   // empty dict
  42828   freeO(self);
  42829   r = isEBoolO(self, "");
  42830   ck_assert(!r);
  42831   terminateO(self);
  42832 
  42833 }
  42834 
  42835 
  42836 void isEContainerSmallJsonT(CuTest *tc UNUSED) {
  42837 
  42838   bool r;
  42839   smallJsont *self = allocSmallJson();
  42840 
  42841   createSmallContainer(c);
  42842   self->f->setInt(self, "", 1);
  42843   self->f->setBool(self, "b", true);
  42844   self->f->setSmallContainer(self, "c", &c);
  42845   r = isEContainerO(self, "c");
  42846   ck_assert(r);
  42847   r = isEContainerO(self, "b");
  42848   ck_assert(!r);
  42849   // path
  42850   baset *value = (baset*) allocSmallContainer(null);
  42851   createSmallArray(a);
  42852   createSmallDict(d);
  42853   a.f->pushDict(&a, &d);
  42854   self->f->setArray(self, "array", &a);
  42855   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42856   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42857   ck_assert_ptr_ne(r2, null);
  42858   finishO(value);
  42859   r = isEContainerO(self, "\"array\"[0].\"key\"");
  42860   ck_assert(r);
  42861   r = isEContainerO(self, "\"array\"[0].\"s\"");
  42862   ck_assert(!r);
  42863   // json bool
  42864   freeO(self);
  42865   setTypeBoolO(self);
  42866   r = isEContainerO(self, "1");
  42867   ck_assert(!r);
  42868   // json array
  42869   freeO(self);
  42870   setTypeArrayO(self);
  42871   r = isEContainerO(self, "1");
  42872   ck_assert(!r);
  42873   // non existing dict path
  42874   freeO(self);
  42875   r = isEContainerO(self, "\"1\"[1]");
  42876   ck_assert(!r);
  42877   //   dict path but the object is an array
  42878   resetO(&a);
  42879   self->f->setArray(self, "1", &a);
  42880   r = isEContainerO(self, "\"1\".\"1\"");
  42881   ck_assert(!r);
  42882   //   dict object in path but the key doesn't exists
  42883   resetO(&d);
  42884   self->f->setDict(self, "2", &d);
  42885   r = isEContainerO(self, "\"2\".\"1\".[12]");
  42886   ck_assert(!r);
  42887   // non existing key
  42888   r = isEContainerO(self, "qwe");
  42889   ck_assert(!r);
  42890   // empty dict
  42891   freeO(self);
  42892   r = isEContainerO(self, "");
  42893   ck_assert(!r);
  42894   terminateO(self);
  42895 
  42896 }
  42897 
  42898 
  42899 void isEDictSmallJsonT(CuTest *tc UNUSED) {
  42900 
  42901   bool r;
  42902   smallJsont *self = allocSmallJson();
  42903 
  42904   self->f->setInt(self, "", 1);
  42905   createSmallDict(D);
  42906   self->f->setDict(self, "b", &D);
  42907   r = isEDictO(self, "b");
  42908   ck_assert(r);
  42909   r = isEDictO(self, "");
  42910   ck_assert(!r);
  42911   // path
  42912   baset *value = (baset*) allocSmallDict();
  42913   createSmallArray(a);
  42914   createSmallDict(d);
  42915   a.f->pushDict(&a, &d);
  42916   self->f->setArray(self, "array", &a);
  42917   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42918   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42919   ck_assert_ptr_ne(r2, null);
  42920   finishO(value);
  42921   r = isEDictO(self, "\"array\"[0].\"key\"");
  42922   ck_assert(r);
  42923   r = isEDictO(self, "\"array\"[0].\"s\"");
  42924   ck_assert(!r);
  42925   // json bool
  42926   freeO(self);
  42927   setTypeBoolO(self);
  42928   r = isEDictO(self, "1");
  42929   ck_assert(!r);
  42930   // json array
  42931   freeO(self);
  42932   setTypeArrayO(self);
  42933   r = isEDictO(self, "1");
  42934   ck_assert(!r);
  42935   // non existing dict path
  42936   freeO(self);
  42937   r = isEDictO(self, "\"1\"[1]");
  42938   ck_assert(!r);
  42939   //   dict path but the object is an array
  42940   resetO(&a);
  42941   self->f->setArray(self, "1", &a);
  42942   r = isEDictO(self, "\"1\".\"1\"");
  42943   ck_assert(!r);
  42944   //   dict object in path but the key doesn't exists
  42945   resetO(&d);
  42946   self->f->setDict(self, "2", &d);
  42947   r = isEDictO(self, "\"2\".\"1\".[12]");
  42948   ck_assert(!r);
  42949   // non existing key
  42950   r = isEDictO(self, "qwe");
  42951   ck_assert(!r);
  42952   // empty dict
  42953   freeO(self);
  42954   r = isEDictO(self, "");
  42955   ck_assert(!r);
  42956   terminateO(self);
  42957 
  42958 }
  42959 
  42960 
  42961 void isEDoubleSmallJsonT(CuTest *tc UNUSED) {
  42962 
  42963   bool r;
  42964   smallJsont *self = allocSmallJson();
  42965 
  42966   self->f->setInt(self, "", 1);
  42967   self->f->setDouble(self, "b", 2.2);
  42968   r = isEDoubleO(self, "b");
  42969   ck_assert(r);
  42970   r = isEDoubleO(self, "");
  42971   ck_assert(!r);
  42972   // path
  42973   baset *value = (baset*) allocSmallDouble(2.2);
  42974   createSmallArray(a);
  42975   createSmallDict(d);
  42976   a.f->pushDict(&a, &d);
  42977   self->f->setArray(self, "array", &a);
  42978   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  42979   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  42980   ck_assert_ptr_ne(r2, null);
  42981   finishO(value);
  42982   r = isEDoubleO(self, "\"array\"[0].\"key\"");
  42983   ck_assert(r);
  42984   r = isEDoubleO(self, "\"array\"[0].\"s\"");
  42985   ck_assert(!r);
  42986   // json bool
  42987   freeO(self);
  42988   setTypeBoolO(self);
  42989   r = isEDoubleO(self, "1");
  42990   ck_assert(!r);
  42991   // json array
  42992   freeO(self);
  42993   setTypeArrayO(self);
  42994   r = isEDoubleO(self, "1");
  42995   ck_assert(!r);
  42996   // non existing dict path
  42997   freeO(self);
  42998   r = isEDoubleO(self, "\"1\"[1]");
  42999   ck_assert(!r);
  43000   //   dict path but the object is an array
  43001   resetO(&a);
  43002   self->f->setArray(self, "1", &a);
  43003   r = isEDoubleO(self, "\"1\".\"1\"");
  43004   ck_assert(!r);
  43005   //   dict object in path but the key doesn't exists
  43006   resetO(&d);
  43007   self->f->setDict(self, "2", &d);
  43008   r = isEDoubleO(self, "\"2\".\"1\".[12]");
  43009   ck_assert(!r);
  43010   // non existing key
  43011   r = isEDoubleO(self, "qwe");
  43012   ck_assert(!r);
  43013   // empty dict
  43014   freeO(self);
  43015   r = isEDoubleO(self, "");
  43016   ck_assert(!r);
  43017   terminateO(self);
  43018 
  43019 }
  43020 
  43021 
  43022 void isEIntSmallJsonT(CuTest *tc UNUSED) {
  43023 
  43024   bool r;
  43025   smallJsont *self = allocSmallJson();
  43026 
  43027   self->f->setBool(self, "", true);
  43028   self->f->setInt(self, "b", 2);
  43029   r = isEIntO(self, "b");
  43030   ck_assert(r);
  43031   r = isEIntO(self, "");
  43032   ck_assert(!r);
  43033   // path
  43034   baset *value = (baset*) allocSmallInt(123);
  43035   createSmallArray(a);
  43036   createSmallDict(d);
  43037   a.f->pushDict(&a, &d);
  43038   self->f->setArray(self, "array", &a);
  43039   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43040   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43041   ck_assert_ptr_ne(r2, null);
  43042   finishO(value);
  43043   r = isEIntO(self, "\"array\"[0].\"key\"");
  43044   ck_assert(r);
  43045   r = isEIntO(self, "\"array\"[0].\"s\"");
  43046   ck_assert(!r);
  43047   // json bool
  43048   freeO(self);
  43049   setTypeBoolO(self);
  43050   r = isEIntO(self, "1");
  43051   ck_assert(!r);
  43052   // json array
  43053   freeO(self);
  43054   setTypeArrayO(self);
  43055   r = isEIntO(self, "1");
  43056   ck_assert(!r);
  43057   // non existing dict path
  43058   freeO(self);
  43059   r = isEIntO(self, "\"1\"[1]");
  43060   ck_assert(!r);
  43061   //   dict path but the object is an array
  43062   resetO(&a);
  43063   self->f->setArray(self, "1", &a);
  43064   r = isEIntO(self, "\"1\".\"1\"");
  43065   ck_assert(!r);
  43066   //   dict object in path but the key doesn't exists
  43067   resetO(&d);
  43068   self->f->setDict(self, "2", &d);
  43069   r = isEIntO(self, "\"2\".\"1\".[12]");
  43070   ck_assert(!r);
  43071   // non existing key
  43072   r = isEIntO(self, "qwe");
  43073   ck_assert(!r);
  43074   // empty dict
  43075   freeO(self);
  43076   r = isEIntO(self, "");
  43077   ck_assert(!r);
  43078   terminateO(self);
  43079 
  43080 }
  43081 
  43082 
  43083 void isEStringSmallJsonT(CuTest *tc UNUSED) {
  43084 
  43085   bool r;
  43086   smallJsont *self = allocSmallJson();
  43087 
  43088   self->f->setInt(self, "", 1);
  43089   self->f->setS(self, "b", "!@#");
  43090   r = isEStringO(self, "b");
  43091   ck_assert(r);
  43092   r = isEStringO(self, "");
  43093   ck_assert(!r);
  43094   // path
  43095   baset *value = (baset*) allocSmallString("qwe");
  43096   createSmallArray(a);
  43097   createSmallDict(d);
  43098   a.f->pushDict(&a, &d);
  43099   self->f->setArray(self, "array", &a);
  43100   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43101   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43102   ck_assert_ptr_ne(r2, null);
  43103   finishO(value);
  43104   r = isEStringO(self, "\"array\"[0].\"key\"");
  43105   ck_assert(r);
  43106   r = isEStringO(self, "\"array\"[0].\"s\"");
  43107   ck_assert(!r);
  43108   // json bool
  43109   freeO(self);
  43110   setTypeBoolO(self);
  43111   r = isEStringO(self, "1");
  43112   ck_assert(!r);
  43113   // json array
  43114   freeO(self);
  43115   setTypeArrayO(self);
  43116   r = isEStringO(self, "1");
  43117   ck_assert(!r);
  43118   // non existing dict path
  43119   freeO(self);
  43120   r = isEStringO(self, "\"1\"[1]");
  43121   ck_assert(!r);
  43122   //   dict path but the object is an array
  43123   resetO(&a);
  43124   self->f->setArray(self, "1", &a);
  43125   r = isEStringO(self, "\"1\".\"1\"");
  43126   ck_assert(!r);
  43127   //   dict object in path but the key doesn't exists
  43128   resetO(&d);
  43129   self->f->setDict(self, "2", &d);
  43130   r = isEStringO(self, "\"2\".\"1\".[12]");
  43131   ck_assert(!r);
  43132   // non existing key
  43133   r = isEStringO(self, "qwe");
  43134   ck_assert(!r);
  43135   // empty dict
  43136   freeO(self);
  43137   r = isEStringO(self, "");
  43138   ck_assert(!r);
  43139   terminateO(self);
  43140 
  43141 }
  43142 
  43143 
  43144 void isEFaststringSmallJsonT(CuTest *tc UNUSED) {
  43145 
  43146   bool r;
  43147   smallJsont *self = allocSmallJson();
  43148 
  43149   self->f->setInt(self, "", 1);
  43150   r = isEFaststringO(self, "");
  43151   ck_assert(!r);
  43152   // path
  43153   baset *value = (baset*) allocSmallBool(true);
  43154   createSmallArray(a);
  43155   createSmallDict(d);
  43156   a.f->pushDict(&a, &d);
  43157   self->f->setArray(self, "array", &a);
  43158   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43159   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43160   ck_assert_ptr_ne(r2, null);
  43161   finishO(value);
  43162   r = isEFaststringO(self, "\"array\"[0].\"key\"");
  43163   ck_assert(!r);
  43164   r = isEFaststringO(self, "\"array\"[0].\"s\"");
  43165   ck_assert(!r);
  43166   // json bool
  43167   freeO(self);
  43168   setTypeBoolO(self);
  43169   r = isEFaststringO(self, "1");
  43170   ck_assert(!r);
  43171   // json array
  43172   freeO(self);
  43173   setTypeArrayO(self);
  43174   r = isEFaststringO(self, "1");
  43175   ck_assert(!r);
  43176   // non existing dict path
  43177   freeO(self);
  43178   r = isEFaststringO(self, "\"1\"[1]");
  43179   ck_assert(!r);
  43180   //   dict path but the object is an array
  43181   resetO(&a);
  43182   self->f->setArray(self, "1", &a);
  43183   r = isEFaststringO(self, "\"1\".\"1\"");
  43184   ck_assert(!r);
  43185   //   dict object in path but the key doesn't exists
  43186   resetO(&d);
  43187   self->f->setDict(self, "2", &d);
  43188   r = isEFaststringO(self, "\"2\".\"1\".[12]");
  43189   ck_assert(!r);
  43190   // non existing key
  43191   r = isEFaststringO(self, "qwe");
  43192   ck_assert(!r);
  43193   // empty dict
  43194   freeO(self);
  43195   r = isEFaststringO(self, "");
  43196   ck_assert(!r);
  43197   terminateO(self);
  43198 
  43199 }
  43200 
  43201 
  43202 void isEArraySmallJsonT(CuTest *tc UNUSED) {
  43203 
  43204   bool r;
  43205   smallJsont *self = allocSmallJson();
  43206 
  43207   createSmallArray(A);
  43208   self->f->setInt(self, "", 1);
  43209   self->f->setArray(self, "b", &A);
  43210   r = isEArrayO(self, "b");
  43211   ck_assert(r);
  43212   r = isEArrayO(self, "");
  43213   ck_assert(!r);
  43214   // path
  43215   baset *value = (baset*) allocSmallArray();
  43216   createSmallArray(a);
  43217   createSmallDict(d);
  43218   a.f->pushDict(&a, &d);
  43219   self->f->setArray(self, "array", &a);
  43220   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43221   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43222   ck_assert_ptr_ne(r2, null);
  43223   finishO(value);
  43224   r = isEArrayO(self, "\"array\"[0].\"key\"");
  43225   ck_assert(r);
  43226   r = isEArrayO(self, "\"array\"[0].\"s\"");
  43227   ck_assert(!r);
  43228   // json bool
  43229   freeO(self);
  43230   setTypeBoolO(self);
  43231   r = isEArrayO(self, "1");
  43232   ck_assert(!r);
  43233   // json array
  43234   freeO(self);
  43235   setTypeArrayO(self);
  43236   r = isEArrayO(self, "1");
  43237   ck_assert(!r);
  43238   // non existing dict path
  43239   freeO(self);
  43240   r = isEArrayO(self, "\"1\"[1]");
  43241   ck_assert(!r);
  43242   //   dict path but the object is an array
  43243   resetO(&a);
  43244   self->f->setArray(self, "1", &a);
  43245   r = isEArrayO(self, "\"1\".\"1\"");
  43246   ck_assert(!r);
  43247   //   dict object in path but the key doesn't exists
  43248   resetO(&d);
  43249   self->f->setDict(self, "2", &d);
  43250   r = isEArrayO(self, "\"2\".\"1\".[12]");
  43251   ck_assert(!r);
  43252   // non existing key
  43253   r = isEArrayO(self, "qwe");
  43254   ck_assert(!r);
  43255   // empty dict
  43256   freeO(self);
  43257   r = isEArrayO(self, "");
  43258   ck_assert(!r);
  43259   terminateO(self);
  43260 
  43261 }
  43262 
  43263 
  43264 void isEBytesSmallJsonT(CuTest *tc UNUSED) {
  43265 
  43266   bool r;
  43267   smallJsont *self = allocSmallJson();
  43268 
  43269   createSmallBytes(b);
  43270   self->f->setInt(self, "", 1);
  43271   self->f->setSmallBytes(self, "b", &b);
  43272   r = isEBytesO(self, "b");
  43273   ck_assert(r);
  43274   r = isEBytesO(self, "");
  43275   ck_assert(!r);
  43276   // path
  43277   baset *value = (baset*) allocSmallBytes("", sizeof(""));
  43278   createSmallArray(a);
  43279   createSmallDict(d);
  43280   a.f->pushDict(&a, &d);
  43281   self->f->setArray(self, "array", &a);
  43282   smallJsont *r2 = self->f->set(self, "\"array\"[0].\"key\"", value);
  43283   r2             = self->f->setUndefined(self, "\"array\"[0].\"s\"");
  43284   ck_assert_ptr_ne(r2, null);
  43285   finishO(value);
  43286   r = isEBytesO(self, "\"array\"[0].\"key\"");
  43287   ck_assert(r);
  43288   r = isEBytesO(self, "\"array\"[0].\"s\"");
  43289   ck_assert(!r);
  43290   // json bool
  43291   freeO(self);
  43292   setTypeBoolO(self);
  43293   r = isEBytesO(self, "1");
  43294   ck_assert(!r);
  43295   // json array
  43296   freeO(self);
  43297   setTypeArrayO(self);
  43298   r = isEBytesO(self, "1");
  43299   ck_assert(!r);
  43300   // non existing dict path
  43301   freeO(self);
  43302   r = isEBytesO(self, "\"1\"[1]");
  43303   ck_assert(!r);
  43304   //   dict path but the object is an array
  43305   resetO(&a);
  43306   self->f->setArray(self, "1", &a);
  43307   r = isEBytesO(self, "\"1\".\"1\"");
  43308   ck_assert(!r);
  43309   //   dict object in path but the key doesn't exists
  43310   resetO(&d);
  43311   self->f->setDict(self, "2", &d);
  43312   r = isEBytesO(self, "\"2\".\"1\".[12]");
  43313   ck_assert(!r);
  43314   // non existing key
  43315   r = isEBytesO(self, "qwe");
  43316   ck_assert(!r);
  43317   // empty dict
  43318   freeO(self);
  43319   r = isEBytesO(self, "");
  43320   ck_assert(!r);
  43321   terminateO(self);
  43322 
  43323 }
  43324 
  43325 
  43326 void areAllETypeSmallJsonT(CuTest *tc UNUSED) {
  43327 
  43328   bool r;
  43329   smallJsont *self = allocSmallJson();
  43330 
  43331   self->f->setBool(self, "a", true);
  43332   self->f->setBool(self, "b", true);
  43333   r = areAllETypeO(self, "bool");
  43334   ck_assert(r);
  43335   self->f->setInt(self, "c", 2);
  43336   r = areAllETypeO(self, "bool");
  43337   ck_assert(!r);
  43338   // null type
  43339   r = areAllETypeO(self, null);
  43340   ck_assert(!r);
  43341   // empty self
  43342   freeO(self);
  43343   setTypeDictO(self);
  43344   r = areAllETypeO(self, "bool");
  43345   ck_assert(!r);
  43346   self->f->setS(self, "a", "");
  43347   self->f->delElem(self, "a");
  43348   r = areAllETypeO(self, "string");
  43349   ck_assert(!r);
  43350   // json array
  43351   freeO(self);
  43352   // empty array
  43353   r = areAllETypeO(self, "undefined");
  43354   ck_assert(!r);
  43355   setTypeArrayO(self);
  43356   r = areAllETypeO(self, "undefined");
  43357   ck_assert(!r);
  43358   // array
  43359   self->f->pushUndefined(self);
  43360   self->f->pushUndefined(self);
  43361   self->f->pushUndefined(self);
  43362   delElemIndexO(self, 1);
  43363   r = areAllETypeO(self, "undefined");
  43364   ck_assert(!r);
  43365   trimO(self);
  43366   r = areAllETypeO(self, "undefined");
  43367   ck_assert(r);
  43368   // NULL type
  43369   r = areAllETypeO(self, NULL);
  43370   ck_assert(!r);
  43371   terminateO(self);
  43372 
  43373 }
  43374 
  43375 
  43376 void areAllEUndefinedSmallJsonT(CuTest *tc UNUSED) {
  43377 
  43378   bool r;
  43379   smallJsont *self = allocSmallJson();
  43380 
  43381   // array
  43382   self->f->pushUndefined(self);
  43383   self->f->pushUndefined(self);
  43384   self->f->pushUndefined(self);
  43385   r = areAllEUndefinedO(self);
  43386   ck_assert(r);
  43387   terminateO(self);
  43388 
  43389 }
  43390 
  43391 
  43392 void areAllEBoolSmallJsonT(CuTest *tc UNUSED) {
  43393 
  43394   bool r;
  43395   smallJsont *self = allocSmallJson();
  43396 
  43397   // array
  43398   self->f->pushBool(self, true);
  43399   self->f->pushBool(self, true);
  43400   self->f->pushBool(self, true);
  43401   r = areAllEBoolO(self);
  43402   ck_assert(r);
  43403   terminateO(self);
  43404 
  43405 }
  43406 
  43407 
  43408 void areAllEContainerSmallJsonT(CuTest *tc UNUSED) {
  43409 
  43410   bool r;
  43411   smallJsont *self = allocSmallJson();
  43412 
  43413   createSmallContainer(c);
  43414   self->f->pushSmallContainer(self, &c);
  43415   r = areAllEContainerO(self);
  43416   ck_assert(r);
  43417   terminateO(self);
  43418 
  43419 }
  43420 
  43421 
  43422 void areAllEDictSmallJsonT(CuTest *tc UNUSED) {
  43423 
  43424   bool r;
  43425   smallJsont *self = allocSmallJson();
  43426 
  43427   createSmallDict(d);
  43428   self->f->pushDict(self, &d);
  43429   r = areAllEDictO(self);
  43430   ck_assert(r);
  43431   terminateO(self);
  43432 
  43433 }
  43434 
  43435 
  43436 void areAllEDoubleSmallJsonT(CuTest *tc UNUSED) {
  43437 
  43438   bool r;
  43439   smallJsont *self = allocSmallJson();
  43440 
  43441   self->f->pushDouble(self, 1);
  43442   r = areAllEDoubleO(self);
  43443   ck_assert(r);
  43444   terminateO(self);
  43445 
  43446 }
  43447 
  43448 
  43449 void areAllEIntSmallJsonT(CuTest *tc UNUSED) {
  43450 
  43451   bool r;
  43452   smallJsont *self = allocSmallJson();
  43453 
  43454   self->f->pushInt(self, 1);
  43455   r = areAllEIntO(self);
  43456   ck_assert(r);
  43457   terminateO(self);
  43458 
  43459 }
  43460 
  43461 
  43462 void areAllEStringSmallJsonT(CuTest *tc UNUSED) {
  43463 
  43464   bool r;
  43465   smallJsont *self = allocSmallJson();
  43466 
  43467   self->f->pushS(self, "");
  43468   r = areAllEStringO(self);
  43469   ck_assert(r);
  43470   terminateO(self);
  43471 
  43472 }
  43473 
  43474 
  43475 void areAllEFaststringSmallJsonT(CuTest *tc UNUSED) {
  43476 
  43477   bool r;
  43478   smallJsont *self = allocSmallJson();
  43479 
  43480   self->f->pushS(self, "");
  43481   r = areAllEFaststringO(self);
  43482   ck_assert(!r);
  43483   terminateO(self);
  43484 
  43485 }
  43486 
  43487 
  43488 void areAllEArraySmallJsonT(CuTest *tc UNUSED) {
  43489 
  43490   bool r;
  43491   smallJsont *self = allocSmallJson();
  43492 
  43493   createSmallArray(a);
  43494   self->f->pushArray(self, &a);
  43495   r = areAllEArrayO(self);
  43496   ck_assert(r);
  43497   terminateO(self);
  43498 
  43499 }
  43500 
  43501 
  43502 void areAllEBytesSmallJsonT(CuTest *tc UNUSED) {
  43503 
  43504   bool r;
  43505   smallJsont *self = allocSmallJson();
  43506 
  43507   createSmallBytes(b);
  43508   self->f->pushSmallBytes(self, &b);
  43509   r = areAllEBytesO(self);
  43510   ck_assert(r);
  43511   terminateO(self);
  43512 
  43513 }
  43514 
  43515 
  43516 void duplicateSmallJsonGT(CuTest *tc UNUSED) {
  43517 
  43518   smallJsont* r;
  43519   smallJsont *self = allocSmallJson();
  43520 
  43521   self->f->pushInt(self, 1);
  43522   iterStartO(self);
  43523   r = duplicateSmallJsonG(self);
  43524   char *s = toStringO(r);
  43525   ck_assert_int_eq(r->iterIndex, 0);
  43526   terminateO(r);
  43527   ck_assert_str_eq(s, "[1]");
  43528   free(s);
  43529   // with iterator
  43530   freeO(self);
  43531   self->f->setS(self, "qwe", "asd");
  43532   iterStartO(self);
  43533   r = duplicateSmallJsonG(self);
  43534   ck_assert_ptr_ne(r, null);
  43535   s = toStringO(r);
  43536   ck_assert_str_eq(s, "{\"qwe\":\"asd\"}");
  43537   free(s);
  43538   ck_assert_str_eq(r->iterKey, "qwe");
  43539   terminateO(r);
  43540   terminateO(self);
  43541 
  43542 }
  43543 
  43544 
  43545 void freeSmallJsonGT(CuTest *tc UNUSED) {
  43546 
  43547   smallJsont *self = allocSmallJson();
  43548 
  43549   self->f->pushInt(self, 1);
  43550   freeSmallJsonG(self);
  43551   char *s = toStringO(self);
  43552   ck_assert_str_eq(s, "{}");
  43553   free(s);
  43554   terminateO(self);
  43555 
  43556 }
  43557 
  43558 
  43559 void setTopSmallJsonGT(CuTest *tc UNUSED) {
  43560 
  43561   smallJsont* r;
  43562   smallJsont *self = allocG(rtSmallJsont);
  43563 
  43564   // value is a smallJson
  43565   // undefined
  43566   createAllocateSmallJson(js);
  43567   createUndefined(u);
  43568   setTopO(js, (baset*)&u);
  43569   r = setTopSmallJsonG(self, (baset*) js);
  43570   ck_assert_ptr_ne(r, null);
  43571   char *s = toStringO(r);
  43572   ck_assert_str_eq(s, "null");
  43573   free(s);
  43574   resetO(js);
  43575   freeO(self);
  43576   // bool
  43577   setTopBoolO(js, true);
  43578   r = setTopSmallJsonG(self, (baset*) js);
  43579   ck_assert_ptr_ne(r, null);
  43580   s = toStringO(r);
  43581   ck_assert_str_eq(s, "true");
  43582   free(s);
  43583   resetO(js);
  43584   freeO(self);
  43585   // double
  43586   setTopDoubleO(js, 2.2);
  43587   r = setTopSmallJsonG(self, (baset*) js);
  43588   ck_assert_ptr_ne(r, null);
  43589   s = toStringO(r);
  43590   ck_assert_str_eq(s, "2.200000e+00");
  43591   free(s);
  43592   resetO(js);
  43593   freeO(self);
  43594   // int
  43595   setTopIntO(js, 2);
  43596   r = setTopSmallJsonG(self, (baset*) js);
  43597   ck_assert_ptr_ne(r, null);
  43598   s = toStringO(r);
  43599   ck_assert_str_eq(s, "2");
  43600   free(s);
  43601   resetO(js);
  43602   freeO(self);
  43603   // string
  43604   setTopSO(js, "qwe");
  43605   r = setTopSmallJsonG(self, (baset*) js);
  43606   ck_assert_ptr_ne(r, null);
  43607   s = toStringO(r);
  43608   ck_assert_str_eq(s, "qwe");
  43609   free(s);
  43610   resetO(js);
  43611   freeO(self);
  43612   // dict
  43613   js->f->setS(js, "1", "2");
  43614   r = setTopSmallJsonG(self, (baset*) js);
  43615   ck_assert_ptr_ne(r, null);
  43616   s = toStringO(r);
  43617   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  43618   free(s);
  43619   resetO(js);
  43620   freeO(self);
  43621   // array
  43622   js->f->pushS(js, "qwe");
  43623   r = setTopSmallJsonG(self, (baset*) js);
  43624   ck_assert_ptr_ne(r, null);
  43625   s = toStringO(r);
  43626   ck_assert_str_eq(s, "[\"qwe\"]");
  43627   free(s);
  43628   resetO(js);
  43629   terminateO(js);
  43630   terminateO(self);
  43631 
  43632 }
  43633 
  43634 
  43635 void setTopBoolSmallJsonGT(CuTest *tc UNUSED) {
  43636 
  43637   smallJsont* r;
  43638   smallJsont *self = allocG(rtSmallJsont);
  43639 
  43640   r = setTopBoolSmallJsonG(self, true);
  43641   ck_assert_ptr_ne(r, null);
  43642   char *s = toStringO(r);
  43643   ck_assert_str_eq(s, "true");
  43644   free(s);
  43645   terminateO(self);
  43646 
  43647 }
  43648 
  43649 
  43650 void setTopDoubleSmallJsonGT(CuTest *tc UNUSED) {
  43651 
  43652   smallJsont* r;
  43653   smallJsont *self = allocG(rtSmallJsont);
  43654 
  43655   r = setTopDoubleSmallJsonG(self, 2);
  43656   ck_assert_ptr_ne(r, null);
  43657   char *s = toStringO(r);
  43658   ck_assert_str_eq(s, "2.000000e+00");
  43659   free(s);
  43660   terminateO(self);
  43661 
  43662 }
  43663 
  43664 
  43665 void setTopIntSmallJsonGT(CuTest *tc UNUSED) {
  43666 
  43667   smallJsont* r;
  43668   smallJsont *self = allocG(rtSmallJsont);
  43669 
  43670   r = setTopIntSmallJsonG(self, 2);
  43671   ck_assert_ptr_ne(r, null);
  43672   char *s = toStringO(r);
  43673   ck_assert_str_eq(s, "2");
  43674   free(s);
  43675   terminateO(self);
  43676 
  43677 }
  43678 
  43679 
  43680 void setTopStringSmallJsonGT(CuTest *tc UNUSED) {
  43681 
  43682   smallJsont* r;
  43683   smallJsont *self = allocG(rtSmallJsont);
  43684 
  43685   r = setTopStringSmallJsonG(self, "qwe");
  43686   ck_assert_ptr_ne(r, null);
  43687   char *s = toStringO(r);
  43688   ck_assert_str_eq(s, "qwe");
  43689   free(s);
  43690   terminateO(self);
  43691 
  43692 }
  43693 
  43694 
  43695 void setTopCharSmallJsonGT(CuTest *tc UNUSED) {
  43696 
  43697   smallJsont* r;
  43698   smallJsont *self = allocG(rtSmallJsont);
  43699 
  43700   r = setTopCharSmallJsonG(self, 'X');
  43701   ck_assert_ptr_ne(r, null);
  43702   char *s = toStringO(r);
  43703   ck_assert_str_eq(s, "X");
  43704   free(s);
  43705   terminateO(self);
  43706 
  43707 }
  43708 
  43709 
  43710 void setTopDictSmallJsonGT(CuTest *tc UNUSED) {
  43711 
  43712   smallJsont* r;
  43713   smallJsont *self = allocG(rtSmallJsont);
  43714   smallDictt *value = allocSmallDict();
  43715 
  43716   r = setTopDictSmallJsonG(self, value);
  43717   ck_assert_ptr_ne(r, null);
  43718   finishG(value);
  43719   char *s = toStringO(r);
  43720   ck_assert_str_eq(s, "{}");
  43721   free(s);
  43722   terminateO(self);
  43723 
  43724 }
  43725 
  43726 
  43727 void setTopArraySmallJsonGT(CuTest *tc UNUSED) {
  43728 
  43729   smallJsont* r;
  43730   smallJsont *self = allocG(rtSmallJsont);
  43731   smallArrayt *value = allocSmallArray();
  43732 
  43733   r = setTopArraySmallJsonG(self, value);
  43734   ck_assert_ptr_ne(r, null);
  43735   finishG(value);
  43736   char *s = toStringO(r);
  43737   ck_assert_str_eq(s, "[]");
  43738   free(s);
  43739   terminateO(self);
  43740 
  43741 }
  43742 
  43743 
  43744 void setTopArraycSmallJsonGT(CuTest *tc UNUSED) {
  43745 
  43746   smallJsont* r;
  43747   smallJsont *self = allocG(rtSmallJsont);
  43748   char **value     = listCreateS("a","bb");
  43749 
  43750   r = setTopArraycSmallJsonG(self, value);
  43751   ck_assert_ptr_ne(r, null);
  43752   listFreeS(value);
  43753   char *s = toStringO(r);
  43754   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43755   free(s);
  43756   terminateO(self);
  43757 
  43758 }
  43759 
  43760 
  43761 void setTopCArraycSmallJsonGT(CuTest *tc UNUSED) {
  43762 
  43763   smallJsont* r;
  43764   smallJsont *self    = allocG(rtSmallJsont);
  43765   const char *value[] = {"a", "bb", null};
  43766 
  43767   r = setTopCArraycSmallJsonG(self, value);
  43768   ck_assert_ptr_ne(r, null);
  43769   char *s = toStringO(r);
  43770   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43771   free(s);
  43772   terminateO(self);
  43773 
  43774 }
  43775 
  43776 
  43777 void setTopSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  43778 
  43779   smallJsont* r;
  43780   smallJsont *self  = allocG(rtSmallJsont);
  43781   smallBoolt *value = allocSmallBool(true);
  43782 
  43783   r = setTopSmallBoolSmallJsonG(self, value);
  43784   ck_assert_ptr_ne(r, null);
  43785   finishG(value);
  43786   char *s = toStringO(r);
  43787   ck_assert_str_eq(s, "true");
  43788   free(s);
  43789   terminateO(self);
  43790 
  43791 }
  43792 
  43793 
  43794 void setTopSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  43795 
  43796   smallJsont* r;
  43797   smallJsont *self    = allocG(rtSmallJsont);
  43798   smallDoublet *value = allocSmallDouble(2);
  43799 
  43800   r = setTopSmallDoubleSmallJsonG(self, value);
  43801   ck_assert_ptr_ne(r, null);
  43802   finishG(value);
  43803   char *s = toStringO(r);
  43804   ck_assert_str_eq(s, "2.000000e+00");
  43805   free(s);
  43806   terminateO(self);
  43807 
  43808 }
  43809 
  43810 
  43811 void setTopSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  43812 
  43813   smallJsont* r;
  43814   smallJsont *self = allocG(rtSmallJsont);
  43815   smallIntt *value = allocSmallInt(2);
  43816 
  43817   r = setTopSmallIntSmallJsonG(self, value);
  43818   ck_assert_ptr_ne(r, null);
  43819   finishG(value);
  43820   char *s = toStringO(r);
  43821   ck_assert_str_eq(s, "2");
  43822   free(s);
  43823   terminateO(self);
  43824 
  43825 }
  43826 
  43827 
  43828 void setTopSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  43829 
  43830   smallJsont* r;
  43831   smallJsont *self  = allocG(rtSmallJsont);
  43832   smallJsont *value = allocSmallJson();
  43833 
  43834   r = setTopSmallJsonSmallJsonG(self, value);
  43835   ck_assert_ptr_ne(r, null);
  43836   finishG(value);
  43837   char *s = toStringO(r);
  43838   ck_assert_str_eq(s, "{}");
  43839   free(s);
  43840   terminateO(self);
  43841 
  43842 }
  43843 
  43844 
  43845 void setTopSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  43846 
  43847   smallJsont* r;
  43848   smallJsont *self    = allocG(rtSmallJsont);
  43849   smallStringt *value = allocSmallString("qwe");
  43850 
  43851   r = setTopSmallStringSmallJsonG(self, value);
  43852   ck_assert_ptr_ne(r, null);
  43853   finishG(value);
  43854   char *s = toStringO(r);
  43855   ck_assert_str_eq(s, "qwe");
  43856   free(s);
  43857   terminateO(self);
  43858 
  43859 }
  43860 
  43861 
  43862 void setTopNFreeSmallJsonGT(CuTest *tc UNUSED) {
  43863 
  43864   smallJsont* r;
  43865   smallJsont *self = allocG(rtSmallJsont);
  43866   baset *value     = (baset*)allocSmallInt(2);
  43867 
  43868   r = setTopNFreeSmallJsonG(self, value);
  43869   ck_assert_ptr_ne(r, null);
  43870   char *s = toStringO(r);
  43871   ck_assert_str_eq(s, "2");
  43872   free(s);
  43873   terminateO(self);
  43874 
  43875 }
  43876 
  43877 
  43878 void setTopNFreeBoolSmallJsonGT(CuTest *tc UNUSED) {
  43879 
  43880   smallJsont* r;
  43881   smallJsont *self = allocG(rtSmallJsont);
  43882 
  43883   r = setTopNFreeBoolSmallJsonG(self, true);
  43884   ck_assert_ptr_ne(r, null);
  43885   char *s = toStringO(r);
  43886   ck_assert_str_eq(s, "true");
  43887   free(s);
  43888   terminateO(self);
  43889 
  43890 }
  43891 
  43892 
  43893 void setTopNFreeDoubleSmallJsonGT(CuTest *tc UNUSED) {
  43894 
  43895   smallJsont* r;
  43896   smallJsont *self = allocG(rtSmallJsont);
  43897 
  43898   r = setTopNFreeDoubleSmallJsonG(self, 2);
  43899   ck_assert_ptr_ne(r, null);
  43900   char *s = toStringO(r);
  43901   ck_assert_str_eq(s, "2.000000e+00");
  43902   free(s);
  43903   terminateO(self);
  43904 
  43905 }
  43906 
  43907 
  43908 void setTopNFreeIntSmallJsonGT(CuTest *tc UNUSED) {
  43909 
  43910   smallJsont* r;
  43911   smallJsont *self = allocG(rtSmallJsont);
  43912 
  43913   r = setTopNFreeIntSmallJsonG(self, 2);
  43914   ck_assert_ptr_ne(r, null);
  43915   char *s = toStringO(r);
  43916   ck_assert_str_eq(s, "2");
  43917   free(s);
  43918   terminateO(self);
  43919 
  43920 }
  43921 
  43922 
  43923 void setTopNFreeStringSmallJsonGT(CuTest *tc UNUSED) {
  43924 
  43925   smallJsont* r;
  43926   smallJsont *self = allocG(rtSmallJsont);
  43927   char *value      = strdup("qwe");
  43928 
  43929   r = setTopNFreeStringSmallJsonG(self, value);
  43930   ck_assert_ptr_ne(r, null);
  43931   char *s = toStringO(r);
  43932   ck_assert_str_eq(s, "qwe");
  43933   free(s);
  43934   terminateO(self);
  43935 
  43936 }
  43937 
  43938 
  43939 void setTopNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  43940 
  43941   smallJsont* r;
  43942   smallJsont *self  = allocG(rtSmallJsont);
  43943   smallDictt *value = allocSmallDict();
  43944 
  43945   r = setTopNFreeDictSmallJsonG(self, value);
  43946   ck_assert_ptr_ne(r, null);
  43947   char *s = toStringO(r);
  43948   ck_assert_str_eq(s, "{}");
  43949   free(s);
  43950   terminateO(self);
  43951 
  43952 }
  43953 
  43954 
  43955 void setTopNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  43956 
  43957   smallJsont* r;
  43958   smallJsont *self   = allocG(rtSmallJsont);
  43959   smallArrayt *value = allocSmallArray();
  43960 
  43961   r = setTopNFreeArraySmallJsonG(self, value);
  43962   ck_assert_ptr_ne(r, null);
  43963   char *s = toStringO(r);
  43964   ck_assert_str_eq(s, "[]");
  43965   free(s);
  43966   terminateO(self);
  43967 
  43968 }
  43969 
  43970 
  43971 void setTopNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  43972 
  43973   smallJsont* r;
  43974   smallJsont *self = allocG(rtSmallJsont);
  43975   char **value     = listCreateS("a","bb");
  43976 
  43977   r = setTopNFreeArraycSmallJsonG(self, value);
  43978   ck_assert_ptr_ne(r, null);
  43979   char *s = toStringO(r);
  43980   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  43981   free(s);
  43982   terminateO(self);
  43983 
  43984 }
  43985 
  43986 
  43987 void setTopNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  43988 
  43989   smallJsont* r;
  43990   smallJsont *self  = allocG(rtSmallJsont);
  43991   smallBoolt *value = allocSmallBool(true);
  43992 
  43993   r = setTopNFreeSmallBoolSmallJsonG(self, value);
  43994   ck_assert_ptr_ne(r, null);
  43995   char *s = toStringO(r);
  43996   ck_assert_str_eq(s, "true");
  43997   free(s);
  43998   terminateO(self);
  43999 
  44000 }
  44001 
  44002 
  44003 void setTopNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44004 
  44005   smallJsont* r;
  44006   smallJsont *self    = allocG(rtSmallJsont);
  44007   smallDoublet *value = allocSmallDouble(2);
  44008 
  44009   r = setTopNFreeSmallDoubleSmallJsonG(self, value);
  44010   ck_assert_ptr_ne(r, null);
  44011   char *s = toStringO(r);
  44012   ck_assert_str_eq(s, "2.000000e+00");
  44013   free(s);
  44014   terminateO(self);
  44015 
  44016 }
  44017 
  44018 
  44019 void setTopNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  44020 
  44021   smallJsont* r;
  44022   smallJsont *self = allocG(rtSmallJsont);
  44023   smallIntt *value = allocSmallInt(2);
  44024 
  44025   r = setTopNFreeSmallIntSmallJsonG(self, value);
  44026   ck_assert_ptr_ne(r, null);
  44027   char *s = toStringO(r);
  44028   ck_assert_str_eq(s, "2");
  44029   free(s);
  44030   terminateO(self);
  44031 
  44032 }
  44033 
  44034 
  44035 void setTopNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  44036 
  44037   smallJsont* r;
  44038   smallJsont *self  = allocG(rtSmallJsont);
  44039   smallJsont *value = allocSmallJson();
  44040 
  44041   r = setTopNFreeSmallJsonSmallJsonG(self, value);
  44042   ck_assert_ptr_ne(r, null);
  44043   char *s = toStringO(r);
  44044   ck_assert_str_eq(s, "{}");
  44045   free(s);
  44046   terminateO(self);
  44047 
  44048 }
  44049 
  44050 
  44051 void setTopNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  44052 
  44053   smallJsont* r;
  44054   smallJsont *self    = allocG(rtSmallJsont);
  44055   smallStringt *value = allocSmallString("qwe");
  44056 
  44057   r = setTopNFreeSmallStringSmallJsonG(self, value);
  44058   ck_assert_ptr_ne(r, null);
  44059   char *s = toStringO(r);
  44060   ck_assert_str_eq(s, "qwe");
  44061   free(s);
  44062   terminateO(self);
  44063 
  44064 }
  44065 
  44066 
  44067 void fromArraySmallJsonGT(CuTest *tc UNUSED) {
  44068 
  44069   smallJsont* r;
  44070   smallJsont *self = allocSmallJson();
  44071 
  44072   char *array[] = {"1", "22", "333"};
  44073   r = fromArraySmallJsonG(self, array, 3);
  44074   ck_assert_ptr_ne(r, NULL);
  44075   char *s = toStringO(r);
  44076   ck_assert_str_eq(s, "[\"1\",\"22\",\"333\"]");
  44077   free(s);
  44078   terminateO(self);
  44079 
  44080 }
  44081 
  44082 
  44083 void fromCArraySmallJsonGT(CuTest *tc UNUSED) {
  44084 
  44085   smallJsont* r;
  44086   smallJsont *self = allocSmallJson();
  44087 
  44088   const char *array[] = {"1", "22", "333"};
  44089   r = fromCArraySmallJsonG(self, array, 3);
  44090   ck_assert_ptr_ne(r, NULL);
  44091   char *s = toStringO(r);
  44092   ck_assert_str_eq(s, "[\"1\",\"22\",\"333\"]");
  44093   free(s);
  44094   terminateO(self);
  44095 
  44096 }
  44097 
  44098 
  44099 void getTopSmallJsonGT(CuTest *tc UNUSED) {
  44100 
  44101   baset*        r;
  44102   smallJsont *self = allocG(rtSmallJsont);
  44103 
  44104   setTopIntO(self, 987);
  44105   r = getTopSmallJsonG(self, null);
  44106   ck_assert_ptr_ne(r, null);
  44107   ck_assert_str_eq(r->type, "smallInt");
  44108   finishO(r);
  44109   terminateO(self);
  44110 
  44111 }
  44112 
  44113 
  44114 void getTopUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  44115 
  44116   undefinedt*   r  = allocUndefined();;
  44117   smallJsont *self = allocG(rtSmallJsont);
  44118 
  44119   setTopO(self, (baset*) r);
  44120   finishO(r);
  44121   r = getTopUndefinedSmallJsonG(self, null);
  44122   ck_assert_ptr_ne(r, null);
  44123   char *s = toStringO(r);
  44124   finishO(r);
  44125   ck_assert_str_eq(s, "null");
  44126   free(s);
  44127   terminateO(self);
  44128 
  44129 }
  44130 
  44131 
  44132 void getTopBoolSmallJsonGT(CuTest *tc UNUSED) {
  44133 
  44134   bool          r;
  44135   smallJsont *self = allocG(rtSmallJsont);
  44136 
  44137   setTopBoolO(self, true);
  44138   r = getTopBoolSmallJsonG(self, true);
  44139   ck_assert(r);
  44140   terminateO(self);
  44141 
  44142 }
  44143 
  44144 
  44145 void getTopBoolPSmallJsonGT(CuTest *tc UNUSED) {
  44146 
  44147   bool*         r;
  44148   smallJsont *self = allocG(rtSmallJsont);
  44149 
  44150   setTopBoolO(self, true);
  44151   r = getTopBoolPSmallJsonG(self, null);
  44152   ck_assert_ptr_ne(r, null);
  44153   ck_assert(*r);
  44154   terminateO(self);
  44155 
  44156 }
  44157 
  44158 
  44159 void getTopDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44160 
  44161   double        r;
  44162   smallJsont *self = allocG(rtSmallJsont);
  44163 
  44164   setTopDoubleO(self, 2);
  44165   r = getTopDoubleSmallJsonG(self, 0);
  44166   ck_assert(r==2);
  44167   terminateO(self);
  44168 
  44169 }
  44170 
  44171 
  44172 void getTopDoublePSmallJsonGT(CuTest *tc UNUSED) {
  44173 
  44174   double*       r;
  44175   smallJsont *self = allocG(rtSmallJsont);
  44176 
  44177   setTopDoubleO(self, 2);
  44178   r = getTopDoublePSmallJsonG(self, null);
  44179   ck_assert_ptr_ne(r, null);
  44180   ck_assert(*r==2);
  44181   terminateO(self);
  44182 
  44183 }
  44184 
  44185 
  44186 void getTopIntSmallJsonGT(CuTest *tc UNUSED) {
  44187 
  44188   int64_t       r;
  44189   smallJsont *self = allocG(rtSmallJsont);
  44190 
  44191   setTopIntO(self, 3);
  44192   r = getTopIntSmallJsonG(self, 0);
  44193   ck_assert_int_eq(r, 3);
  44194   terminateO(self);
  44195 
  44196 }
  44197 
  44198 
  44199 void getTopIntPSmallJsonGT(CuTest *tc UNUSED) {
  44200 
  44201   int64_t*      r;
  44202   smallJsont *self = allocG(rtSmallJsont);
  44203 
  44204   setTopIntO(self, 3);
  44205   r = getTopIntPSmallJsonG(self, null);
  44206   ck_assert_ptr_ne(r, null);
  44207   ck_assert_int_eq(*r, 3);
  44208   terminateO(self);
  44209 
  44210 }
  44211 
  44212 
  44213 void getTopInt32SmallJsonGT(CuTest *tc UNUSED) {
  44214 
  44215   int32_t       r;
  44216   smallJsont *self = allocG(rtSmallJsont);
  44217 
  44218   setTopIntO(self, 3);
  44219   r = getTopInt32SmallJsonG(self, 0);
  44220   ck_assert_int_eq(r, 3);
  44221   terminateO(self);
  44222 
  44223 }
  44224 
  44225 
  44226 void getTopInt32PSmallJsonGT(CuTest *tc UNUSED) {
  44227 
  44228   int32_t*      r;
  44229   smallJsont *self = allocG(rtSmallJsont);
  44230 
  44231   setTopIntO(self, 3);
  44232   r = getTopInt32PSmallJsonG(self, null);
  44233   ck_assert_ptr_ne(r, null);
  44234   ck_assert_int_eq(*r, 3);
  44235   terminateO(self);
  44236 
  44237 }
  44238 
  44239 
  44240 void getTopUintSmallJsonGT(CuTest *tc UNUSED) {
  44241 
  44242   uint64_t      r;
  44243   smallJsont *self = allocG(rtSmallJsont);
  44244 
  44245   setTopIntO(self, 3);
  44246   r = getTopUintSmallJsonG(self, 0);
  44247   ck_assert_int_eq(r, 3);
  44248   terminateO(self);
  44249 
  44250 }
  44251 
  44252 
  44253 void getTopUintPSmallJsonGT(CuTest *tc UNUSED) {
  44254 
  44255   uint64_t*     r;
  44256   smallJsont *self = allocG(rtSmallJsont);
  44257 
  44258   setTopIntO(self, 3);
  44259   r = getTopUintPSmallJsonG(self, null);
  44260   ck_assert_ptr_ne(r, null);
  44261   ck_assert_int_eq(*r, 3);
  44262   terminateO(self);
  44263 
  44264 }
  44265 
  44266 
  44267 void getTopUint32SmallJsonGT(CuTest *tc UNUSED) {
  44268 
  44269   uint32_t      r;
  44270   smallJsont *self = allocG(rtSmallJsont);
  44271 
  44272   setTopIntO(self, 3);
  44273   r = getTopUint32SmallJsonG(self, 0);
  44274   ck_assert_int_eq(r, 3);
  44275   terminateO(self);
  44276 
  44277 }
  44278 
  44279 
  44280 void getTopUint32PSmallJsonGT(CuTest *tc UNUSED) {
  44281 
  44282   uint32_t*     r;
  44283   smallJsont *self = allocG(rtSmallJsont);
  44284 
  44285   setTopIntO(self, 3);
  44286   r = getTopUint32PSmallJsonG(self, null);
  44287   ck_assert_ptr_ne(r, null);
  44288   ck_assert_int_eq(*r, 3);
  44289   terminateO(self);
  44290 
  44291 }
  44292 
  44293 
  44294 void getTopSSmallJsonGT(CuTest *tc UNUSED) {
  44295 
  44296   char*         r;
  44297   smallJsont *self = allocG(rtSmallJsont);
  44298 
  44299   setTopStringO(self, "qwe");
  44300   r = getTopSSmallJsonG(self, null);
  44301   ck_assert_ptr_ne(r, null);
  44302   ck_assert_str_eq(r, "qwe");
  44303   terminateO(self);
  44304 
  44305 }
  44306 
  44307 
  44308 void getTopDictSmallJsonGT(CuTest *tc UNUSED) {
  44309 
  44310   smallDictt*   r  = allocSmallDict();
  44311   smallJsont *self = allocG(rtSmallJsont);
  44312 
  44313   setTopNFreeDictO(self, r);
  44314   r = getTopDictSmallJsonG(self, null);
  44315   ck_assert_ptr_ne(r, null);
  44316   char *s = toStringO(r);
  44317   finishO(r);
  44318   ck_assert_str_eq(s, "{}");
  44319   free(s);
  44320   terminateO(self);
  44321 
  44322 }
  44323 
  44324 
  44325 void getTopArraySmallJsonGT(CuTest *tc UNUSED) {
  44326 
  44327   smallArrayt*  r  = allocSmallArray();
  44328   smallJsont *self = allocG(rtSmallJsont);
  44329 
  44330   setTopNFreeArrayO(self, r);
  44331   r = getTopArraySmallJsonG(self, null);
  44332   ck_assert_ptr_ne(r, null);
  44333   char *s = toStringO(r);
  44334   finishO(r);
  44335   ck_assert_str_eq(s, "[]");
  44336   free(s);
  44337   terminateO(self);
  44338 
  44339 }
  44340 
  44341 
  44342 void getTopSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  44343 
  44344   smallBoolt*   r  = allocSmallBool(true);
  44345   smallJsont *self = allocG(rtSmallJsont);
  44346 
  44347   setTopNFreeSmallBoolO(self, r);
  44348   r = getTopSmallBoolSmallJsonG(self, null);
  44349   ck_assert_ptr_ne(r, null);
  44350   char *s = toStringO(r);
  44351   finishO(r);
  44352   ck_assert_str_eq(s, "true");
  44353   free(s);
  44354   terminateO(self);
  44355 
  44356 }
  44357 
  44358 
  44359 void getTopSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44360 
  44361   smallDoublet* r  = allocSmallDouble(2);
  44362   smallJsont *self = allocG(rtSmallJsont);
  44363 
  44364   setTopNFreeSmallDoubleO(self, r);
  44365   r = getTopSmallDoubleSmallJsonG(self, null);
  44366   ck_assert_ptr_ne(r, null);
  44367   char *s = toStringO(r);
  44368   finishO(r);
  44369   ck_assert_str_eq(s, "2.000000e+00");
  44370   free(s);
  44371   terminateO(self);
  44372 
  44373 }
  44374 
  44375 
  44376 void getTopSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  44377 
  44378   smallIntt*    r  = allocSmallInt(2);
  44379   smallJsont *self = allocG(rtSmallJsont);
  44380 
  44381   setTopNFreeSmallIntO(self, r);
  44382   r = getTopSmallIntSmallJsonG(self, null);
  44383   ck_assert_ptr_ne(r, null);
  44384   char *s = toStringO(r);
  44385   finishO(r);
  44386   ck_assert_str_eq(s, "2");
  44387   free(s);
  44388   terminateO(self);
  44389 
  44390 }
  44391 
  44392 
  44393 void getTopSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  44394 
  44395   smallStringt* r  = allocSmallString("qwe");
  44396   smallJsont *self = allocG(rtSmallJsont);
  44397 
  44398   setTopNFreeSmallStringO(self, r);
  44399   r = getTopSmallStringSmallJsonG(self, null);
  44400   ck_assert_ptr_ne(r, null);
  44401   char *s = toStringO(r);
  44402   finishO(r);
  44403   ck_assert_str_eq(s, "qwe");
  44404   free(s);
  44405   terminateO(self);
  44406 
  44407 }
  44408 
  44409 
  44410 void pushSmallJsonGT(CuTest *tc UNUSED) {
  44411 
  44412   smallJsont* r;
  44413   smallJsont *self = allocSmallJson();
  44414   baset *value = (baset*) allocSmallInt(1);
  44415 
  44416   r = pushSmallJsonG(self, value);
  44417   ck_assert_ptr_ne(r, null);
  44418   finishO(value);
  44419   char *s = toStringO(r);
  44420   ck_assert_str_eq(s, "[1]");
  44421   free(s);
  44422   terminateO(self);
  44423 
  44424 }
  44425 
  44426 
  44427 void pushUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  44428 
  44429   smallJsont* r;
  44430   smallJsont *self = allocSmallJson();
  44431 
  44432   r = pushUndefinedSmallJsonG(self, NULL);
  44433   ck_assert_ptr_ne(r, null);
  44434   char *s = toStringO(r);
  44435   ck_assert_str_eq(s, "[null]");
  44436   free(s);
  44437   terminateO(self);
  44438 
  44439 }
  44440 
  44441 
  44442 void pushBoolSmallJsonGT(CuTest *tc UNUSED) {
  44443 
  44444   smallJsont* r;
  44445   smallJsont *self = allocSmallJson();
  44446 
  44447   r = pushBoolSmallJsonG(self, true);
  44448   ck_assert_ptr_ne(r, null);
  44449   char *s = toStringO(r);
  44450   ck_assert_str_eq(s, "[true]");
  44451   free(s);
  44452   terminateO(self);
  44453 
  44454 }
  44455 
  44456 
  44457 void pushDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44458 
  44459   smallJsont* r;
  44460   smallJsont *self = allocSmallJson();
  44461 
  44462   r = pushDoubleSmallJsonG(self, 1);
  44463   ck_assert_ptr_ne(r, null);
  44464   char *s = toStringO(r);
  44465   ck_assert_str_eq(s, "[1.000000e+00]");
  44466   free(s);
  44467   terminateO(self);
  44468 
  44469 }
  44470 
  44471 
  44472 void pushIntSmallJsonGT(CuTest *tc UNUSED) {
  44473 
  44474   smallJsont* r;
  44475   smallJsont *self = allocSmallJson();
  44476 
  44477   r = pushIntSmallJsonG(self, 1);
  44478   ck_assert_ptr_ne(r, null);
  44479   char *s = toStringO(r);
  44480   ck_assert_str_eq(s, "[1]");
  44481   free(s);
  44482   terminateO(self);
  44483 
  44484 }
  44485 
  44486 
  44487 void pushSSmallJsonGT(CuTest *tc UNUSED) {
  44488 
  44489   smallJsont* r;
  44490   smallJsont *self = allocSmallJson();
  44491 
  44492   r = pushSSmallJsonG(self, "qwe");
  44493   ck_assert_ptr_ne(r, null);
  44494   char *s = toStringO(r);
  44495   ck_assert_str_eq(s, "[\"qwe\"]");
  44496   free(s);
  44497   terminateO(self);
  44498 
  44499 }
  44500 
  44501 
  44502 void pushCharSmallJsonGT(CuTest *tc UNUSED) {
  44503 
  44504   smallJsont* r;
  44505   smallJsont *self = allocSmallJson();
  44506 
  44507   r = pushCharSmallJsonG(self, 'Q');
  44508   ck_assert_ptr_ne(r, null);
  44509   char *s = toStringO(r);
  44510   ck_assert_str_eq(s, "[\"Q\"]");
  44511   free(s);
  44512   terminateO(self);
  44513 
  44514 }
  44515 
  44516 
  44517 void pushDictSmallJsonGT(CuTest *tc UNUSED) {
  44518 
  44519   smallJsont* r;
  44520   smallJsont *self = allocSmallJson();
  44521   smallDictt *dict  = allocSmallDict();
  44522 
  44523   r = pushDictSmallJsonG(self, dict);
  44524   ck_assert_ptr_ne(r, null);
  44525   finishO(dict);
  44526   char *s = toStringO(r);
  44527   ck_assert_str_eq(s, "[{}]");
  44528   free(s);
  44529   terminateO(self);
  44530 
  44531 }
  44532 
  44533 
  44534 void pushArraySmallJsonGT(CuTest *tc UNUSED) {
  44535 
  44536   smallJsont* r;
  44537   smallJsont *self  = allocSmallJson();
  44538   smallArrayt *array = allocSmallArray();
  44539 
  44540   r = pushArraySmallJsonG(self, array);
  44541   ck_assert_ptr_ne(r, null);
  44542   finishO(array);
  44543   char *s = toStringO(r);
  44544   ck_assert_str_eq(s, "[[]]");
  44545   free(s);
  44546   terminateO(self);
  44547 
  44548 }
  44549 
  44550 
  44551 void pushArraycSmallJsonGT(CuTest *tc UNUSED) {
  44552 
  44553   smallJsont* r;
  44554   smallJsont *self = allocSmallJson();
  44555   char **array      = listCreateS("a","bb");
  44556 
  44557   r = pushArraycSmallJsonG(self, array);
  44558   ck_assert_ptr_ne(r, null);
  44559   ck_assert_int_eq(lenO(r), 1);
  44560   listFreeS(array);
  44561   char *s = toStringO(r);
  44562   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44563   free(s);
  44564   terminateO(self);
  44565 
  44566 }
  44567 
  44568 
  44569 void pushCArraycSmallJsonGT(CuTest *tc UNUSED) {
  44570 
  44571   smallJsont* r;
  44572   smallJsont *self   = allocSmallJson();
  44573   const char *array[] = {"a", "bb", NULL};
  44574 
  44575   r = pushCArraycSmallJsonG(self, array);
  44576   ck_assert_ptr_ne(r, null);
  44577   ck_assert_int_eq(lenO(r), 1);
  44578   char *s = toStringO(r);
  44579   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44580   free(s);
  44581   terminateO(self);
  44582 
  44583 }
  44584 
  44585 
  44586 void pushVoidSmallJsonGT(CuTest *tc UNUSED) {
  44587 
  44588   smallJsont* r;
  44589   smallJsont *self = allocSmallJson();
  44590 
  44591   // NULL value
  44592   r = pushVoidSmallJsonG(self, NULL);
  44593   ck_assert_ptr_ne(r, null);
  44594   char *s = toStringO(r);
  44595   ck_assert_str_eq(s, "[null]");
  44596   free(s);
  44597   // value
  44598   r = pushVoidSmallJsonG(self, r);
  44599   s = toStringO(r);
  44600   ck_assert_str_eq(s, "[null,\"<data container>\"]");
  44601   free(s);
  44602   terminateO(self);
  44603 
  44604 }
  44605 
  44606 
  44607 void pushSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  44608 
  44609   smallJsont* r;
  44610   smallJsont *self = allocSmallJson();
  44611   smallBoolt *value = allocSmallBool(true);
  44612 
  44613   r = pushSmallBoolSmallJsonG(self, value);
  44614   ck_assert_ptr_ne(r, null);
  44615   finishO(value);
  44616   char *s = toStringO(r);
  44617   ck_assert_str_eq(s, "[true]");
  44618   free(s);
  44619   terminateO(self);
  44620 
  44621 }
  44622 
  44623 
  44624 void pushSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  44625 
  44626   smallJsont* r;
  44627   smallJsont *self = allocSmallJson();
  44628   smallBytest *value = allocSmallBytes("qwe", 3);
  44629 
  44630   r = pushSmallBytesSmallJsonG(self, value);
  44631   ck_assert_ptr_ne(r, null);
  44632   finishO(value);
  44633   char *s = toStringO(r);
  44634   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  44635   free(s);
  44636   terminateO(self);
  44637 
  44638 }
  44639 
  44640 
  44641 void pushSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44642 
  44643   smallJsont* r;
  44644   smallJsont *self = allocSmallJson();
  44645   smallDoublet *value = allocSmallDouble(1);
  44646 
  44647   r = pushSmallDoubleSmallJsonG(self, value);
  44648   ck_assert_ptr_ne(r, null);
  44649   finishO(value);
  44650   char *s = toStringO(r);
  44651   ck_assert_str_eq(s, "[1.000000e+00]");
  44652   free(s);
  44653   terminateO(self);
  44654 
  44655 }
  44656 
  44657 
  44658 void pushSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  44659 
  44660   smallJsont* r;
  44661   smallJsont *self = allocSmallJson();
  44662   smallIntt *value  = allocSmallInt(1);
  44663 
  44664   r = pushSmallIntSmallJsonG(self, value);
  44665   ck_assert_ptr_ne(r, null);
  44666   finishO(value);
  44667   char *s = toStringO(r);
  44668   ck_assert_str_eq(s, "[1]");
  44669   free(s);
  44670   terminateO(self);
  44671 
  44672 }
  44673 
  44674 
  44675 void pushSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  44676 
  44677   smallJsont* r;
  44678   smallJsont *self = allocSmallJson();
  44679   smallJsont *value = allocSmallJson();
  44680 
  44681   r = pushSmallJsonSmallJsonG(self, value);
  44682   ck_assert_ptr_ne(r, null);
  44683   finishO(value);
  44684   char *s = toStringO(r);
  44685   ck_assert_str_eq(s, "[{}]");
  44686   free(s);
  44687   terminateO(self);
  44688 
  44689 }
  44690 
  44691 
  44692 void pushSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  44693 
  44694   smallJsont* r;
  44695   smallJsont *self    = allocSmallJson();
  44696   smallStringt *string = allocSmallString("qwe");
  44697 
  44698   r = pushSmallStringSmallJsonG(self, string);
  44699   ck_assert_ptr_ne(r, null);
  44700   finishO(string);
  44701   char *s = toStringO(r);
  44702   ck_assert_str_eq(s, "[\"qwe\"]");
  44703   free(s);
  44704   terminateO(self);
  44705 
  44706 }
  44707 
  44708 
  44709 void pushSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  44710 
  44711   smallJsont* r;
  44712   smallJsont *self = allocSmallJson();
  44713 
  44714   createSmallContainer(c);
  44715   r = pushSmallContainerSmallJsonG(self, &c);
  44716   ck_assert_ptr_ne(r, null);
  44717   char *s = toStringO(r);
  44718   ck_assert_str_eq(s, "[\"<data container>\"]");
  44719   free(s);
  44720   terminateO(self);
  44721 
  44722 }
  44723 
  44724 
  44725 void pushNFreeSmallJsonGT(CuTest *tc UNUSED) {
  44726 
  44727   smallJsont* r;
  44728   smallJsont *self = allocSmallJson();
  44729   baset *value = (baset*) allocSmallInt(1);
  44730 
  44731   r = pushNFreeSmallJsonG(self, value);
  44732   ck_assert_ptr_ne(r, null);
  44733   char *s = toStringO(r);
  44734   ck_assert_str_eq(s, "[1]");
  44735   free(s);
  44736   terminateO(self);
  44737 
  44738 }
  44739 
  44740 
  44741 void pushNFreeUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  44742 
  44743   smallJsont* r;
  44744   smallJsont *self = allocSmallJson();
  44745   undefinedt *value = allocUndefined();
  44746 
  44747   r = pushNFreeUndefinedSmallJsonG(self, value);
  44748   ck_assert_ptr_ne(r, null);
  44749   char *s = toStringO(r);
  44750   ck_assert_str_eq(s, "[null]");
  44751   free(s);
  44752   terminateO(self);
  44753 
  44754 }
  44755 
  44756 
  44757 void pushNFreeSSmallJsonGT(CuTest *tc UNUSED) {
  44758 
  44759   smallJsont* r;
  44760   smallJsont *self = allocSmallJson();
  44761 
  44762   r = pushNFreeSSmallJsonG(self, strdup("qwe"));
  44763   ck_assert_ptr_ne(r, null);
  44764   char *s = toStringO(r);
  44765   ck_assert_str_eq(s, "[\"qwe\"]");
  44766   free(s);
  44767   terminateO(self);
  44768 
  44769 }
  44770 
  44771 
  44772 void pushNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  44773 
  44774   smallJsont* r;
  44775   smallJsont *self = allocSmallJson();
  44776   smallDictt *dict  = allocSmallDict();
  44777 
  44778   r = pushNFreeDictSmallJsonG(self, dict);
  44779   ck_assert_ptr_ne(r, null);
  44780   char *s = toStringO(r);
  44781   ck_assert_str_eq(s, "[{}]");
  44782   free(s);
  44783   terminateO(self);
  44784 
  44785 }
  44786 
  44787 
  44788 void pushNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  44789 
  44790   smallJsont* r;
  44791   smallJsont *self  = allocSmallJson();
  44792   smallArrayt *array = allocSmallArray();
  44793 
  44794   r = pushNFreeArraySmallJsonG(self, array);
  44795   ck_assert_ptr_ne(r, null);
  44796   char *s = toStringO(r);
  44797   ck_assert_str_eq(s, "[[]]");
  44798   free(s);
  44799   terminateO(self);
  44800 
  44801 }
  44802 
  44803 
  44804 void pushNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  44805 
  44806   smallJsont* r;
  44807   smallJsont *self = allocSmallJson();
  44808   char **array      = listCreateS("a","bb");
  44809 
  44810   r = pushNFreeArraycSmallJsonG(self, array);
  44811   ck_assert_ptr_ne(r, null);
  44812   ck_assert_int_eq(lenO(r), 1);
  44813   char *s = toStringO(r);
  44814   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  44815   free(s);
  44816   terminateO(self);
  44817 
  44818 }
  44819 
  44820 
  44821 void pushNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  44822 
  44823   smallJsont* r;
  44824   smallJsont *self = allocSmallJson();
  44825   smallBoolt *value = allocSmallBool(true);
  44826 
  44827   r = pushNFreeSmallBoolSmallJsonG(self, value);
  44828   ck_assert_ptr_ne(r, null);
  44829   char *s = toStringO(r);
  44830   ck_assert_str_eq(s, "[true]");
  44831   free(s);
  44832   terminateO(self);
  44833 
  44834 }
  44835 
  44836 
  44837 void pushNFreeSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  44838 
  44839   smallJsont* r;
  44840   smallJsont *self = allocSmallJson();
  44841   smallBytest *value = allocSmallBytes("qwe", 3);
  44842 
  44843   r = pushNFreeSmallBytesSmallJsonG(self, value);
  44844   ck_assert_ptr_ne(r, null);
  44845   char *s = toStringO(r);
  44846   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  44847   free(s);
  44848   terminateO(self);
  44849 
  44850 }
  44851 
  44852 
  44853 void pushNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44854 
  44855   smallJsont* r;
  44856   smallJsont *self = allocSmallJson();
  44857   smallDoublet *value = allocSmallDouble(1);
  44858 
  44859   r = pushNFreeSmallDoubleSmallJsonG(self, value);
  44860   ck_assert_ptr_ne(r, null);
  44861   char *s = toStringO(r);
  44862   ck_assert_str_eq(s, "[1.000000e+00]");
  44863   free(s);
  44864   terminateO(self);
  44865 
  44866 }
  44867 
  44868 
  44869 void pushNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  44870 
  44871   smallJsont* r;
  44872   smallJsont *self = allocSmallJson();
  44873   smallIntt *value  = allocSmallInt(1);
  44874 
  44875   r = pushNFreeSmallIntSmallJsonG(self, value);
  44876   ck_assert_ptr_ne(r, null);
  44877   char *s = toStringO(r);
  44878   ck_assert_str_eq(s, "[1]");
  44879   free(s);
  44880   terminateO(self);
  44881 
  44882 }
  44883 
  44884 
  44885 void pushNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  44886 
  44887   smallJsont* r;
  44888   smallJsont *self = allocSmallJson();
  44889   smallJsont *value = allocSmallJson();
  44890 
  44891   r = pushNFreeSmallJsonSmallJsonG(self, value);
  44892   ck_assert_ptr_ne(r, null);
  44893   char *s = toStringO(r);
  44894   ck_assert_str_eq(s, "[{}]");
  44895   free(s);
  44896   terminateO(self);
  44897 
  44898 }
  44899 
  44900 
  44901 void pushNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  44902 
  44903   smallJsont* r;
  44904   smallJsont *self = allocSmallJson();
  44905   smallStringt *string = allocSmallString("qwe");
  44906 
  44907   r = pushNFreeSmallStringSmallJsonG(self, string);
  44908   ck_assert_ptr_ne(r, null);
  44909   char *s = toStringO(r);
  44910   ck_assert_str_eq(s, "[\"qwe\"]");
  44911   free(s);
  44912   terminateO(self);
  44913 
  44914 }
  44915 
  44916 
  44917 void pushNFreeSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  44918 
  44919   smallJsont* r;
  44920   smallJsont *self = allocSmallJson();
  44921 
  44922   createAllocateSmallContainer(c);
  44923   r = pushNFreeSmallContainerSmallJsonG(self, c);
  44924   ck_assert_ptr_ne(r, null);
  44925   char *s = toStringO(r);
  44926   ck_assert_str_eq(s, "[\"<data container>\"]");
  44927   free(s);
  44928   terminateO(self);
  44929 
  44930 }
  44931 
  44932 
  44933 void popSmallJsonGT(CuTest *tc UNUSED) {
  44934 
  44935   baset*           r;
  44936   smallJsont *self = allocSmallJson();
  44937 
  44938   smallJsont *r2   = self->f->pushInt(self, 1);
  44939   ck_assert_ptr_ne(r2, null);
  44940   r = popSmallJsonG(self, NULL);
  44941   ck_assert_ptr_ne(r, null);
  44942   char *s = toStringO(r);
  44943   terminateO(r);
  44944   ck_assert_str_eq(s, "1");
  44945   free(s);
  44946   terminateO(self);
  44947 
  44948 }
  44949 
  44950 
  44951 void popUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  44952 
  44953   undefinedt*      r;
  44954   smallJsont *self = allocSmallJson();
  44955 
  44956   smallJsont *r2   = self->f->pushUndefined(self);
  44957   ck_assert_ptr_ne(r2, null);
  44958   r = popUndefinedSmallJsonG(self, null);
  44959   ck_assert_ptr_ne(r, null);
  44960   char *s = toStringO(r);
  44961   terminateO(r);
  44962   ck_assert_str_eq(s, "null");
  44963   free(s);
  44964   terminateO(self);
  44965 
  44966 }
  44967 
  44968 
  44969 void popBoolSmallJsonGT(CuTest *tc UNUSED) {
  44970 
  44971   bool             r;
  44972   smallJsont *self = allocSmallJson();
  44973 
  44974   smallJsont *r2   = self->f->pushBool(self, TRUE);
  44975   ck_assert_ptr_ne(r2, null);
  44976   r = popBoolSmallJsonG(self, null);
  44977   ck_assert(r);
  44978   terminateO(self);
  44979 
  44980 }
  44981 
  44982 
  44983 void popDoubleSmallJsonGT(CuTest *tc UNUSED) {
  44984 
  44985   double           r;
  44986   smallJsont *self = allocSmallJson();
  44987 
  44988   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  44989   ck_assert_ptr_ne(r2, null);
  44990   r = popDoubleSmallJsonG(self, 0);
  44991   ck_assert(r==2.0);
  44992   terminateO(self);
  44993 
  44994 }
  44995 
  44996 
  44997 void popIntSmallJsonGT(CuTest *tc UNUSED) {
  44998 
  44999   int64_t          r;
  45000   smallJsont *self = allocSmallJson();
  45001 
  45002   smallJsont *r2   = self->f->pushInt(self, 2);
  45003   ck_assert_ptr_ne(r2, null);
  45004   r = popIntSmallJsonG(self, 0);
  45005   ck_assert_int_eq(r, 2);
  45006   terminateO(self);
  45007 
  45008 }
  45009 
  45010 
  45011 void popInt32SmallJsonGT(CuTest *tc UNUSED) {
  45012 
  45013   int32_t          r;
  45014   smallJsont *self = allocSmallJson();
  45015 
  45016   smallJsont *r2   = self->f->pushInt(self, 2);
  45017   ck_assert_ptr_ne(r2, null);
  45018   r = popInt32SmallJsonG(self, 0);
  45019   ck_assert_int_eq(r, 2);
  45020   terminateO(self);
  45021 
  45022 }
  45023 
  45024 
  45025 void popUintSmallJsonGT(CuTest *tc UNUSED) {
  45026 
  45027   uint64_t         r;
  45028   smallJsont *self = allocSmallJson();
  45029 
  45030   smallJsont *r2   = self->f->pushInt(self, 2);
  45031   ck_assert_ptr_ne(r2, null);
  45032   r = popUintSmallJsonG(self, 0);
  45033   ck_assert_int_eq(r, 2);
  45034   terminateO(self);
  45035 
  45036 }
  45037 
  45038 
  45039 void popUint32SmallJsonGT(CuTest *tc UNUSED) {
  45040 
  45041   uint32_t         r;
  45042   smallJsont *self = allocSmallJson();
  45043 
  45044   smallJsont *r2   = self->f->pushInt(self, 2);
  45045   ck_assert_ptr_ne(r2, null);
  45046   r = popUint32SmallJsonG(self, 0);
  45047   ck_assert_int_eq(r, 2);
  45048   terminateO(self);
  45049 
  45050 }
  45051 
  45052 
  45053 void popSSmallJsonGT(CuTest *tc UNUSED) {
  45054 
  45055   char*            r;
  45056   smallJsont *self = allocSmallJson();
  45057 
  45058   smallJsont *r2   = self->f->pushS(self, "2");
  45059   ck_assert_ptr_ne(r2, null);
  45060   r = popSSmallJsonG(self, null);
  45061   ck_assert_str_eq(r, "2");
  45062   free(r);
  45063   terminateO(self);
  45064 
  45065 }
  45066 
  45067 
  45068 void popDictSmallJsonGT(CuTest *tc UNUSED) {
  45069 
  45070   smallDictt*      r;
  45071   smallJsont *self = allocSmallJson();
  45072 
  45073   createSmallDict(d);
  45074   smallJsont *r2   = self->f->pushDict(self, &d);
  45075   ck_assert_ptr_ne(r2, null);
  45076   r = popDictSmallJsonG(self, null);
  45077   ck_assert_ptr_ne(r, null);
  45078   char *s = toStringO(r);
  45079   ck_assert_str_eq(s, "{}");
  45080   free(s);
  45081   terminateO(r);
  45082   terminateO(self);
  45083 
  45084 }
  45085 
  45086 
  45087 void popArraySmallJsonGT(CuTest *tc UNUSED) {
  45088 
  45089   smallArrayt*     r;
  45090   smallJsont *self = allocSmallJson();
  45091 
  45092   createSmallArray(a);
  45093   smallJsont *r2   = self->f->pushArray(self, &a);
  45094   ck_assert_ptr_ne(r2, null);
  45095   r = popArraySmallJsonG(self, null);
  45096   ck_assert_ptr_ne(r, null);
  45097   char *s = toStringO(r);
  45098   ck_assert_str_eq(s, "[]");
  45099   free(s);
  45100   terminateO(r);
  45101   terminateO(self);
  45102 
  45103 }
  45104 
  45105 
  45106 void popSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  45107 
  45108   smallBoolt*      r;
  45109   smallJsont *self = allocSmallJson();
  45110 
  45111   smallJsont *r2   = self->f->pushBool(self, true);
  45112   ck_assert_ptr_ne(r2, null);
  45113   r = popSmallBoolSmallJsonG(self, null);
  45114   ck_assert_ptr_ne(r, null);
  45115   char *s = toStringO(r);
  45116   ck_assert_str_eq(s, "true");
  45117   free(s);
  45118   terminateO(r);
  45119   terminateO(self);
  45120 
  45121 }
  45122 
  45123 
  45124 void popSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  45125 
  45126   smallBytest*      r;
  45127   smallJsont *self = allocSmallJson();
  45128 
  45129   createSmallBytes(b);
  45130   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  45131   ck_assert_ptr_ne(r2, null);
  45132   r = popSmallBytesSmallJsonG(self, null);
  45133   ck_assert_ptr_ne(r, null);
  45134   char *s = toStringO(r);
  45135   ck_assert_str_eq(s, "[]");
  45136   free(s);
  45137   terminateO(r);
  45138   terminateO(self);
  45139 
  45140 }
  45141 
  45142 
  45143 void popSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  45144 
  45145   smallDoublet*    r;
  45146   smallJsont *self = allocSmallJson();
  45147 
  45148   smallJsont *r2   = self->f->pushDouble(self, 1);
  45149   ck_assert_ptr_ne(r2, null);
  45150   r = popSmallDoubleSmallJsonG(self, null);
  45151   ck_assert_ptr_ne(r, null);
  45152   char *s = toStringO(r);
  45153   ck_assert_str_eq(s, "1.000000e+00");
  45154   free(s);
  45155   terminateO(r);
  45156   terminateO(self);
  45157 
  45158 }
  45159 
  45160 
  45161 void popSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  45162 
  45163   smallIntt*       r;
  45164   smallJsont *self = allocSmallJson();
  45165 
  45166   smallJsont *r2   = self->f->pushInt(self, 1);
  45167   ck_assert_ptr_ne(r2, null);
  45168   r = popSmallIntSmallJsonG(self, null);
  45169   ck_assert_ptr_ne(r, null);
  45170   char *s = toStringO(r);
  45171   ck_assert_str_eq(s, "1");
  45172   free(s);
  45173   terminateO(r);
  45174   terminateO(self);
  45175 
  45176 }
  45177 
  45178 
  45179 void popSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  45180 
  45181   smallJsont*      r;
  45182   smallJsont *self = allocSmallJson();
  45183 
  45184   createSmallJson(j);
  45185   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  45186   ck_assert_ptr_ne(r2, null);
  45187   r = popSmallJsonSmallJsonG(self, null);
  45188   ck_assert_ptr_ne(r, null);
  45189   char *s = toStringO(r);
  45190   ck_assert_str_eq(s, "{}");
  45191   free(s);
  45192   terminateO(r);
  45193   terminateO(self);
  45194 
  45195 }
  45196 
  45197 
  45198 void popSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  45199 
  45200   smallStringt*    r;
  45201   smallJsont *self = allocSmallJson();
  45202 
  45203   createSmallString(S);
  45204   smallJsont *r2   = self->f->pushSmallString(self, &S);
  45205   ck_assert_ptr_ne(r2, null);
  45206   r = popSmallStringSmallJsonG(self, null);
  45207   ck_assert_ptr_ne(r, null);
  45208   char *s = toStringO(r);
  45209   ck_assert_str_eq(s, "");
  45210   free(s);
  45211   terminateO(r);
  45212   terminateO(self);
  45213 
  45214 }
  45215 
  45216 
  45217 void popVoidSmallJsonGT(CuTest *tc UNUSED) {
  45218 
  45219   void*            r;
  45220   smallJsont *self = allocSmallJson();
  45221 
  45222   createSmallContainer(c);
  45223   setValO(&c, &r);
  45224   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  45225   ck_assert_ptr_ne(r2, null);
  45226   r = popVoidSmallJsonG(self, null);
  45227   ck_assert_ptr_eq(r, &r);
  45228   terminateO(self);
  45229 
  45230 }
  45231 
  45232 
  45233 void popSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  45234 
  45235   smallContainert* r;
  45236   smallJsont *self = allocSmallJson();
  45237 
  45238   createSmallContainer(c);
  45239   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  45240   ck_assert_ptr_ne(r2, null);
  45241   r = popSmallContainerSmallJsonG(self, null);
  45242   ck_assert_ptr_ne(r, null);
  45243   char *s = toStringO(r);
  45244   ck_assert_str_eq(s, "<data smallContainer>");
  45245   free(s);
  45246   terminateO(r);
  45247   terminateO(self);
  45248 
  45249 }
  45250 
  45251 
  45252 void setSmallJsonGT(CuTest *tc UNUSED) {
  45253 
  45254   smallJsont* r;
  45255   smallJsont *self = allocSmallJson();
  45256   baset *value     = (baset*) allocSmallInt(2);
  45257 
  45258   r = setSmallJsonG(self, "1", value);
  45259   ck_assert_ptr_ne(r, null);
  45260   finishO(value);
  45261   char *s = toStringO(r);
  45262   ck_assert_str_eq(s, "{\"1\":2}");
  45263   free(s);
  45264   terminateO(self);
  45265 
  45266 }
  45267 
  45268 
  45269 void setUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  45270 
  45271   smallJsont* r;
  45272   smallJsont *self = allocSmallJson();
  45273 
  45274   r = setUndefinedSmallJsonG(self, "1", null);
  45275   ck_assert_ptr_ne(r, null);
  45276   char *s = toStringO(r);
  45277   ck_assert_str_eq(s, "{\"1\":null}");
  45278   free(s);
  45279   terminateO(self);
  45280 
  45281 }
  45282 
  45283 
  45284 void setBoolSmallJsonGT(CuTest *tc UNUSED) {
  45285 
  45286   smallJsont* r;
  45287   smallJsont *self = allocSmallJson();
  45288 
  45289   r = setBoolSmallJsonG(self, "1", true);
  45290   ck_assert_ptr_ne(r, null);
  45291   char *s = toStringO(r);
  45292   ck_assert_str_eq(s, "{\"1\":true}");
  45293   free(s);
  45294   terminateO(self);
  45295 
  45296 }
  45297 
  45298 
  45299 void setDoubleSmallJsonGT(CuTest *tc UNUSED) {
  45300 
  45301   smallJsont* r;
  45302   smallJsont *self = allocSmallJson();
  45303 
  45304   r = setDoubleSmallJsonG(self, "1", 2.2);
  45305   ck_assert_ptr_ne(r, null);
  45306   char *s = toStringO(r);
  45307   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45308   free(s);
  45309   terminateO(self);
  45310 
  45311 }
  45312 
  45313 
  45314 void setIntSmallJsonGT(CuTest *tc UNUSED) {
  45315 
  45316   smallJsont* r;
  45317   smallJsont *self = allocSmallJson();
  45318 
  45319   r = setIntSmallJsonG(self, "1", 2);
  45320   ck_assert_ptr_ne(r, null);
  45321   char *s = toStringO(r);
  45322   ck_assert_str_eq(s, "{\"1\":2}");
  45323   free(s);
  45324   terminateO(self);
  45325 
  45326 }
  45327 
  45328 
  45329 void setSSmallJsonGT(CuTest *tc UNUSED) {
  45330 
  45331   smallJsont* r;
  45332   smallJsont *self = allocSmallJson();
  45333 
  45334   r = setSSmallJsonG(self, "1", "qwe");
  45335   ck_assert_ptr_ne(r, null);
  45336   char *s = toStringO(r);
  45337   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45338   free(s);
  45339   terminateO(self);
  45340 
  45341 }
  45342 
  45343 
  45344 void setCharSmallJsonGT(CuTest *tc UNUSED) {
  45345 
  45346   smallJsont* r;
  45347   smallJsont *self = allocSmallJson();
  45348 
  45349   r = setCharSmallJsonG(self, "1", 'x');
  45350   ck_assert_ptr_ne(r, null);
  45351   char *s = toStringO(r);
  45352   ck_assert_str_eq(s, "{\"1\":\"x\"}");
  45353   free(s);
  45354   terminateO(self);
  45355 
  45356 }
  45357 
  45358 
  45359 void setDictSmallJsonGT(CuTest *tc UNUSED) {
  45360 
  45361   smallJsont* r;
  45362   smallJsont *self = allocSmallJson();
  45363   smallDictt *dict = allocSmallDict();
  45364 
  45365   r = setDictSmallJsonG(self, "1", dict);
  45366   ck_assert_ptr_ne(r, null);
  45367   finishO(dict);
  45368   char *s = toStringO(r);
  45369   ck_assert_str_eq(s, "{\"1\":{}}");
  45370   free(s);
  45371   terminateO(self);
  45372 
  45373 }
  45374 
  45375 
  45376 void setArraySmallJsonGT(CuTest *tc UNUSED) {
  45377 
  45378   smallJsont* r;
  45379   smallJsont *self   = allocSmallJson();
  45380   smallArrayt *array = allocSmallArray();
  45381 
  45382   r = setArraySmallJsonG(self, "1", array);
  45383   ck_assert_ptr_ne(r, null);
  45384   finishO(array);
  45385   char *s = toStringO(r);
  45386   ck_assert_str_eq(s, "{\"1\":[]}");
  45387   free(s);
  45388   terminateO(self);
  45389 
  45390 }
  45391 
  45392 
  45393 void setArraycSmallJsonGT(CuTest *tc UNUSED) {
  45394 
  45395   smallJsont* r;
  45396   smallJsont *self = allocSmallJson();
  45397   char **array     = listCreateS("a", "b");
  45398 
  45399   r = setArraycSmallJsonG(self, "1", array);
  45400   ck_assert_ptr_ne(r, null);
  45401   listFreeS(array);
  45402   char *s = toStringO(r);
  45403   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45404   free(s);
  45405   terminateO(self);
  45406 
  45407 }
  45408 
  45409 
  45410 void setCArraycSmallJsonGT(CuTest *tc UNUSED) {
  45411 
  45412   smallJsont* r;
  45413   smallJsont *self    = allocSmallJson();
  45414   const char *array[] = {"a", "b", null};
  45415 
  45416   r = setCArraycSmallJsonG(self, "1", array);
  45417   ck_assert_ptr_ne(r, null);
  45418   char *s = toStringO(r);
  45419   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45420   free(s);
  45421   terminateO(self);
  45422 
  45423 }
  45424 
  45425 
  45426 void setVoidSmallJsonGT(CuTest *tc UNUSED) {
  45427 
  45428   smallJsont* r;
  45429   smallJsont *self = allocSmallJson();
  45430 
  45431   r = setVoidSmallJsonG(self, "1", null);
  45432   ck_assert_ptr_ne(r, null);
  45433   char *s = toStringO(r);
  45434   ck_assert_str_eq(s, "{\"1\":null}");
  45435   free(s);
  45436   r = setVoidSmallJsonG(self, "1", &r);
  45437   ck_assert_ptr_ne(r, null);
  45438   s = toStringO(r);
  45439   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45440   free(s);
  45441   // null key
  45442   r = setVoidSmallJsonG(self, null, &r);
  45443   ck_assert_ptr_eq(r, null);
  45444   terminateO(self);
  45445 
  45446 }
  45447 
  45448 
  45449 void setSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  45450 
  45451   smallJsont* r;
  45452   smallJsont *self = allocSmallJson();
  45453   smallBoolt *value = allocSmallBool(true);
  45454 
  45455   r = setSmallBoolSmallJsonG(self, "1", value);
  45456   ck_assert_ptr_ne(r, null);
  45457   finishO(value);
  45458   char *s = toStringO(r);
  45459   ck_assert_str_eq(s, "{\"1\":true}");
  45460   free(s);
  45461   terminateO(self);
  45462 
  45463 }
  45464 
  45465 
  45466 void setSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  45467 
  45468   smallJsont* r;
  45469   smallJsont *self   = allocSmallJson();
  45470   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  45471 
  45472   r = setSmallBytesSmallJsonG(self, "1", value);
  45473   ck_assert_ptr_ne(r, null);
  45474   finishO(value);
  45475   char *s = toStringO(r);
  45476   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
  45477   free(s);
  45478   terminateO(self);
  45479 
  45480 }
  45481 
  45482 
  45483 void setSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  45484 
  45485   smallJsont* r;
  45486   smallJsont *self    = allocSmallJson();
  45487   smallDoublet *value = allocSmallDouble(2.2);
  45488 
  45489   r = setSmallDoubleSmallJsonG(self, "1", value);
  45490   ck_assert_ptr_ne(r, null);
  45491   finishO(value);
  45492   char *s = toStringO(r);
  45493   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45494   free(s);
  45495   terminateO(self);
  45496 
  45497 }
  45498 
  45499 
  45500 void setSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  45501 
  45502   smallJsont* r;
  45503   smallJsont *self = allocSmallJson();
  45504   smallIntt *value = allocSmallInt(2);
  45505 
  45506   r = setSmallIntSmallJsonG(self, "1", value);
  45507   ck_assert_ptr_ne(r, null);
  45508   finishO(value);
  45509   char *s = toStringO(r);
  45510   ck_assert_str_eq(s, "{\"1\":2}");
  45511   free(s);
  45512   terminateO(self);
  45513 
  45514 }
  45515 
  45516 
  45517 void setSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  45518 
  45519   smallJsont* r;
  45520   smallJsont *self  = allocSmallJson();
  45521   smallJsont *value = allocSmallJson();
  45522 
  45523   setTopIntO(value, 2);
  45524   r = setSmallJsonSmallJsonG(self, "1", value);
  45525   ck_assert_ptr_ne(r, null);
  45526   finishO(value);
  45527   char *s = toStringO(r);
  45528   ck_assert_str_eq(s, "{\"1\":2}");
  45529   free(s);
  45530   terminateO(self);
  45531 
  45532 }
  45533 
  45534 
  45535 void setSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  45536 
  45537   smallJsont* r;
  45538   smallJsont *self     = allocSmallJson();
  45539   smallStringt *string = allocSmallString("qwe");
  45540 
  45541   r = setSmallStringSmallJsonG(self, "1", string);
  45542   ck_assert_ptr_ne(r, null);
  45543   finishO(string);
  45544   char *s = toStringO(r);
  45545   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45546   free(s);
  45547   terminateO(self);
  45548 
  45549 }
  45550 
  45551 
  45552 void setSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  45553 
  45554   smallJsont* r;
  45555   smallJsont *self           = allocSmallJson();
  45556   smallContainert *container = allocSmallContainer(null);
  45557 
  45558   r = setSmallContainerSmallJsonG(self, "1", container);
  45559   ck_assert_ptr_ne(r, null);
  45560   finishO(container);
  45561   char *s = toStringO(r);
  45562   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45563   free(s);
  45564   terminateO(self);
  45565 
  45566 }
  45567 
  45568 
  45569 void setNFreeSmallJsonGT(CuTest *tc UNUSED) {
  45570 
  45571   smallJsont* r;
  45572   smallJsont *self = allocSmallJson();
  45573   baset *value;
  45574 
  45575   value   = (baset*)allocUndefined();
  45576   r = setNFreeSmallJsonG(self, "1", value);
  45577   ck_assert_ptr_ne(r, null);
  45578   char *s = toStringO(r);
  45579   ck_assert_str_eq(s, "{\"1\":null}");
  45580   free(s);
  45581   terminateO(self);
  45582 
  45583 }
  45584 
  45585 
  45586 void setNFreeUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  45587 
  45588   smallJsont* r;
  45589   smallJsont *self      = allocSmallJson();
  45590   undefinedt *undefined = allocUndefined();
  45591 
  45592   r = setNFreeUndefinedSmallJsonG(self, "1", undefined);
  45593   ck_assert_ptr_ne(r, null);
  45594   char *s = toStringO(r);
  45595   ck_assert_str_eq(s, "{\"1\":null}");
  45596   free(s);
  45597   terminateO(self);
  45598 
  45599 }
  45600 
  45601 
  45602 void setNFreeSSmallJsonGT(CuTest *tc UNUSED) {
  45603 
  45604   smallJsont* r;
  45605   smallJsont *self = allocSmallJson();
  45606   char *string     = strdup("qwe");
  45607 
  45608   r = setNFreeSSmallJsonG(self, "1", string);
  45609   ck_assert_ptr_ne(r, null);
  45610   char *s = toStringO(r);
  45611   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45612   free(s);
  45613   terminateO(self);
  45614 
  45615 }
  45616 
  45617 
  45618 void setNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  45619 
  45620   smallJsont* r;
  45621   smallJsont *self = allocSmallJson();
  45622   smallDictt *dict = allocSmallDict();
  45623 
  45624   r = setNFreeDictSmallJsonG(self, "1", dict);
  45625   ck_assert_ptr_ne(r, null);
  45626   char *s = toStringO(r);
  45627   ck_assert_str_eq(s, "{\"1\":{}}");
  45628   free(s);
  45629   terminateO(self);
  45630 
  45631 }
  45632 
  45633 
  45634 void setNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  45635 
  45636   smallJsont* r;
  45637   smallJsont *self   = allocSmallJson();
  45638   smallArrayt *array = allocSmallArray();
  45639 
  45640   r = setNFreeArraySmallJsonG(self, "1", array);
  45641   ck_assert_ptr_ne(r, null);
  45642   char *s = toStringO(r);
  45643   ck_assert_str_eq(s, "{\"1\":[]}");
  45644   free(s);
  45645   terminateO(self);
  45646 
  45647 }
  45648 
  45649 
  45650 void setNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  45651 
  45652   smallJsont* r;
  45653   smallJsont *self = allocSmallJson();
  45654   char **array     = listCreateS("a", "b");
  45655 
  45656   r = setNFreeArraycSmallJsonG(self, "1", array);
  45657   ck_assert_ptr_ne(r, null);
  45658   char *s = toStringO(r);
  45659   ck_assert_str_eq(s, "{\"1\":[\"a\",\"b\"]}");
  45660   free(s);
  45661   terminateO(self);
  45662 
  45663 }
  45664 
  45665 
  45666 void setNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  45667 
  45668   smallJsont* r;
  45669   smallJsont *self  = allocSmallJson();
  45670   smallBoolt *value = allocSmallBool(true);
  45671 
  45672   r = setNFreeSmallBoolSmallJsonG(self, "1", value);
  45673   ck_assert_ptr_ne(r, null);
  45674   char *s = toStringO(r);
  45675   ck_assert_str_eq(s, "{\"1\":true}");
  45676   free(s);
  45677   terminateO(self);
  45678 
  45679 }
  45680 
  45681 
  45682 void setNFreeSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  45683 
  45684   smallJsont* r;
  45685   smallJsont *self   = allocSmallJson();
  45686   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  45687 
  45688   r = setNFreeSmallBytesSmallJsonG(self, "1", value);
  45689   ck_assert_ptr_ne(r, null);
  45690   char *s = toStringO(r);
  45691   ck_assert_str_eq(s, "{\"1\":[0x71,0x77,0x65,0x00]}");
  45692   free(s);
  45693   terminateO(self);
  45694 
  45695 }
  45696 
  45697 
  45698 void setNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  45699 
  45700   smallJsont* r;
  45701   smallJsont *self    = allocSmallJson();
  45702   smallDoublet *value = allocSmallDouble(2.2);
  45703 
  45704   r = setNFreeSmallDoubleSmallJsonG(self, "1", value);
  45705   ck_assert_ptr_ne(r, null);
  45706   char *s = toStringO(r);
  45707   ck_assert_str_eq(s, "{\"1\":2.200000e+00}");
  45708   free(s);
  45709   terminateO(self);
  45710 
  45711 }
  45712 
  45713 
  45714 void setNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  45715 
  45716   smallJsont* r;
  45717   smallJsont *self = allocSmallJson();
  45718   smallIntt *value = allocSmallInt(2);
  45719 
  45720   r = setNFreeSmallIntSmallJsonG(self, "1", value);
  45721   ck_assert_ptr_ne(r, null);
  45722   char *s = toStringO(r);
  45723   ck_assert_str_eq(s, "{\"1\":2}");
  45724   free(s);
  45725   terminateO(self);
  45726 
  45727 }
  45728 
  45729 
  45730 void setNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  45731 
  45732   smallJsont* r;
  45733   smallJsont *self = allocSmallJson();
  45734   smallJsont *value = allocSmallJson();
  45735 
  45736   setTopIntO(value, 2);
  45737   r = setNFreeSmallJsonSmallJsonG(self, "1", value);
  45738   ck_assert_ptr_ne(r, null);
  45739   char *s = toStringO(r);
  45740   ck_assert_str_eq(s, "{\"1\":2}");
  45741   free(s);
  45742   terminateO(self);
  45743 
  45744 }
  45745 
  45746 
  45747 void setNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  45748 
  45749   smallJsont* r;
  45750   smallJsont *self     = allocSmallJson();
  45751   smallStringt *string = allocSmallString("qwe");
  45752 
  45753   r = setNFreeSmallStringSmallJsonG(self, "1", string);
  45754   ck_assert_ptr_ne(r, null);
  45755   char *s = toStringO(r);
  45756   ck_assert_str_eq(s, "{\"1\":\"qwe\"}");
  45757   free(s);
  45758   terminateO(self);
  45759 
  45760 }
  45761 
  45762 
  45763 void setNFreeSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  45764 
  45765   smallJsont* r;
  45766   smallJsont *self           = allocSmallJson();
  45767   smallContainert *container = allocSmallContainer(null);
  45768 
  45769   r = setNFreeSmallContainerSmallJsonG(self, "1", container);
  45770   ck_assert_ptr_ne(r, null);
  45771   char *s = toStringO(r);
  45772   ck_assert_str_eq(s, "{\"1\":\"<data container>\"}");
  45773   free(s);
  45774   terminateO(self);
  45775 
  45776 }
  45777 
  45778 
  45779 void setPDictSmallJsonGT(CuTest *tc UNUSED) {
  45780 
  45781   smallJsont* r;
  45782   smallJsont *self = allocSmallJson();
  45783   smallDictt *dict;
  45784 
  45785   dict = allocSmallDict();
  45786   r    = self->f->setDict(self, "1", dict);
  45787   ck_assert_ptr_ne(r, null);
  45788   dict->f->setInt(dict, "a", 1);
  45789   r    = setPDictSmallJsonG(self, "1", dict);
  45790   ck_assert_ptr_ne(r, null);
  45791   char *s = toStringO(r);
  45792   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45793   free(s);
  45794   finishO(dict);
  45795   terminateO(self);
  45796 
  45797 }
  45798 
  45799 
  45800 void setPArraySmallJsonGT(CuTest *tc UNUSED) {
  45801 
  45802   smallJsont* r;
  45803   smallJsont *self = allocSmallJson();
  45804   smallArrayt *array;
  45805 
  45806   array   = allocSmallArray();
  45807   r       = self->f->setArray(self, "1", array);
  45808   ck_assert_ptr_ne(r, null);
  45809   array->f->pushInt(array, 1);
  45810   r       = setPArraySmallJsonG(self, "1", array);
  45811   ck_assert_ptr_ne(r, null);
  45812   char *s = toStringO(r);
  45813   ck_assert_str_eq(s, "{\"1\":[1]}");
  45814   free(s);
  45815   finishO(array);
  45816   terminateO(self);
  45817 
  45818 }
  45819 
  45820 
  45821 void setPSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  45822 
  45823   smallJsont* r;
  45824   smallJsont *self = allocSmallJson();
  45825   smallJsont *json;
  45826 
  45827   json    = allocSmallJson();
  45828   r       = self->f->setSmallJson(self, "1", json);
  45829   ck_assert_ptr_ne(r, null);
  45830   json->f->setInt(json, "a", 1);
  45831   r       = setPSmallJsonSmallJsonG(self, "1", json);
  45832   ck_assert_ptr_ne(r, null);
  45833   finishO(json);
  45834   char *s = toStringO(r);
  45835   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45836   free(s);
  45837   terminateO(self);
  45838 
  45839 }
  45840 
  45841 
  45842 void setPSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  45843 
  45844   smallJsont* r;
  45845   smallJsont *self = allocSmallJson();
  45846   smallStringt *string;
  45847 
  45848   string = allocSmallString("");
  45849   r      = self->f->setSmallString(self, "1", string);
  45850   ck_assert_ptr_ne(r, null);
  45851   string->f->appendS(string, "s");
  45852   r      = setPSmallStringSmallJsonG(self, "1", string);
  45853   ck_assert_ptr_ne(r, null);
  45854   finishO(string);
  45855   char *s = toStringO(r);
  45856   ck_assert_str_eq(s, "{\"1\":\"s\"}");
  45857   free(s);
  45858   terminateO(self);
  45859 
  45860 }
  45861 
  45862 
  45863 void setNFreePDictSmallJsonGT(CuTest *tc UNUSED) {
  45864 
  45865   smallJsont* r;
  45866   smallJsont *self = allocSmallJson();
  45867   smallDictt *value;
  45868 
  45869   value   = allocSmallDict();
  45870   r       = self->f->setDict(self, "1", value);
  45871   ck_assert_ptr_ne(r, null);
  45872   value->f->setInt(value, "a", 1);
  45873   r       = setNFreePDictSmallJsonG(self, "1", value);
  45874   ck_assert_ptr_ne(r, null);
  45875   char *s = toStringO(r);
  45876   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45877   free(s);
  45878   terminateO(self);
  45879 
  45880 }
  45881 
  45882 
  45883 void setNFreePArraySmallJsonGT(CuTest *tc UNUSED) {
  45884 
  45885   smallJsont* r;
  45886   smallJsont *self = allocSmallJson();
  45887   smallArrayt *value;
  45888 
  45889   value   = allocSmallArray();
  45890   r       = self->f->setArray(self, "1", value);
  45891   ck_assert_ptr_ne(r, null);
  45892   value->f->pushInt(value, 2);
  45893   r       = setNFreePArraySmallJsonG(self, "1", value);
  45894   ck_assert_ptr_ne(r, null);
  45895   char *s = toStringO(r);
  45896   ck_assert_str_eq(s, "{\"1\":[2]}");
  45897   free(s);
  45898   terminateO(self);
  45899 
  45900 }
  45901 
  45902 
  45903 void setNFreePSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  45904 
  45905   smallJsont* r;
  45906   smallJsont *self = allocSmallJson();
  45907   smallJsont *value;
  45908 
  45909   value   = allocSmallJson();
  45910   r       = self->f->setSmallJson(self, "1", value);
  45911   ck_assert_ptr_ne(r, null);
  45912   value->f->setInt(value, "a", 1);
  45913   r       = setNFreePSmallJsonSmallJsonG(self, "1", value);
  45914   ck_assert_ptr_ne(r, null);
  45915   char *s = toStringO(r);
  45916   ck_assert_str_eq(s, "{\"1\":{\"a\":1}}");
  45917   free(s);
  45918   terminateO(self);
  45919 
  45920 }
  45921 
  45922 
  45923 void setNFreePSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  45924 
  45925   smallJsont* r;
  45926   smallJsont *self = allocSmallJson();
  45927   smallStringt *value;
  45928 
  45929   value = allocSmallString("");
  45930   r       = self->f->setSmallString(self, "1", value);
  45931   ck_assert_ptr_ne(r, null);
  45932   value->f->appendS(value, "2");
  45933   r       = setNFreePSmallStringSmallJsonG(self, "1", value);
  45934   ck_assert_ptr_ne(r, null);
  45935   char *s = toStringO(r);
  45936   ck_assert_str_eq(s, "{\"1\":\"2\"}");
  45937   free(s);
  45938   terminateO(self);
  45939 
  45940 }
  45941 
  45942 
  45943 void setAtSmallJsonGT(CuTest *tc UNUSED) {
  45944 
  45945   smallJsont* r;
  45946   smallJsont *self = allocSmallJson();
  45947   baset *value = (baset*) allocSmallInt(1);
  45948 
  45949   r       = pushSmallJsonG(self, value);
  45950   ck_assert_ptr_ne(r, null);
  45951   finishO(value);
  45952   value   = (baset*) allocSmallInt(2);
  45953   r       = setAtSmallJsonG(self, 0, value);
  45954   ck_assert_ptr_ne(r, null);
  45955   finishO(value);
  45956   char *s = toStringO(r);
  45957   ck_assert_str_eq(s, "[2]");
  45958   free(s);
  45959   terminateO(self);
  45960 
  45961 }
  45962 
  45963 
  45964 void setAtUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  45965 
  45966   smallJsont* r;
  45967   smallJsont *self = allocSmallJson();
  45968   baset *value = (baset*) allocSmallInt(1);
  45969 
  45970   r       = pushSmallJsonG(self, value);
  45971   ck_assert_ptr_ne(r, null);
  45972   finishO(value);
  45973   char *v = strdup("freed by setAtUndefinedSmallJsonG");
  45974   r = setAtUndefinedSmallJsonG(self, 0, v);
  45975   ck_assert_ptr_ne(r, null);
  45976   char *s = toStringO(r);
  45977   ck_assert_str_eq(s, "[null]");
  45978   free(s);
  45979   terminateO(self);
  45980 
  45981 }
  45982 
  45983 
  45984 void setAtBoolSmallJsonGT(CuTest *tc UNUSED) {
  45985 
  45986   smallJsont* r;
  45987   smallJsont *self = allocSmallJson();
  45988 
  45989   r = pushBoolSmallJsonG(self, true);
  45990   ck_assert_ptr_ne(r, null);
  45991   r = setAtBoolSmallJsonG(self, 0, false);
  45992   ck_assert_ptr_ne(r, null);
  45993   char *s = toStringO(r);
  45994   ck_assert_str_eq(s, "[false]");
  45995   free(s);
  45996   terminateO(self);
  45997 
  45998 }
  45999 
  46000 
  46001 void setAtDoubleSmallJsonGT(CuTest *tc UNUSED) {
  46002 
  46003   smallJsont* r;
  46004   smallJsont *self = allocSmallJson();
  46005 
  46006   r = pushDoubleSmallJsonG(self, 1);
  46007   ck_assert_ptr_ne(r, null);
  46008   r = setAtDoubleSmallJsonG(self, 0, 2);
  46009   ck_assert_ptr_ne(r, null);
  46010   char *s = toStringO(r);
  46011   ck_assert_str_eq(s, "[2.000000e+00]");
  46012   free(s);
  46013   terminateO(self);
  46014 
  46015 }
  46016 
  46017 
  46018 void setAtIntSmallJsonGT(CuTest *tc UNUSED) {
  46019 
  46020   smallJsont* r;
  46021   smallJsont *self = allocSmallJson();
  46022 
  46023   r = pushIntSmallJsonG(self, 1);
  46024   ck_assert_ptr_ne(r, null);
  46025   r = setAtIntSmallJsonG(self, 0, 2);
  46026   ck_assert_ptr_ne(r, null);
  46027   char *s = toStringO(r);
  46028   ck_assert_str_eq(s, "[2]");
  46029   free(s);
  46030   terminateO(self);
  46031 
  46032 }
  46033 
  46034 
  46035 void setAtSSmallJsonGT(CuTest *tc UNUSED) {
  46036 
  46037   smallJsont* r;
  46038   smallJsont *self = allocSmallJson();
  46039 
  46040   r = pushSSmallJsonG(self, "qwe");
  46041   ck_assert_ptr_ne(r, null);
  46042   r = setAtSSmallJsonG(self, 0, "asd");
  46043   ck_assert_ptr_ne(r, null);
  46044   char *s = toStringO(r);
  46045   ck_assert_str_eq(s, "[\"asd\"]");
  46046   free(s);
  46047   terminateO(self);
  46048 
  46049 }
  46050 
  46051 
  46052 void setAtCharSmallJsonGT(CuTest *tc UNUSED) {
  46053 
  46054   smallJsont* r;
  46055   smallJsont *self = allocSmallJson();
  46056 
  46057   r = pushCharSmallJsonG(self, 'Q');
  46058   ck_assert_ptr_ne(r, null);
  46059   r = setAtCharSmallJsonG(self, 0, 'x');
  46060   ck_assert_ptr_ne(r, null);
  46061   char *s = toStringO(r);
  46062   ck_assert_str_eq(s, "[\"x\"]");
  46063   free(s);
  46064   terminateO(self);
  46065 
  46066 }
  46067 
  46068 
  46069 void setAtDictSmallJsonGT(CuTest *tc UNUSED) {
  46070 
  46071   smallJsont* r;
  46072   smallJsont *self = allocSmallJson();
  46073   smallDictt *dict  = allocSmallDict();
  46074 
  46075   r = pushDictSmallJsonG(self, dict);
  46076   ck_assert_ptr_ne(r, null);
  46077   resetO(dict);
  46078   dict->f->setInt(dict, "a", 1);
  46079   r = setAtDictSmallJsonG(self, 0, dict);
  46080   ck_assert_ptr_ne(r, null);
  46081   finishO(dict);
  46082   char *s = toStringO(r);
  46083   ck_assert_str_eq(s, "[{\"a\":1}]");
  46084   free(s);
  46085   terminateO(self);
  46086 
  46087 }
  46088 
  46089 
  46090 void setAtArraySmallJsonGT(CuTest *tc UNUSED) {
  46091 
  46092   smallJsont* r;
  46093   smallJsont *self  = allocSmallJson();
  46094   smallArrayt *array = allocSmallArray();
  46095 
  46096   r = pushArraySmallJsonG(self, array);
  46097   ck_assert_ptr_ne(r, null);
  46098   resetO(array);
  46099   array->f->pushInt(array, 1);
  46100   r = setAtArraySmallJsonG(self, 0, array);
  46101   ck_assert_ptr_ne(r, null);
  46102   finishO(array);
  46103   char *s = toStringO(r);
  46104   ck_assert_str_eq(s, "[[1]]");
  46105   free(s);
  46106   terminateO(self);
  46107 
  46108 }
  46109 
  46110 
  46111 void setAtArraycSmallJsonGT(CuTest *tc UNUSED) {
  46112 
  46113   smallJsont* r;
  46114   smallJsont *self = allocSmallJson();
  46115   char **array      = listCreateS("a","bb");
  46116 
  46117   r     = pushArraycSmallJsonG(self, array);
  46118   ck_assert_ptr_ne(r, null);
  46119   listFreeS(array);
  46120   array = listCreateS("1","22");
  46121   r     = setAtArraycSmallJsonG(self, 0, array);
  46122   ck_assert_ptr_ne(r, null);
  46123   ck_assert_int_eq(lenO(r), 1);
  46124   listFreeS(array);
  46125   char *s = toStringO(r);
  46126   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46127   free(s);
  46128   terminateO(self);
  46129 
  46130 }
  46131 
  46132 
  46133 void setAtCArraycSmallJsonGT(CuTest *tc UNUSED) {
  46134 
  46135   smallJsont* r;
  46136   smallJsont *self = allocSmallJson();
  46137   const char *array[] = {"a", "bb", NULL};
  46138 
  46139   r = pushCArraycSmallJsonG(self, array);
  46140   ck_assert_ptr_ne(r, null);
  46141   const char *array2[] = {"1", "22", NULL};
  46142   r = setAtCArraycSmallJsonG(self, 0, array2);
  46143   ck_assert_ptr_ne(r, null);
  46144   ck_assert_int_eq(lenO(r), 1);
  46145   char *s = toStringO(r);
  46146   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46147   free(s);
  46148   terminateO(self);
  46149 
  46150 }
  46151 
  46152 
  46153 void setAtVoidSmallJsonGT(CuTest *tc UNUSED) {
  46154 
  46155   smallJsont* r;
  46156   smallJsont *self = allocSmallJson();
  46157 
  46158   // NULL value
  46159   r = pushVoidSmallJsonG(self, NULL);
  46160   ck_assert_ptr_ne(r, null);
  46161   r = setAtVoidSmallJsonG(self, 0, null);
  46162   ck_assert_ptr_ne(r, null);
  46163   r = setAtVoidSmallJsonG(self, 0, r);
  46164   ck_assert_ptr_ne(r, null);
  46165   char *s = toStringO(r);
  46166   ck_assert_str_eq(s, "[\"<data container>\"]");
  46167   free(s);
  46168   terminateO(self);
  46169 
  46170 }
  46171 
  46172 
  46173 void setAtSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  46174 
  46175   smallJsont* r;
  46176   smallJsont *self = allocSmallJson();
  46177   smallBoolt *value = allocSmallBool(true);
  46178 
  46179   r = pushBoolSmallJsonG(self, false);
  46180   ck_assert_ptr_ne(r, null);
  46181   r = setAtSmallBoolSmallJsonG(self, 0, value);
  46182   ck_assert_ptr_ne(r, null);
  46183   finishO(value);
  46184   char *s = toStringO(r);
  46185   ck_assert_str_eq(s, "[true]");
  46186   free(s);
  46187   terminateO(self);
  46188 
  46189 }
  46190 
  46191 
  46192 void setAtSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  46193 
  46194   smallJsont* r;
  46195   smallJsont *self = allocSmallJson();
  46196   smallBytest *value = allocSmallBytes("qwe", 3);
  46197 
  46198   r = pushSmallBytesSmallJsonG(self, value);
  46199   ck_assert_ptr_ne(r, null);
  46200   finishO(value);
  46201   value = allocSmallBytes("asd", 3);
  46202   r = setAtSmallBytesSmallJsonG(self, 0, value);
  46203   ck_assert_ptr_ne(r, null);
  46204   finishO(value);
  46205   char *s = toStringO(r);
  46206   ck_assert_str_eq(s, "[[0x61,0x73,0x64]]");
  46207   free(s);
  46208   terminateO(self);
  46209 
  46210 }
  46211 
  46212 
  46213 void setAtSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  46214 
  46215   smallJsont* r;
  46216   smallJsont *self = allocSmallJson();
  46217   smallDoublet *value = allocSmallDouble(1);
  46218 
  46219   r = pushDoubleSmallJsonG(self, 2);
  46220   ck_assert_ptr_ne(r, null);
  46221   r = setAtSmallDoubleSmallJsonG(self, 0, value);
  46222   ck_assert_ptr_ne(r, null);
  46223   finishO(value);
  46224   char *s = toStringO(r);
  46225   ck_assert_str_eq(s, "[1.000000e+00]");
  46226   free(s);
  46227 
  46228   terminateO(self);
  46229 
  46230 }
  46231 
  46232 
  46233 void setAtSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  46234 
  46235   smallJsont* r;
  46236   smallJsont *self = allocSmallJson();
  46237   smallIntt *value  = allocSmallInt(1);
  46238 
  46239   r = pushIntSmallJsonG(self, 2);
  46240   ck_assert_ptr_ne(r, null);
  46241   r = setAtSmallIntSmallJsonG(self, 0, value);
  46242   ck_assert_ptr_ne(r, null);
  46243   finishO(value);
  46244   char *s = toStringO(r);
  46245   ck_assert_str_eq(s, "[1]");
  46246   free(s);
  46247   terminateO(self);
  46248 
  46249 }
  46250 
  46251 
  46252 void setAtSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  46253 
  46254   smallJsont* r;
  46255   smallJsont *self = allocSmallJson();
  46256   smallJsont *value = allocSmallJson();
  46257 
  46258   r = pushSmallJsonSmallJsonG(self, value);
  46259   ck_assert_ptr_ne(r, null);
  46260   finishO(value);
  46261   value = allocSmallJson();
  46262   value->f->setInt(value, "a", 1);
  46263   r = setAtSmallJsonSmallJsonG(self, 0, value);
  46264   ck_assert_ptr_ne(r, null);
  46265   finishO(value);
  46266   char *s = toStringO(r);
  46267   ck_assert_str_eq(s, "[{\"a\":1}]");
  46268   free(s);
  46269   terminateO(self);
  46270 
  46271 }
  46272 
  46273 
  46274 void setAtSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  46275 
  46276   smallJsont* r;
  46277   smallJsont *self = allocSmallJson();
  46278   smallStringt *string = allocSmallString("qwe");
  46279 
  46280   r = pushSSmallJsonG(self, "asd");
  46281   ck_assert_ptr_ne(r, null);
  46282   r = setAtSmallStringSmallJsonG(self, 0, string);
  46283   ck_assert_ptr_ne(r, null);
  46284   finishO(string);
  46285   char *s = toStringO(r);
  46286   ck_assert_str_eq(s, "[\"qwe\"]");
  46287   free(s);
  46288   terminateO(self);
  46289 
  46290 }
  46291 
  46292 
  46293 void setAtSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  46294 
  46295   smallJsont* r;
  46296   smallJsont *self = allocSmallJson();
  46297 
  46298   createSmallContainer(c);
  46299   r = pushSmallContainerSmallJsonG(self, &c);
  46300   ck_assert_ptr_ne(r, null);
  46301   createSmallContainer(c2);
  46302   r = setAtSmallContainerSmallJsonG(self, 0, &c2);
  46303   ck_assert_ptr_ne(r, null);
  46304   char *s = toStringO(r);
  46305   ck_assert_str_eq(s, "[\"<data container>\"]");
  46306   free(s);
  46307   terminateO(self);
  46308 
  46309 }
  46310 
  46311 
  46312 void setAtNFreeSmallJsonGT(CuTest *tc UNUSED) {
  46313 
  46314   smallJsont* r;
  46315   smallJsont *self = allocSmallJson();
  46316   baset *value = (baset*) allocSmallInt(1);
  46317 
  46318   r       = pushSmallJsonG(self, value);
  46319   ck_assert_ptr_ne(r, null);
  46320   finishO(value);
  46321   value   = (baset*) allocSmallInt(2);
  46322   r       = setAtNFreeSmallJsonG(self, 0, value);
  46323   ck_assert_ptr_ne(r, null);
  46324   char *s = toStringO(r);
  46325   ck_assert_str_eq(s, "[2]");
  46326   free(s);
  46327   terminateO(self);
  46328 
  46329 }
  46330 
  46331 
  46332 void setAtNFreeUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  46333 
  46334   smallJsont* r;
  46335   smallJsont *self = allocSmallJson();
  46336   baset *value = (baset*) allocSmallInt(1);
  46337 
  46338   r       = pushSmallJsonG(self, value);
  46339   ck_assert_ptr_ne(r, null);
  46340   finishO(value);
  46341   r = setAtNFreeUndefinedSmallJsonG(self, 0, null);
  46342   ck_assert_ptr_ne(r, null);
  46343   char *s = toStringO(r);
  46344   ck_assert_str_eq(s, "[null]");
  46345   free(s);
  46346   terminateO(self);
  46347 
  46348 }
  46349 
  46350 
  46351 void setAtNFreeSSmallJsonGT(CuTest *tc UNUSED) {
  46352 
  46353   smallJsont* r;
  46354   smallJsont *self = allocSmallJson();
  46355 
  46356   r = pushSSmallJsonG(self, "qwe");
  46357   ck_assert_ptr_ne(r, null);
  46358   r = setAtNFreeSSmallJsonG(self, 0, strdup("asd"));
  46359   ck_assert_ptr_ne(r, null);
  46360   char *s = toStringO(r);
  46361   ck_assert_str_eq(s, "[\"asd\"]");
  46362   free(s);
  46363   terminateO(self);
  46364 
  46365 }
  46366 
  46367 
  46368 void setAtNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  46369 
  46370   smallJsont* r;
  46371   smallJsont *self = allocSmallJson();
  46372   smallDictt *dict  = allocSmallDict();
  46373 
  46374   r = pushDictSmallJsonG(self, dict);
  46375   ck_assert_ptr_ne(r, null);
  46376   resetO(dict);
  46377   dict->f->setInt(dict, "a", 1);
  46378   r = setAtNFreeDictSmallJsonG(self, 0, dict);
  46379   ck_assert_ptr_ne(r, null);
  46380   char *s = toStringO(r);
  46381   ck_assert_str_eq(s, "[{\"a\":1}]");
  46382   free(s);
  46383   terminateO(self);
  46384 
  46385 }
  46386 
  46387 
  46388 void setAtNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  46389 
  46390   smallJsont* r;
  46391   smallJsont *self = allocSmallJson();
  46392   smallArrayt *array = allocSmallArray();
  46393 
  46394   r = pushArraySmallJsonG(self, array);
  46395   ck_assert_ptr_ne(r, null);
  46396   resetO(array);
  46397   array->f->pushInt(array, 1);
  46398   r = setAtNFreeArraySmallJsonG(self, 0, array);
  46399   ck_assert_ptr_ne(r, null);
  46400   char *s = toStringO(r);
  46401   ck_assert_str_eq(s, "[[1]]");
  46402   free(s);
  46403   terminateO(self);
  46404 
  46405 }
  46406 
  46407 
  46408 void setAtNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  46409 
  46410   smallJsont* r;
  46411   smallJsont *self = allocSmallJson();
  46412   char **array      = listCreateS("a","bb");
  46413 
  46414   r     = pushArraycSmallJsonG(self, array);
  46415   ck_assert_ptr_ne(r, null);
  46416   listFreeS(array);
  46417   array = listCreateS("1","22");
  46418   r     = setAtNFreeArraycSmallJsonG(self, 0, array);
  46419   ck_assert_ptr_ne(r, null);
  46420   ck_assert_int_eq(lenO(r), 1);
  46421   char *s = toStringO(r);
  46422   ck_assert_str_eq(s, "[[\"1\",\"22\"]]");
  46423   free(s);
  46424   terminateO(self);
  46425 
  46426 }
  46427 
  46428 
  46429 void setAtNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  46430 
  46431   smallJsont* r;
  46432   smallJsont *self = allocSmallJson();
  46433   smallBoolt *value = allocSmallBool(true);
  46434 
  46435   r = pushBoolSmallJsonG(self, false);
  46436   ck_assert_ptr_ne(r, null);
  46437   r = setAtNFreeSmallBoolSmallJsonG(self, 0, value);
  46438   ck_assert_ptr_ne(r, null);
  46439   char *s = toStringO(r);
  46440   ck_assert_str_eq(s, "[true]");
  46441   free(s);
  46442   terminateO(self);
  46443 
  46444 }
  46445 
  46446 
  46447 void setAtNFreeSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  46448 
  46449   smallJsont* r;
  46450   smallJsont *self = allocSmallJson();
  46451   smallBytest *value = allocSmallBytes("qwe", 3);
  46452 
  46453   r = pushSmallBytesSmallJsonG(self, value);
  46454   ck_assert_ptr_ne(r, null);
  46455   finishO(value);
  46456   value = allocSmallBytes("asd", 3);
  46457   r = setAtNFreeSmallBytesSmallJsonG(self, 0, value);
  46458   ck_assert_ptr_ne(r, null);
  46459   char *s = toStringO(r);
  46460   ck_assert_str_eq(s, "[[0x61,0x73,0x64]]");
  46461   free(s);
  46462   terminateO(self);
  46463 
  46464 }
  46465 
  46466 
  46467 void setAtNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  46468 
  46469   smallJsont* r;
  46470   smallJsont *self = allocSmallJson();
  46471   smallDoublet *value = allocSmallDouble(1);
  46472 
  46473   r = pushDoubleSmallJsonG(self, 2);
  46474   ck_assert_ptr_ne(r, null);
  46475   r = setAtNFreeSmallDoubleSmallJsonG(self, 0, value);
  46476   ck_assert_ptr_ne(r, null);
  46477   char *s = toStringO(r);
  46478   ck_assert_str_eq(s, "[1.000000e+00]");
  46479   free(s);
  46480   terminateO(self);
  46481 
  46482 }
  46483 
  46484 
  46485 void setAtNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  46486 
  46487   smallJsont* r;
  46488   smallJsont *self = allocSmallJson();
  46489   smallIntt *value  = allocSmallInt(1);
  46490 
  46491   r = pushIntSmallJsonG(self, 2);
  46492   ck_assert_ptr_ne(r, null);
  46493   r = setAtNFreeSmallIntSmallJsonG(self, 0, value);
  46494   ck_assert_ptr_ne(r, null);
  46495   char *s = toStringO(r);
  46496   ck_assert_str_eq(s, "[1]");
  46497   free(s);
  46498   terminateO(self);
  46499 
  46500 }
  46501 
  46502 
  46503 void setAtNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  46504 
  46505   smallJsont* r;
  46506   smallJsont *self = allocSmallJson();
  46507   smallJsont *value = allocSmallJson();
  46508 
  46509   r = pushSmallJsonSmallJsonG(self, value);
  46510   ck_assert_ptr_ne(r, null);
  46511   finishO(value);
  46512   value = allocSmallJson();
  46513   value->f->setInt(value, "a", 1);
  46514   r = setAtNFreeSmallJsonSmallJsonG(self, 0, value);
  46515   ck_assert_ptr_ne(r, null);
  46516   char *s = toStringO(r);
  46517   ck_assert_str_eq(s, "[{\"a\":1}]");
  46518   free(s);
  46519   terminateO(self);
  46520 
  46521 }
  46522 
  46523 
  46524 void setAtNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  46525 
  46526   smallJsont* r;
  46527   smallJsont *self = allocSmallJson();
  46528   smallStringt *string = allocSmallString("qwe");
  46529 
  46530   r = pushSSmallJsonG(self, "asd");
  46531   ck_assert_ptr_ne(r, null);
  46532   r = setAtNFreeSmallStringSmallJsonG(self, 0, string);
  46533   ck_assert_ptr_ne(r, null);
  46534   char *s = toStringO(r);
  46535   ck_assert_str_eq(s, "[\"qwe\"]");
  46536   free(s);
  46537   terminateO(self);
  46538 
  46539 }
  46540 
  46541 
  46542 void setAtNFreeSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  46543 
  46544   smallJsont* r;
  46545   smallJsont *self = allocSmallJson();
  46546 
  46547   createSmallContainer(c);
  46548   r = pushSmallContainerSmallJsonG(self, &c);
  46549   ck_assert_ptr_ne(r, null);
  46550   createAllocateSmallContainer(c2);
  46551   r = setAtNFreeSmallContainerSmallJsonG(self, 0, c2);
  46552   ck_assert_ptr_ne(r, null);
  46553   char *s = toStringO(r);
  46554   ck_assert_str_eq(s, "[\"<data container>\"]");
  46555   free(s);
  46556   terminateO(self);
  46557 
  46558 }
  46559 
  46560 
  46561 void setPAtDictSmallJsonGT(CuTest *tc UNUSED) {
  46562 
  46563   smallJsont* r;
  46564   smallJsont *self = allocSmallJson();
  46565   smallDictt *dict  = allocSmallDict();
  46566 
  46567   r = pushDictSmallJsonG(self, dict);
  46568   ck_assert_ptr_ne(r, null);
  46569   finishO(dict);
  46570   dict = getAtDictSmallJsonG(self, null, 0);
  46571   ck_assert_ptr_ne(dict, null);
  46572   dict->f->setInt(dict, "a", 1);
  46573   r = setPAtDictSmallJsonG(self, 0, dict);
  46574   ck_assert_ptr_ne(r, null);
  46575   finishO(dict);
  46576   char *s = toStringO(r);
  46577   ck_assert_str_eq(s, "[{\"a\":1}]");
  46578   free(s);
  46579   terminateO(self);
  46580 
  46581 }
  46582 
  46583 
  46584 void setPAtArraySmallJsonGT(CuTest *tc UNUSED) {
  46585 
  46586   smallJsont* r;
  46587   smallJsont *self = allocSmallJson();
  46588   smallArrayt *array = allocSmallArray();
  46589 
  46590   r = pushArraySmallJsonG(self, array);
  46591   ck_assert_ptr_ne(r, null);
  46592   finishO(array);
  46593   array = getAtArraySmallJsonG(self, null, 0);
  46594   ck_assert_ptr_ne(array, null);
  46595   array->f->pushInt(array, 1);
  46596   r = setPAtArraySmallJsonG(self, 0, array);
  46597   ck_assert_ptr_ne(r, null);
  46598   finishO(array);
  46599   char *s = toStringO(r);
  46600   ck_assert_str_eq(s, "[[1]]");
  46601   free(s);
  46602   terminateO(self);
  46603 
  46604 }
  46605 
  46606 
  46607 void setPAtSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  46608 
  46609   smallJsont* r;
  46610   smallJsont *self = allocSmallJson();
  46611   smallJsont *value = allocSmallJson();
  46612 
  46613   r = pushSmallJsonSmallJsonG(self, value);
  46614   ck_assert_ptr_ne(r, null);
  46615   finishO(value);
  46616   value = getAtSmallJsonSmallJsonG(self, null, 0);
  46617   value->f->setInt(value, "a", 1);
  46618   r = setPAtSmallJsonSmallJsonG(self, 0, value);
  46619   ck_assert_ptr_ne(r, null);
  46620   finishO(value);
  46621   char *s = toStringO(r);
  46622   ck_assert_str_eq(s, "[{\"a\":1}]");
  46623   free(s);
  46624   terminateO(self);
  46625 
  46626 }
  46627 
  46628 
  46629 void setPAtSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  46630 
  46631   smallJsont* r;
  46632   smallJsont *self = allocSmallJson();
  46633   smallStringt *string;
  46634 
  46635   r = pushSSmallJsonG(self, "asd");
  46636   ck_assert_ptr_ne(r, null);
  46637   string = getAtSmallStringSmallJsonG(self, null, 0);
  46638   setValO(string, "qwe");
  46639   r = setPAtSmallStringSmallJsonG(self, 0, string);
  46640   ck_assert_ptr_ne(r, null);
  46641   finishO(string);
  46642   char *s = toStringO(r);
  46643   ck_assert_str_eq(s, "[\"qwe\"]");
  46644   free(s);
  46645   terminateO(self);
  46646 
  46647 }
  46648 
  46649 
  46650 void setPAtNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  46651 
  46652   smallJsont* r;
  46653   smallJsont *self = allocSmallJson();
  46654   smallDictt *dict  = allocSmallDict();
  46655 
  46656   r = pushDictSmallJsonG(self, dict);
  46657   ck_assert_ptr_ne(r, null);
  46658   finishO(dict);
  46659   dict = getAtDictSmallJsonG(self, null, 0);
  46660   ck_assert_ptr_ne(dict, null);
  46661   dict->f->setInt(dict, "a", 1);
  46662   r = setPAtNFreeDictSmallJsonG(self, 0, dict);
  46663   ck_assert_ptr_ne(r, null);
  46664   char *s = toStringO(r);
  46665   ck_assert_str_eq(s, "[{\"a\":1}]");
  46666   free(s);
  46667   terminateO(self);
  46668 
  46669 }
  46670 
  46671 
  46672 void setPAtNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  46673 
  46674   smallJsont* r;
  46675   smallJsont *self = allocSmallJson();
  46676   smallArrayt *array = allocSmallArray();
  46677 
  46678   r = pushArraySmallJsonG(self, array);
  46679   ck_assert_ptr_ne(r, null);
  46680   finishO(array);
  46681   array = getAtArraySmallJsonG(self, null, 0);
  46682   ck_assert_ptr_ne(array, null);
  46683   array->f->pushInt(array, 1);
  46684   r = setPAtNFreeArraySmallJsonG(self, 0, array);
  46685   ck_assert_ptr_ne(r, null);
  46686   char *s = toStringO(r);
  46687   ck_assert_str_eq(s, "[[1]]");
  46688   free(s);
  46689   terminateO(self);
  46690 
  46691 }
  46692 
  46693 
  46694 void setPAtNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  46695 
  46696   smallJsont* r;
  46697   smallJsont *self = allocSmallJson();
  46698   smallJsont *value = allocSmallJson();
  46699 
  46700   r = pushSmallJsonSmallJsonG(self, value);
  46701   ck_assert_ptr_ne(r, null);
  46702   finishO(value);
  46703   value = getAtSmallJsonSmallJsonG(self, null, 0);
  46704   value->f->setInt(value, "a", 1);
  46705   r = setPAtNFreeSmallJsonSmallJsonG(self, 0, value);
  46706   ck_assert_ptr_ne(r, null);
  46707   char *s = toStringO(r);
  46708   ck_assert_str_eq(s, "[{\"a\":1}]");
  46709   free(s);
  46710   terminateO(self);
  46711 
  46712 }
  46713 
  46714 
  46715 void setPAtNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  46716 
  46717   smallJsont* r;
  46718   smallJsont *self = allocSmallJson();
  46719   smallStringt *string;
  46720 
  46721   r = pushSSmallJsonG(self, "asd");
  46722   ck_assert_ptr_ne(r, null);
  46723   string = getAtSmallStringSmallJsonG(self, null, 0);
  46724   setValO(string, "qwe");
  46725   r = setPAtNFreeSmallStringSmallJsonG(self, 0, string);
  46726   ck_assert_ptr_ne(r, null);
  46727   char *s = toStringO(r);
  46728   ck_assert_str_eq(s, "[\"qwe\"]");
  46729   free(s);
  46730   terminateO(self);
  46731 
  46732 }
  46733 
  46734 
  46735 void getSmallJsonGT(CuTest *tc UNUSED) {
  46736 
  46737   baset*      r;
  46738   smallJsont *self = allocSmallJson();
  46739 
  46740   self->f->setInt(self, "1", 2);
  46741   r = getSmallJsonG(self, null, "1");
  46742   ck_assert_ptr_ne(r, null);
  46743   char *s = toStringO(r);
  46744   finishO(r);
  46745   ck_assert_str_eq(s, "2");
  46746   free(s);
  46747   terminateO(self);
  46748 
  46749 }
  46750 
  46751 
  46752 void getUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  46753 
  46754   undefinedt*      r;
  46755   smallJsont *self = allocSmallJson();
  46756 
  46757   smallJsont *r2 = self->f->setUndefined(self, "1");
  46758   ck_assert_ptr_ne(r2, null);
  46759   r = getUndefinedSmallJsonG(self, null, "1");
  46760   ck_assert_ptr_ne(r, null);
  46761   finishO(r);
  46762   terminateO(self);
  46763 
  46764 }
  46765 
  46766 
  46767 void getBoolSmallJsonGT(CuTest *tc UNUSED) {
  46768 
  46769   bool             r;
  46770   smallJsont *self = allocSmallJson();
  46771 
  46772   smallJsont *r2 = self->f->setBool(self, "1", true);
  46773   ck_assert_ptr_ne(r2, null);
  46774   r = getBoolSmallJsonG(self, false, "1");
  46775   ck_assert(r);
  46776   terminateO(self);
  46777 
  46778 }
  46779 
  46780 
  46781 void getBoolPSmallJsonGT(CuTest *tc UNUSED) {
  46782 
  46783   bool*            r;
  46784   smallJsont *self = allocSmallJson();
  46785 
  46786   smallJsont *r2 = self->f->setBool(self, "1", true);
  46787   ck_assert_ptr_ne(r2, null);
  46788   r = getBoolPSmallJsonG(self, null, "1");
  46789   ck_assert_ptr_ne(r, null);
  46790   ck_assert(*r);
  46791   terminateO(self);
  46792 
  46793 }
  46794 
  46795 
  46796 void getDoubleSmallJsonGT(CuTest *tc UNUSED) {
  46797 
  46798   double           r;
  46799   smallJsont *self = allocSmallJson();
  46800 
  46801   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  46802   ck_assert_ptr_ne(r2, null);
  46803   r = getDoubleSmallJsonG(self, 0, "1");
  46804   ck_assert(r == 2.2);
  46805   terminateO(self);
  46806 
  46807 }
  46808 
  46809 
  46810 void getDoublePSmallJsonGT(CuTest *tc UNUSED) {
  46811 
  46812   double*          r;
  46813   smallJsont *self = allocSmallJson();
  46814 
  46815   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  46816   ck_assert_ptr_ne(r2, null);
  46817   r = getDoublePSmallJsonG(self, null, "1");
  46818   ck_assert_ptr_ne(r, null);
  46819   ck_assert(*r == 2.2);
  46820   terminateO(self);
  46821 
  46822 }
  46823 
  46824 
  46825 void getIntSmallJsonGT(CuTest *tc UNUSED) {
  46826 
  46827   int64_t          r;
  46828   smallJsont *self = allocSmallJson();
  46829 
  46830   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46831   ck_assert_ptr_ne(r2, null);
  46832   r = getIntSmallJsonG(self, 0, "1");
  46833   ck_assert_int_eq(r, 2);
  46834   terminateO(self);
  46835 
  46836 }
  46837 
  46838 
  46839 void getIntPSmallJsonGT(CuTest *tc UNUSED) {
  46840 
  46841   int64_t*         r;
  46842   smallJsont *self = allocSmallJson();
  46843 
  46844   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46845   ck_assert_ptr_ne(r2, null);
  46846   r = getIntPSmallJsonG(self, null, "1");
  46847   ck_assert_ptr_ne(r, null);
  46848   ck_assert_int_eq(*r, 2);
  46849   terminateO(self);
  46850 
  46851 }
  46852 
  46853 
  46854 void getInt32SmallJsonGT(CuTest *tc UNUSED) {
  46855 
  46856   int32_t          r;
  46857   smallJsont *self = allocSmallJson();
  46858 
  46859   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46860   ck_assert_ptr_ne(r2, null);
  46861   r = getInt32SmallJsonG(self, 0, "1");
  46862   ck_assert_int_eq(r, 2);
  46863   terminateO(self);
  46864 
  46865 }
  46866 
  46867 
  46868 void getInt32PSmallJsonGT(CuTest *tc UNUSED) {
  46869 
  46870   int32_t*         r;
  46871   smallJsont *self = allocSmallJson();
  46872 
  46873   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46874   ck_assert_ptr_ne(r2, null);
  46875   r = getInt32PSmallJsonG(self, null, "1");
  46876   ck_assert_ptr_ne(r, null);
  46877   ck_assert_int_eq(*r, 2);
  46878   terminateO(self);
  46879 
  46880 }
  46881 
  46882 
  46883 void getUintSmallJsonGT(CuTest *tc UNUSED) {
  46884 
  46885   uint64_t         r;
  46886   smallJsont *self = allocSmallJson();
  46887 
  46888   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46889   ck_assert_ptr_ne(r2, null);
  46890   r = getUintSmallJsonG(self, 0, "1");
  46891   ck_assert_int_eq(r, 2);
  46892   terminateO(self);
  46893 
  46894 }
  46895 
  46896 
  46897 void getUintPSmallJsonGT(CuTest *tc UNUSED) {
  46898 
  46899   uint64_t*        r;
  46900   smallJsont *self = allocSmallJson();
  46901 
  46902   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46903   ck_assert_ptr_ne(r2, null);
  46904   r = getUintPSmallJsonG(self, null, "1");
  46905   ck_assert_ptr_ne(r, null);
  46906   ck_assert_int_eq(*r, 2);
  46907   terminateO(self);
  46908 
  46909 }
  46910 
  46911 
  46912 void getUint32SmallJsonGT(CuTest *tc UNUSED) {
  46913 
  46914   uint32_t         r;
  46915   smallJsont *self = allocSmallJson();
  46916 
  46917   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46918   ck_assert_ptr_ne(r2, null);
  46919   r = getUint32SmallJsonG(self, 0, "1");
  46920   ck_assert_int_eq(r, 2);
  46921   terminateO(self);
  46922 
  46923 }
  46924 
  46925 
  46926 void getUint32PSmallJsonGT(CuTest *tc UNUSED) {
  46927 
  46928   uint32_t*        r;
  46929   smallJsont *self = allocSmallJson();
  46930 
  46931   smallJsont *r2 = self->f->setInt(self, "1", 2);
  46932   ck_assert_ptr_ne(r2, null);
  46933   r = getUint32PSmallJsonG(self, null, "1");
  46934   ck_assert_ptr_ne(r, null);
  46935   ck_assert_int_eq(*r, 2);
  46936   terminateO(self);
  46937 
  46938 }
  46939 
  46940 
  46941 void getSSmallJsonGT(CuTest *tc UNUSED) {
  46942 
  46943   char*            r;
  46944   smallJsont *self = allocSmallJson();
  46945 
  46946   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  46947   ck_assert_ptr_ne(r2, null);
  46948   r = getSSmallJsonG(self, null, "1");
  46949   ck_assert_ptr_ne(r, null);
  46950   ck_assert_str_eq(r, "qwe");
  46951   terminateO(self);
  46952 
  46953 }
  46954 
  46955 
  46956 void getDictSmallJsonGT(CuTest *tc UNUSED) {
  46957 
  46958   smallJsont* r2;
  46959   smallDictt*      r;
  46960   smallJsont *self = allocSmallJson();
  46961   smallDictt *dict = allocSmallDict();
  46962 
  46963   r2 = self->f->setNFreeDict(self, "1", dict);
  46964   ck_assert_ptr_ne(r2, null);
  46965   r = getDictSmallJsonG(self, null, "1");
  46966   ck_assert_ptr_ne(r, null);
  46967   char *s = toStringO(r);
  46968   finishO(r);
  46969   ck_assert_str_eq(s, "{}");
  46970   free(s);
  46971   terminateO(self);
  46972 
  46973 }
  46974 
  46975 
  46976 void getArraySmallJsonGT(CuTest *tc UNUSED) {
  46977 
  46978   smallArrayt *r;
  46979   smallJsont *self   = allocSmallJson();
  46980   smallArrayt *array = allocSmallArray();
  46981 
  46982   smallJsont *r2 = self->f->setNFreeArray(self, "1", array);
  46983   ck_assert_ptr_ne(r2, null);
  46984   r = getArraySmallJsonG(self, null, "1");
  46985   ck_assert_ptr_ne(r, null);
  46986   char *s = toStringO(r);
  46987   finishO(r);
  46988   ck_assert_str_eq(s, "[]");
  46989   free(s);
  46990   terminateO(self);
  46991 
  46992 }
  46993 
  46994 
  46995 void getSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  46996 
  46997   smallBoolt*      r;
  46998   smallJsont *self = allocSmallJson();
  46999 
  47000   smallJsont *r2 = self->f->setBool(self, "1", true);
  47001   ck_assert_ptr_ne(r2, null);
  47002   r = getSmallBoolSmallJsonG(self, null, "1");
  47003   ck_assert_ptr_ne(r, null);
  47004   char *s = toStringO(r);
  47005   finishO(r);
  47006   ck_assert_str_eq(s, "true");
  47007   free(s);
  47008   terminateO(self);
  47009 
  47010 }
  47011 
  47012 
  47013 void getSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  47014 
  47015   smallBytest*     r;
  47016   smallJsont *self   = allocSmallJson();
  47017   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  47018 
  47019   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", value);
  47020   ck_assert_ptr_ne(r2, null);
  47021   r = getSmallBytesSmallJsonG(self, null, "1");
  47022   ck_assert_ptr_ne(r, null);
  47023   char *s = toStringO(r);
  47024   finishO(r);
  47025   ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]");
  47026   free(s);
  47027   terminateO(self);
  47028 
  47029 }
  47030 
  47031 
  47032 void getSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47033 
  47034   smallDoublet*    r;
  47035   smallJsont *self = allocSmallJson();
  47036 
  47037   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47038   ck_assert_ptr_ne(r2, null);
  47039   r = getSmallDoubleSmallJsonG(self, null, "1");
  47040   ck_assert_ptr_ne(r, null);
  47041   char *s = toStringO(r);
  47042   finishO(r);
  47043   ck_assert_str_eq(s, "2.200000e+00");
  47044   free(s);
  47045   terminateO(self);
  47046 
  47047 }
  47048 
  47049 
  47050 void getSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  47051 
  47052   smallIntt*       r;
  47053   smallJsont *self = allocSmallJson();
  47054 
  47055   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47056   ck_assert_ptr_ne(r2, null);
  47057   r = getSmallIntSmallJsonG(self, null, "1");
  47058   ck_assert_ptr_ne(r, null);
  47059   char *s = toStringO(r);
  47060   finishO(r);
  47061   ck_assert_str_eq(s, "2");
  47062   free(s);
  47063   terminateO(self);
  47064 
  47065 }
  47066 
  47067 
  47068 void getSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  47069 
  47070   smallJsont* r;
  47071   smallJsont *self = allocSmallJson();
  47072   smallJsont *value = allocSmallJson();
  47073 
  47074   setTopIntO(value, 2);
  47075   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", value);
  47076   ck_assert_ptr_ne(r2, null);
  47077   r = getSmallJsonSmallJsonG(self, null, "1");
  47078   ck_assert_ptr_ne(r, null);
  47079   char *s = toStringO(r);
  47080   finishO(r);
  47081   ck_assert_str_eq(s, "2");
  47082   free(s);
  47083   terminateO(self);
  47084 
  47085 }
  47086 
  47087 
  47088 void getSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  47089 
  47090   smallStringt*    r;
  47091   smallJsont *self = allocSmallJson();
  47092 
  47093   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47094   ck_assert_ptr_ne(r2, null);
  47095   r = getSmallStringSmallJsonG(self, null, "1");
  47096   ck_assert_ptr_ne(r, null);
  47097   char *s = toStringO(r);
  47098   finishO(r);
  47099   ck_assert_str_eq(s, "qwe");
  47100   free(s);
  47101   terminateO(self);
  47102 
  47103 }
  47104 
  47105 
  47106 void getVoidSmallJsonGT(CuTest *tc UNUSED) {
  47107 
  47108   void*            r;
  47109   smallJsont *self = allocSmallJson();
  47110 
  47111   createSmallContainer(c);
  47112   setValO(&c, &r);
  47113   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47114   ck_assert_ptr_ne(r2, null);
  47115   r = getVoidSmallJsonG(self, null, "1");
  47116   ck_assert_ptr_eq(r, &r);
  47117   terminateO(self);
  47118 
  47119 }
  47120 
  47121 
  47122 void getSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  47123 
  47124   smallContainert* r;
  47125   smallJsont *self = allocSmallJson();
  47126 
  47127   createSmallContainer(c);
  47128   setValO(&c, &r);
  47129   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47130   ck_assert_ptr_ne(r2, null);
  47131   r = getSmallContainerSmallJsonG(self, null, "1");
  47132   ck_assert_ptr_ne(r, null);
  47133   char *s = toStringO(r);
  47134   finishO(r);
  47135   ck_assert_str_eq(s, "<data smallContainer>");
  47136   free(s);
  47137   terminateO(self);
  47138 
  47139 }
  47140 
  47141 
  47142 void getNDupSmallJsonGT(CuTest *tc UNUSED) {
  47143 
  47144   baset*           r;
  47145   smallJsont *self = allocSmallJson();
  47146 
  47147   self->f->setInt(self, "1", 2);
  47148   r = getNDupSmallJsonG(self, null, "1");
  47149   ck_assert_ptr_ne(r, null);
  47150   char *s = toStringO(r);
  47151   terminateO(r);
  47152   ck_assert_str_eq(s, "2");
  47153   free(s);
  47154   terminateO(self);
  47155 
  47156 }
  47157 
  47158 
  47159 void getNDupUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  47160 
  47161   undefinedt*      r;
  47162   smallJsont *self = allocSmallJson();
  47163 
  47164   smallJsont *r2 = self->f->setUndefined(self, "1");
  47165   ck_assert_ptr_ne(r2, null);
  47166   r = getNDupUndefinedSmallJsonG(self, null, "1");
  47167   ck_assert_ptr_ne(r, null);
  47168   terminateO(r);
  47169   terminateO(self);
  47170 
  47171 }
  47172 
  47173 
  47174 void getNDupBoolSmallJsonGT(CuTest *tc UNUSED) {
  47175 
  47176   bool             r;
  47177   smallJsont *self = allocSmallJson();
  47178 
  47179   smallJsont *r2 = self->f->setBool(self, "1", true);
  47180   ck_assert_ptr_ne(r2, null);
  47181   r = getNDupBoolSmallJsonG(self, false, "1");
  47182   ck_assert(r);
  47183   terminateO(self);
  47184 
  47185 }
  47186 
  47187 
  47188 void getNDupDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47189 
  47190   double           r;
  47191   smallJsont *self = allocSmallJson();
  47192 
  47193   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47194   ck_assert_ptr_ne(r2, null);
  47195   r = getNDupDoubleSmallJsonG(self, 0, "1");
  47196   ck_assert(r == 2.2);
  47197   terminateO(self);
  47198 
  47199 }
  47200 
  47201 
  47202 void getNDupIntSmallJsonGT(CuTest *tc UNUSED) {
  47203 
  47204   int64_t          r;
  47205   smallJsont *self = allocSmallJson();
  47206 
  47207   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47208   ck_assert_ptr_ne(r2, null);
  47209   r = getNDupIntSmallJsonG(self, 0, "1");
  47210   ck_assert_int_eq(r, 2);
  47211   terminateO(self);
  47212 
  47213 }
  47214 
  47215 
  47216 void getNDupInt32SmallJsonGT(CuTest *tc UNUSED) {
  47217 
  47218   int32_t          r;
  47219   smallJsont *self = allocSmallJson();
  47220 
  47221   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47222   ck_assert_ptr_ne(r2, null);
  47223   r = getNDupInt32SmallJsonG(self, 0, "1");
  47224   ck_assert_int_eq(r, 2);
  47225   terminateO(self);
  47226 
  47227 }
  47228 
  47229 
  47230 void getNDupUintSmallJsonGT(CuTest *tc UNUSED) {
  47231 
  47232   uint64_t         r;
  47233   smallJsont *self = allocSmallJson();
  47234 
  47235   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47236   ck_assert_ptr_ne(r2, null);
  47237   r = getNDupUintSmallJsonG(self, 0, "1");
  47238   ck_assert_int_eq(r, 2);
  47239   terminateO(self);
  47240 
  47241 }
  47242 
  47243 
  47244 void getNDupUint32SmallJsonGT(CuTest *tc UNUSED) {
  47245 
  47246   uint32_t         r;
  47247   smallJsont *self = allocSmallJson();
  47248 
  47249   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47250   ck_assert_ptr_ne(r2, null);
  47251   r = getNDupUint32SmallJsonG(self, 0, "1");
  47252   ck_assert_int_eq(r, 2);
  47253   terminateO(self);
  47254 
  47255 }
  47256 
  47257 
  47258 void getNDupSSmallJsonGT(CuTest *tc UNUSED) {
  47259 
  47260   char*            r;
  47261   smallJsont *self = allocSmallJson();
  47262 
  47263   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47264   ck_assert_ptr_ne(r2, null);
  47265   r = getNDupSSmallJsonG(self, null, "1");
  47266   ck_assert_ptr_ne(r, null);
  47267   ck_assert_str_eq(r, "qwe");
  47268   free(r);
  47269   terminateO(self);
  47270 
  47271 }
  47272 
  47273 
  47274 void getNDupDictSmallJsonGT(CuTest *tc UNUSED) {
  47275 
  47276   smallJsont* r2;
  47277   smallDictt*      r;
  47278   smallJsont *self = allocSmallJson();
  47279   smallDictt *dict = allocSmallDict();
  47280 
  47281   r2 = self->f->setNFreeDict(self, "1", dict);
  47282   ck_assert_ptr_ne(r2, null);
  47283   r = getNDupDictSmallJsonG(self, null, "1");
  47284   ck_assert_ptr_ne(r, null);
  47285   char *s = toStringO(r);
  47286   terminateO(r);
  47287   ck_assert_str_eq(s, "{}");
  47288   free(s);
  47289   terminateO(self);
  47290 
  47291 }
  47292 
  47293 
  47294 void getNDupArraySmallJsonGT(CuTest *tc UNUSED) {
  47295 
  47296   smallArrayt*     r;
  47297   smallJsont *self   = allocSmallJson();
  47298   smallArrayt *array = allocSmallArray();
  47299 
  47300   smallJsont *r2 = self->f->setNFreeArray(self, "1", array);
  47301   ck_assert_ptr_ne(r2, null);
  47302   r = getNDupArraySmallJsonG(self, null, "1");
  47303   ck_assert_ptr_ne(r, null);
  47304   char *s = toStringO(r);
  47305   terminateO(r);
  47306   ck_assert_str_eq(s, "[]");
  47307   free(s);
  47308   terminateO(self);
  47309 
  47310 }
  47311 
  47312 
  47313 void getNDupSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  47314 
  47315   smallBoolt*      r;
  47316   smallJsont *self = allocSmallJson();
  47317 
  47318   smallJsont *r2 = self->f->setBool(self, "1", true);
  47319   ck_assert_ptr_ne(r2, null);
  47320   r = getNDupSmallBoolSmallJsonG(self, null, "1");
  47321   ck_assert_ptr_ne(r, null);
  47322   char *s = toStringO(r);
  47323   terminateO(r);
  47324   ck_assert_str_eq(s, "true");
  47325   free(s);
  47326   terminateO(self);
  47327 
  47328 }
  47329 
  47330 
  47331 void getNDupSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  47332 
  47333   smallBytest*     r;
  47334   smallJsont *self   = allocSmallJson();
  47335   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  47336 
  47337   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "1", value);
  47338   ck_assert_ptr_ne(r2, null);
  47339   r = getNDupSmallBytesSmallJsonG(self, null, "1");
  47340   ck_assert_ptr_ne(r, null);
  47341   char *s = toStringO(r);
  47342   terminateO(r);
  47343   ck_assert_str_eq(s, "[0x71,0x77,0x65,0x00]");
  47344   free(s);
  47345   terminateO(self);
  47346 
  47347 }
  47348 
  47349 
  47350 void getNDupSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47351 
  47352   smallDoublet*    r;
  47353   smallJsont *self = allocSmallJson();
  47354 
  47355   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  47356   ck_assert_ptr_ne(r2, null);
  47357   r = getNDupSmallDoubleSmallJsonG(self, null, "1");
  47358   ck_assert_ptr_ne(r, null);
  47359   char *s = toStringO(r);
  47360   terminateO(r);
  47361   ck_assert_str_eq(s, "2.200000e+00");
  47362   free(s);
  47363   terminateO(self);
  47364 
  47365 }
  47366 
  47367 
  47368 void getNDupSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  47369 
  47370   smallIntt*       r;
  47371   smallJsont *self = allocSmallJson();
  47372 
  47373   smallJsont *r2 = self->f->setInt(self, "1", 2);
  47374   ck_assert_ptr_ne(r2, null);
  47375   r = getNDupSmallIntSmallJsonG(self, null, "1");
  47376   ck_assert_ptr_ne(r, null);
  47377   char *s = toStringO(r);
  47378   terminateO(r);
  47379   ck_assert_str_eq(s, "2");
  47380   free(s);
  47381   terminateO(self);
  47382 
  47383 }
  47384 
  47385 
  47386 void getNDupSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  47387 
  47388   smallJsont*      r;
  47389   smallJsont *self  = allocSmallJson();
  47390   smallJsont *value = allocSmallJson();
  47391 
  47392   setTopIntO(value, 2);
  47393   smallJsont *r2 = self->f->setNFreeSmallJson(self, "1", value);
  47394   ck_assert_ptr_ne(r2, null);
  47395   r = getNDupSmallJsonSmallJsonG(self, null, "1");
  47396   ck_assert_ptr_ne(r, null);
  47397   char *s = toStringO(r);
  47398   terminateO(r);
  47399   ck_assert_str_eq(s, "2");
  47400   free(s);
  47401   terminateO(self);
  47402 
  47403 }
  47404 
  47405 
  47406 void getNDupSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  47407 
  47408   smallStringt*    r;
  47409   smallJsont *self = allocSmallJson();
  47410 
  47411   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  47412   ck_assert_ptr_ne(r2, null);
  47413   r = getNDupSmallStringSmallJsonG(self, null, "1");
  47414   ck_assert_ptr_ne(r, null);
  47415   char *s = toStringO(r);
  47416   terminateO(r);
  47417   ck_assert_str_eq(s, "qwe");
  47418   free(s);
  47419   terminateO(self);
  47420 
  47421 }
  47422 
  47423 
  47424 void getNDupVoidSmallJsonGT(CuTest *tc UNUSED) {
  47425 
  47426   void*            r;
  47427   smallJsont *self = allocSmallJson();
  47428 
  47429   createSmallContainer(c);
  47430   setValO(&c, &r);
  47431   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47432   ck_assert_ptr_ne(r2, null);
  47433   r = getNDupVoidSmallJsonG(self, null, "1");
  47434   ck_assert_ptr_eq(r, null);
  47435   terminateO(self);
  47436 
  47437 }
  47438 
  47439 
  47440 void getNDupSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  47441 
  47442   smallContainert* r;
  47443   smallJsont *self = allocSmallJson();
  47444 
  47445   createSmallContainer(c);
  47446   setValO(&c, &r);
  47447   smallJsont *r2 = self->f->setSmallContainer(self, "1", &c);
  47448   ck_assert_ptr_ne(r2, null);
  47449   r = getNDupSmallContainerSmallJsonG(self, null, "1");
  47450   ck_assert_ptr_ne(r, null);
  47451   char *s = toStringO(r);
  47452   terminateO(r);
  47453   ck_assert_str_eq(s, "<data smallContainer>");
  47454   free(s);
  47455   terminateO(self);
  47456 
  47457 }
  47458 
  47459 
  47460 void getAtSmallJsonGT(CuTest *tc UNUSED) {
  47461 
  47462   baset*           r;
  47463   smallJsont *self = allocSmallJson();
  47464 
  47465   smallJsont *r2   = self->f->pushInt(self, 1);
  47466   ck_assert_ptr_ne(r2, null);
  47467   r = getAtSmallJsonG(self, NULL, 0);
  47468   ck_assert_ptr_ne(r, null);
  47469   char *s = toStringO(r);
  47470   finishO(r);
  47471   ck_assert_str_eq(s, "1");
  47472   free(s);
  47473   terminateO(self);
  47474 
  47475 }
  47476 
  47477 
  47478 void getAtUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  47479 
  47480   undefinedt*      r;
  47481   smallJsont *self = allocSmallJson();
  47482 
  47483   smallJsont *r2   = self->f->pushUndefined(self);
  47484   ck_assert_ptr_ne(r2, null);
  47485   r = getAtUndefinedSmallJsonG(self, null, 0);
  47486   ck_assert_ptr_ne(r, null);
  47487   char *s = toStringO(r);
  47488   finishO(r);
  47489   ck_assert_str_eq(s, "null");
  47490   free(s);
  47491   terminateO(self);
  47492 
  47493 }
  47494 
  47495 
  47496 void getAtBoolSmallJsonGT(CuTest *tc UNUSED) {
  47497 
  47498   bool             r;
  47499   smallJsont *self = allocSmallJson();
  47500 
  47501   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47502   ck_assert_ptr_ne(r2, null);
  47503   r = getAtBoolSmallJsonG(self, null, 0);
  47504   ck_assert(r);
  47505   terminateO(self);
  47506 
  47507 }
  47508 
  47509 
  47510 void getAtBoolPSmallJsonGT(CuTest *tc UNUSED) {
  47511 
  47512   bool*            r;
  47513   smallJsont *self = allocSmallJson();
  47514 
  47515   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47516   ck_assert_ptr_ne(r2, null);
  47517   r = getAtBoolPSmallJsonG(self, null, 0);
  47518   ck_assert_ptr_ne(r, null);
  47519   ck_assert(*r);
  47520   terminateO(self);
  47521 
  47522 }
  47523 
  47524 
  47525 void getAtDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47526 
  47527   double           r;
  47528   smallJsont *self = allocSmallJson();
  47529 
  47530   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47531   ck_assert_ptr_ne(r2, null);
  47532   r = getAtDoubleSmallJsonG(self, 0, 0);
  47533   ck_assert(r==2.0);
  47534   terminateO(self);
  47535 
  47536 }
  47537 
  47538 
  47539 void getAtDoublePSmallJsonGT(CuTest *tc UNUSED) {
  47540 
  47541   double*          r;
  47542   smallJsont *self = allocSmallJson();
  47543 
  47544   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47545   ck_assert_ptr_ne(r2, null);
  47546   r = getAtDoublePSmallJsonG(self, 0, 0);
  47547   ck_assert_ptr_ne(r, null);
  47548   ck_assert(*r==2.0);
  47549   terminateO(self);
  47550 
  47551 }
  47552 
  47553 
  47554 void getAtIntSmallJsonGT(CuTest *tc UNUSED) {
  47555 
  47556   int64_t          r;
  47557   smallJsont *self = allocSmallJson();
  47558 
  47559   smallJsont *r2   = self->f->pushInt(self, 2);
  47560   ck_assert_ptr_ne(r2, null);
  47561   r = getAtIntSmallJsonG(self, 0, 0);
  47562   ck_assert_int_eq(r, 2);
  47563   terminateO(self);
  47564 
  47565 }
  47566 
  47567 
  47568 void getAtIntPSmallJsonGT(CuTest *tc UNUSED) {
  47569 
  47570   int64_t*         r;
  47571   smallJsont *self = allocSmallJson();
  47572 
  47573   smallJsont *r2   = self->f->pushInt(self, 2);
  47574   ck_assert_ptr_ne(r2, null);
  47575   r = getAtIntPSmallJsonG(self, 0, 0);
  47576   ck_assert_ptr_ne(r, null);
  47577   ck_assert_int_eq(*r, 2);
  47578   terminateO(self);
  47579 
  47580 }
  47581 
  47582 
  47583 void getAtInt32SmallJsonGT(CuTest *tc UNUSED) {
  47584 
  47585   int32_t          r;
  47586   smallJsont *self = allocSmallJson();
  47587 
  47588   smallJsont *r2   = self->f->pushInt(self, 2);
  47589   ck_assert_ptr_ne(r2, null);
  47590   r = getAtInt32SmallJsonG(self, 0, 0);
  47591   ck_assert_int_eq(r, 2);
  47592   terminateO(self);
  47593 
  47594 }
  47595 
  47596 
  47597 void getAtInt32PSmallJsonGT(CuTest *tc UNUSED) {
  47598 
  47599   int32_t*         r;
  47600   smallJsont *self = allocSmallJson();
  47601 
  47602   smallJsont *r2   = self->f->pushInt(self, 2);
  47603   ck_assert_ptr_ne(r2, null);
  47604   r = getAtInt32PSmallJsonG(self, 0, 0);
  47605   ck_assert_ptr_ne(r, null);
  47606   ck_assert_int_eq(*r, 2);
  47607   terminateO(self);
  47608 
  47609 }
  47610 
  47611 
  47612 void getAtUintSmallJsonGT(CuTest *tc UNUSED) {
  47613 
  47614   uint64_t         r;
  47615   smallJsont *self = allocSmallJson();
  47616 
  47617   smallJsont *r2   = self->f->pushInt(self, 2);
  47618   ck_assert_ptr_ne(r2, null);
  47619   r = getAtUintSmallJsonG(self, 0, 0);
  47620   ck_assert_int_eq(r, 2);
  47621   terminateO(self);
  47622 
  47623 }
  47624 
  47625 
  47626 void getAtUintPSmallJsonGT(CuTest *tc UNUSED) {
  47627 
  47628   uint64_t*        r;
  47629   smallJsont *self = allocSmallJson();
  47630 
  47631   smallJsont *r2   = self->f->pushInt(self, 2);
  47632   ck_assert_ptr_ne(r2, null);
  47633   r = getAtUintPSmallJsonG(self, 0, 0);
  47634   ck_assert_ptr_ne(r, null);
  47635   ck_assert_int_eq(*r, 2);
  47636   terminateO(self);
  47637 
  47638 }
  47639 
  47640 
  47641 void getAtUint32SmallJsonGT(CuTest *tc UNUSED) {
  47642 
  47643   uint32_t         r;
  47644   smallJsont *self = allocSmallJson();
  47645 
  47646   smallJsont *r2   = self->f->pushInt(self, 2);
  47647   ck_assert_ptr_ne(r2, null);
  47648   r = getAtUint32SmallJsonG(self, 0, 0);
  47649   ck_assert_int_eq(r, 2);
  47650   terminateO(self);
  47651 
  47652 }
  47653 
  47654 
  47655 void getAtUint32PSmallJsonGT(CuTest *tc UNUSED) {
  47656 
  47657   uint32_t*        r;
  47658   smallJsont *self = allocSmallJson();
  47659 
  47660   smallJsont *r2   = self->f->pushInt(self, 2);
  47661   ck_assert_ptr_ne(r2, null);
  47662   r = getAtUint32PSmallJsonG(self, 0, 0);
  47663   ck_assert_ptr_ne(r, null);
  47664   ck_assert_int_eq(*r, 2);
  47665   terminateO(self);
  47666 
  47667 }
  47668 
  47669 
  47670 void getAtSSmallJsonGT(CuTest *tc UNUSED) {
  47671 
  47672   char*            r;
  47673   smallJsont *self = allocSmallJson();
  47674 
  47675   smallJsont *r2   = self->f->pushS(self, "2");
  47676   ck_assert_ptr_ne(r2, null);
  47677   r = getAtSSmallJsonG(self, null, 0);
  47678   ck_assert_str_eq(r, "2");
  47679   terminateO(self);
  47680 
  47681 }
  47682 
  47683 
  47684 void getAtDictSmallJsonGT(CuTest *tc UNUSED) {
  47685 
  47686   smallDictt*      r;
  47687   smallJsont *self = allocSmallJson();
  47688 
  47689   createSmallDict(d);
  47690   smallJsont *r2   = self->f->pushDict(self, &d);
  47691   ck_assert_ptr_ne(r2, null);
  47692   r = getAtDictSmallJsonG(self, null, 0);
  47693   ck_assert_ptr_ne(r, null);
  47694   char *s = toStringO(r);
  47695   ck_assert_str_eq(s, "{}");
  47696   free(s);
  47697   finishO(r);
  47698   terminateO(self);
  47699 
  47700 }
  47701 
  47702 
  47703 void getAtArraySmallJsonGT(CuTest *tc UNUSED) {
  47704 
  47705   smallArrayt*     r;
  47706   smallJsont *self = allocSmallJson();
  47707 
  47708   createSmallArray(a);
  47709   smallJsont *r2   = self->f->pushArray(self, &a);
  47710   ck_assert_ptr_ne(r2, null);
  47711   r = getAtArraySmallJsonG(self, null, 0);
  47712   ck_assert_ptr_ne(r, null);
  47713   char *s = toStringO(r);
  47714   ck_assert_str_eq(s, "[]");
  47715   free(s);
  47716   finishO(r);
  47717   terminateO(self);
  47718 
  47719 }
  47720 
  47721 
  47722 void getAtSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  47723 
  47724   smallBoolt*      r;
  47725   smallJsont *self = allocSmallJson();
  47726 
  47727   smallJsont *r2   = self->f->pushBool(self, true);
  47728   ck_assert_ptr_ne(r2, null);
  47729   r = getAtSmallBoolSmallJsonG(self, null, 0);
  47730   ck_assert_ptr_ne(r, null);
  47731   char *s = toStringO(r);
  47732   ck_assert_str_eq(s, "true");
  47733   free(s);
  47734   finishO(r);
  47735   terminateO(self);
  47736 
  47737 }
  47738 
  47739 
  47740 void getAtSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  47741 
  47742   smallBytest*      r;
  47743   smallJsont *self = allocSmallJson();
  47744 
  47745   createSmallBytes(b);
  47746   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  47747   ck_assert_ptr_ne(r2, null);
  47748   r = getAtSmallBytesSmallJsonG(self, null, 0);
  47749   ck_assert_ptr_ne(r, null);
  47750   char *s = toStringO(r);
  47751   ck_assert_str_eq(s, "[]");
  47752   free(s);
  47753   finishO(r);
  47754   terminateO(self);
  47755 
  47756 }
  47757 
  47758 
  47759 void getAtSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47760 
  47761   smallDoublet*    r;
  47762   smallJsont *self = allocSmallJson();
  47763 
  47764   smallJsont *r2   = self->f->pushDouble(self, 1);
  47765   ck_assert_ptr_ne(r2, null);
  47766   r = getAtSmallDoubleSmallJsonG(self, null, 0);
  47767   ck_assert_ptr_ne(r, null);
  47768   char *s = toStringO(r);
  47769   ck_assert_str_eq(s, "1.000000e+00");
  47770   free(s);
  47771   finishO(r);
  47772   terminateO(self);
  47773 
  47774 }
  47775 
  47776 
  47777 void getAtSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  47778 
  47779   smallIntt*       r;
  47780   smallJsont *self = allocSmallJson();
  47781 
  47782   smallJsont *r2   = self->f->pushInt(self, 1);
  47783   ck_assert_ptr_ne(r2, null);
  47784   r = getAtSmallIntSmallJsonG(self, null, 0);
  47785   ck_assert_ptr_ne(r, null);
  47786   char *s = toStringO(r);
  47787   ck_assert_str_eq(s, "1");
  47788   free(s);
  47789   finishO(r);
  47790   terminateO(self);
  47791 
  47792 }
  47793 
  47794 
  47795 void getAtSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  47796 
  47797   smallJsont* r;
  47798   smallJsont *self = allocSmallJson();
  47799 
  47800   createSmallJson(j);
  47801   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  47802   ck_assert_ptr_ne(r2, null);
  47803   r = getAtSmallJsonSmallJsonG(self, null, 0);
  47804   ck_assert_ptr_ne(r, null);
  47805   char *s = toStringO(r);
  47806   ck_assert_str_eq(s, "{}");
  47807   free(s);
  47808   finishO(r);
  47809   terminateO(self);
  47810 
  47811 }
  47812 
  47813 
  47814 void getAtSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  47815 
  47816   smallStringt*    r;
  47817   smallJsont *self = allocSmallJson();
  47818 
  47819   createSmallString(S);
  47820   smallJsont *r2   = self->f->pushSmallString(self, &S);
  47821   ck_assert_ptr_ne(r2, null);
  47822   r = getAtSmallStringSmallJsonG(self, null, 0);
  47823   ck_assert_ptr_ne(r, null);
  47824   char *s = toStringO(r);
  47825   ck_assert_str_eq(s, "");
  47826   free(s);
  47827   finishO(r);
  47828   terminateO(self);
  47829 
  47830 }
  47831 
  47832 
  47833 void getAtVoidSmallJsonGT(CuTest *tc UNUSED) {
  47834 
  47835   void*            r;
  47836   smallJsont *self = allocSmallJson();
  47837 
  47838   createSmallContainer(c);
  47839   setValO(&c, &r);
  47840   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  47841   ck_assert_ptr_ne(r2, null);
  47842   r = getAtVoidSmallJsonG(self, null, 0);
  47843   ck_assert_ptr_eq(r, &r);
  47844   terminateO(self);
  47845 
  47846 }
  47847 
  47848 
  47849 void getAtSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  47850 
  47851   smallContainert* r;
  47852   smallJsont *self = allocSmallJson();
  47853 
  47854   createSmallContainer(c);
  47855   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  47856   ck_assert_ptr_ne(r2, null);
  47857   r = getAtSmallContainerSmallJsonG(self, null, 0);
  47858   ck_assert_ptr_ne(r, null);
  47859   char *s = toStringO(r);
  47860   ck_assert_str_eq(s, "<data smallContainer>");
  47861   free(s);
  47862   finishO(r);
  47863   terminateO(self);
  47864 
  47865 }
  47866 
  47867 
  47868 void getAtNDupSmallJsonGT(CuTest *tc UNUSED) {
  47869 
  47870   baset*           r;
  47871   smallJsont *self = allocSmallJson();
  47872 
  47873   smallJsont *r2   = self->f->pushInt(self, 1);
  47874   ck_assert_ptr_ne(r2, null);
  47875   r = getAtNDupSmallJsonG(self, NULL, 0);
  47876   ck_assert_ptr_ne(r, null);
  47877   char *s = toStringO(r);
  47878   terminateO(r);
  47879   ck_assert_str_eq(s, "1");
  47880   free(s);
  47881   terminateO(self);
  47882 
  47883 }
  47884 
  47885 
  47886 void getAtNDupUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  47887 
  47888   undefinedt*      r;
  47889   smallJsont *self = allocSmallJson();
  47890 
  47891   smallJsont *r2   = self->f->pushUndefined(self);
  47892   ck_assert_ptr_ne(r2, null);
  47893   r = getAtNDupUndefinedSmallJsonG(self, null, 0);
  47894   ck_assert_ptr_ne(r, null);
  47895   char *s = toStringO(r);
  47896   terminateO(r);
  47897   ck_assert_str_eq(s, "null");
  47898   free(s);
  47899   terminateO(self);
  47900 
  47901 }
  47902 
  47903 
  47904 void getAtNDupBoolSmallJsonGT(CuTest *tc UNUSED) {
  47905 
  47906   bool             r;
  47907   smallJsont *self = allocSmallJson();
  47908 
  47909   smallJsont *r2   = self->f->pushBool(self, TRUE);
  47910   ck_assert_ptr_ne(r2, null);
  47911   r = getAtNDupBoolSmallJsonG(self, null, 0);
  47912   ck_assert(r);
  47913   terminateO(self);
  47914 
  47915 }
  47916 
  47917 
  47918 void getAtNDupDoubleSmallJsonGT(CuTest *tc UNUSED) {
  47919 
  47920   double           r;
  47921   smallJsont *self = allocSmallJson();
  47922 
  47923   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  47924   ck_assert_ptr_ne(r2, null);
  47925   r = getAtNDupDoubleSmallJsonG(self, 0, 0);
  47926   ck_assert(r==2.0);
  47927   terminateO(self);
  47928 
  47929 }
  47930 
  47931 
  47932 void getAtNDupIntSmallJsonGT(CuTest *tc UNUSED) {
  47933 
  47934   int64_t          r;
  47935   smallJsont *self = allocSmallJson();
  47936 
  47937   smallJsont *r2   = self->f->pushInt(self, 2);
  47938   ck_assert_ptr_ne(r2, null);
  47939   r = getAtNDupIntSmallJsonG(self, 0, 0);
  47940   ck_assert_int_eq(r, 2);
  47941   terminateO(self);
  47942 
  47943 }
  47944 
  47945 
  47946 void getAtNDupInt32SmallJsonGT(CuTest *tc UNUSED) {
  47947 
  47948   int32_t          r;
  47949   smallJsont *self = allocSmallJson();
  47950 
  47951   smallJsont *r2   = self->f->pushInt(self, 2);
  47952   ck_assert_ptr_ne(r2, null);
  47953   r = getAtNDupInt32SmallJsonG(self, 0, 0);
  47954   ck_assert_int_eq(r, 2);
  47955   terminateO(self);
  47956 
  47957 }
  47958 
  47959 
  47960 void getAtNDupUintSmallJsonGT(CuTest *tc UNUSED) {
  47961 
  47962   uint64_t         r;
  47963   smallJsont *self = allocSmallJson();
  47964 
  47965   smallJsont *r2   = self->f->pushInt(self, 2);
  47966   ck_assert_ptr_ne(r2, null);
  47967   r = getAtNDupUintSmallJsonG(self, 0, 0);
  47968   ck_assert_int_eq(r, 2);
  47969   terminateO(self);
  47970 
  47971 }
  47972 
  47973 
  47974 void getAtNDupUint32SmallJsonGT(CuTest *tc UNUSED) {
  47975 
  47976   uint32_t         r;
  47977   smallJsont *self = allocSmallJson();
  47978 
  47979   smallJsont *r2   = self->f->pushInt(self, 2);
  47980   ck_assert_ptr_ne(r2, null);
  47981   r = getAtNDupUint32SmallJsonG(self, 0, 0);
  47982   ck_assert_int_eq(r, 2);
  47983   terminateO(self);
  47984 
  47985 }
  47986 
  47987 
  47988 void getAtNDupSSmallJsonGT(CuTest *tc UNUSED) {
  47989 
  47990   char*            r;
  47991   smallJsont *self = allocSmallJson();
  47992 
  47993   smallJsont *r2   = self->f->pushS(self, "2");
  47994   ck_assert_ptr_ne(r2, null);
  47995   r = getAtNDupSSmallJsonG(self, null, 0);
  47996   ck_assert_str_eq(r, "2");
  47997   free(r);
  47998   terminateO(self);
  47999 
  48000 }
  48001 
  48002 
  48003 void getAtNDupDictSmallJsonGT(CuTest *tc UNUSED) {
  48004 
  48005   smallDictt*      r;
  48006   smallJsont *self = allocSmallJson();
  48007 
  48008   createSmallDict(d);
  48009   smallJsont *r2   = self->f->pushDict(self, &d);
  48010   ck_assert_ptr_ne(r2, null);
  48011   r = getAtNDupDictSmallJsonG(self, null, 0);
  48012   ck_assert_ptr_ne(r, null);
  48013   char *s = toStringO(r);
  48014   ck_assert_str_eq(s, "{}");
  48015   free(s);
  48016   terminateO(r);
  48017   terminateO(self);
  48018 
  48019 }
  48020 
  48021 
  48022 void getAtNDupArraySmallJsonGT(CuTest *tc UNUSED) {
  48023 
  48024   smallArrayt*     r;
  48025   smallJsont *self = allocSmallJson();
  48026 
  48027   createSmallArray(a);
  48028   smallJsont *r2   = self->f->pushArray(self, &a);
  48029   ck_assert_ptr_ne(r2, null);
  48030   r = getAtNDupArraySmallJsonG(self, null, 0);
  48031   ck_assert_ptr_ne(r, null);
  48032   char *s = toStringO(r);
  48033   ck_assert_str_eq(s, "[]");
  48034   free(s);
  48035   terminateO(r);
  48036   terminateO(self);
  48037 
  48038 }
  48039 
  48040 
  48041 void getAtNDupSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  48042 
  48043   smallBoolt*      r;
  48044   smallJsont *self = allocSmallJson();
  48045 
  48046   smallJsont *r2   = self->f->pushBool(self, true);
  48047   ck_assert_ptr_ne(r2, null);
  48048   r = getAtNDupSmallBoolSmallJsonG(self, null, 0);
  48049   ck_assert_ptr_ne(r, null);
  48050   char *s = toStringO(r);
  48051   ck_assert_str_eq(s, "true");
  48052   free(s);
  48053   terminateO(r);
  48054   terminateO(self);
  48055 
  48056 }
  48057 
  48058 
  48059 void getAtNDupSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  48060 
  48061   smallBytest*      r;
  48062   smallJsont *self = allocSmallJson();
  48063 
  48064   createSmallBytes(b);
  48065   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  48066   ck_assert_ptr_ne(r2, null);
  48067   r = getAtNDupSmallBytesSmallJsonG(self, null, 0);
  48068   ck_assert_ptr_ne(r, null);
  48069   char *s = toStringO(r);
  48070   ck_assert_str_eq(s, "[]");
  48071   free(s);
  48072   terminateO(r);
  48073   terminateO(self);
  48074 
  48075 }
  48076 
  48077 
  48078 void getAtNDupSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  48079 
  48080   smallDoublet*    r;
  48081   smallJsont *self = allocSmallJson();
  48082 
  48083   smallJsont *r2   = self->f->pushDouble(self, 1);
  48084   ck_assert_ptr_ne(r2, null);
  48085   r = getAtNDupSmallDoubleSmallJsonG(self, null, 0);
  48086   ck_assert_ptr_ne(r, null);
  48087   char *s = toStringO(r);
  48088   ck_assert_str_eq(s, "1.000000e+00");
  48089   free(s);
  48090   terminateO(r);
  48091   terminateO(self);
  48092 
  48093 }
  48094 
  48095 
  48096 void getAtNDupSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  48097 
  48098   smallIntt*       r;
  48099   smallJsont *self = allocSmallJson();
  48100 
  48101   smallJsont *r2   = self->f->pushInt(self, 1);
  48102   ck_assert_ptr_ne(r2, null);
  48103   r = getAtNDupSmallIntSmallJsonG(self, null, 0);
  48104   ck_assert_ptr_ne(r, null);
  48105   char *s = toStringO(r);
  48106   ck_assert_str_eq(s, "1");
  48107   free(s);
  48108   terminateO(r);
  48109   terminateO(self);
  48110 
  48111 }
  48112 
  48113 
  48114 void getAtNDupSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  48115 
  48116   smallJsont*      r;
  48117   smallJsont *self = allocSmallJson();
  48118 
  48119   createSmallJson(j);
  48120   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  48121   ck_assert_ptr_ne(r2, null);
  48122   r = getAtNDupSmallJsonSmallJsonG(self, null, 0);
  48123   ck_assert_ptr_ne(r, null);
  48124   char *s = toStringO(r);
  48125   ck_assert_str_eq(s, "{}");
  48126   free(s);
  48127   terminateO(r);
  48128   terminateO(self);
  48129 
  48130 }
  48131 
  48132 
  48133 void getAtNDupSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  48134 
  48135   smallStringt*    r;
  48136   smallJsont *self = allocSmallJson();
  48137 
  48138   createSmallString(S);
  48139   smallJsont *r2   = self->f->pushSmallString(self, &S);
  48140   ck_assert_ptr_ne(r2, null);
  48141   r = getAtNDupSmallStringSmallJsonG(self, null, 0);
  48142   ck_assert_ptr_ne(r, null);
  48143   char *s = toStringO(r);
  48144   ck_assert_str_eq(s, "");
  48145   free(s);
  48146   terminateO(r);
  48147   terminateO(self);
  48148 
  48149 }
  48150 
  48151 
  48152 void getAtNDupVoidSmallJsonGT(CuTest *tc UNUSED) {
  48153 
  48154   void*            r;
  48155   smallJsont *self = allocSmallJson();
  48156 
  48157   createSmallContainer(c);
  48158   setValO(&c, &r);
  48159   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  48160   ck_assert_ptr_ne(r2, null);
  48161   r = getAtNDupVoidSmallJsonG(self, null, 0);
  48162   ck_assert_ptr_eq(r, NULL);
  48163   terminateO(self);
  48164 
  48165 }
  48166 
  48167 
  48168 void getAtNDupSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  48169 
  48170   smallContainert* r;
  48171   smallJsont *self = allocSmallJson();
  48172 
  48173   createSmallContainer(c);
  48174   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  48175   ck_assert_ptr_ne(r2, null);
  48176   r = getAtNDupSmallContainerSmallJsonG(self, null, 0);
  48177   ck_assert_ptr_ne(r, null);
  48178   char *s = toStringO(r);
  48179   ck_assert_str_eq(s, "<data smallContainer>");
  48180   free(s);
  48181   terminateO(r);
  48182   terminateO(self);
  48183 
  48184 }
  48185 
  48186 
  48187 void getNumSmallJsonGT(CuTest *tc UNUSED) {
  48188 
  48189   double r;
  48190   smallJsont *self = allocSmallJson();
  48191   smallJsont *r2;
  48192 
  48193   r2 = self->f->setInt(self, "1", 1);
  48194   ck_assert_ptr_ne(r2, null);
  48195   r2 = self->f->setDouble(self, "2", 2.2);
  48196   ck_assert_ptr_ne(r2, null);
  48197   r2 = self->f->setS(self, "3", "2");
  48198   ck_assert_ptr_ne(r2, null);
  48199   r = getNumSmallJsonG(self, "1");
  48200   ck_assert(r == 1);
  48201   r = getNumSmallJsonG(self, "2");
  48202   ck_assert(r == 2.2);
  48203   terminateO(self);
  48204 
  48205 }
  48206 
  48207 
  48208 void getNumAtSmallJsonGT(CuTest *tc UNUSED) {
  48209 
  48210   double r;
  48211   smallJsont *self = allocSmallJson();
  48212   smallJsont *r2;
  48213 
  48214   r2 = self->f->pushDouble(self, 1);
  48215   ck_assert_ptr_ne(r2, NULL);
  48216   r  = getNumAtSmallJsonG(self, 0);
  48217   ck_assert(r==1);
  48218   terminateO(self);
  48219 
  48220 }
  48221 
  48222 
  48223 void delKeySmallJsonGT(CuTest *tc UNUSED) {
  48224 
  48225   smallJsont* r;
  48226   smallJsont *self = allocG(rtSmallJsont);
  48227 
  48228   r = self->f->setInt(self, "1", 1);
  48229   ck_assert_ptr_ne(r, null);
  48230   r = self->f->setDouble(self, "2", 2.2);
  48231   ck_assert_ptr_ne(r, null);
  48232   r = delKeySmallJsonG(self, "2", 0);
  48233   ck_assert_ptr_ne(r, null);
  48234   char *s = toStringO(r);
  48235   ck_assert_str_eq(s, "{\"1\":1}");
  48236   free(s);
  48237   terminateO(self);
  48238 
  48239 }
  48240 
  48241 
  48242 void delSmallJsonGT(CuTest *tc UNUSED) {
  48243 
  48244   smallJsont* r;
  48245   smallJsont *self = allocSmallJson();
  48246 
  48247   r = self->f->pushInt(self, 1);
  48248   ck_assert_ptr_ne(r, null);
  48249   r = self->f->pushInt(self, 2);
  48250   ck_assert_ptr_ne(r, null);
  48251   r = self->f->pushInt(self, 3);
  48252   ck_assert_ptr_ne(r, null);
  48253   r = self->f->pushInt(self, 4);
  48254   ck_assert_ptr_ne(r, null);
  48255   r = delSmallJsonG(self, 1, -1);
  48256   ck_assert_ptr_ne(r, null);
  48257   char *s = toStringO(r);
  48258   ck_assert_str_eq(s, "[1,4]");
  48259   free(s);
  48260   terminateO(self);
  48261 
  48262 }
  48263 
  48264 
  48265 void delElemSmallJsonGT(CuTest *tc UNUSED) {
  48266 
  48267   smallJsont* r;
  48268   smallJsont *self = allocG(rtSmallJsont);
  48269 
  48270   r = self->f->setInt(self, "1", 1);
  48271   ck_assert_ptr_ne(r, null);
  48272   r = self->f->setDouble(self, "2", 2.2);
  48273   ck_assert_ptr_ne(r, null);
  48274   r = delElemSmallJsonG(self, "2");
  48275   ck_assert_ptr_ne(r, null);
  48276   char *s = toStringO(r);
  48277   ck_assert_str_eq(s, "{\"1\":1}");
  48278   free(s);
  48279   terminateO(self);
  48280 
  48281 }
  48282 
  48283 
  48284 void delElemIndexSmallJsonGT(CuTest *tc UNUSED) {
  48285 
  48286   smallJsont* r;
  48287   smallJsont *self = allocSmallJson();
  48288 
  48289   r = self->f->pushInt(self, 1);
  48290   ck_assert_ptr_ne(r, null);
  48291   r = self->f->pushInt(self, 2);
  48292   ck_assert_ptr_ne(r, null);
  48293   r = self->f->pushInt(self, 3);
  48294   ck_assert_ptr_ne(r, null);
  48295   r = self->f->pushInt(self, 4);
  48296   ck_assert_ptr_ne(r, null);
  48297   r = delElemIndexSmallJsonG(self, 0);
  48298   ck_assert_ptr_ne(r, null);
  48299   char *s = toStringO(r);
  48300   ck_assert_str_eq(s, "[2,3,4]");
  48301   free(s);
  48302   r = delElemIndexSmallJsonG(self, -1);
  48303   ck_assert_ptr_ne(r, null);
  48304   s = toStringO(r);
  48305   ck_assert_str_eq(s, "[2,3]");
  48306   free(s);
  48307   r = delElemIndexSmallJsonG(self, 5);
  48308   ck_assert_ptr_eq(r, null);
  48309   r = delElemIndexSmallJsonG(self, -5);
  48310   ck_assert_ptr_eq(r, null);
  48311   terminateO(self);
  48312 
  48313 }
  48314 
  48315 
  48316 void prependSmallJsonGT(CuTest *tc UNUSED) {
  48317 
  48318   smallJsont* r;
  48319   smallJsont *self = allocSmallJson();
  48320   baset *value = (baset*) allocSmallInt(1);
  48321 
  48322   r = prependSmallJsonG(self, value);
  48323   ck_assert_ptr_ne(r, null);
  48324   finishO(value);
  48325   char *s = toStringO(r);
  48326   ck_assert_str_eq(s, "[1]");
  48327   free(s);
  48328   terminateO(self);
  48329 
  48330 }
  48331 
  48332 
  48333 void prependUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  48334 
  48335   smallJsont* r;
  48336   smallJsont *self = allocSmallJson();
  48337 
  48338   r = prependUndefinedSmallJsonG(self, NULL);
  48339   ck_assert_ptr_ne(r, null);
  48340   char *s = toStringO(r);
  48341   ck_assert_str_eq(s, "[null]");
  48342   free(s);
  48343   terminateO(self);
  48344 
  48345 }
  48346 
  48347 
  48348 void prependBoolSmallJsonGT(CuTest *tc UNUSED) {
  48349 
  48350   smallJsont* r;
  48351   smallJsont *self = allocSmallJson();
  48352 
  48353   r = prependBoolSmallJsonG(self, true);
  48354   ck_assert_ptr_ne(r, null);
  48355   char *s = toStringO(r);
  48356   ck_assert_str_eq(s, "[true]");
  48357   free(s);
  48358   terminateO(self);
  48359 
  48360 }
  48361 
  48362 
  48363 void prependDoubleSmallJsonGT(CuTest *tc UNUSED) {
  48364 
  48365   smallJsont* r;
  48366   smallJsont *self = allocSmallJson();
  48367 
  48368   r = prependDoubleSmallJsonG(self, 1);
  48369   ck_assert_ptr_ne(r, null);
  48370   char *s = toStringO(r);
  48371   ck_assert_str_eq(s, "[1.000000e+00]");
  48372   free(s);
  48373   terminateO(self);
  48374 
  48375 }
  48376 
  48377 
  48378 void prependIntSmallJsonGT(CuTest *tc UNUSED) {
  48379 
  48380   smallJsont* r;
  48381   smallJsont *self = allocSmallJson();
  48382 
  48383   r = prependIntSmallJsonG(self, 1);
  48384   ck_assert_ptr_ne(r, null);
  48385   char *s = toStringO(r);
  48386   ck_assert_str_eq(s, "[1]");
  48387   free(s);
  48388   terminateO(self);
  48389 
  48390 }
  48391 
  48392 
  48393 void prependSSmallJsonGT(CuTest *tc UNUSED) {
  48394 
  48395   smallJsont* r;
  48396   smallJsont *self = allocSmallJson();
  48397 
  48398   r = prependSSmallJsonG(self, "qwe");
  48399   ck_assert_ptr_ne(r, null);
  48400   char *s = toStringO(r);
  48401   ck_assert_str_eq(s, "[\"qwe\"]");
  48402   free(s);
  48403   terminateO(self);
  48404 
  48405 }
  48406 
  48407 
  48408 void prependCharSmallJsonGT(CuTest *tc UNUSED) {
  48409 
  48410   smallJsont* r;
  48411   smallJsont *self = allocSmallJson();
  48412 
  48413   r = prependCharSmallJsonG(self, 'Q');
  48414   ck_assert_ptr_ne(r, null);
  48415   char *s = toStringO(r);
  48416   ck_assert_str_eq(s, "[\"Q\"]");
  48417   free(s);
  48418   terminateO(self);
  48419 
  48420 }
  48421 
  48422 
  48423 void prependDictSmallJsonGT(CuTest *tc UNUSED) {
  48424 
  48425   smallJsont* r;
  48426   smallJsont *self = allocSmallJson();
  48427   smallDictt *dict  = allocSmallDict();
  48428 
  48429   r = prependDictSmallJsonG(self, dict);
  48430   ck_assert_ptr_ne(r, null);
  48431   finishO(dict);
  48432   char *s = toStringO(r);
  48433   ck_assert_str_eq(s, "[{}]");
  48434   free(s);
  48435   terminateO(self);
  48436 
  48437 }
  48438 
  48439 
  48440 void prependArraySmallJsonGT(CuTest *tc UNUSED) {
  48441 
  48442   smallJsont* r;
  48443   smallJsont *self  = allocSmallJson();
  48444   smallArrayt *array = allocSmallArray();
  48445 
  48446   r = prependArraySmallJsonG(self, array);
  48447   ck_assert_ptr_ne(r, null);
  48448   finishO(array);
  48449   char *s = toStringO(r);
  48450   ck_assert_str_eq(s, "[[]]");
  48451   free(s);
  48452   terminateO(self);
  48453 
  48454 }
  48455 
  48456 
  48457 void prependArraycSmallJsonGT(CuTest *tc UNUSED) {
  48458 
  48459   smallJsont* r;
  48460   smallJsont *self = allocSmallJson();
  48461   char **array      = listCreateS("a","bb");
  48462 
  48463   r = prependArraycSmallJsonG(self, array);
  48464   ck_assert_ptr_ne(r, null);
  48465   ck_assert_int_eq(lenO(r), 1);
  48466   listFreeS(array);
  48467   char *s = toStringO(r);
  48468   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48469   free(s);
  48470   terminateO(self);
  48471 
  48472 }
  48473 
  48474 
  48475 void prependCArraycSmallJsonGT(CuTest *tc UNUSED) {
  48476 
  48477   smallJsont* r;
  48478   smallJsont *self   = allocSmallJson();
  48479   const char *array[] = {"a", "bb", NULL};
  48480 
  48481   r = prependCArraycSmallJsonG(self, array);
  48482   ck_assert_ptr_ne(r, null);
  48483   ck_assert_int_eq(lenO(r), 1);
  48484   char *s = toStringO(r);
  48485   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48486   free(s);
  48487   terminateO(self);
  48488 
  48489 }
  48490 
  48491 
  48492 void prependVoidSmallJsonGT(CuTest *tc UNUSED) {
  48493 
  48494   smallJsont* r;
  48495   smallJsont *self = allocSmallJson();
  48496 
  48497   // NULL value
  48498   r = prependVoidSmallJsonG(self, NULL);
  48499   ck_assert_ptr_ne(r, null);
  48500   char *s = toStringO(r);
  48501   ck_assert_str_eq(s, "[null]");
  48502   free(s);
  48503   // value
  48504   r = prependVoidSmallJsonG(self, r);
  48505   s = toStringO(r);
  48506   ck_assert_str_eq(s, "[\"<data container>\",null]");
  48507   free(s);
  48508   terminateO(self);
  48509 
  48510 }
  48511 
  48512 
  48513 void prependSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  48514 
  48515   smallJsont* r;
  48516   smallJsont *self = allocSmallJson();
  48517   smallBoolt *value = allocSmallBool(true);
  48518 
  48519   r = prependSmallBoolSmallJsonG(self, value);
  48520   ck_assert_ptr_ne(r, null);
  48521   finishO(value);
  48522   char *s = toStringO(r);
  48523   ck_assert_str_eq(s, "[true]");
  48524   free(s);
  48525   terminateO(self);
  48526 
  48527 }
  48528 
  48529 
  48530 void prependSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  48531 
  48532   smallJsont* r;
  48533   smallJsont *self = allocSmallJson();
  48534   smallBytest *value = allocSmallBytes("qwe", 3);
  48535 
  48536   r = prependSmallBytesSmallJsonG(self, value);
  48537   ck_assert_ptr_ne(r, null);
  48538   finishO(value);
  48539   char *s = toStringO(r);
  48540   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  48541   free(s);
  48542   terminateO(self);
  48543 
  48544 }
  48545 
  48546 
  48547 void prependSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  48548 
  48549   smallJsont* r;
  48550   smallJsont *self = allocSmallJson();
  48551   smallDoublet *value = allocSmallDouble(1);
  48552 
  48553   r = prependSmallDoubleSmallJsonG(self, value);
  48554   ck_assert_ptr_ne(r, null);
  48555   finishO(value);
  48556   char *s = toStringO(r);
  48557   ck_assert_str_eq(s, "[1.000000e+00]");
  48558   free(s);
  48559   terminateO(self);
  48560 
  48561 }
  48562 
  48563 
  48564 void prependSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  48565 
  48566   smallJsont* r;
  48567   smallJsont *self = allocSmallJson();
  48568   smallIntt *value  = allocSmallInt(1);
  48569 
  48570   r = prependSmallIntSmallJsonG(self, value);
  48571   ck_assert_ptr_ne(r, null);
  48572   finishO(value);
  48573   char *s = toStringO(r);
  48574   ck_assert_str_eq(s, "[1]");
  48575   free(s);
  48576   terminateO(self);
  48577 
  48578 }
  48579 
  48580 
  48581 void prependSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  48582 
  48583   smallJsont* r;
  48584   smallJsont *self = allocSmallJson();
  48585   smallJsont *value = allocSmallJson();
  48586 
  48587   r = prependSmallJsonSmallJsonG(self, value);
  48588   ck_assert_ptr_ne(r, null);
  48589   finishO(value);
  48590   char *s = toStringO(r);
  48591   ck_assert_str_eq(s, "[{}]");
  48592   free(s);
  48593   terminateO(self);
  48594 
  48595 }
  48596 
  48597 
  48598 void prependSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  48599 
  48600   smallJsont* r;
  48601   smallJsont *self    = allocSmallJson();
  48602   smallStringt *string = allocSmallString("qwe");
  48603 
  48604   r = prependSmallStringSmallJsonG(self, string);
  48605   ck_assert_ptr_ne(r, null);
  48606   finishO(string);
  48607   char *s = toStringO(r);
  48608   ck_assert_str_eq(s, "[\"qwe\"]");
  48609   free(s);
  48610   terminateO(self);
  48611 
  48612 }
  48613 
  48614 
  48615 void prependSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  48616 
  48617   smallJsont* r;
  48618   smallJsont *self = allocSmallJson();
  48619 
  48620   createSmallContainer(c);
  48621   r = prependSmallContainerSmallJsonG(self, &c);
  48622   ck_assert_ptr_ne(r, null);
  48623   char *s = toStringO(r);
  48624   ck_assert_str_eq(s, "[\"<data container>\"]");
  48625   free(s);
  48626   terminateO(self);
  48627 
  48628 }
  48629 
  48630 
  48631 void prependNFreeSmallJsonGT(CuTest *tc UNUSED) {
  48632 
  48633   smallJsont* r;
  48634   smallJsont *self = allocSmallJson();
  48635   baset *value = (baset*) allocSmallInt(1);
  48636 
  48637   r = prependNFreeSmallJsonG(self, value);
  48638   ck_assert_ptr_ne(r, null);
  48639   char *s = toStringO(r);
  48640   ck_assert_str_eq(s, "[1]");
  48641   free(s);
  48642   terminateO(self);
  48643 
  48644 }
  48645 
  48646 
  48647 void prependNFreeUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  48648 
  48649   smallJsont* r;
  48650   smallJsont *self = allocSmallJson();
  48651   undefinedt *value = allocUndefined();
  48652 
  48653   r = prependNFreeUndefinedSmallJsonG(self, value);
  48654   ck_assert_ptr_ne(r, null);
  48655   char *s = toStringO(r);
  48656   ck_assert_str_eq(s, "[null]");
  48657   free(s);
  48658   terminateO(self);
  48659 
  48660 }
  48661 
  48662 
  48663 void prependNFreeSSmallJsonGT(CuTest *tc UNUSED) {
  48664 
  48665   smallJsont* r;
  48666   smallJsont *self = allocSmallJson();
  48667 
  48668   r = prependNFreeSSmallJsonG(self, strdup("qwe"));
  48669   ck_assert_ptr_ne(r, null);
  48670   char *s = toStringO(r);
  48671   ck_assert_str_eq(s, "[\"qwe\"]");
  48672   free(s);
  48673   terminateO(self);
  48674 
  48675 }
  48676 
  48677 
  48678 void prependNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  48679 
  48680   smallJsont* r;
  48681   smallJsont *self = allocSmallJson();
  48682   smallDictt *dict  = allocSmallDict();
  48683 
  48684   r = prependNFreeDictSmallJsonG(self, dict);
  48685   ck_assert_ptr_ne(r, null);
  48686   char *s = toStringO(r);
  48687   ck_assert_str_eq(s, "[{}]");
  48688   free(s);
  48689   terminateO(self);
  48690 
  48691 }
  48692 
  48693 
  48694 void prependNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  48695 
  48696   smallJsont* r;
  48697   smallJsont *self  = allocSmallJson();
  48698   smallArrayt *array = allocSmallArray();
  48699 
  48700   r = prependNFreeArraySmallJsonG(self, array);
  48701   ck_assert_ptr_ne(r, null);
  48702   char *s = toStringO(r);
  48703   ck_assert_str_eq(s, "[[]]");
  48704   free(s);
  48705   terminateO(self);
  48706 
  48707 }
  48708 
  48709 
  48710 void prependNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  48711 
  48712   smallJsont* r;
  48713   smallJsont *self = allocSmallJson();
  48714   char **array      = listCreateS("a","bb");
  48715 
  48716   r = prependNFreeArraycSmallJsonG(self, array);
  48717   ck_assert_ptr_ne(r, null);
  48718   ck_assert_int_eq(lenO(r), 1);
  48719   char *s = toStringO(r);
  48720   ck_assert_str_eq(s, "[[\"a\",\"bb\"]]");
  48721   free(s);
  48722   terminateO(self);
  48723 
  48724 }
  48725 
  48726 
  48727 void prependNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  48728 
  48729   smallJsont* r;
  48730   smallJsont *self = allocSmallJson();
  48731   smallBoolt *value = allocSmallBool(true);
  48732 
  48733   r = prependNFreeSmallBoolSmallJsonG(self, value);
  48734   ck_assert_ptr_ne(r, null);
  48735   char *s = toStringO(r);
  48736   ck_assert_str_eq(s, "[true]");
  48737   free(s);
  48738   terminateO(self);
  48739 
  48740 }
  48741 
  48742 
  48743 void prependNFreeSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  48744 
  48745   smallJsont* r;
  48746   smallJsont *self = allocSmallJson();
  48747   smallBytest *value = allocSmallBytes("qwe", 3);
  48748 
  48749   r = prependNFreeSmallBytesSmallJsonG(self, value);
  48750   ck_assert_ptr_ne(r, null);
  48751   char *s = toStringO(r);
  48752   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  48753   free(s);
  48754   terminateO(self);
  48755 
  48756 }
  48757 
  48758 
  48759 void prependNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  48760 
  48761   smallJsont* r;
  48762   smallJsont *self = allocSmallJson();
  48763   smallDoublet *value = allocSmallDouble(1);
  48764 
  48765   r = prependNFreeSmallDoubleSmallJsonG(self, value);
  48766   ck_assert_ptr_ne(r, null);
  48767   char *s = toStringO(r);
  48768   ck_assert_str_eq(s, "[1.000000e+00]");
  48769   free(s);
  48770   terminateO(self);
  48771 
  48772 }
  48773 
  48774 
  48775 void prependNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  48776 
  48777   smallJsont* r;
  48778   smallJsont *self = allocSmallJson();
  48779   smallIntt *value  = allocSmallInt(1);
  48780 
  48781   r = prependNFreeSmallIntSmallJsonG(self, value);
  48782   ck_assert_ptr_ne(r, null);
  48783   char *s = toStringO(r);
  48784   ck_assert_str_eq(s, "[1]");
  48785   free(s);
  48786   terminateO(self);
  48787 
  48788 }
  48789 
  48790 
  48791 void prependNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  48792 
  48793   smallJsont* r;
  48794   smallJsont *self = allocSmallJson();
  48795   smallJsont *value = allocSmallJson();
  48796 
  48797   r = prependNFreeSmallJsonSmallJsonG(self, value);
  48798   ck_assert_ptr_ne(r, null);
  48799   char *s = toStringO(r);
  48800   ck_assert_str_eq(s, "[{}]");
  48801   free(s);
  48802   terminateO(self);
  48803 
  48804 }
  48805 
  48806 
  48807 void prependNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  48808 
  48809   smallJsont* r;
  48810   smallJsont *self = allocSmallJson();
  48811   smallStringt *string = allocSmallString("qwe");
  48812 
  48813   r = prependNFreeSmallStringSmallJsonG(self, string);
  48814   ck_assert_ptr_ne(r, null);
  48815   char *s = toStringO(r);
  48816   ck_assert_str_eq(s, "[\"qwe\"]");
  48817   free(s);
  48818   terminateO(self);
  48819 
  48820 }
  48821 
  48822 
  48823 void prependNFreeSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  48824 
  48825   smallJsont* r;
  48826   smallJsont *self = allocSmallJson();
  48827 
  48828   createAllocateSmallContainer(c);
  48829   r = prependNFreeSmallContainerSmallJsonG(self, c);
  48830   ck_assert_ptr_ne(r, null);
  48831   char *s = toStringO(r);
  48832   ck_assert_str_eq(s, "[\"<data container>\"]");
  48833   free(s);
  48834   terminateO(self);
  48835 
  48836 }
  48837 
  48838 
  48839 void dequeueSmallJsonGT(CuTest *tc UNUSED) {
  48840 
  48841   baset*           r;
  48842   smallJsont *self = allocSmallJson();
  48843 
  48844   smallJsont *r2   = self->f->pushInt(self, 1);
  48845   ck_assert_ptr_ne(r2, null);
  48846   r = dequeueSmallJsonG(self, NULL);
  48847   ck_assert_ptr_ne(r, null);
  48848   char *s = toStringO(r);
  48849   terminateO(r);
  48850   ck_assert_str_eq(s, "1");
  48851   free(s);
  48852   terminateO(self);
  48853 
  48854 }
  48855 
  48856 
  48857 void dequeueUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  48858 
  48859   undefinedt*      r;
  48860   smallJsont *self = allocSmallJson();
  48861 
  48862   smallJsont *r2   = self->f->pushUndefined(self);
  48863   ck_assert_ptr_ne(r2, null);
  48864   r = dequeueUndefinedSmallJsonG(self, null);
  48865   ck_assert_ptr_ne(r, null);
  48866   char *s = toStringO(r);
  48867   terminateO(r);
  48868   ck_assert_str_eq(s, "null");
  48869   free(s);
  48870   terminateO(self);
  48871 
  48872 }
  48873 
  48874 
  48875 void dequeueBoolSmallJsonGT(CuTest *tc UNUSED) {
  48876 
  48877   bool             r;
  48878   smallJsont *self = allocSmallJson();
  48879 
  48880   smallJsont *r2   = self->f->pushBool(self, TRUE);
  48881   ck_assert_ptr_ne(r2, null);
  48882   r = dequeueBoolSmallJsonG(self, null);
  48883   ck_assert(r);
  48884   terminateO(self);
  48885 
  48886 }
  48887 
  48888 
  48889 void dequeueDoubleSmallJsonGT(CuTest *tc UNUSED) {
  48890 
  48891   double           r;
  48892   smallJsont *self = allocSmallJson();
  48893 
  48894   smallJsont *r2   = self->f->pushDouble(self, 2.0);
  48895   ck_assert_ptr_ne(r2, null);
  48896   r = dequeueDoubleSmallJsonG(self, 0);
  48897   ck_assert(r==2.0);
  48898   terminateO(self);
  48899 
  48900 }
  48901 
  48902 
  48903 void dequeueIntSmallJsonGT(CuTest *tc UNUSED) {
  48904 
  48905   int64_t          r;
  48906   smallJsont *self = allocSmallJson();
  48907 
  48908   smallJsont *r2   = self->f->pushInt(self, 2);
  48909   ck_assert_ptr_ne(r2, null);
  48910   r = dequeueIntSmallJsonG(self, 0);
  48911   ck_assert_int_eq(r, 2);
  48912   terminateO(self);
  48913 
  48914 }
  48915 
  48916 
  48917 void dequeueInt32SmallJsonGT(CuTest *tc UNUSED) {
  48918 
  48919   int32_t          r;
  48920   smallJsont *self = allocSmallJson();
  48921 
  48922   smallJsont *r2   = self->f->pushInt(self, 2);
  48923   ck_assert_ptr_ne(r2, null);
  48924   r = dequeueInt32SmallJsonG(self, 0);
  48925   ck_assert_int_eq(r, 2);
  48926   terminateO(self);
  48927 
  48928 }
  48929 
  48930 
  48931 void dequeueUintSmallJsonGT(CuTest *tc UNUSED) {
  48932 
  48933   uint64_t         r;
  48934   smallJsont *self = allocSmallJson();
  48935 
  48936   smallJsont *r2   = self->f->pushInt(self, 2);
  48937   ck_assert_ptr_ne(r2, null);
  48938   r = dequeueUintSmallJsonG(self, 0);
  48939   ck_assert_int_eq(r, 2);
  48940   terminateO(self);
  48941 
  48942 }
  48943 
  48944 
  48945 void dequeueUint32SmallJsonGT(CuTest *tc UNUSED) {
  48946 
  48947   uint32_t         r;
  48948   smallJsont *self = allocSmallJson();
  48949 
  48950   smallJsont *r2   = self->f->pushInt(self, 2);
  48951   ck_assert_ptr_ne(r2, null);
  48952   r = dequeueUint32SmallJsonG(self, 0);
  48953   ck_assert_int_eq(r, 2);
  48954   terminateO(self);
  48955 
  48956 }
  48957 
  48958 
  48959 void dequeueSSmallJsonGT(CuTest *tc UNUSED) {
  48960 
  48961   char*            r;
  48962   smallJsont *self = allocSmallJson();
  48963 
  48964   smallJsont *r2   = self->f->pushS(self, "2");
  48965   ck_assert_ptr_ne(r2, null);
  48966   r = dequeueSSmallJsonG(self, null);
  48967   ck_assert_str_eq(r, "2");
  48968   free(r);
  48969   terminateO(self);
  48970 
  48971 }
  48972 
  48973 
  48974 void dequeueDictSmallJsonGT(CuTest *tc UNUSED) {
  48975 
  48976   smallDictt*      r;
  48977   smallJsont *self = allocSmallJson();
  48978 
  48979   createSmallDict(d);
  48980   smallJsont *r2   = self->f->pushDict(self, &d);
  48981   ck_assert_ptr_ne(r2, null);
  48982   r = dequeueDictSmallJsonG(self, null);
  48983   ck_assert_ptr_ne(r, null);
  48984   char *s = toStringO(r);
  48985   ck_assert_str_eq(s, "{}");
  48986   free(s);
  48987   terminateO(r);
  48988   terminateO(self);
  48989 
  48990 }
  48991 
  48992 
  48993 void dequeueArraySmallJsonGT(CuTest *tc UNUSED) {
  48994 
  48995   smallArrayt*     r;
  48996   smallJsont *self = allocSmallJson();
  48997 
  48998   createSmallArray(a);
  48999   smallJsont *r2   = self->f->pushArray(self, &a);
  49000   ck_assert_ptr_ne(r2, null);
  49001   r = dequeueArraySmallJsonG(self, null);
  49002   ck_assert_ptr_ne(r, null);
  49003   char *s = toStringO(r);
  49004   ck_assert_str_eq(s, "[]");
  49005   free(s);
  49006   terminateO(r);
  49007   terminateO(self);
  49008 
  49009 }
  49010 
  49011 
  49012 void dequeueSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  49013 
  49014   smallBoolt*      r;
  49015   smallJsont *self = allocSmallJson();
  49016 
  49017   smallJsont *r2   = self->f->pushBool(self, true);
  49018   ck_assert_ptr_ne(r2, null);
  49019   r = dequeueSmallBoolSmallJsonG(self, null);
  49020   ck_assert_ptr_ne(r, null);
  49021   char *s = toStringO(r);
  49022   ck_assert_str_eq(s, "true");
  49023   free(s);
  49024   terminateO(r);
  49025   terminateO(self);
  49026 
  49027 }
  49028 
  49029 
  49030 void dequeueSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  49031 
  49032   smallBytest*      r;
  49033   smallJsont *self = allocSmallJson();
  49034 
  49035   createSmallBytes(b);
  49036   smallJsont *r2   = self->f->pushSmallBytes(self, &b);
  49037   ck_assert_ptr_ne(r2, null);
  49038   r = dequeueSmallBytesSmallJsonG(self, null);
  49039   ck_assert_ptr_ne(r, null);
  49040   char *s = toStringO(r);
  49041   ck_assert_str_eq(s, "[]");
  49042   free(s);
  49043   terminateO(r);
  49044   terminateO(self);
  49045 
  49046 }
  49047 
  49048 
  49049 void dequeueSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  49050 
  49051   smallDoublet*    r;
  49052   smallJsont *self = allocSmallJson();
  49053 
  49054   smallJsont *r2   = self->f->pushDouble(self, 1);
  49055   ck_assert_ptr_ne(r2, null);
  49056   r = dequeueSmallDoubleSmallJsonG(self, null);
  49057   ck_assert_ptr_ne(r, null);
  49058   char *s = toStringO(r);
  49059   ck_assert_str_eq(s, "1.000000e+00");
  49060   free(s);
  49061   terminateO(r);
  49062   terminateO(self);
  49063 
  49064 }
  49065 
  49066 
  49067 void dequeueSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  49068 
  49069   smallIntt*       r;
  49070   smallJsont *self = allocSmallJson();
  49071 
  49072   smallJsont *r2   = self->f->pushInt(self, 1);
  49073   ck_assert_ptr_ne(r2, null);
  49074   r = dequeueSmallIntSmallJsonG(self, null);
  49075   ck_assert_ptr_ne(r, null);
  49076   char *s = toStringO(r);
  49077   ck_assert_str_eq(s, "1");
  49078   free(s);
  49079   terminateO(r);
  49080   terminateO(self);
  49081 
  49082 }
  49083 
  49084 
  49085 void dequeueSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  49086 
  49087   smallJsont*      r;
  49088   smallJsont *self = allocSmallJson();
  49089 
  49090   createSmallJson(j);
  49091   smallJsont *r2   = self->f->pushSmallJson(self, &j);
  49092   ck_assert_ptr_ne(r2, null);
  49093   r = dequeueSmallJsonSmallJsonG(self, null);
  49094   ck_assert_ptr_ne(r, null);
  49095   char *s = toStringO(r);
  49096   ck_assert_str_eq(s, "{}");
  49097   free(s);
  49098   terminateO(r);
  49099   terminateO(self);
  49100 
  49101 }
  49102 
  49103 
  49104 void dequeueSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  49105 
  49106   smallStringt*    r;
  49107   smallJsont *self = allocSmallJson();
  49108 
  49109   createSmallString(S);
  49110   smallJsont *r2   = self->f->pushSmallString(self, &S);
  49111   ck_assert_ptr_ne(r2, null);
  49112   r = dequeueSmallStringSmallJsonG(self, null);
  49113   ck_assert_ptr_ne(r, null);
  49114   char *s = toStringO(r);
  49115   ck_assert_str_eq(s, "");
  49116   free(s);
  49117   terminateO(r);
  49118   terminateO(self);
  49119 
  49120 }
  49121 
  49122 
  49123 void dequeueVoidSmallJsonGT(CuTest *tc UNUSED) {
  49124 
  49125   void*            r;
  49126   smallJsont *self = allocSmallJson();
  49127 
  49128   createSmallContainer(c);
  49129   setValO(&c, &r);
  49130   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  49131   ck_assert_ptr_ne(r2, null);
  49132   r = dequeueVoidSmallJsonG(self, null);
  49133   ck_assert_ptr_eq(r, &r);
  49134   terminateO(self);
  49135 
  49136 }
  49137 
  49138 
  49139 void dequeueSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  49140 
  49141   smallContainert* r;
  49142   smallJsont *self = allocSmallJson();
  49143 
  49144   createSmallContainer(c);
  49145   smallJsont *r2   = self->f->pushSmallContainer(self, &c);
  49146   ck_assert_ptr_ne(r2, null);
  49147   r = dequeueSmallContainerSmallJsonG(self, null);
  49148   ck_assert_ptr_ne(r, null);
  49149   char *s = toStringO(r);
  49150   ck_assert_str_eq(s, "<data smallContainer>");
  49151   free(s);
  49152   terminateO(r);
  49153   terminateO(self);
  49154 
  49155 }
  49156 
  49157 
  49158 void reverseSmallJsonGT(CuTest *tc UNUSED) {
  49159 
  49160   smallJsont* r;
  49161   smallJsont *self = allocSmallJson();
  49162 
  49163   self->f->pushInt(self, 1);
  49164   self->f->pushInt(self, 2);
  49165   r = reverseSmallJsonG(self);
  49166   ck_assert_ptr_ne(r, NULL);
  49167   char *s = toStringO(r);
  49168   ck_assert_str_eq(s, "[2,1]");
  49169   free(s);
  49170   terminateO(self);
  49171 
  49172 }
  49173 
  49174 
  49175 void mergeDictSmallJsonGT(CuTest *tc UNUSED) {
  49176 
  49177   smallJsont*  r;
  49178   smallJsont *self  = allocG(rtSmallJsont);
  49179   smallDictt *value = allocSmallDict();
  49180 
  49181   self->f->setS(self, "1", "2");
  49182   self->f->setS(self, "3", "4");
  49183   value->f->setS(value, "3", "#");
  49184   value->f->setInt(value, "4", 0);
  49185   r = mergeDictSmallJsonG(self, value);
  49186   ck_assert_ptr_ne(r, null);
  49187   char *s = toStringO(r);
  49188   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  49189   free(s);
  49190   smashO(value);
  49191   terminateO(self);
  49192 
  49193 }
  49194 
  49195 
  49196 void mergeDictNSmashSmallJsonGT(CuTest *tc UNUSED) {
  49197 
  49198   smallJsont*  r;
  49199   smallJsont *self  = allocG(rtSmallJsont);
  49200   smallDictt *value = allocSmallDict();
  49201 
  49202   self->f->setS(self, "1", "2");
  49203   self->f->setS(self, "3", "4");
  49204   value->f->setS(value, "3", "#");
  49205   value->f->setInt(value, "4", 0);
  49206   r = mergeDictNSmashSmallJsonG(self, value);
  49207   ck_assert_ptr_ne(r, null);
  49208   char *s = toStringO(r);
  49209   ck_assert_str_eq(s, "{\"1\":\"2\",\"3\":\"#\",\"4\":0}");
  49210   free(s);
  49211   terminateO(self);
  49212 
  49213 }
  49214 
  49215 
  49216 void mergeSmallJsonGT(CuTest *tc UNUSED) {
  49217 
  49218   smallJsont* r;
  49219   smallJsont *self = allocSmallJson();
  49220   smallJsont *json  = allocSmallJson();
  49221 
  49222   r = self->f->pushInt(self, 1);
  49223   ck_assert_ptr_ne(r, null);
  49224   json->f->pushInt(json, 1);
  49225   json->f->pushInt(json, 2);
  49226   r = mergeSmallJsonG(self, json);
  49227   ck_assert_ptr_ne(r, NULL);
  49228   smashO(json);
  49229   char *s = toStringO(r);
  49230   ck_assert_str_eq(s, "[1,1,2]");
  49231   free(s);
  49232   terminateO(self);
  49233 
  49234 }
  49235 
  49236 
  49237 void mergeNSmashSmallJsonGT(CuTest *tc UNUSED) {
  49238 
  49239   smallJsont* r;
  49240   smallJsont *self = allocSmallJson();
  49241   smallJsont *json  = allocSmallJson();
  49242 
  49243   r = self->f->pushInt(self, 1);
  49244   ck_assert_ptr_ne(r, null);
  49245   json->f->pushInt(json, 1);
  49246   json->f->pushInt(json, 2);
  49247   r = mergeNSmashSmallJsonG(self, json);
  49248   ck_assert_ptr_ne(r, NULL);
  49249   char *s = toStringO(r);
  49250   ck_assert_str_eq(s, "[1,1,2]");
  49251   free(s);
  49252   terminateO(self);
  49253 
  49254 }
  49255 
  49256 
  49257 void appendSmallJsonGT(CuTest *tc UNUSED) {
  49258 
  49259   smallJsont* r;
  49260   smallJsont *self  = allocSmallJson();
  49261   smallArrayt *array = allocSmallArray();
  49262 
  49263   r = self->f->pushInt(self, 1);
  49264   ck_assert_ptr_ne(r, null);
  49265   array->f->pushInt(array, 1);
  49266   array->f->pushInt(array, 2);
  49267   r = appendSmallJsonG(self, array);
  49268   ck_assert_ptr_ne(r, NULL);
  49269   smashO(array);
  49270   char *s = toStringO(r);
  49271   ck_assert_str_eq(s, "[1,1,2]");
  49272   free(s);
  49273   terminateO(self);
  49274 
  49275 }
  49276 
  49277 
  49278 void appendNSmashSmallJsonGT(CuTest *tc UNUSED) {
  49279 
  49280   smallJsont* r;
  49281   smallJsont *self  = allocSmallJson();
  49282   smallArrayt *array = allocSmallArray();
  49283 
  49284   r = self->f->pushInt(self, 1);
  49285   ck_assert_ptr_ne(r, null);
  49286   array->f->pushInt(array, 1);
  49287   array->f->pushInt(array, 2);
  49288   r = appendNSmashSmallJsonG(self, array);
  49289   ck_assert_ptr_ne(r, NULL);
  49290   char *s = toStringO(r);
  49291   ck_assert_str_eq(s, "[1,1,2]");
  49292   free(s);
  49293   terminateO(self);
  49294 
  49295 }
  49296 
  49297 
  49298 void appendArraySmallJsonGT(CuTest *tc UNUSED) {
  49299 
  49300   smallJsont* r;
  49301   smallJsont *self = allocSmallJson();
  49302   char **array      = listCreateS("1", "2");
  49303 
  49304   r = self->f->pushInt(self, 1);
  49305   ck_assert_ptr_ne(r, null);
  49306   r = appendArraySmallJsonG(self, array);
  49307   ck_assert_ptr_ne(r, NULL);
  49308   listFreeS(array);
  49309   char *s = toStringO(r);
  49310   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49311   free(s);
  49312   terminateO(self);
  49313 
  49314 }
  49315 
  49316 
  49317 void appendNSmashArraySmallJsonGT(CuTest *tc UNUSED) {
  49318 
  49319   smallJsont* r;
  49320   smallJsont *self = allocSmallJson();
  49321   char **array      = listCreateS("1", "2");
  49322 
  49323   r = self->f->pushInt(self, 1);
  49324   ck_assert_ptr_ne(r, null);
  49325   r = appendNSmashArraySmallJsonG(self, array);
  49326   ck_assert_ptr_ne(r, NULL);
  49327   char *s = toStringO(r);
  49328   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49329   free(s);
  49330   terminateO(self);
  49331 
  49332 }
  49333 
  49334 
  49335 void appendCArraySmallJsonGT(CuTest *tc UNUSED) {
  49336 
  49337   smallJsont* r;
  49338   smallJsont *self = allocSmallJson();
  49339   const char *array[] = {"1", "2", null};
  49340 
  49341   r = self->f->pushInt(self, 1);
  49342   ck_assert_ptr_ne(r, null);
  49343   r = appendCArraySmallJsonG(self, array);
  49344   ck_assert_ptr_ne(r, NULL);
  49345   char *s = toStringO(r);
  49346   ck_assert_str_eq(s, "[1,\"1\",\"2\"]");
  49347   free(s);
  49348   terminateO(self);
  49349 
  49350 }
  49351 
  49352 
  49353 void shiftSmallJsonGT(CuTest *tc UNUSED) {
  49354 
  49355   smallJsont* r;
  49356   smallJsont *self = allocSmallJson();
  49357   smallArrayt *array = allocSmallArray();
  49358 
  49359   r = self->f->pushInt(self, 1);
  49360   ck_assert_ptr_ne(r, null);
  49361   array->f->pushInt(array, 1);
  49362   array->f->pushInt(array, 2);
  49363   r = shiftSmallJsonG(self, array);
  49364   ck_assert_ptr_ne(r, NULL);
  49365   smashO(array);
  49366   char *s = toStringO(r);
  49367   ck_assert_str_eq(s, "[1,2,1]");
  49368   free(s);
  49369   terminateO(self);
  49370 
  49371 }
  49372 
  49373 
  49374 void shiftNSmashSmallJsonGT(CuTest *tc UNUSED) {
  49375 
  49376   smallJsont* r;
  49377   smallJsont *self = allocSmallJson();
  49378   smallArrayt *array = allocSmallArray();
  49379 
  49380   r = self->f->pushInt(self, 1);
  49381   ck_assert_ptr_ne(r, null);
  49382   array->f->pushInt(array, 1);
  49383   array->f->pushInt(array, 2);
  49384   r = shiftNSmashSmallJsonG(self, array);
  49385   ck_assert_ptr_ne(r, NULL);
  49386   char *s = toStringO(r);
  49387   ck_assert_str_eq(s, "[1,2,1]");
  49388   free(s);
  49389   terminateO(self);
  49390 
  49391 }
  49392 
  49393 
  49394 void shiftSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  49395 
  49396   smallJsont* r;
  49397   smallJsont *self = allocSmallJson();
  49398   smallJsont *json  = allocSmallJson();
  49399 
  49400   r = self->f->pushInt(self, 1);
  49401   ck_assert_ptr_ne(r, null);
  49402   json->f->pushInt(json, 1);
  49403   json->f->pushInt(json, 2);
  49404   r = shiftSmallJsonSmallJsonG(self, json);
  49405   ck_assert_ptr_ne(r, NULL);
  49406   smashO(json);
  49407   char *s = toStringO(r);
  49408   ck_assert_str_eq(s, "[1,2,1]");
  49409   free(s);
  49410   terminateO(self);
  49411 
  49412 }
  49413 
  49414 
  49415 void shiftNSmashSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  49416 
  49417   smallJsont* r;
  49418   smallJsont *self = allocSmallJson();
  49419   smallJsont *json  = allocSmallJson();
  49420 
  49421   r = self->f->pushInt(self, 1);
  49422   ck_assert_ptr_ne(r, null);
  49423   json->f->pushInt(json, 1);
  49424   json->f->pushInt(json, 2);
  49425   r = shiftNSmashSmallJsonSmallJsonG(self, json);
  49426   ck_assert_ptr_ne(r, NULL);
  49427   char *s = toStringO(r);
  49428   ck_assert_str_eq(s, "[1,2,1]");
  49429   free(s);
  49430   terminateO(self);
  49431 
  49432 }
  49433 
  49434 
  49435 void addSmallJsonGT(CuTest *tc UNUSED) {
  49436 
  49437   smallJsont* r;
  49438   smallJsont *self = allocSmallJson();
  49439   createAllocateSmallArray(a);
  49440 
  49441   // add an element to check that the second array is added
  49442   // at the end
  49443   r = self->f->pushInt(self, 1);
  49444   ck_assert_ptr_ne(r, null);
  49445 
  49446   // add array
  49447   a->f->pushInt(a, 2);
  49448   r = addSmallJsonG(self, a);
  49449   smashO(a);
  49450   ck_assert_ptr_ne(r, null);
  49451   char *s = toStringO(r);
  49452   terminateO(r);
  49453   ck_assert_str_eq(s, "[1,2]");
  49454   free(s);
  49455   terminateO(self);
  49456 
  49457 }
  49458 
  49459 
  49460 void addJsonSmallJsonGT(CuTest *tc UNUSED) {
  49461 
  49462   smallJsont* r;
  49463   smallJsont *self = allocG(rtSmallJsont);
  49464   smallJsont *a    = allocSmallJson();
  49465 
  49466   // add an element to check that the second array is added
  49467   // at the end
  49468   r = self->f->pushInt(self, 1);
  49469   ck_assert_ptr_ne(r, null);
  49470 
  49471   // add array
  49472   a->f->pushInt(a, 2);
  49473   r = addJsonSmallJsonG(self, a);
  49474   smashO(a);
  49475   ck_assert_ptr_ne(r, null);
  49476   char *s = toStringO(r);
  49477   terminateO(r);
  49478   ck_assert_str_eq(s, "[1,2]");
  49479   free(s);
  49480   terminateO(self);
  49481 
  49482 }
  49483 
  49484 
  49485 void sliceSmallJsonGT(CuTest *tc UNUSED) {
  49486 
  49487   smallJsont* r;
  49488   smallJsont *self = allocSmallJson();
  49489 
  49490   r = self->f->pushInt(self, 1);
  49491   ck_assert_ptr_ne(r, null);
  49492   r = self->f->pushInt(self, 2);
  49493   ck_assert_ptr_ne(r, null);
  49494   r = self->f->pushInt(self, 3);
  49495   ck_assert_ptr_ne(r, null);
  49496   r = self->f->pushInt(self, 4);
  49497   ck_assert_ptr_ne(r, null);
  49498   r = sliceSmallJsonG(self, 1, -1);
  49499   ck_assert_ptr_ne(r, null);
  49500   char *s = toStringO(r);
  49501   ck_assert_str_eq(s, "[2,3]");
  49502   free(s);
  49503   terminateO(self);
  49504 
  49505 }
  49506 
  49507 
  49508 void cropSmallJsonGT(CuTest *tc UNUSED) {
  49509 
  49510   smallJsont* r;
  49511   smallJsont *self = allocSmallJson();
  49512 
  49513   r = self->f->pushInt(self, 1);
  49514   ck_assert_ptr_ne(r, null);
  49515   r = self->f->pushInt(self, 2);
  49516   ck_assert_ptr_ne(r, null);
  49517   r = self->f->pushInt(self, 3);
  49518   ck_assert_ptr_ne(r, null);
  49519   r = self->f->pushInt(self, 4);
  49520   ck_assert_ptr_ne(r, null);
  49521   r = cropSmallJsonG(self, 1, -1);
  49522   ck_assert_ptr_ne(r, null);
  49523   char *s = toStringO(r);
  49524   terminateO(r);
  49525   ck_assert_str_eq(s, "[2,3]");
  49526   free(s);
  49527   s = toStringO(self);
  49528   ck_assert_str_eq(s, "[1,4]");
  49529   free(s);
  49530   terminateO(self);
  49531 
  49532 }
  49533 
  49534 
  49535 void cropSSmallJsonGT(CuTest *tc UNUSED) {
  49536 
  49537   char* s;
  49538   smallJsont *self = allocG(rtSmallJsont);
  49539 
  49540   setTopSO(self, "sheepy");
  49541   s = cropSSmallJsonG(self, 0,2);
  49542   ck_assert_str_eq(s, "sh");
  49543   ck_assert_str_eq(sjGet(self), "eepy");
  49544   free(s);
  49545   terminateO(self);
  49546 
  49547 }
  49548 
  49549 
  49550 void cropSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  49551 
  49552   smallStringt* r;
  49553   smallJsont *self = allocG(rtSmallJsont);
  49554 
  49555   setTopSO(self, "sheepy");
  49556   r = cropSmallStringSmallJsonG(self, 0,2);
  49557   ck_assert_ptr_ne(r, null);
  49558   ck_assert_str_eq(ssGet(r), "sh");
  49559   ck_assert_str_eq(sjGet(self), "eepy");
  49560   terminateO(r);
  49561   terminateO(self);
  49562 
  49563 }
  49564 
  49565 
  49566 void cropElemAtSmallJsonGT(CuTest *tc UNUSED) {
  49567 
  49568   baset* r;
  49569   smallJsont *self = allocSmallJson();
  49570 
  49571   smallJsont *r2 = self->f->pushInt(self, 1);
  49572   ck_assert_ptr_ne(r2, null);
  49573   r = cropElemAtSmallJsonG(self, 0);
  49574   ck_assert_ptr_ne(r, null);
  49575   char *s = toStringO(r);
  49576   terminateO(r);
  49577   ck_assert_str_eq(s, "1");
  49578   free(s);
  49579   terminateO(self);
  49580 
  49581 }
  49582 
  49583 
  49584 void cropElemAtUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  49585 
  49586   undefinedt* r;
  49587   smallJsont *self = allocSmallJson();
  49588 
  49589   smallJsont *r2 = self->f->pushUndefined(self);
  49590   ck_assert_ptr_ne(r2, null);
  49591   r = cropElemAtUndefinedSmallJsonG(self, 0);
  49592   ck_assert_ptr_ne(r, null);
  49593   char *s = toStringO(r);
  49594   terminateO(r);
  49595   ck_assert_str_eq(s, "null");
  49596   free(s);
  49597   terminateO(self);
  49598 
  49599 }
  49600 
  49601 
  49602 void cropElemAtBoolSmallJsonGT(CuTest *tc UNUSED) {
  49603 
  49604   bool r;
  49605   smallJsont *self = allocSmallJson();
  49606 
  49607   smallJsont *r2 = self->f->pushBool(self, true);
  49608   ck_assert_ptr_ne(r2, null);
  49609   r = cropElemAtBoolSmallJsonG(self, 0);
  49610   ck_assert(r);
  49611   terminateO(self);
  49612 
  49613 }
  49614 
  49615 
  49616 void cropElemAtDoubleSmallJsonGT(CuTest *tc UNUSED) {
  49617 
  49618   double r;
  49619   smallJsont *self = allocSmallJson();
  49620 
  49621   smallJsont *r2 = self->f->pushDouble(self, 1);
  49622   ck_assert_ptr_ne(r2, null);
  49623   r = cropElemAtDoubleSmallJsonG(self, 0);
  49624   ck_assert(r==1);
  49625   terminateO(self);
  49626 
  49627 }
  49628 
  49629 
  49630 void cropElemAtIntSmallJsonGT(CuTest *tc UNUSED) {
  49631 
  49632   int64_t r;
  49633   smallJsont *self = allocSmallJson();
  49634 
  49635   smallJsont *r2 = self->f->pushInt(self, 2);
  49636   ck_assert_ptr_ne(r2, null);
  49637   r = cropElemAtIntSmallJsonG(self, 0);
  49638   ck_assert_int_eq(r, 2);
  49639   terminateO(self);
  49640 
  49641 }
  49642 
  49643 
  49644 void cropElemAtInt32SmallJsonGT(CuTest *tc UNUSED) {
  49645 
  49646   int32_t r;
  49647   smallJsont *self = allocSmallJson();
  49648 
  49649   smallJsont *r2 = self->f->pushInt(self, 2);
  49650   ck_assert_ptr_ne(r2, null);
  49651   r = cropElemAtInt32SmallJsonG(self, 0);
  49652   ck_assert_int_eq(r, 2);
  49653   terminateO(self);
  49654 
  49655 }
  49656 
  49657 
  49658 void cropElemAtUintSmallJsonGT(CuTest *tc UNUSED) {
  49659 
  49660   uint64_t r;
  49661   smallJsont *self = allocSmallJson();
  49662 
  49663   smallJsont *r2 = self->f->pushInt(self, 2);
  49664   ck_assert_ptr_ne(r2, null);
  49665   r = cropElemAtUintSmallJsonG(self, 0);
  49666   ck_assert_int_eq(r, 2);
  49667   terminateO(self);
  49668 
  49669 }
  49670 
  49671 
  49672 void cropElemAtUint32SmallJsonGT(CuTest *tc UNUSED) {
  49673 
  49674   uint32_t r;
  49675   smallJsont *self = allocSmallJson();
  49676 
  49677   smallJsont *r2 = self->f->pushInt(self, 2);
  49678   ck_assert_ptr_ne(r2, null);
  49679   r = cropElemAtUint32SmallJsonG(self, 0);
  49680   ck_assert_int_eq(r, 2);
  49681   terminateO(self);
  49682 
  49683 }
  49684 
  49685 
  49686 void cropElemAtSSmallJsonGT(CuTest *tc UNUSED) {
  49687 
  49688   char* r;
  49689   smallJsont *self = allocSmallJson();
  49690 
  49691   smallJsont *r2 = self->f->pushS(self, "qwe");
  49692   ck_assert_ptr_ne(r2, null);
  49693   r = cropElemAtSSmallJsonG(self, 0);
  49694   ck_assert_str_eq(r, "qwe");
  49695   free(r);
  49696   terminateO(self);
  49697 
  49698 }
  49699 
  49700 
  49701 void cropElemAtCharSmallJsonGT(CuTest *tc UNUSED) {
  49702 
  49703   char r;
  49704   smallJsont *self = allocG(rtSmallJsont);
  49705 
  49706   setTopSO(self, "sheepy");
  49707   r = cropElemAtCharSmallJsonG(self, 0);
  49708   ck_assert_int_eq(r, 's');
  49709   ck_assert_str_eq(sjGet(self), "heepy");
  49710   terminateO(self);
  49711 
  49712 }
  49713 
  49714 
  49715 void cropElemAtDictSmallJsonGT(CuTest *tc UNUSED) {
  49716 
  49717   smallDictt* r;
  49718   smallJsont *self = allocSmallJson();
  49719 
  49720   createSmallDict(d);
  49721   (&d)->f->setInt(&d, "a", 1);
  49722   smallJsont *r2 = self->f->pushDict(self, &d);
  49723   ck_assert_ptr_ne(r2, null);
  49724   r = cropElemAtDictSmallJsonG(self, 0);
  49725   ck_assert_ptr_ne(r, null);
  49726   char *s = toStringO(r);
  49727   terminateO(r);
  49728   ck_assert_str_eq(s, "{\"a\":1}");
  49729   free(s);
  49730   terminateO(self);
  49731 
  49732 }
  49733 
  49734 
  49735 void cropElemAtArraySmallJsonGT(CuTest *tc UNUSED) {
  49736 
  49737   smallArrayt* r;
  49738   smallJsont *self = allocSmallJson();
  49739 
  49740   r = allocSmallArray();
  49741   r->f->pushInt(r, 1);
  49742   smallJsont *r2 = self->f->pushNFreeArray(self, r);
  49743   ck_assert_ptr_ne(r2, null);
  49744   r = cropElemAtArraySmallJsonG(self, 0);
  49745   ck_assert_ptr_ne(r, null);
  49746   char *s = toStringO(r);
  49747   terminateO(r);
  49748   ck_assert_str_eq(s, "[1]");
  49749   free(s);
  49750   terminateO(self);
  49751 
  49752 }
  49753 
  49754 
  49755 void cropElemAtSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  49756 
  49757   smallBoolt* r;
  49758   smallJsont *self = allocSmallJson();
  49759 
  49760   smallJsont *r2 = self->f->pushBool(self, true);
  49761   ck_assert_ptr_ne(r2, null);
  49762   r = cropElemAtSmallBoolSmallJsonG(self, 0);
  49763   ck_assert_ptr_ne(r, null);
  49764   char *s = toStringO(r);
  49765   terminateO(r);
  49766   ck_assert_str_eq(s, "true");
  49767   free(s);
  49768   terminateO(self);
  49769 
  49770 }
  49771 
  49772 
  49773 void cropElemAtSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  49774 
  49775   smallBytest* r;
  49776   smallJsont *self = allocSmallJson();
  49777 
  49778   r = allocSmallBytes("qwe", 3);
  49779   smallJsont *r2 = self->f->pushNFreeSmallBytes(self, r);
  49780   ck_assert_ptr_ne(r2, null);
  49781   r = cropElemAtSmallBytesSmallJsonG(self, 0);
  49782   ck_assert_ptr_ne(r, null);
  49783   char *s = toStringO(r);
  49784   terminateO(r);
  49785   ck_assert_str_eq(s, "[0x71,0x77,0x65]");
  49786   free(s);
  49787   terminateO(self);
  49788 
  49789 }
  49790 
  49791 
  49792 void cropElemAtSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  49793 
  49794   smallDoublet* r;
  49795   smallJsont *self = allocSmallJson();
  49796 
  49797   smallJsont *r2 = self->f->pushDouble(self, 1);
  49798   ck_assert_ptr_ne(r2, null);
  49799   r = cropElemAtSmallDoubleSmallJsonG(self, 0);
  49800   ck_assert_ptr_ne(r, null);
  49801   char *s = toStringO(r);
  49802   terminateO(r);
  49803   ck_assert_str_eq(s, "1.000000e+00");
  49804   free(s);
  49805   terminateO(self);
  49806 
  49807 }
  49808 
  49809 
  49810 void cropElemAtSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  49811 
  49812   smallIntt* r;
  49813   smallJsont *self = allocSmallJson();
  49814 
  49815   smallJsont *r2 = self->f->pushInt(self, 1);
  49816   ck_assert_ptr_ne(r2, null);
  49817   r = cropElemAtSmallIntSmallJsonG(self, 0);
  49818   ck_assert_ptr_ne(r, null);
  49819   char *s = toStringO(r);
  49820   terminateO(r);
  49821   ck_assert_str_eq(s, "1");
  49822   free(s);
  49823   terminateO(self);
  49824 
  49825 }
  49826 
  49827 
  49828 void cropElemAtSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  49829 
  49830   smallJsont* r;
  49831   smallJsont *self = allocSmallJson();
  49832 
  49833   r = allocSmallJson();
  49834   r->f->setInt(r, "a", 1);
  49835   smallJsont *r2 = self->f->pushNFreeSmallJson(self, r);
  49836   ck_assert_ptr_ne(r2, null);
  49837   r = cropElemAtSmallJsonSmallJsonG(self, 0);
  49838   ck_assert_ptr_ne(r, null);
  49839   char *s = toStringO(r);
  49840   terminateO(r);
  49841   ck_assert_str_eq(s, "{\"a\":1}");
  49842   free(s);
  49843   terminateO(self);
  49844 
  49845 }
  49846 
  49847 
  49848 void cropElemAtSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  49849 
  49850   smallStringt* r;
  49851   smallJsont *self = allocSmallJson();
  49852 
  49853   smallJsont *r2 = self->f->pushS(self, "qwe");
  49854   ck_assert_ptr_ne(r2, null);
  49855   r = cropElemAtSmallStringSmallJsonG(self, 0);
  49856   ck_assert_ptr_ne(r, null);
  49857   char *s = toStringO(r);
  49858   terminateO(r);
  49859   ck_assert_str_eq(s, "qwe");
  49860   free(s);
  49861   terminateO(self);
  49862 
  49863 }
  49864 
  49865 
  49866 void cropElemAtVoidSmallJsonGT(CuTest *tc UNUSED) {
  49867 
  49868   void* r;
  49869   smallJsont *self = allocSmallJson();
  49870 
  49871   smallJsont *r2 = pushVoidSmallJsonG(self, &r);
  49872   ck_assert_ptr_ne(r2, null);
  49873   r = cropElemAtVoidSmallJsonG(self, 0);
  49874   ck_assert_ptr_eq(r, &r);
  49875   terminateO(self);
  49876 
  49877 }
  49878 
  49879 
  49880 void cropElemAtSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  49881 
  49882   smallContainert* r;
  49883   smallJsont *self = allocSmallJson();
  49884 
  49885   createSmallContainer(e2);
  49886   smallJsont *r2 = self->f->pushSmallContainer(self, &e2);
  49887   ck_assert_ptr_ne(r2, null);
  49888   r = cropElemAtSmallContainerSmallJsonG(self, 0);
  49889   ck_assert_ptr_ne(r, null);
  49890   char *s = toStringO(r);
  49891   terminateO(r);
  49892   ck_assert_str_eq(s, "<data smallContainer>");
  49893   free(s);
  49894   terminateO(self);
  49895 
  49896 }
  49897 
  49898 
  49899 void cropElemKeySmallJsonGT(CuTest *tc UNUSED) {
  49900 
  49901   baset* r;
  49902   smallJsont *self = allocSmallJson();
  49903   smallJsont *r2;
  49904 
  49905   r2 = self->f->setInt(self, "1", 1);
  49906   ck_assert_ptr_ne(r2, null);
  49907   r2 = self->f->setDouble(self, "2", 2.2);
  49908   ck_assert_ptr_ne(r2, null);
  49909   r2 = self->f->setS(self, "3", "2");
  49910   ck_assert_ptr_ne(r2, null);
  49911   r2 = self->f->setUndefined(self, "u");
  49912   ck_assert_ptr_ne(r2, null);
  49913   createSmallContainer(c);
  49914   r2 = self->f->setSmallContainer(self, "c", &c);
  49915   ck_assert_ptr_ne(r2, null);
  49916   createAllocateSmallInt(I);
  49917   setValG(I, 11);
  49918   I->type = "anothertype";
  49919   r2 = self->f->set(self, "b", (baset*)I);
  49920   ck_assert_ptr_ne(r2, null);
  49921   // crop string
  49922   r = cropElemKeySmallJsonG(self, "3");
  49923   ck_assert_ptr_ne(r, null);
  49924   char *s = toStringO(r);
  49925   terminateO(r);
  49926   ck_assert_str_eq(s, "2");
  49927   free(s);
  49928   s = toStringO(self);
  49929   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"u\":null,\"c\":\"<data container>\",\"b\":\"<data container>\"}");
  49930   free(s);
  49931   terminateO(self);
  49932 
  49933 }
  49934 
  49935 
  49936 void cropElemKeyUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  49937 
  49938   undefinedt* r;
  49939   smallJsont *self = allocSmallJson();
  49940   smallJsont *r2;
  49941 
  49942   r2 = self->f->setInt(self, "1", 1);
  49943   ck_assert_ptr_ne(r2, null);
  49944   r2 = self->f->setDouble(self, "2", 2.2);
  49945   ck_assert_ptr_ne(r2, null);
  49946   r2 = self->f->setUndefined(self, "u");
  49947   ck_assert_ptr_ne(r2, null);
  49948   r = cropElemKeyUndefinedSmallJsonG(self, "u");
  49949   ck_assert_ptr_ne(r, null);
  49950   char *s = toStringO(r);
  49951   terminateO(r);
  49952   ck_assert_str_eq(s, "null");
  49953   free(s);
  49954   s = toStringO(self);
  49955   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00}");
  49956   free(s);
  49957   terminateO(self);
  49958 
  49959 }
  49960 
  49961 
  49962 void cropElemKeyBoolSmallJsonGT(CuTest *tc UNUSED) {
  49963 
  49964   bool r;
  49965   smallJsont *self = allocSmallJson();
  49966   smallJsont *r2;
  49967 
  49968   r2 = self->f->setInt(self, "1", 1);
  49969   ck_assert_ptr_ne(r2, null);
  49970   r2 = self->f->setDouble(self, "2", 2.2);
  49971   ck_assert_ptr_ne(r2, null);
  49972   r2 = self->f->setBool(self, "b", true);
  49973   ck_assert_ptr_ne(r2, null);
  49974   createAllocateSmallInt(I);
  49975   setValG(I, 11);
  49976   I->type = "anothertype";
  49977   r2 = self->f->set(self, "B", (baset*)I);
  49978   ck_assert_ptr_ne(r2, null);
  49979   r = cropElemKeyBoolSmallJsonG(self, "b");
  49980   ck_assert(r);
  49981   char *s = toStringO(self);
  49982   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  49983   free(s);
  49984   terminateO(self);
  49985 
  49986 }
  49987 
  49988 
  49989 void cropElemKeyDoubleSmallJsonGT(CuTest *tc UNUSED) {
  49990 
  49991   double r;
  49992   smallJsont *self = allocSmallJson();
  49993   smallJsont *r2;
  49994 
  49995   r2 = self->f->setInt(self, "1", 1);
  49996   ck_assert_ptr_ne(r2, null);
  49997   r2 = self->f->setDouble(self, "2", 2.2);
  49998   ck_assert_ptr_ne(r2, null);
  49999   r2 = self->f->setDouble(self, "b", 3.3);
  50000   ck_assert_ptr_ne(r2, null);
  50001   createAllocateSmallInt(I);
  50002   setValG(I, 11);
  50003   I->type = "anothertype";
  50004   r2 = self->f->set(self, "B", (baset*)I);
  50005   ck_assert_ptr_ne(r2, null);
  50006   r = cropElemKeyDoubleSmallJsonG(self, "b");
  50007   ck_assert(r == 3.3);
  50008   char *s = toStringO(self);
  50009   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50010   free(s);
  50011   terminateO(self);
  50012 
  50013 }
  50014 
  50015 
  50016 void cropElemKeyIntSmallJsonGT(CuTest *tc UNUSED) {
  50017 
  50018   int64_t r;
  50019   smallJsont *self = allocSmallJson();
  50020   smallJsont *r2;
  50021 
  50022   r2 = self->f->setInt(self, "1", 1);
  50023   ck_assert_ptr_ne(r2, null);
  50024   r2 = self->f->setDouble(self, "2", 2.2);
  50025   ck_assert_ptr_ne(r2, null);
  50026   r2 = self->f->setInt(self, "b", 2);
  50027   ck_assert_ptr_ne(r2, null);
  50028   createAllocateSmallInt(I);
  50029   setValG(I, 11);
  50030   I->type = "anothertype";
  50031   r2 = self->f->set(self, "B", (baset*)I);
  50032   ck_assert_ptr_ne(r2, null);
  50033   r = cropElemKeyIntSmallJsonG(self, "b");
  50034   ck_assert_int_eq(r, 2);
  50035   char *s = toStringO(self);
  50036   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50037   free(s);
  50038   terminateO(self);
  50039 
  50040 }
  50041 
  50042 
  50043 void cropElemKeyInt32SmallJsonGT(CuTest *tc UNUSED) {
  50044 
  50045   int32_t r;
  50046   smallJsont *self = allocSmallJson();
  50047   smallJsont *r2;
  50048 
  50049   r2 = self->f->setInt(self, "1", 1);
  50050   ck_assert_ptr_ne(r2, null);
  50051   r2 = self->f->setDouble(self, "2", 2.2);
  50052   ck_assert_ptr_ne(r2, null);
  50053   r2 = self->f->setInt(self, "b", 2);
  50054   ck_assert_ptr_ne(r2, null);
  50055   createAllocateSmallInt(I);
  50056   setValG(I, 11);
  50057   I->type = "anothertype";
  50058   r2 = self->f->set(self, "B", (baset*)I);
  50059   ck_assert_ptr_ne(r2, null);
  50060   r = cropElemKeyInt32SmallJsonG(self, "b");
  50061   ck_assert_int_eq(r, 2);
  50062   char *s = toStringO(self);
  50063   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50064   free(s);
  50065   terminateO(self);
  50066 
  50067 }
  50068 
  50069 
  50070 void cropElemKeyUintSmallJsonGT(CuTest *tc UNUSED) {
  50071 
  50072   uint64_t r;
  50073   smallJsont *self = allocSmallJson();
  50074   smallJsont *r2;
  50075 
  50076   r2 = self->f->setInt(self, "1", 1);
  50077   ck_assert_ptr_ne(r2, null);
  50078   r2 = self->f->setDouble(self, "2", 2.2);
  50079   ck_assert_ptr_ne(r2, null);
  50080   r2 = self->f->setInt(self, "b", 2);
  50081   ck_assert_ptr_ne(r2, null);
  50082   createAllocateSmallInt(I);
  50083   setValG(I, 11);
  50084   I->type = "anothertype";
  50085   r2 = self->f->set(self, "B", (baset*)I);
  50086   ck_assert_ptr_ne(r2, null);
  50087   r = cropElemKeyUintSmallJsonG(self, "b");
  50088   ck_assert_int_eq(r, 2);
  50089   char *s = toStringO(self);
  50090   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50091   free(s);
  50092   terminateO(self);
  50093 
  50094 }
  50095 
  50096 
  50097 void cropElemKeyUint32SmallJsonGT(CuTest *tc UNUSED) {
  50098 
  50099   uint32_t r;
  50100   smallJsont *self = allocSmallJson();
  50101   smallJsont *r2;
  50102 
  50103   r2 = self->f->setInt(self, "1", 1);
  50104   ck_assert_ptr_ne(r2, null);
  50105   r2 = self->f->setDouble(self, "2", 2.2);
  50106   ck_assert_ptr_ne(r2, null);
  50107   r2 = self->f->setInt(self, "b", 2);
  50108   ck_assert_ptr_ne(r2, null);
  50109   createAllocateSmallInt(I);
  50110   setValG(I, 11);
  50111   I->type = "anothertype";
  50112   r2 = self->f->set(self, "B", (baset*)I);
  50113   ck_assert_ptr_ne(r2, null);
  50114   r = cropElemKeyUint32SmallJsonG(self, "b");
  50115   ck_assert_int_eq(r, 2);
  50116   char *s = toStringO(self);
  50117   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50118   free(s);
  50119   terminateO(self);
  50120 
  50121 }
  50122 
  50123 
  50124 void cropElemKeySSmallJsonGT(CuTest *tc UNUSED) {
  50125 
  50126   char* r;
  50127   smallJsont *self = allocSmallJson();
  50128   smallJsont *r2;
  50129 
  50130   r2 = self->f->setInt(self, "1", 1);
  50131   ck_assert_ptr_ne(r2, null);
  50132   r2 = self->f->setDouble(self, "2", 2.2);
  50133   ck_assert_ptr_ne(r2, null);
  50134   r2 = self->f->setS(self, "b", "qwe");
  50135   ck_assert_ptr_ne(r2, null);
  50136   createAllocateSmallInt(I);
  50137   setValG(I, 11);
  50138   I->type = "anothertype";
  50139   r2 = self->f->set(self, "B", (baset*)I);
  50140   ck_assert_ptr_ne(r2, null);
  50141   r = cropElemKeySSmallJsonG(self, "b");
  50142   ck_assert_str_eq(r, "qwe");
  50143   free(r);
  50144   char *s = toStringO(self);
  50145   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50146   free(s);
  50147   terminateO(self);
  50148 
  50149 }
  50150 
  50151 
  50152 void cropElemKeyDictSmallJsonGT(CuTest *tc UNUSED) {
  50153 
  50154   smallDictt* r;
  50155   smallJsont *self = allocSmallJson();
  50156   smallJsont *r2;
  50157 
  50158   r2 = self->f->setInt(self, "1", 1);
  50159   ck_assert_ptr_ne(r2, null);
  50160   r2 = self->f->setDouble(self, "2", 2.2);
  50161   ck_assert_ptr_ne(r2, null);
  50162   createAllocateSmallDict(d);
  50163   r2 = self->f->setNFreeDict(self, "b", d);
  50164   ck_assert_ptr_ne(r2, null);
  50165   createAllocateSmallInt(I);
  50166   setValG(I, 11);
  50167   I->type = "anothertype";
  50168   r2 = self->f->set(self, "B", (baset*)I);
  50169   ck_assert_ptr_ne(r2, null);
  50170   r = cropElemKeyDictSmallJsonG(self, "b");
  50171   ck_assert_ptr_ne(r, null);
  50172   char *s = toStringO(r);
  50173   terminateO(r);
  50174   ck_assert_str_eq(s, "{}");
  50175   free(s);
  50176   s = toStringO(self);
  50177   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50178   free(s);
  50179   terminateO(self);
  50180 
  50181 }
  50182 
  50183 
  50184 void cropElemKeyArraySmallJsonGT(CuTest *tc UNUSED) {
  50185 
  50186   smallArrayt* r;
  50187   smallJsont *self = allocSmallJson();
  50188   smallJsont *r2;
  50189 
  50190   r2 = self->f->setInt(self, "1", 1);
  50191   ck_assert_ptr_ne(r2, null);
  50192   r2 = self->f->setDouble(self, "2", 2.2);
  50193   ck_assert_ptr_ne(r2, null);
  50194   createAllocateSmallArray(d);
  50195   r2 = self->f->setNFreeArray(self, "b", d);
  50196   ck_assert_ptr_ne(r2, null);
  50197   createAllocateSmallInt(I);
  50198   setValG(I, 11);
  50199   I->type = "anothertype";
  50200   r2 = self->f->set(self, "B", (baset*)I);
  50201   ck_assert_ptr_ne(r2, null);
  50202   r = cropElemKeyArraySmallJsonG(self, "b");
  50203   ck_assert_ptr_ne(r, null);
  50204   char *s = toStringO(r);
  50205   terminateO(r);
  50206   ck_assert_str_eq(s, "[]");
  50207   free(s);
  50208   s = toStringO(self);
  50209   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50210   free(s);
  50211   terminateO(self);
  50212 
  50213 }
  50214 
  50215 
  50216 void cropElemKeySmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  50217 
  50218   smallBoolt* r;
  50219   smallJsont *self = allocSmallJson();
  50220   smallJsont *r2;
  50221 
  50222   r2 = self->f->setInt(self, "1", 1);
  50223   ck_assert_ptr_ne(r2, null);
  50224   r2 = self->f->setDouble(self, "2", 2.2);
  50225   ck_assert_ptr_ne(r2, null);
  50226   r2 = self->f->setBool(self, "b", true);
  50227   ck_assert_ptr_ne(r2, null);
  50228   createAllocateSmallInt(I);
  50229   setValG(I, 11);
  50230   I->type = "anothertype";
  50231   r2 = self->f->set(self, "B", (baset*)I);
  50232   ck_assert_ptr_ne(r2, null);
  50233   r = cropElemKeySmallBoolSmallJsonG(self, "b");
  50234   ck_assert_ptr_ne(r, null);
  50235   char *s = toStringO(r);
  50236   terminateO(r);
  50237   ck_assert_str_eq(s, "true");
  50238   free(s);
  50239   s = toStringO(self);
  50240   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50241   free(s);
  50242   terminateO(self);
  50243 
  50244 }
  50245 
  50246 
  50247 void cropElemKeySmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  50248 
  50249   smallBytest* r;
  50250   smallJsont *self = allocSmallJson();
  50251   smallJsont *r2;
  50252 
  50253   r2 = self->f->setInt(self, "1", 1);
  50254   ck_assert_ptr_ne(r2, null);
  50255   r2 = self->f->setDouble(self, "2", 2.2);
  50256   ck_assert_ptr_ne(r2, null);
  50257   createAllocateSmallBytes(d);
  50258   r2 = self->f->setNFreeSmallBytes(self, "b", d);
  50259   ck_assert_ptr_ne(r2, null);
  50260   createAllocateSmallInt(I);
  50261   setValG(I, 11);
  50262   I->type = "anothertype";
  50263   r2 = self->f->set(self, "B", (baset*)I);
  50264   ck_assert_ptr_ne(r2, null);
  50265   r = cropElemKeySmallBytesSmallJsonG(self, "b");
  50266   ck_assert_ptr_ne(r, null);
  50267   char *s = toStringO(r);
  50268   terminateO(r);
  50269   ck_assert_str_eq(s, "[]");
  50270   free(s);
  50271   s = toStringO(self);
  50272   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50273   free(s);
  50274   terminateO(self);
  50275 
  50276 }
  50277 
  50278 
  50279 void cropElemKeySmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  50280 
  50281   smallDoublet* r;
  50282   smallJsont *self = allocSmallJson();
  50283   smallJsont *r2;
  50284 
  50285   r2 = self->f->setInt(self, "1", 1);
  50286   ck_assert_ptr_ne(r2, null);
  50287   r2 = self->f->setDouble(self, "2", 2.2);
  50288   ck_assert_ptr_ne(r2, null);
  50289   r2 = self->f->setDouble(self, "b", 3.3);
  50290   ck_assert_ptr_ne(r2, null);
  50291   createAllocateSmallInt(I);
  50292   setValG(I, 11);
  50293   I->type = "anothertype";
  50294   r2 = self->f->set(self, "B", (baset*)I);
  50295   ck_assert_ptr_ne(r2, null);
  50296   r = cropElemKeySmallDoubleSmallJsonG(self, "b");
  50297   ck_assert_ptr_ne(r, null);
  50298   char *s = toStringO(r);
  50299   terminateO(r);
  50300   ck_assert_str_eq(s, "3.300000e+00");
  50301   free(s);
  50302   s = toStringO(self);
  50303   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50304   free(s);
  50305   terminateO(self);
  50306 
  50307 }
  50308 
  50309 
  50310 void cropElemKeySmallIntSmallJsonGT(CuTest *tc UNUSED) {
  50311 
  50312   smallIntt* r;
  50313   smallJsont *self = allocSmallJson();
  50314   smallJsont *r2;
  50315 
  50316   r2 = self->f->setInt(self, "1", 1);
  50317   ck_assert_ptr_ne(r2, null);
  50318   r2 = self->f->setDouble(self, "2", 2.2);
  50319   ck_assert_ptr_ne(r2, null);
  50320   r2 = self->f->setInt(self, "b", 2);
  50321   ck_assert_ptr_ne(r2, null);
  50322   createAllocateSmallInt(I);
  50323   setValG(I, 11);
  50324   I->type = "anothertype";
  50325   r2 = self->f->set(self, "B", (baset*)I);
  50326   ck_assert_ptr_ne(r2, null);
  50327   r = cropElemKeySmallIntSmallJsonG(self, "b");
  50328   ck_assert_ptr_ne(r, null);
  50329   char *s = toStringO(r);
  50330   terminateO(r);
  50331   ck_assert_str_eq(s, "2");
  50332   free(s);
  50333   s = toStringO(self);
  50334   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50335   free(s);
  50336   terminateO(self);
  50337 
  50338 }
  50339 
  50340 
  50341 void cropElemKeySmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  50342 
  50343   smallJsont* r;
  50344   smallJsont *self = allocSmallJson();
  50345   smallJsont *r2;
  50346 
  50347   r2 = self->f->setInt(self, "1", 1);
  50348   ck_assert_ptr_ne(r2, null);
  50349   createAllocateSmallBytes(b);
  50350   r2 = self->f->setNFreeSmallBytes(self, "2", b);
  50351   ck_assert_ptr_ne(r2, null);
  50352   createAllocateSmallJson(d);
  50353   r2 = self->f->setNFreeSmallJson(self, "b", d);
  50354   ck_assert_ptr_ne(r2, null);
  50355   createAllocateSmallInt(I);
  50356   setValG(I, 11);
  50357   I->type = "anothertype";
  50358   r2 = self->f->set(self, "B", (baset*)I);
  50359   ck_assert_ptr_ne(r2, null);
  50360   r = cropElemKeySmallJsonSmallJsonG(self, "b");
  50361   ck_assert_ptr_ne(r, null);
  50362   char *s = toStringO(r);
  50363   terminateO(r);
  50364   ck_assert_str_eq(s, "{}");
  50365   free(s);
  50366   s = toStringO(self);
  50367   ck_assert_str_eq(s, "{\"1\":1,\"2\":[],\"B\":\"<data container>\"}");
  50368   free(s);
  50369   terminateO(self);
  50370 
  50371 }
  50372 
  50373 
  50374 void cropElemKeySmallStringSmallJsonGT(CuTest *tc UNUSED) {
  50375 
  50376   smallStringt* r;
  50377   smallJsont *self = allocSmallJson();
  50378   smallJsont *r2;
  50379 
  50380   r2 = self->f->setInt(self, "1", 1);
  50381   ck_assert_ptr_ne(r2, null);
  50382   r2 = self->f->setDouble(self, "2", 2.2);
  50383   ck_assert_ptr_ne(r2, null);
  50384   r2 = self->f->setS(self, "b", "qwe");
  50385   ck_assert_ptr_ne(r2, null);
  50386   createAllocateSmallInt(I);
  50387   setValG(I, 11);
  50388   I->type = "anothertype";
  50389   r2 = self->f->set(self, "B", (baset*)I);
  50390   ck_assert_ptr_ne(r2, null);
  50391   r = cropElemKeySmallStringSmallJsonG(self, "b");
  50392   ck_assert_ptr_ne(r, null);
  50393   char *s = toStringO(r);
  50394   terminateO(r);
  50395   ck_assert_str_eq(s, "qwe");
  50396   free(s);
  50397   s = toStringO(self);
  50398   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50399   free(s);
  50400   terminateO(self);
  50401 
  50402 }
  50403 
  50404 
  50405 void cropElemKeyVoidSmallJsonGT(CuTest *tc UNUSED) {
  50406 
  50407   void* r;
  50408   smallJsont *self = allocSmallJson();
  50409   smallJsont *r2;
  50410 
  50411   r2 = self->f->setInt(self, "1", 1);
  50412   ck_assert_ptr_ne(r2, null);
  50413   r2 = self->f->setDouble(self, "2", 2.2);
  50414   ck_assert_ptr_ne(r2, null);
  50415   smallContainert *c = allocSmallContainer(&r);
  50416   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  50417   ck_assert_ptr_ne(r2, null);
  50418   createAllocateSmallInt(I);
  50419   setValG(I, 11);
  50420   I->type = "anothertype";
  50421   r2 = self->f->set(self, "B", (baset*)I);
  50422   ck_assert_ptr_ne(r2, null);
  50423   r = cropElemKeyVoidSmallJsonG(self, "b");
  50424   ck_assert_ptr_eq(r, &r);
  50425   char *s = toStringO(self);
  50426   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50427   free(s);
  50428   terminateO(self);
  50429 
  50430 }
  50431 
  50432 
  50433 void cropElemKeySmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  50434 
  50435   smallContainert* r;
  50436   smallJsont *self = allocSmallJson();
  50437   smallJsont *r2;
  50438 
  50439   r2 = self->f->setInt(self, "1", 1);
  50440   ck_assert_ptr_ne(r2, null);
  50441   r2 = self->f->setDouble(self, "2", 2.2);
  50442   ck_assert_ptr_ne(r2, null);
  50443   smallContainert *c = allocSmallContainer(&r);
  50444   r2 = self->f->setNFreeSmallContainer(self, "b", c);
  50445   ck_assert_ptr_ne(r2, null);
  50446   createAllocateSmallInt(I);
  50447   setValG(I, 11);
  50448   I->type = "anothertype";
  50449   r2 = self->f->set(self, "B", (baset*)I);
  50450   ck_assert_ptr_ne(r2, null);
  50451   r = cropElemKeySmallContainerSmallJsonG(self, "b");
  50452   ck_assert_ptr_ne(r, null);
  50453   char *s = toStringO(r);
  50454   terminateO(r);
  50455   ck_assert_str_eq(s, "<data smallContainer>");
  50456   free(s);
  50457   s = toStringO(self);
  50458   ck_assert_str_eq(s, "{\"1\":1,\"2\":2.200000e+00,\"B\":\"<data container>\"}");
  50459   free(s);
  50460   terminateO(self);
  50461 
  50462 }
  50463 
  50464 
  50465 void copySmallJsonGT(CuTest *tc UNUSED) {
  50466 
  50467   smallJsont* r;
  50468   smallJsont *self = allocSmallJson();
  50469 
  50470   // add elements to self
  50471   r = self->f->pushInt(self, 1);
  50472   ck_assert_ptr_ne(r, null);
  50473   r = self->f->pushInt(self, 2);
  50474   ck_assert_ptr_ne(r, null);
  50475   r = self->f->pushInt(self, 3);
  50476   ck_assert_ptr_ne(r, null);
  50477   r = self->f->pushInt(self, 4);
  50478   ck_assert_ptr_ne(r, null);
  50479   r = copySmallJsonG(self, 1, -1);
  50480   ck_assert_ptr_ne(r, null);
  50481   ck_assert_int_eq(lenO(r), 2);
  50482   char *s = toStringO(r);
  50483   terminateO(r);
  50484   ck_assert_str_eq(s, "[2,3]");
  50485   free(s);
  50486   s = toStringO(self);
  50487   ck_assert_str_eq(s, "[1,2,3,4]");
  50488   free(s);
  50489   terminateO(self);
  50490 
  50491 }
  50492 
  50493 
  50494 void insertSmallJsonGT(CuTest *tc UNUSED) {
  50495 
  50496   smallJsont* r;
  50497   smallJsont *self     = allocSmallJson();
  50498   smallArrayt *toInsert = allocSmallArray();
  50499 
  50500   toInsert->f->pushInt(toInsert, 3);
  50501   r = insertSmallJsonG(self, 0, toInsert);
  50502   smashO(toInsert);
  50503   ck_assert_ptr_ne(r, null);
  50504   char *s  = toStringO(r);
  50505   ck_assert_str_eq(s, "[3]");
  50506   free(s);
  50507   terminateO(self);
  50508 
  50509 }
  50510 
  50511 
  50512 void insertNSmashSmallJsonGT(CuTest *tc UNUSED) {
  50513 
  50514   smallJsont* r;
  50515   smallJsont *self     = allocSmallJson();
  50516   smallArrayt *toInsert = allocSmallArray();
  50517 
  50518   toInsert->f->pushInt(toInsert, 3);
  50519   r = insertNSmashSmallJsonG(self, 0, toInsert);
  50520   ck_assert_ptr_ne(r, null);
  50521   char *s  = toStringO(r);
  50522   ck_assert_str_eq(s, "[3]");
  50523   free(s);
  50524   terminateO(self);
  50525 
  50526 }
  50527 
  50528 
  50529 void insertSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  50530 
  50531   smallJsont* r;
  50532   smallJsont *self    = allocSmallJson();
  50533   setTypeArrayO(self);
  50534   smallJsont *toInsert = allocSmallJson();
  50535 
  50536   toInsert->f->pushInt(toInsert, 3);
  50537   r = insertSmallJsonSmallJsonG(self, 0, toInsert);
  50538   smashO(toInsert);
  50539   ck_assert_ptr_ne(r, null);
  50540   char *s  = toStringO(r);
  50541   ck_assert_str_eq(s, "[3]");
  50542   free(s);
  50543   terminateO(self);
  50544 
  50545 }
  50546 
  50547 
  50548 void insertNSmashSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  50549 
  50550   smallJsont* r;
  50551   smallJsont *self = allocSmallJson();
  50552   setTypeArrayO(self);
  50553   smallJsont *toInsert = allocSmallJson();
  50554 
  50555   toInsert->f->pushInt(toInsert, 3);
  50556   r = insertNSmashSmallJsonSmallJsonG(self, 0, toInsert);
  50557   ck_assert_ptr_ne(r, null);
  50558   char *s  = toStringO(r);
  50559   ck_assert_str_eq(s, "[3]");
  50560   free(s);
  50561   terminateO(self);
  50562 
  50563 }
  50564 
  50565 
  50566 void insertStringSmallJsonGT(CuTest *tc UNUSED) {
  50567 
  50568   smallJsont*    r;
  50569   smallJsont *self       = allocG(rtSmallJsont);
  50570   smallStringt *toInsert = allocSmallString("lib");
  50571 
  50572   setTopSO(self, "sheepy");
  50573   r = insertStringSmallJsonG(self, 0, toInsert);
  50574   ck_assert_ptr_ne(r, null);
  50575   char *s = toStringO(r);
  50576   ck_assert_str_eq(s, "libsheepy");
  50577   free(s);
  50578   terminateO(toInsert);
  50579   terminateO(self);
  50580 
  50581 }
  50582 
  50583 
  50584 void insertSSmallJsonGT(CuTest *tc UNUSED) {
  50585 
  50586   smallJsont*    r;
  50587   smallJsont *self = allocG(rtSmallJsont);
  50588 
  50589   setTopSO(self, "sheepy");
  50590   r = insertSSmallJsonG(self, 0, "lib");
  50591   ck_assert_ptr_ne(r, null);
  50592   char *s = toStringO(r);
  50593   ck_assert_str_eq(s, "libsheepy");
  50594   free(s);
  50595   terminateO(self);
  50596 
  50597 }
  50598 
  50599 
  50600 void insertNFreeSmallJsonGT(CuTest *tc UNUSED) {
  50601 
  50602   smallJsont*    r;
  50603   smallJsont *self       = allocG(rtSmallJsont);
  50604   smallStringt *toInsert = allocSmallString("lib");
  50605 
  50606   setTopSO(self, "sheepy");
  50607   r = insertNFreeStringSmallJsonG(self, 0, toInsert);
  50608   ck_assert_ptr_ne(r, null);
  50609   char *s = toStringO(r);
  50610   ck_assert_str_eq(s, "libsheepy");
  50611   free(s);
  50612   terminateO(self);
  50613 
  50614 }
  50615 
  50616 
  50617 void insertSNFreeStringSmallJsonGT(CuTest *tc UNUSED) {
  50618 
  50619   smallJsont*    r;
  50620   smallJsont *self = allocG(rtSmallJsont);
  50621 
  50622   setTopSO(self, "sheepy");
  50623   r = insertNFreeSSmallJsonG(self, 0, strdup("lib"));
  50624   ck_assert_ptr_ne(r, null);
  50625   char *s = toStringO(r);
  50626   ck_assert_str_eq(s, "libsheepy");
  50627   free(s);
  50628   terminateO(self);
  50629 
  50630 }
  50631 
  50632 
  50633 void injectSmallJsonGT(CuTest *tc UNUSED) {
  50634 
  50635   smallJsont* r;
  50636   smallJsont *self = allocSmallJson();
  50637   baset *value      = (baset*) allocSmallInt(8);
  50638 
  50639   r = injectSmallJsonG(self, 0, value);
  50640   ck_assert_ptr_ne(r, null);
  50641   finishO(value);
  50642   char *s  = toStringO(r);
  50643   ck_assert_str_eq(s, "[8]");
  50644   free(s);
  50645   terminateO(self);
  50646 
  50647 }
  50648 
  50649 
  50650 void injectUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  50651 
  50652   smallJsont* r;
  50653   smallJsont *self = allocSmallJson();
  50654 
  50655   r = injectUndefinedSmallJsonG(self, 0, null);
  50656   ck_assert_ptr_ne(r, null);
  50657   char *s  = toStringO(r);
  50658   ck_assert_str_eq(s, "[null]");
  50659   free(s);
  50660   terminateO(self);
  50661 
  50662 }
  50663 
  50664 
  50665 void injectBoolSmallJsonGT(CuTest *tc UNUSED) {
  50666 
  50667   smallJsont* r;
  50668   smallJsont *self = allocSmallJson();
  50669 
  50670   r = injectBoolSmallJsonG(self, 0, true);
  50671   ck_assert_ptr_ne(r, null);
  50672   char *s  = toStringO(r);
  50673   ck_assert_str_eq(s, "[true]");
  50674   free(s);
  50675   terminateO(self);
  50676 
  50677 }
  50678 
  50679 
  50680 void injectDoubleSmallJsonGT(CuTest *tc UNUSED) {
  50681 
  50682   smallJsont* r;
  50683   smallJsont *self = allocSmallJson();
  50684 
  50685   r = injectDoubleSmallJsonG(self, 0, 1);
  50686   ck_assert_ptr_ne(r, null);
  50687   char *s  = toStringO(r);
  50688   ck_assert_str_eq(s, "[1.000000e+00]");
  50689   free(s);
  50690   terminateO(self);
  50691 
  50692 }
  50693 
  50694 
  50695 void injectIntSmallJsonGT(CuTest *tc UNUSED) {
  50696 
  50697   smallJsont* r;
  50698   smallJsont *self = allocSmallJson();
  50699 
  50700   r = injectIntSmallJsonG(self, 0, 2);
  50701   ck_assert_ptr_ne(r, null);
  50702   char *s  = toStringO(r);
  50703   ck_assert_str_eq(s, "[2]");
  50704   free(s);
  50705   terminateO(self);
  50706 
  50707 }
  50708 
  50709 
  50710 void injectSSmallJsonGT(CuTest *tc UNUSED) {
  50711 
  50712   smallJsont* r;
  50713   smallJsont *self = allocSmallJson();
  50714 
  50715   r = injectSSmallJsonG(self, 0, "qwe");
  50716   ck_assert_ptr_ne(r, null);
  50717   char *s  = toStringO(r);
  50718   ck_assert_str_eq(s, "[\"qwe\"]");
  50719   free(s);
  50720   terminateO(self);
  50721 
  50722 }
  50723 
  50724 
  50725 void injectCharSmallJsonGT(CuTest *tc UNUSED) {
  50726 
  50727   smallJsont* r;
  50728   smallJsont *self = allocSmallJson();
  50729 
  50730   r = injectCharSmallJsonG(self, 0, 'a');
  50731   ck_assert_ptr_ne(r, null);
  50732   char *s  = toStringO(r);
  50733   ck_assert_str_eq(s, "[\"a\"]");
  50734   free(s);
  50735   terminateO(self);
  50736 
  50737 }
  50738 
  50739 
  50740 void injectDictSmallJsonGT(CuTest *tc UNUSED) {
  50741 
  50742   smallJsont* r;
  50743   smallJsont *self = allocSmallJson();
  50744 
  50745   createSmallDict(d);
  50746   r = injectDictSmallJsonG(self, 0, &d);
  50747   ck_assert_ptr_ne(r, null);
  50748   char *s  = toStringO(r);
  50749   ck_assert_str_eq(s, "[{}]");
  50750   free(s);
  50751   terminateO(self);
  50752 
  50753 }
  50754 
  50755 
  50756 void injectArraySmallJsonGT(CuTest *tc UNUSED) {
  50757 
  50758   smallJsont* r;
  50759   smallJsont *self = allocSmallJson();
  50760 
  50761   createSmallArray(a);
  50762   r = injectArraySmallJsonG(self, 0, &a);
  50763   ck_assert_ptr_ne(r, null);
  50764   char *s  = toStringO(r);
  50765   ck_assert_str_eq(s, "[[]]");
  50766   free(s);
  50767   terminateO(self);
  50768 
  50769 }
  50770 
  50771 
  50772 void injectArraycSmallJsonGT(CuTest *tc UNUSED) {
  50773 
  50774   smallJsont* r;
  50775   smallJsont *self = allocSmallJson();
  50776   char **array      = listCreateS("a","b");
  50777 
  50778   r = injectArraycSmallJsonG(self, 0, array);
  50779   ck_assert_ptr_ne(r, null);
  50780   listFreeS(array);
  50781   char *s  = toStringO(r);
  50782   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  50783   free(s);
  50784   terminateO(self);
  50785 
  50786 }
  50787 
  50788 
  50789 void injectCArraycSmallJsonGT(CuTest *tc UNUSED) {
  50790 
  50791   smallJsont* r;
  50792   smallJsont *self   = allocSmallJson();
  50793   const char *array[] = {"a","b",null};
  50794 
  50795   r = injectCArraycSmallJsonG(self, 0, array);
  50796   ck_assert_ptr_ne(r, null);
  50797   char *s  = toStringO(r);
  50798   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  50799   free(s);
  50800   terminateO(self);
  50801 
  50802 }
  50803 
  50804 
  50805 void injectVoidSmallJsonGT(CuTest *tc UNUSED) {
  50806 
  50807   smallJsont* r;
  50808   smallJsont *self = allocSmallJson();
  50809 
  50810   r = injectVoidSmallJsonG(self, 0, null);
  50811   ck_assert_ptr_ne(r, null);
  50812   char *s  = toStringO(r);
  50813   ck_assert_str_eq(s, "[null]");
  50814   free(s);
  50815   r = injectVoidSmallJsonG(self, 0, &r);
  50816   ck_assert_ptr_ne(r, null);
  50817   s  = toStringO(r);
  50818   ck_assert_str_eq(s, "[\"<data container>\",null]");
  50819   free(s);
  50820   terminateO(self);
  50821 
  50822 }
  50823 
  50824 
  50825 void injectSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  50826 
  50827   smallJsont* r;
  50828   smallJsont *self = allocSmallJson();
  50829 
  50830   smallBoolt *b = allocSmallBool(true);
  50831   r = injectSmallBoolSmallJsonG(self, 0, b);
  50832   ck_assert_ptr_ne(r, null);
  50833   finishO(b);
  50834   char *s  = toStringO(r);
  50835   ck_assert_str_eq(s, "[true]");
  50836   free(s);
  50837   terminateO(self);
  50838 
  50839 }
  50840 
  50841 
  50842 void injectSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  50843 
  50844   smallJsont* r;
  50845   smallJsont *self = allocSmallJson();
  50846   smallBytest *b    = allocSmallBytes("qwe", 3);
  50847 
  50848   r = injectSmallBytesSmallJsonG(self, 0, b);
  50849   ck_assert_ptr_ne(r, null);
  50850   finishO(b);
  50851   char *s  = toStringO(r);
  50852   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  50853   free(s);
  50854   terminateO(self);
  50855 
  50856 }
  50857 
  50858 
  50859 void injectSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  50860 
  50861   smallJsont* r;
  50862   smallJsont *self = allocSmallJson();
  50863   smallDoublet *value = allocSmallDouble(1);
  50864 
  50865   r = injectSmallDoubleSmallJsonG(self, 0, value);
  50866   ck_assert_ptr_ne(r, null);
  50867   finishO(value);
  50868   char *s  = toStringO(r);
  50869   ck_assert_str_eq(s, "[1.000000e+00]");
  50870   free(s);
  50871   terminateO(self);
  50872 
  50873 }
  50874 
  50875 
  50876 void injectSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  50877 
  50878   smallJsont* r;
  50879   smallJsont *self = allocSmallJson();
  50880   smallIntt *value  = allocSmallInt(1);
  50881 
  50882   r = injectSmallIntSmallJsonG(self, 0, value);
  50883   ck_assert_ptr_ne(r, null);
  50884   finishO(value);
  50885   char *s  = toStringO(r);
  50886   ck_assert_str_eq(s, "[1]");
  50887   free(s);
  50888   terminateO(self);
  50889 
  50890 }
  50891 
  50892 
  50893 void injectSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  50894 
  50895   smallJsont* r;
  50896   smallJsont *self  = allocSmallJson();
  50897   smallJsont *string = allocSmallJson();
  50898 
  50899   r = injectSmallJsonSmallJsonG(self, 0, string);
  50900   ck_assert_ptr_ne(r, null);
  50901   finishO(string);
  50902   char *s  = toStringO(r);
  50903   ck_assert_str_eq(s, "[{}]");
  50904   free(s);
  50905   terminateO(self);
  50906 
  50907 }
  50908 
  50909 
  50910 void injectSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  50911 
  50912   smallJsont* r;
  50913   smallJsont *self    = allocSmallJson();
  50914   smallStringt *string = allocSmallString("qwe");
  50915 
  50916   r = injectSmallStringSmallJsonG(self, 0, string);
  50917   ck_assert_ptr_ne(r, null);
  50918   finishO(string);
  50919   char *s  = toStringO(r);
  50920   ck_assert_str_eq(s, "[\"qwe\"]");
  50921   free(s);
  50922   terminateO(self);
  50923 
  50924 }
  50925 
  50926 
  50927 void injectSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  50928 
  50929   smallJsont* r;
  50930   smallJsont *self      = allocSmallJson();
  50931   smallContainert *value = allocSmallContainer(null);
  50932 
  50933   r = injectSmallContainerSmallJsonG(self, 0, value);
  50934   ck_assert_ptr_ne(r, null);
  50935   finishO(value);
  50936   char *s  = toStringO(r);
  50937   ck_assert_str_eq(s, "[\"<data container>\"]");
  50938   free(s);
  50939   terminateO(self);
  50940 
  50941 }
  50942 
  50943 
  50944 void injectNFreeSmallJsonGT(CuTest *tc UNUSED) {
  50945 
  50946   smallJsont* r;
  50947   smallJsont *self = allocSmallJson();
  50948   baset *value      = (baset*) allocSmallInt(8);
  50949 
  50950   r = injectNFreeSmallJsonG(self, 0, value);
  50951   ck_assert_ptr_ne(r, null);
  50952   char *s  = toStringO(r);
  50953   ck_assert_str_eq(s, "[8]");
  50954   free(s);
  50955   terminateO(self);
  50956 
  50957 }
  50958 
  50959 
  50960 void injectNFreeUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  50961 
  50962   smallJsont* r;
  50963   smallJsont *self = allocSmallJson();
  50964 
  50965   createAllocateUndefined(u);
  50966   r = injectNFreeUndefinedSmallJsonG(self, 0, u);
  50967   ck_assert_ptr_ne(r, null);
  50968   char *s  = toStringO(r);
  50969   ck_assert_str_eq(s, "[null]");
  50970   free(s);
  50971   terminateO(self);
  50972 
  50973 }
  50974 
  50975 
  50976 void injectNFreeSSmallJsonGT(CuTest *tc UNUSED) {
  50977 
  50978   smallJsont* r;
  50979   smallJsont *self = allocSmallJson();
  50980   char *string      = strdup("qwe");
  50981 
  50982   r = injectNFreeSSmallJsonG(self, 0, string);
  50983   ck_assert_ptr_ne(r, null);
  50984   char *s  = toStringO(r);
  50985   ck_assert_str_eq(s, "[\"qwe\"]");
  50986   free(s);
  50987   terminateO(self);
  50988 
  50989 }
  50990 
  50991 
  50992 void injectNFreeDictSmallJsonGT(CuTest *tc UNUSED) {
  50993 
  50994   smallJsont* r;
  50995   smallJsont *self = allocSmallJson();
  50996 
  50997   createAllocateSmallDict(d);
  50998   r = injectNFreeDictSmallJsonG(self, 0, d);
  50999   ck_assert_ptr_ne(r, null);
  51000   char *s  = toStringO(r);
  51001   ck_assert_str_eq(s, "[{}]");
  51002   free(s);
  51003   terminateO(self);
  51004 
  51005 }
  51006 
  51007 
  51008 void injectNFreeArraySmallJsonGT(CuTest *tc UNUSED) {
  51009 
  51010   smallJsont* r;
  51011   smallJsont *self = allocSmallJson();
  51012 
  51013   createAllocateSmallArray(a);
  51014   r = injectNFreeArraySmallJsonG(self, 0, a);
  51015   ck_assert_ptr_ne(r, null);
  51016   char *s  = toStringO(r);
  51017   ck_assert_str_eq(s, "[[]]");
  51018   free(s);
  51019   terminateO(self);
  51020 
  51021 }
  51022 
  51023 
  51024 void injectNFreeArraycSmallJsonGT(CuTest *tc UNUSED) {
  51025 
  51026   smallJsont* r;
  51027   smallJsont *self = allocSmallJson();
  51028   char **array      = listCreateS("a","b");
  51029 
  51030   r = injectNFreeArraycSmallJsonG(self, 0, array);
  51031   ck_assert_ptr_ne(r, null);
  51032   char *s  = toStringO(r);
  51033   ck_assert_str_eq(s, "[[\"a\",\"b\"]]");
  51034   free(s);
  51035   terminateO(self);
  51036 
  51037 }
  51038 
  51039 
  51040 void injectNFreeSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  51041 
  51042   smallJsont* r;
  51043   smallJsont *self = allocSmallJson();
  51044 
  51045   smallBoolt *b = allocSmallBool(true);
  51046   r = injectNFreeSmallBoolSmallJsonG(self, 0, b);
  51047   ck_assert_ptr_ne(r, null);
  51048   char *s  = toStringO(r);
  51049   ck_assert_str_eq(s, "[true]");
  51050   free(s);
  51051   terminateO(self);
  51052 
  51053 }
  51054 
  51055 
  51056 void injectNFreeSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  51057 
  51058   smallJsont* r;
  51059   smallJsont *self = allocSmallJson();
  51060   smallBytest *b    = allocSmallBytes("qwe", 3);
  51061 
  51062   r = injectNFreeSmallBytesSmallJsonG(self, 0, b);
  51063   ck_assert_ptr_ne(r, null);
  51064   char *s  = toStringO(r);
  51065   ck_assert_str_eq(s, "[[0x71,0x77,0x65]]");
  51066   free(s);
  51067   terminateO(self);
  51068 
  51069 }
  51070 
  51071 
  51072 void injectNFreeSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51073 
  51074   smallJsont* r;
  51075   smallJsont *self   = allocSmallJson();
  51076   smallDoublet *value = allocSmallDouble(1);
  51077 
  51078   r = injectNFreeSmallDoubleSmallJsonG(self, 0, value);
  51079   ck_assert_ptr_ne(r, null);
  51080   char *s  = toStringO(r);
  51081   ck_assert_str_eq(s, "[1.000000e+00]");
  51082   free(s);
  51083   terminateO(self);
  51084 
  51085 }
  51086 
  51087 
  51088 void injectNFreeSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  51089 
  51090   smallJsont* r;
  51091   smallJsont *self = allocSmallJson();
  51092   smallIntt *value  = allocSmallInt(1);
  51093 
  51094   r = injectNFreeSmallIntSmallJsonG(self, 0, value);
  51095   ck_assert_ptr_ne(r, null);
  51096   char *s  = toStringO(r);
  51097   ck_assert_str_eq(s, "[1]");
  51098   free(s);
  51099   terminateO(self);
  51100 
  51101 }
  51102 
  51103 
  51104 void injectNFreeSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  51105 
  51106   smallJsont* r;
  51107   smallJsont *self  = allocSmallJson();
  51108   smallJsont *string = allocSmallJson();
  51109 
  51110   r = injectNFreeSmallJsonSmallJsonG(self, 0, string);
  51111   ck_assert_ptr_ne(r, null);
  51112   char *s  = toStringO(r);
  51113   ck_assert_str_eq(s, "[{}]");
  51114   free(s);
  51115   terminateO(self);
  51116 
  51117 }
  51118 
  51119 
  51120 void injectNFreeSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  51121 
  51122   smallJsont* r;
  51123   smallJsont *self    = allocSmallJson();
  51124   smallStringt *string = allocSmallString("qwe");
  51125 
  51126   r = injectNFreeSmallStringSmallJsonG(self, 0, string);
  51127   ck_assert_ptr_ne(r, null);
  51128   char *s  = toStringO(r);
  51129   ck_assert_str_eq(s, "[\"qwe\"]");
  51130   free(s);
  51131   terminateO(self);
  51132 
  51133 }
  51134 
  51135 
  51136 void injectNFreeSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  51137 
  51138   smallJsont* r;
  51139   smallJsont *self = allocSmallJson();
  51140   smallContainert *value = allocSmallContainer(null);
  51141 
  51142   r = injectNFreeSmallContainerSmallJsonG(self, 0, value);
  51143   ck_assert_ptr_ne(r, null);
  51144   char *s  = toStringO(r);
  51145   ck_assert_str_eq(s, "[\"<data container>\"]");
  51146   free(s);
  51147   terminateO(self);
  51148 
  51149 }
  51150 
  51151 
  51152 void uniqSmallJsonGT(CuTest *tc UNUSED) {
  51153 
  51154   smallJsont* r;
  51155   smallJsont *self = allocSmallJson();
  51156 
  51157   self->f->pushUndefined(self);
  51158   self->f->pushBool(self, true);
  51159   self->f->pushNFreeDict(self, allocSmallDict());
  51160   self->f->pushDouble(self, 1);
  51161   self->f->pushInt(self, 2);
  51162   self->f->pushS(self, "");
  51163   self->f->pushNFreeArray(self, allocSmallArray());
  51164   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51165   self->f->pushUndefined(self);
  51166   self->f->pushBool(self, true);
  51167   self->f->pushNFreeDict(self, allocSmallDict());
  51168   self->f->pushDouble(self, 1);
  51169   self->f->pushInt(self, 2);
  51170   self->f->pushS(self, "");
  51171   self->f->pushNFreeArray(self, allocSmallArray());
  51172   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51173   r = uniqSmallJsonG(self, 0);
  51174   ck_assert_ptr_ne(r, NULL);
  51175   char *s = toStringO(r);
  51176   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"\",[],[0x71,0x77,0x65,0x00]]");
  51177   free(s);
  51178   // json string
  51179   freeO(self);
  51180   setTopSO(self, "/qwd///");
  51181   r = uniqSmallJsonG(self, '/');
  51182   ck_assert_ptr_ne(r, null);
  51183   s = toStringO(r);
  51184   ck_assert_str_eq(s, "/qwd/");
  51185   free(s);
  51186   terminateO(self);
  51187 
  51188 }
  51189 
  51190 
  51191 void sortSmallJsonGT(CuTest *tc UNUSED) {
  51192 
  51193   smallJsont* r;
  51194   smallJsont *self = allocSmallJson();
  51195 
  51196   self->f->pushS(self, "bb");
  51197   self->f->pushS(self, "a");
  51198   r = sortSmallJsonG(self);
  51199   ck_assert_ptr_ne(r, null);
  51200   char *s = toStringO(r);
  51201   ck_assert_str_eq(s, "[\"a\",\"bb\"]");
  51202   free(s);
  51203   terminateO(self);
  51204 
  51205 }
  51206 
  51207 
  51208 void sortFSmallJsonGT(CuTest *tc UNUSED) {
  51209 
  51210   smallJsont* r;
  51211   smallJsont *self = allocSmallJson();
  51212 
  51213   // sort dict
  51214   smallDictt *d[4];
  51215   arange(i,d) d[i] = allocSmallDict();
  51216   d[0]->f->setInt(d[0], "a", 1);
  51217   d[1]->f->setInt(d[1], "a", 0);
  51218   d[3]->f->setInt(d[3], "a", 0);
  51219   d[3]->f->setInt(d[3], "b", 0);
  51220   arange(i,d) self->f->pushNFreeDict(self, d[i]);
  51221   r = sortFSmallJsonG(self, sortFOCmp);
  51222   ck_assert_ptr_ne(r, null);
  51223   char *s = toStringO(r);
  51224   ck_assert_str_eq(s, "[{},{\"a\":0},{\"a\":1},{\"a\":0,\"b\":0}]");
  51225   free(s);
  51226   terminateO(self);
  51227 
  51228 }
  51229 
  51230 
  51231 void icSortSmallJsonGT(CuTest *tc UNUSED) {
  51232 
  51233   smallJsont* r;
  51234   smallJsont *self = allocSmallJson();
  51235 
  51236   self->f->pushS(self, "bb");
  51237   self->f->pushS(self, "A");
  51238   r = icSortSmallJsonG(self);
  51239   ck_assert_ptr_ne(r, null);
  51240   char *s = toStringO(r);
  51241   ck_assert_str_eq(s, "[\"A\",\"bb\"]");
  51242   free(s);
  51243   terminateO(self);
  51244 
  51245 }
  51246 
  51247 
  51248 void icUniqSmallJsonGT(CuTest *tc UNUSED) {
  51249 
  51250   smallJsont* r;
  51251   smallJsont *self = allocSmallJson();
  51252 
  51253   self->f->pushUndefined(self);
  51254   self->f->pushBool(self, true);
  51255   self->f->pushNFreeDict(self, allocSmallDict());
  51256   self->f->pushDouble(self, 1);
  51257   self->f->pushInt(self, 2);
  51258   self->f->pushS(self, "ASD");
  51259   self->f->pushNFreeArray(self, allocSmallArray());
  51260   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51261   self->f->pushUndefined(self);
  51262   self->f->pushBool(self, true);
  51263   self->f->pushNFreeDict(self, allocSmallDict());
  51264   self->f->pushDouble(self, 1);
  51265   self->f->pushInt(self, 2);
  51266   self->f->pushS(self, "asd");
  51267   self->f->pushNFreeArray(self, allocSmallArray());
  51268   self->f->pushNFreeSmallBytes(self, allocSmallBytes("qwe",4));
  51269   r = icUniqSmallJsonG(self, 0);
  51270   ck_assert_ptr_ne(r, NULL);
  51271   char *s = toStringO(r);
  51272   ck_assert_str_eq(s, "[null,true,{},1.000000e+00,2,\"ASD\",[],[0x71,0x77,0x65,0x00]]");
  51273   free(s);
  51274   // json string
  51275   freeO(self);
  51276   setTopSO(self, "/qQwd///");
  51277   r = icUniqSmallJsonG(self, 'q');
  51278   ck_assert_ptr_ne(r, null);
  51279   s = toStringO(r);
  51280   ck_assert_str_eq(s, "/qwd///");
  51281   free(s);
  51282   terminateO(self);
  51283 
  51284 }
  51285 
  51286 
  51287 void hasSmallJsonGT(CuTest *tc UNUSED) {
  51288 
  51289   bool r;
  51290   smallJsont *self = allocSmallJson();
  51291 
  51292   r = hasSmallJsonG(self, null);
  51293   ck_assert(!r);
  51294   terminateO(self);
  51295 
  51296 }
  51297 
  51298 
  51299 void hasUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  51300 
  51301   bool r;
  51302   smallJsont *self = allocSmallJson();
  51303 
  51304   r = hasUndefinedSmallJsonG(self, null);
  51305   ck_assert(!r);
  51306   terminateO(self);
  51307 
  51308 }
  51309 
  51310 
  51311 void hasBoolSmallJsonGT(CuTest *tc UNUSED) {
  51312 
  51313   bool r;
  51314   smallJsont *self = allocSmallJson();
  51315 
  51316   r = hasBoolSmallJsonG(self, true);
  51317   ck_assert(!r);
  51318   terminateO(self);
  51319 
  51320 }
  51321 
  51322 
  51323 void hasDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51324 
  51325   bool r;
  51326   smallJsont *self = allocSmallJson();
  51327 
  51328   r = hasDoubleSmallJsonG(self, 1);
  51329   ck_assert(!r);
  51330   terminateO(self);
  51331 
  51332 }
  51333 
  51334 
  51335 void hasIntSmallJsonGT(CuTest *tc UNUSED) {
  51336 
  51337   bool r;
  51338   smallJsont *self = allocSmallJson();
  51339 
  51340   r = hasIntSmallJsonG(self, 1);
  51341   ck_assert(!r);
  51342   terminateO(self);
  51343 
  51344 }
  51345 
  51346 
  51347 void hasSSmallJsonGT(CuTest *tc UNUSED) {
  51348 
  51349   bool r;
  51350   smallJsont *self = allocSmallJson();
  51351 
  51352   r = hasSSmallJsonG(self, null);
  51353   ck_assert(!r);
  51354   terminateO(self);
  51355 
  51356 }
  51357 
  51358 
  51359 void hasCharSmallJsonGT(CuTest *tc UNUSED) {
  51360 
  51361   bool r;
  51362   smallJsont *self = allocSmallJson();
  51363 
  51364   r = hasCharSmallJsonG(self, ' ');
  51365   ck_assert(!r);
  51366   terminateO(self);
  51367 
  51368 }
  51369 
  51370 
  51371 void hasDictSmallJsonGT(CuTest *tc UNUSED) {
  51372 
  51373   bool r;
  51374   smallJsont *self = allocSmallJson();
  51375 
  51376   r = hasDictSmallJsonG(self, null);
  51377   ck_assert(!r);
  51378   terminateO(self);
  51379 
  51380 }
  51381 
  51382 
  51383 void hasArraySmallJsonGT(CuTest *tc UNUSED) {
  51384 
  51385   bool r;
  51386   smallJsont *self = allocSmallJson();
  51387 
  51388   r = hasArraySmallJsonG(self, null);
  51389   ck_assert(!r);
  51390   terminateO(self);
  51391 
  51392 }
  51393 
  51394 
  51395 void hasArraycSmallJsonGT(CuTest *tc UNUSED) {
  51396 
  51397   bool r;
  51398   smallJsont *self = allocSmallJson();
  51399 
  51400   r = hasArraycSmallJsonG(self, null);
  51401   ck_assert(!r);
  51402   terminateO(self);
  51403 
  51404 }
  51405 
  51406 
  51407 void hasCArraycSmallJsonGT(CuTest *tc UNUSED) {
  51408 
  51409   bool r;
  51410   smallJsont *self = allocSmallJson();
  51411 
  51412   r = hasCArraycSmallJsonG(self, null);
  51413   ck_assert(!r);
  51414   terminateO(self);
  51415 
  51416 }
  51417 
  51418 
  51419 void hasSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  51420 
  51421   bool r;
  51422   smallJsont *self = allocSmallJson();
  51423 
  51424   r = hasSmallBoolSmallJsonG(self, null);
  51425   ck_assert(!r);
  51426   terminateO(self);
  51427 
  51428 }
  51429 
  51430 
  51431 void hasSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  51432 
  51433   bool r;
  51434   smallJsont *self = allocSmallJson();
  51435 
  51436   r = hasSmallBytesSmallJsonG(self, null);
  51437   ck_assert(!r);
  51438   terminateO(self);
  51439 
  51440 }
  51441 
  51442 
  51443 void hasSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51444 
  51445   bool r;
  51446   smallJsont *self = allocSmallJson();
  51447 
  51448   r = hasSmallDoubleSmallJsonG(self, null);
  51449   ck_assert(!r);
  51450   terminateO(self);
  51451 
  51452 }
  51453 
  51454 
  51455 void hasSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  51456 
  51457   bool r;
  51458   smallJsont *self = allocSmallJson();
  51459 
  51460   r = hasSmallIntSmallJsonG(self, null);
  51461   ck_assert(!r);
  51462   terminateO(self);
  51463 
  51464 }
  51465 
  51466 
  51467 void hasSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  51468 
  51469   bool r;
  51470   smallJsont *self = allocSmallJson();
  51471 
  51472   r = hasSmallJsonSmallJsonG(self, null);
  51473   ck_assert(!r);
  51474   terminateO(self);
  51475 
  51476 }
  51477 
  51478 
  51479 void hasSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  51480 
  51481   bool r;
  51482   smallJsont *self = allocSmallJson();
  51483 
  51484   r = hasSmallStringSmallJsonG(self, null);
  51485   ck_assert(!r);
  51486   terminateO(self);
  51487 
  51488 }
  51489 
  51490 
  51491 void hasSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  51492 
  51493   bool r;
  51494   smallJsont *self = allocSmallJson();
  51495 
  51496   r = hasSmallContainerSmallJsonG(self, null);
  51497   ck_assert(!r);
  51498   terminateO(self);
  51499 
  51500 }
  51501 
  51502 
  51503 void findSmallJsonGT(CuTest *tc UNUSED) {
  51504 
  51505   smallJsont* r;
  51506   smallJsont *self = allocG(rtSmallJsont);
  51507 
  51508   // find string in the middle
  51509   freeO(self);
  51510   setTopSO(self, "sheepy");
  51511   r =  findSmallJsonG(self, "ee");
  51512   ck_assert_ptr_ne(r, null);
  51513   ck_assert_str_eq(sjGet(r), "eepy");
  51514   terminateO(r);
  51515   terminateO(self);
  51516 
  51517 }
  51518 
  51519 
  51520 void findCharSmallJsonGT(CuTest *tc UNUSED) {
  51521 
  51522   smallJsont* r;
  51523   smallJsont *self = allocG(rtSmallJsont);
  51524 
  51525   // find string in the middle
  51526   setTopSO(self, "sheepy");
  51527   r = findCharSmallJsonG(self, 'e');
  51528   ck_assert_ptr_ne(r, null);
  51529   ck_assert_str_eq(sjGet(r), "eepy");
  51530   terminateO(r);
  51531   terminateO(self);
  51532 
  51533 }
  51534 
  51535 
  51536 void findSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  51537 
  51538   smallJsont* r;
  51539   smallJsont *self     = allocG(rtSmallJsont);
  51540   smallStringt *needle = allocSmallString("ee");
  51541 
  51542   // find string in the middle
  51543   setTopSO(self, "sheepy");
  51544   r = findSmallStringSmallJsonG(self, needle);
  51545   ck_assert_ptr_ne(r, null);
  51546   ck_assert_str_eq(sjGet(r), "eepy");
  51547   terminateO(r);
  51548   terminateO(needle);
  51549   terminateO(self);
  51550 
  51551 }
  51552 
  51553 
  51554 void findJsonSmallJsonGT(CuTest *tc UNUSED) {
  51555 
  51556   smallJsont* r;
  51557   smallJsont *self   = allocG(rtSmallJsont);
  51558   smallJsont *needle = allocSmallJson();
  51559 
  51560   // find string in the middle
  51561   setTopSO(self, "sheepy");
  51562   setTopSO(needle, "ee");
  51563   r = findJsonSmallJsonG(self, needle);
  51564   ck_assert_ptr_ne(r, null);
  51565   ck_assert_str_eq(sjGet(r), "eepy");
  51566   terminateO(r);
  51567   terminateO(needle);
  51568   terminateO(self);
  51569 
  51570 }
  51571 
  51572 
  51573 void indexOfSmallJsonGT(CuTest *tc UNUSED) {
  51574 
  51575   ssize_t r;
  51576   smallJsont *self = allocSmallJson();
  51577 
  51578   r = indexOfSmallJsonG(self, null);
  51579   ck_assert_int_eq(r, -1);
  51580   terminateO(self);
  51581 
  51582 }
  51583 
  51584 
  51585 void indexOfUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  51586 
  51587   ssize_t r;
  51588   smallJsont *self = allocSmallJson();
  51589 
  51590   r = indexOfUndefinedSmallJsonG(self, null);
  51591   ck_assert_int_eq(r, -1);
  51592   terminateO(self);
  51593 
  51594 }
  51595 
  51596 
  51597 void indexOfBoolSmallJsonGT(CuTest *tc UNUSED) {
  51598 
  51599   ssize_t r;
  51600   smallJsont *self = allocSmallJson();
  51601 
  51602   r = indexOfBoolSmallJsonG(self, false);
  51603   ck_assert_int_eq(r, -1);
  51604   terminateO(self);
  51605 
  51606 }
  51607 
  51608 
  51609 void indexOfDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51610 
  51611   ssize_t r;
  51612   smallJsont *self = allocSmallJson();
  51613 
  51614   r = indexOfDoubleSmallJsonG(self, 0);
  51615   ck_assert_int_eq(r, -1);
  51616   terminateO(self);
  51617 
  51618 }
  51619 
  51620 
  51621 void indexOfIntSmallJsonGT(CuTest *tc UNUSED) {
  51622 
  51623   ssize_t r;
  51624   smallJsont *self = allocSmallJson();
  51625 
  51626   r = indexOfIntSmallJsonG(self, 0);
  51627   ck_assert_int_eq(r, -1);
  51628   terminateO(self);
  51629 
  51630 }
  51631 
  51632 
  51633 void indexOfSSmallJsonGT(CuTest *tc UNUSED) {
  51634 
  51635   ssize_t r;
  51636   smallJsont *self = allocSmallJson();
  51637 
  51638   r = indexOfSSmallJsonG(self, null);
  51639   ck_assert_int_eq(r, -1);
  51640   terminateO(self);
  51641 
  51642 }
  51643 
  51644 
  51645 void indexOfCharSmallJsonGT(CuTest *tc UNUSED) {
  51646 
  51647   ssize_t r;
  51648   smallJsont *self = allocSmallJson();
  51649 
  51650   r = indexOfCharSmallJsonG(self, ' ');
  51651   ck_assert_int_eq(r, -1);
  51652   terminateO(self);
  51653 
  51654 }
  51655 
  51656 
  51657 void indexOfDictSmallJsonGT(CuTest *tc UNUSED) {
  51658 
  51659   ssize_t r;
  51660   smallJsont *self = allocSmallJson();
  51661 
  51662   r = indexOfDictSmallJsonG(self, null);
  51663   ck_assert_int_eq(r, -1);
  51664   terminateO(self);
  51665 
  51666 }
  51667 
  51668 
  51669 void indexOfArraySmallJsonGT(CuTest *tc UNUSED) {
  51670 
  51671   ssize_t r;
  51672   smallJsont *self = allocSmallJson();
  51673 
  51674   r = indexOfArraySmallJsonG(self, null);
  51675   ck_assert_int_eq(r, -1);
  51676   terminateO(self);
  51677 
  51678 }
  51679 
  51680 
  51681 void indexOfArraycSmallJsonGT(CuTest *tc UNUSED) {
  51682 
  51683   ssize_t r;
  51684   smallJsont *self = allocSmallJson();
  51685 
  51686   r = indexOfArraycSmallJsonG(self, null);
  51687   ck_assert_int_eq(r, -1);
  51688   terminateO(self);
  51689 
  51690 }
  51691 
  51692 
  51693 void indexOfCArraycSmallJsonGT(CuTest *tc UNUSED) {
  51694 
  51695   ssize_t r;
  51696   smallJsont *self = allocSmallJson();
  51697 
  51698   r = indexOfCArraycSmallJsonG(self, null);
  51699   ck_assert_int_eq(r, -1);
  51700   terminateO(self);
  51701 
  51702 }
  51703 
  51704 
  51705 void indexOfSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  51706 
  51707   ssize_t r;
  51708   smallJsont *self = allocSmallJson();
  51709 
  51710   r = indexOfSmallBoolSmallJsonG(self, null);
  51711   ck_assert_int_eq(r, -1);
  51712   terminateO(self);
  51713 
  51714 }
  51715 
  51716 
  51717 void indexOfSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  51718 
  51719   ssize_t r;
  51720   smallJsont *self = allocSmallJson();
  51721 
  51722   r = indexOfSmallBytesSmallJsonG(self, null);
  51723   ck_assert_int_eq(r, -1);
  51724   terminateO(self);
  51725 
  51726 }
  51727 
  51728 
  51729 void indexOfSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51730 
  51731   ssize_t r;
  51732   smallJsont *self = allocSmallJson();
  51733 
  51734   r = indexOfSmallDoubleSmallJsonG(self, null);
  51735   ck_assert_int_eq(r, -1);
  51736   terminateO(self);
  51737 
  51738 }
  51739 
  51740 
  51741 void indexOfSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  51742 
  51743   ssize_t r;
  51744   smallJsont *self = allocSmallJson();
  51745 
  51746   r = indexOfSmallIntSmallJsonG(self, null);
  51747   ck_assert_int_eq(r, -1);
  51748   terminateO(self);
  51749 
  51750 }
  51751 
  51752 
  51753 void indexOfSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  51754 
  51755   ssize_t r;
  51756   smallJsont *self = allocSmallJson();
  51757 
  51758   r = indexOfSmallJsonSmallJsonG(self, null);
  51759   ck_assert_int_eq(r, -1);
  51760   terminateO(self);
  51761 
  51762 }
  51763 
  51764 
  51765 void indexOfSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  51766 
  51767   ssize_t r;
  51768   smallJsont *self = allocSmallJson();
  51769 
  51770   r = indexOfSmallStringSmallJsonG(self, null);
  51771   ck_assert_int_eq(r, -1);
  51772   terminateO(self);
  51773 
  51774 }
  51775 
  51776 
  51777 void indexOfSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  51778 
  51779   ssize_t r;
  51780   smallJsont *self = allocSmallJson();
  51781 
  51782   r = indexOfSmallContainerSmallJsonG(self, null);
  51783   ck_assert_int_eq(r, -1);
  51784   terminateO(self);
  51785 
  51786 }
  51787 
  51788 
  51789 void binarySearchSmallJsonGT(CuTest *tc UNUSED) {
  51790 
  51791   ssize_t r;
  51792   smallJsont *self = allocSmallJson();
  51793 
  51794   r = binarySearchSmallJsonG(self, null);
  51795   ck_assert_int_eq(r, -1);
  51796   terminateO(self);
  51797 
  51798 }
  51799 
  51800 
  51801 void binarySearchUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  51802 
  51803   ssize_t r;
  51804   smallJsont *self = allocSmallJson();
  51805 
  51806   r = binarySearchUndefinedSmallJsonG(self, null);
  51807   ck_assert_int_eq(r, -1);
  51808   terminateO(self);
  51809 
  51810 }
  51811 
  51812 
  51813 void binarySearchBoolSmallJsonGT(CuTest *tc UNUSED) {
  51814 
  51815   ssize_t r;
  51816   smallJsont *self = allocSmallJson();
  51817 
  51818   r = binarySearchBoolSmallJsonG(self, false);
  51819   ck_assert_int_eq(r, -1);
  51820   terminateO(self);
  51821 
  51822 }
  51823 
  51824 
  51825 void binarySearchDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51826 
  51827   ssize_t r;
  51828   smallJsont *self = allocSmallJson();
  51829 
  51830   r = binarySearchDoubleSmallJsonG(self, 0);
  51831   ck_assert_int_eq(r, -1);
  51832   terminateO(self);
  51833 
  51834 }
  51835 
  51836 
  51837 void binarySearchIntSmallJsonGT(CuTest *tc UNUSED) {
  51838 
  51839   ssize_t r;
  51840   smallJsont *self = allocSmallJson();
  51841 
  51842   r = binarySearchIntSmallJsonG(self, 0);
  51843   ck_assert_int_eq(r, -1);
  51844   terminateO(self);
  51845 
  51846 }
  51847 
  51848 
  51849 void binarySearchSSmallJsonGT(CuTest *tc UNUSED) {
  51850 
  51851   ssize_t r;
  51852   smallJsont *self = allocSmallJson();
  51853 
  51854   r = binarySearchSSmallJsonG(self, null);
  51855   ck_assert_int_eq(r, -1);
  51856   terminateO(self);
  51857 
  51858 }
  51859 
  51860 
  51861 void binarySearchCharSmallJsonGT(CuTest *tc UNUSED) {
  51862 
  51863   ssize_t r;
  51864   smallJsont *self = allocSmallJson();
  51865 
  51866   r = binarySearchCharSmallJsonG(self, ' ');
  51867   ck_assert_int_eq(r, -1);
  51868   terminateO(self);
  51869 
  51870 }
  51871 
  51872 
  51873 void binarySearchDictSmallJsonGT(CuTest *tc UNUSED) {
  51874 
  51875   ssize_t r;
  51876   smallJsont *self = allocSmallJson();
  51877 
  51878   r = binarySearchDictSmallJsonG(self, null);
  51879   ck_assert_int_eq(r, -1);
  51880   terminateO(self);
  51881 
  51882 }
  51883 
  51884 
  51885 void binarySearchArraySmallJsonGT(CuTest *tc UNUSED) {
  51886 
  51887   ssize_t r;
  51888   smallJsont *self = allocSmallJson();
  51889 
  51890   r = binarySearchArraySmallJsonG(self, null);
  51891   ck_assert_int_eq(r, -1);
  51892   terminateO(self);
  51893 
  51894 }
  51895 
  51896 
  51897 void binarySearchArraycSmallJsonGT(CuTest *tc UNUSED) {
  51898 
  51899   ssize_t r;
  51900   smallJsont *self = allocSmallJson();
  51901 
  51902   r = binarySearchArraycSmallJsonG(self, null);
  51903   ck_assert_int_eq(r, -1);
  51904   terminateO(self);
  51905 
  51906 }
  51907 
  51908 
  51909 void binarySearchCArraycSmallJsonGT(CuTest *tc UNUSED) {
  51910 
  51911   ssize_t r;
  51912   smallJsont *self = allocSmallJson();
  51913 
  51914   r = binarySearchCArraycSmallJsonG(self, null);
  51915   ck_assert_int_eq(r, -1);
  51916   terminateO(self);
  51917 
  51918 }
  51919 
  51920 
  51921 void binarySearchSmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  51922 
  51923   ssize_t r;
  51924   smallJsont *self = allocSmallJson();
  51925 
  51926   r = binarySearchSmallBoolSmallJsonG(self, null);
  51927   ck_assert_int_eq(r, -1);
  51928   terminateO(self);
  51929 
  51930 }
  51931 
  51932 
  51933 void binarySearchSmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  51934 
  51935   ssize_t r;
  51936   smallJsont *self = allocSmallJson();
  51937 
  51938   r = binarySearchSmallBytesSmallJsonG(self, null);
  51939   ck_assert_int_eq(r, -1);
  51940   terminateO(self);
  51941 
  51942 }
  51943 
  51944 
  51945 void binarySearchSmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  51946 
  51947   ssize_t r;
  51948   smallJsont *self = allocSmallJson();
  51949 
  51950   r = binarySearchSmallDoubleSmallJsonG(self, null);
  51951   ck_assert_int_eq(r, -1);
  51952   terminateO(self);
  51953 
  51954 }
  51955 
  51956 
  51957 void binarySearchSmallIntSmallJsonGT(CuTest *tc UNUSED) {
  51958 
  51959   ssize_t r;
  51960   smallJsont *self = allocSmallJson();
  51961 
  51962   r = binarySearchSmallIntSmallJsonG(self, null);
  51963   ck_assert_int_eq(r, -1);
  51964   terminateO(self);
  51965 
  51966 }
  51967 
  51968 
  51969 void binarySearchSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  51970 
  51971   ssize_t r;
  51972   smallJsont *self = allocSmallJson();
  51973 
  51974   r = binarySearchSmallJsonSmallJsonG(self, null);
  51975   ck_assert_int_eq(r, -1);
  51976   terminateO(self);
  51977 
  51978 }
  51979 
  51980 
  51981 void binarySearchSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  51982 
  51983   ssize_t r;
  51984   smallJsont *self = allocSmallJson();
  51985 
  51986   r = binarySearchSmallStringSmallJsonG(self, null);
  51987   ck_assert_int_eq(r, -1);
  51988   terminateO(self);
  51989 
  51990 }
  51991 
  51992 
  51993 void binarySearchSmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  51994 
  51995   ssize_t r;
  51996   smallJsont *self = allocSmallJson();
  51997 
  51998   r = binarySearchSmallContainerSmallJsonG(self, null);
  51999   ck_assert_int_eq(r, -1);
  52000   terminateO(self);
  52001 
  52002 }
  52003 
  52004 
  52005 void icHasSmallJsonGT(CuTest *tc UNUSED) {
  52006 
  52007   bool r;
  52008   smallJsont *self = allocSmallJson();
  52009 
  52010   r = icHasSmallJsonG(self, null);
  52011   ck_assert(!r);
  52012   terminateO(self);
  52013 
  52014 }
  52015 
  52016 
  52017 void icHasSSmallJsonGT(CuTest *tc UNUSED) {
  52018 
  52019   bool r;
  52020   smallJsont *self = allocSmallJson();
  52021 
  52022   r = icHasSSmallJsonG(self, null);
  52023   ck_assert(!r);
  52024   terminateO(self);
  52025 
  52026 }
  52027 
  52028 
  52029 void icHasCharSmallJsonGT(CuTest *tc UNUSED) {
  52030 
  52031   bool r;
  52032   smallJsont *self = allocSmallJson();
  52033 
  52034   r = icHasCharSmallJsonG(self, 'a');
  52035   ck_assert(!r);
  52036   terminateO(self);
  52037 
  52038 }
  52039 
  52040 
  52041 void icHasDictSmallJsonGT(CuTest *tc UNUSED) {
  52042 
  52043   bool r;
  52044   smallJsont *self = allocSmallJson();
  52045 
  52046   r = icHasDictSmallJsonG(self, null);
  52047   ck_assert(!r);
  52048   terminateO(self);
  52049 
  52050 }
  52051 
  52052 
  52053 void icHasArraySmallJsonGT(CuTest *tc UNUSED) {
  52054 
  52055   bool r;
  52056   smallJsont *self = allocSmallJson();
  52057 
  52058   r = icHasArraySmallJsonG(self, null);
  52059   ck_assert(!r);
  52060   terminateO(self);
  52061 
  52062 }
  52063 
  52064 
  52065 void icHasArraycSmallJsonGT(CuTest *tc UNUSED) {
  52066 
  52067   bool r;
  52068   smallJsont *self = allocSmallJson();
  52069 
  52070   r = icHasArraycSmallJsonG(self, null);
  52071   ck_assert(!r);
  52072   terminateO(self);
  52073 
  52074 }
  52075 
  52076 
  52077 void icHasCArraycSmallJsonGT(CuTest *tc UNUSED) {
  52078 
  52079   bool r;
  52080   smallJsont *self = allocSmallJson();
  52081 
  52082   r = icHasCArraycSmallJsonG(self, null);
  52083   ck_assert(!r);
  52084   terminateO(self);
  52085 
  52086 }
  52087 
  52088 
  52089 void icHasSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52090 
  52091   bool r;
  52092   smallJsont *self = allocSmallJson();
  52093 
  52094   r = icHasSmallStringSmallJsonG(self, null);
  52095   ck_assert(!r);
  52096   terminateO(self);
  52097 
  52098 }
  52099 
  52100 
  52101 void icFindSmallJsonGT(CuTest *tc UNUSED) {
  52102 
  52103   smallJsont* r;
  52104   smallJsont *self = allocG(rtSmallJsont);
  52105 
  52106   // icFind string in the middle
  52107   setTopSO(self, "sheepy");
  52108   r =  icFindSmallJsonG(self, "EE");
  52109   ck_assert_ptr_ne(r, null);
  52110   ck_assert_str_eq(sjGet(r), "eepy");
  52111   terminateO(r);
  52112   terminateO(self);
  52113 
  52114 }
  52115 
  52116 
  52117 void icFindCharSmallJsonGT(CuTest *tc UNUSED) {
  52118 
  52119   smallJsont* r;
  52120   smallJsont *self = allocG(rtSmallJsont);
  52121 
  52122   // find string in the middle
  52123   setTopSO(self, "sheepy");
  52124   r = icFindCharSmallJsonG(self, 'E');
  52125   ck_assert_ptr_ne(r, null);
  52126   ck_assert_str_eq(sjGet(r), "eepy");
  52127   terminateO(r);
  52128   terminateO(self);
  52129 
  52130 }
  52131 
  52132 
  52133 void icFindSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52134 
  52135   smallJsont* r;
  52136   smallJsont *self     = allocG(rtSmallJsont);
  52137   smallStringt *needle = allocSmallString("EE");
  52138 
  52139   // find string in the middle
  52140   setTopSO(self, "sheepy");
  52141   r = icFindSmallStringSmallJsonG(self, needle);
  52142   ck_assert_ptr_ne(r, null);
  52143   ck_assert_str_eq(sjGet(r), "eepy");
  52144   terminateO(r);
  52145   terminateO(needle);
  52146   terminateO(self);
  52147 
  52148 }
  52149 
  52150 
  52151 void icFindJsonSmallJsonGT(CuTest *tc UNUSED) {
  52152 
  52153   smallJsont* r;
  52154   smallJsont *self   = allocG(rtSmallJsont);
  52155   smallJsont *needle = allocSmallJson();
  52156 
  52157   // find string in the middle
  52158   setTopSO(self, "sheepy");
  52159   setTopSO(needle, "EE");
  52160   r = icFindJsonSmallJsonG(self, needle);
  52161   ck_assert_ptr_ne(r, null);
  52162   ck_assert_str_eq(sjGet(r), "eepy");
  52163   terminateO(r);
  52164   terminateO(needle);
  52165   terminateO(self);
  52166 
  52167 }
  52168 
  52169 
  52170 void icIndexOfSmallJsonGT(CuTest *tc UNUSED) {
  52171 
  52172   ssize_t r;
  52173   smallJsont *self = allocSmallJson();
  52174 
  52175   r = icIndexOfSmallJsonG(self, null);
  52176   ck_assert_int_eq(r, -1);
  52177   terminateO(self);
  52178 
  52179 }
  52180 
  52181 
  52182 void icIndexOfSSmallJsonGT(CuTest *tc UNUSED) {
  52183 
  52184   ssize_t r;
  52185   smallJsont *self = allocSmallJson();
  52186 
  52187   r = icIndexOfSSmallJsonG(self, null);
  52188   ck_assert_int_eq(r, -1);
  52189   terminateO(self);
  52190 
  52191 }
  52192 
  52193 
  52194 void icIndexOfCharSmallJsonGT(CuTest *tc UNUSED) {
  52195 
  52196   ssize_t r;
  52197   smallJsont *self = allocSmallJson();
  52198 
  52199   r = icIndexOfCharSmallJsonG(self, 'A');
  52200   ck_assert_int_eq(r, -1);
  52201   terminateO(self);
  52202 
  52203 }
  52204 
  52205 
  52206 void icIndexOfDictSmallJsonGT(CuTest *tc UNUSED) {
  52207 
  52208   ssize_t r;
  52209   smallJsont *self = allocSmallJson();
  52210 
  52211   r = icIndexOfDictSmallJsonG(self, null);
  52212   ck_assert_int_eq(r, -1);
  52213   terminateO(self);
  52214 
  52215 }
  52216 
  52217 
  52218 void icIndexOfArraySmallJsonGT(CuTest *tc UNUSED) {
  52219 
  52220   ssize_t r;
  52221   smallJsont *self = allocSmallJson();
  52222 
  52223   r = icIndexOfArraySmallJsonG(self, null);
  52224   ck_assert_int_eq(r, -1);
  52225   terminateO(self);
  52226 
  52227 }
  52228 
  52229 
  52230 void icIndexOfArraycSmallJsonGT(CuTest *tc UNUSED) {
  52231 
  52232   ssize_t r;
  52233   smallJsont *self = allocSmallJson();
  52234 
  52235   r = icIndexOfArraycSmallJsonG(self, null);
  52236   ck_assert_int_eq(r, -1);
  52237   terminateO(self);
  52238 
  52239 }
  52240 
  52241 
  52242 void icIndexOfCArraycSmallJsonGT(CuTest *tc UNUSED) {
  52243 
  52244   ssize_t r;
  52245   smallJsont *self = allocSmallJson();
  52246 
  52247   r = icIndexOfCArraycSmallJsonG(self, null);
  52248   ck_assert_int_eq(r, -1);
  52249   terminateO(self);
  52250 
  52251 }
  52252 
  52253 
  52254 void icIndexOfSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52255 
  52256   ssize_t r;
  52257   smallJsont *self = allocSmallJson();
  52258 
  52259   r = icIndexOfSmallStringSmallJsonG(self, null);
  52260   ck_assert_int_eq(r, -1);
  52261   terminateO(self);
  52262 
  52263 }
  52264 
  52265 
  52266 void icBinarySearchSmallJsonGT(CuTest *tc UNUSED) {
  52267 
  52268   ssize_t r;
  52269   smallJsont *self = allocSmallJson();
  52270 
  52271   r = icBinarySearchSmallJsonG(self, null);
  52272   ck_assert_int_eq(r, -1);
  52273   terminateO(self);
  52274 
  52275 }
  52276 
  52277 
  52278 void icBinarySearchSSmallJsonGT(CuTest *tc UNUSED) {
  52279 
  52280   ssize_t r;
  52281   smallJsont *self = allocSmallJson();
  52282 
  52283   r = icBinarySearchSSmallJsonG(self, null);
  52284   ck_assert_int_eq(r, -1);
  52285   terminateO(self);
  52286 
  52287 }
  52288 
  52289 
  52290 void icBinarySearchCharSmallJsonGT(CuTest *tc UNUSED) {
  52291 
  52292   ssize_t r;
  52293   smallJsont *self = allocSmallJson();
  52294 
  52295   r = icBinarySearchCharSmallJsonG(self, 'a');
  52296   ck_assert_int_eq(r, -1);
  52297   terminateO(self);
  52298 
  52299 }
  52300 
  52301 
  52302 void icBinarySearchDictSmallJsonGT(CuTest *tc UNUSED) {
  52303 
  52304   ssize_t r;
  52305   smallJsont *self = allocSmallJson();
  52306 
  52307   r = icBinarySearchDictSmallJsonG(self, null);
  52308   ck_assert_int_eq(r, -1);
  52309   terminateO(self);
  52310 
  52311 }
  52312 
  52313 
  52314 void icBinarySearchArraySmallJsonGT(CuTest *tc UNUSED) {
  52315 
  52316   ssize_t r;
  52317   smallJsont *self = allocSmallJson();
  52318 
  52319   r = icBinarySearchArraySmallJsonG(self, null);
  52320   ck_assert_int_eq(r, -1);
  52321   terminateO(self);
  52322 
  52323 }
  52324 
  52325 
  52326 void icBinarySearchArraycSmallJsonGT(CuTest *tc UNUSED) {
  52327 
  52328   ssize_t r;
  52329   smallJsont *self = allocSmallJson();
  52330 
  52331   r = icBinarySearchArraycSmallJsonG(self, null);
  52332   ck_assert_int_eq(r, -1);
  52333   terminateO(self);
  52334 
  52335 }
  52336 
  52337 
  52338 void icBinarySearchCArraycSmallJsonGT(CuTest *tc UNUSED) {
  52339 
  52340   ssize_t r;
  52341   smallJsont *self = allocSmallJson();
  52342 
  52343   r = icBinarySearchCArraycSmallJsonG(self, null);
  52344   ck_assert_int_eq(r, -1);
  52345   terminateO(self);
  52346 
  52347 }
  52348 
  52349 
  52350 void icBinarySearchSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52351 
  52352   ssize_t r;
  52353   smallJsont *self = allocSmallJson();
  52354 
  52355   r = icBinarySearchSmallStringSmallJsonG(self, null);
  52356   ck_assert_int_eq(r, -1);
  52357   terminateO(self);
  52358 
  52359 }
  52360 
  52361 
  52362 void keyBySmallJsonGT(CuTest *tc UNUSED) {
  52363 
  52364   char* r;
  52365   smallJsont *self = allocSmallJson();
  52366   baset *value;
  52367 
  52368   smallJsont *r2 = self->f->setInt(self, "1", 1);
  52369   ck_assert_ptr_ne(r2, null);
  52370   value = (baset*) allocSmallInt(1);
  52371   r = keyBySmallJsonG(self, value);
  52372   ck_assert_str_eq(r, "1");
  52373   terminateO(value);
  52374   terminateO(self);
  52375 
  52376 }
  52377 
  52378 
  52379 void keyByUndefinedSmallJsonGT(CuTest *tc UNUSED) {
  52380 
  52381   char* r;
  52382   smallJsont *self = allocSmallJson();
  52383   undefinedt *value;
  52384 
  52385   smallJsont *r2 = self->f->setUndefined(self, "1");
  52386   ck_assert_ptr_ne(r2, null);
  52387   value = allocUndefined();
  52388   r = keyByUndefinedSmallJsonG(self, value);
  52389   ck_assert_str_eq(r, "1");
  52390   terminateO(value);
  52391   terminateO(self);
  52392 
  52393 }
  52394 
  52395 
  52396 void keyByBoolSmallJsonGT(CuTest *tc UNUSED) {
  52397 
  52398   char* r;
  52399   smallJsont *self = allocSmallJson();
  52400 
  52401   smallJsont *r2 = self->f->setBool(self, "1", true);
  52402   ck_assert_ptr_ne(r2, null);
  52403   r = keyByBoolSmallJsonG(self, true);
  52404   ck_assert_str_eq(r, "1");
  52405   terminateO(self);
  52406 
  52407 }
  52408 
  52409 
  52410 void keyByDoubleSmallJsonGT(CuTest *tc UNUSED) {
  52411 
  52412   char* r;
  52413   smallJsont *self = allocSmallJson();
  52414 
  52415   smallJsont *r2 = self->f->setDouble(self, "1", 2.2);
  52416   ck_assert_ptr_ne(r2, null);
  52417   r = keyByDoubleSmallJsonG(self, 2.2);
  52418   ck_assert_str_eq(r, "1");
  52419   terminateO(self);
  52420 
  52421 }
  52422 
  52423 
  52424 void keyByIntSmallJsonGT(CuTest *tc UNUSED) {
  52425 
  52426   char* r;
  52427   smallJsont *self = allocSmallJson();
  52428 
  52429   smallJsont *r2 = self->f->setInt(self, "1", 2);
  52430   ck_assert_ptr_ne(r2, null);
  52431   r = keyByIntSmallJsonG(self, 2);
  52432   ck_assert_str_eq(r, "1");
  52433   terminateO(self);
  52434 
  52435 }
  52436 
  52437 
  52438 void keyBySSmallJsonGT(CuTest *tc UNUSED) {
  52439 
  52440   char* r;
  52441   smallJsont *self = allocSmallJson();
  52442 
  52443   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  52444   ck_assert_ptr_ne(r2, null);
  52445   r = keyBySSmallJsonG(self, "qwe");
  52446   ck_assert_str_eq(r, "1");
  52447   terminateO(self);
  52448 
  52449 }
  52450 
  52451 
  52452 void keyByCharSmallJsonGT(CuTest *tc UNUSED) {
  52453 
  52454   char* r;
  52455   smallJsont *self = allocSmallJson();
  52456 
  52457   smallJsont *r2 = self->f->setS(self, "1", "q");
  52458   ck_assert_ptr_ne(r2, null);
  52459   r = keyByCharSmallJsonG(self, 'q');
  52460   ck_assert_str_eq(r, "1");
  52461   terminateO(self);
  52462 
  52463 }
  52464 
  52465 
  52466 void keyByDictSmallJsonGT(CuTest *tc UNUSED) {
  52467 
  52468   char* r;
  52469   smallJsont *self = allocSmallJson();
  52470   smallDictt *dict = allocSmallDict();
  52471 
  52472   createAllocateSmallDict(d);
  52473   d->f->setS(d, "another", "dict");
  52474   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  52475   ck_assert_ptr_ne(r2, null);
  52476   r2 = self->f->setNFreeDict(self, "1", dict);
  52477   ck_assert_ptr_ne(r2, null);
  52478   dict = allocSmallDict();
  52479   r = keyByDictSmallJsonG(self, dict);
  52480   ck_assert_str_eq(r, "1");
  52481   terminateO(dict);
  52482   terminateO(self);
  52483 
  52484 }
  52485 
  52486 
  52487 void keyByArraySmallJsonGT(CuTest *tc UNUSED) {
  52488 
  52489   char* r;
  52490   smallJsont *self   = allocSmallJson();
  52491   smallArrayt *array = allocSmallArray();
  52492 
  52493   createAllocateSmallArray(d);
  52494   d->f->pushS(d, "another array");
  52495   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  52496   ck_assert_ptr_ne(r2, null);
  52497   r2 = self->f->setNFreeArray(self, "1", array);
  52498   ck_assert_ptr_ne(r2, null);
  52499   array = allocSmallArray();
  52500   r = keyByArraySmallJsonG(self, array);
  52501   ck_assert_str_eq(r, "1");
  52502   terminateO(array);
  52503   terminateO(self);
  52504 
  52505 }
  52506 
  52507 
  52508 void keyByArraycSmallJsonGT(CuTest *tc UNUSED) {
  52509 
  52510   char* r;
  52511   smallJsont *self = allocSmallJson();
  52512   char **array     = listCreateS("a","b");
  52513 
  52514   char **d = listCreateS("asd", "zxcv");
  52515   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52516   ck_assert_ptr_ne(r2, null);
  52517   r2 = self->f->setArrayc(self, "1", array);
  52518   ck_assert_ptr_ne(r2, null);
  52519   r = keyByArraycSmallJsonG(self, array);
  52520   ck_assert_ptr_ne(r, NULL);
  52521   ck_assert_str_eq(r, "1");
  52522   listFreeS(array);
  52523   terminateO(self);
  52524 
  52525 }
  52526 
  52527 
  52528 void keyByCArraycSmallJsonGT(CuTest *tc UNUSED) {
  52529 
  52530   char* r;
  52531   smallJsont *self = allocSmallJson();
  52532   char **array     = listCreateS("a","b");
  52533   const char *a[]  = {"a", "b", null};
  52534 
  52535   char **d = listCreateS("asd", "zxcv");
  52536   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52537   ck_assert_ptr_ne(r2, null);
  52538   r2 = self->f->setArrayc(self, "1", array);
  52539   ck_assert_ptr_ne(r2, null);
  52540   r = keyByCArraycSmallJsonG(self, a);
  52541   ck_assert_ptr_ne(r, NULL);
  52542   ck_assert_str_eq(r, "1");
  52543   listFreeS(array);
  52544   terminateO(self);
  52545 
  52546 }
  52547 
  52548 
  52549 void keyBySmallBoolSmallJsonGT(CuTest *tc UNUSED) {
  52550 
  52551   char* r;
  52552   smallJsont *self  = allocSmallJson();
  52553   smallBoolt *value = allocSmallBool(true);
  52554 
  52555   createAllocateSmallBool(d);
  52556   setValO(d, false);
  52557   smallJsont *r2 = self->f->setNFreeSmallBool(self, "d", d);
  52558   ck_assert_ptr_ne(r2, null);
  52559   r2 = self->f->setNFreeSmallBool(self, "1", value);
  52560   ck_assert_ptr_ne(r2, null);
  52561   value = allocSmallBool(true);
  52562   r = keyBySmallBoolSmallJsonG(self, value);
  52563   ck_assert_str_eq(r, "1");
  52564   terminateO(value);
  52565   terminateO(self);
  52566 
  52567 }
  52568 
  52569 
  52570 void keyBySmallBytesSmallJsonGT(CuTest *tc UNUSED) {
  52571 
  52572   char* r;
  52573   smallJsont *self   = allocSmallJson();
  52574   smallBytest *value = allocSmallBytes("qwe", sizeof("qwe"));
  52575 
  52576   smallBytest *d = allocSmallBytes("asd", sizeof("asd"));
  52577   smallJsont *r2 = self->f->setNFreeSmallBytes(self, "d", d);
  52578   ck_assert_ptr_ne(r2, null);
  52579   r2 = self->f->setNFreeSmallBytes(self, "1", value);
  52580   ck_assert_ptr_ne(r2, null);
  52581   value = allocSmallBytes("qwe", sizeof("qwe"));
  52582   r = keyBySmallBytesSmallJsonG(self, value);
  52583   ck_assert_str_eq(r, "1");
  52584   terminateO(value);
  52585   terminateO(self);
  52586 
  52587 }
  52588 
  52589 
  52590 void keyBySmallDoubleSmallJsonGT(CuTest *tc UNUSED) {
  52591 
  52592   char* r;
  52593   smallJsont *self    = allocSmallJson();
  52594   smallDoublet *value = allocSmallDouble(2.2);
  52595 
  52596   createAllocateSmallDouble(d);
  52597   smallJsont *r2 = self->f->setNFreeSmallDouble(self, "d", d);
  52598   ck_assert_ptr_ne(r2, null);
  52599   r2 = self->f->setNFreeSmallDouble(self, "1", value);
  52600   ck_assert_ptr_ne(r2, null);
  52601   value = allocSmallDouble(2.2);
  52602   r = keyBySmallDoubleSmallJsonG(self, value);
  52603   ck_assert_str_eq(r, "1");
  52604   terminateO(value);
  52605   terminateO(self);
  52606 
  52607 }
  52608 
  52609 
  52610 void keyBySmallIntSmallJsonGT(CuTest *tc UNUSED) {
  52611 
  52612   char* r;
  52613   smallJsont *self = allocSmallJson();
  52614   smallIntt *value = allocSmallInt(2);
  52615 
  52616   createAllocateSmallInt(d);
  52617   smallJsont *r2 = self->f->setNFreeSmallInt(self, "d", d);
  52618   ck_assert_ptr_ne(r2, null);
  52619   r2 = self->f->setNFreeSmallInt(self, "1", value);
  52620   ck_assert_ptr_ne(r2, null);
  52621   value = allocSmallInt(2);
  52622   r = keyBySmallIntSmallJsonG(self, value);
  52623   ck_assert_str_eq(r, "1");
  52624   terminateO(value);
  52625   terminateO(self);
  52626 
  52627 }
  52628 
  52629 
  52630 void keyBySmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  52631 
  52632   char* r;
  52633   smallJsont *self  = allocSmallJson();
  52634   smallJsont *value = allocSmallJson();
  52635 
  52636   createUndefined(u);
  52637   setTopO(value, (baset*)&u);
  52638   self->f->setUndefined(self, "1");
  52639   r = keyBySmallJsonSmallJsonG(self, value);
  52640   ck_assert_str_eq(r, "1");
  52641   terminateO(value);
  52642   terminateO(self);
  52643 
  52644 }
  52645 
  52646 
  52647 void keyBySmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52648 
  52649   char* r;
  52650   smallJsont *self    = allocSmallJson();
  52651   smallStringt *value = allocSmallString("qwe");
  52652 
  52653   createAllocateSmallString(d);
  52654   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52655   ck_assert_ptr_ne(r2, null);
  52656   r2 = self->f->setNFreeSmallString(self, "1", value);
  52657   ck_assert_ptr_ne(r2, null);
  52658   value = allocSmallString("qwe");
  52659   r = keyBySmallStringSmallJsonG(self, value);
  52660   ck_assert_str_eq(r, "1");
  52661   terminateO(value);
  52662   terminateO(self);
  52663 
  52664 }
  52665 
  52666 
  52667 void keyBySmallContainerSmallJsonGT(CuTest *tc UNUSED) {
  52668 
  52669   char* r;
  52670   smallJsont *self       = allocSmallJson();
  52671   smallContainert *value = allocSmallContainer(null);
  52672 
  52673   createAllocateSmallString(d);
  52674   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52675   ck_assert_ptr_ne(r2, null);
  52676   r = keyBySmallContainerSmallJsonG(self, value);
  52677   ck_assert_ptr_eq(r, null);
  52678   terminateO(value);
  52679   terminateO(self);
  52680 
  52681 }
  52682 
  52683 
  52684 void icKeyBySmallJsonGT(CuTest *tc UNUSED) {
  52685 
  52686   char* r;
  52687   smallJsont *self = allocSmallJson();
  52688   baset *value;
  52689 
  52690   smallJsont *r2 = self->f->setS(self, "1", "QQ");
  52691   ck_assert_ptr_ne(r2, null);
  52692   value = (baset*) allocSmallString("qq");
  52693   r = icKeyBySmallJsonG(self, value);
  52694   ck_assert_str_eq(r, "1");
  52695   terminateO(value);
  52696   terminateO(self);
  52697 
  52698 }
  52699 
  52700 
  52701 void icKeyBySSmallJsonGT(CuTest *tc UNUSED) {
  52702 
  52703   char* r;
  52704   smallJsont *self = allocSmallJson();
  52705 
  52706   smallJsont *r2 = self->f->setS(self, "1", "qwe");
  52707   ck_assert_ptr_ne(r2, null);
  52708   r = icKeyBySSmallJsonG(self, "QWE");
  52709   ck_assert_str_eq(r, "1");
  52710   terminateO(self);
  52711 
  52712 }
  52713 
  52714 
  52715 void icKeyByCharSmallJsonGT(CuTest *tc UNUSED) {
  52716 
  52717   char* r;
  52718   smallJsont *self = allocSmallJson();
  52719 
  52720   smallJsont *r2 = self->f->setS(self, "1", "q");
  52721   ck_assert_ptr_ne(r2, null);
  52722   r = icKeyByCharSmallJsonG(self, 'Q');
  52723   ck_assert_str_eq(r, "1");
  52724   terminateO(self);
  52725 
  52726 }
  52727 
  52728 
  52729 void icKeyByDictSmallJsonGT(CuTest *tc UNUSED) {
  52730 
  52731   char* r;
  52732   smallJsont *self = allocSmallJson();
  52733   smallDictt *dict = allocSmallDict();
  52734 
  52735   createAllocateSmallDict(d);
  52736   d->f->setS(d, "another", "dict");
  52737   smallJsont *r2 = self->f->setNFreeDict(self, "d", d);
  52738   ck_assert_ptr_ne(r2, null);
  52739   dict->f->setS(dict, "asd", "asd");
  52740   r2 = self->f->setNFreeDict(self, "1", dict);
  52741   ck_assert_ptr_ne(r2, null);
  52742   dict = allocSmallDict();
  52743   dict->f->setS(dict, "ASD", "asd");
  52744   r = icKeyByDictSmallJsonG(self, dict);
  52745   ck_assert_str_eq(r, "1");
  52746   terminateO(dict);
  52747   terminateO(self);
  52748 
  52749 }
  52750 
  52751 
  52752 void icKeyByArraySmallJsonGT(CuTest *tc UNUSED) {
  52753 
  52754   char* r;
  52755   smallJsont *self   = allocSmallJson();
  52756   smallArrayt *array = allocSmallArray();
  52757 
  52758   createAllocateSmallArray(d);
  52759   d->f->pushS(d, "another array");
  52760   smallJsont *r2 = self->f->setNFreeArray(self, "d", d);
  52761   ck_assert_ptr_ne(r2, null);
  52762   array->f->pushS(array, "the array");
  52763   r2 = self->f->setNFreeArray(self, "1", array);
  52764   ck_assert_ptr_ne(r2, null);
  52765   array = allocSmallArray();
  52766   array->f->pushS(array, "The array");
  52767   r = icKeyByArraySmallJsonG(self, array);
  52768   ck_assert_str_eq(r, "1");
  52769   terminateO(array);
  52770   terminateO(self);
  52771 
  52772 }
  52773 
  52774 
  52775 void icKeyByArraycSmallJsonGT(CuTest *tc UNUSED) {
  52776 
  52777   char* r;
  52778   smallJsont *self = allocSmallJson();
  52779   char **array     = listCreateS("a","b");
  52780 
  52781   char **d = listCreateS("asd", "zxcv");
  52782   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52783   ck_assert_ptr_ne(r2, null);
  52784   r2 = self->f->setArrayc(self, "1", array);
  52785   ck_assert_ptr_ne(r2, null);
  52786   iUpperS(&array[0]);
  52787   r = icKeyByArraycSmallJsonG(self, array);
  52788   ck_assert_ptr_ne(r, NULL);
  52789   ck_assert_str_eq(r, "1");
  52790   listFreeS(array);
  52791   terminateO(self);
  52792 
  52793 }
  52794 
  52795 
  52796 void icKeyByCArraycSmallJsonGT(CuTest *tc UNUSED) {
  52797 
  52798   char* r;
  52799   smallJsont *self = allocSmallJson();
  52800   const char *a2[] = {"a","b",null};
  52801   char **array     = listCreateS("a","b");
  52802 
  52803   char **d = listCreateS("asd", "zxcv");
  52804   smallJsont *r2 = self->f->setNFreeArrayc(self, "d", d);
  52805   ck_assert_ptr_ne(r2, null);
  52806   r2 = self->f->setArrayc(self, "1", array);
  52807   ck_assert_ptr_ne(r2, null);
  52808   iUpperS(&array[0]);
  52809   r = icKeyByCArraycSmallJsonG(self, a2);
  52810   ck_assert_ptr_ne(r, NULL);
  52811   ck_assert_str_eq(r, "1");
  52812   listFreeS(array);
  52813   terminateO(self);
  52814 
  52815 }
  52816 
  52817 
  52818 void icKeyBySmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52819 
  52820   char* r;
  52821   smallJsont *self    = allocSmallJson();
  52822   smallStringt *value = allocSmallString("qwe");
  52823 
  52824   createAllocateSmallString(d);
  52825   smallJsont *r2 = self->f->setNFreeSmallString(self, "d", d);
  52826   ck_assert_ptr_ne(r2, null);
  52827   r2 = self->f->setNFreeSmallString(self, "1", value);
  52828   ck_assert_ptr_ne(r2, null);
  52829   value = allocSmallString("QWE");
  52830   r = icKeyBySmallStringSmallJsonG(self, value);
  52831   ck_assert_str_eq(r, "1");
  52832   terminateO(value);
  52833   terminateO(self);
  52834 
  52835 }
  52836 
  52837 
  52838 void replaceSmallJsonGT(CuTest *tc UNUSED) {
  52839 
  52840   smallJsont*  r;
  52841   smallJsont *self = allocG(rtSmallJsont);
  52842   setTopSO(self, "#ee#ee#ad");
  52843 
  52844   // replace string, multiple character new delimeter
  52845   r = replaceSmallJsonG(self, "#","^^", 0);
  52846   ck_assert_ptr_ne(r, null);
  52847   char *s = toStringO(r);
  52848   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52849   free(s);
  52850   terminateO(self);
  52851 
  52852 }
  52853 
  52854 
  52855 void replaceCharSSmallJsonGT(CuTest *tc UNUSED) {
  52856 
  52857   smallJsont* r;
  52858   smallJsont *self = allocG(rtSmallJsont);
  52859 
  52860   // replace string, multiple character new delimeter
  52861   setTopSO(self, "#ee#ee#ad");
  52862   r = replaceCharSSmallJsonG(self, '#',"^^", 0);
  52863   ck_assert_ptr_ne(r, null);
  52864   char *s = toStringO(r);
  52865   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52866   free(s);
  52867   terminateO(self);
  52868 
  52869 }
  52870 
  52871 
  52872 void replaceSCharSmallJsonGT(CuTest *tc UNUSED) {
  52873 
  52874   smallJsont* r;
  52875   smallJsont *self = allocG(rtSmallJsont);
  52876 
  52877   // replace string, multiple character new delimeter
  52878   setTopSO(self, "#ee#ee#ad");
  52879   r = replaceSCharSmallJsonG(self, "#",'^',0);
  52880   ck_assert_ptr_ne(r, null);
  52881   char *s = toStringO(r);
  52882   ck_assert_str_eq(s, "^ee^ee^ad");
  52883   free(s);
  52884   terminateO(self);
  52885 
  52886 }
  52887 
  52888 
  52889 void replaceCharCharSmallJsonGT(CuTest *tc UNUSED) {
  52890 
  52891   smallJsont* r;
  52892   smallJsont *self = allocG(rtSmallJsont);
  52893 
  52894   // replace string, multiple character new delimeter
  52895   setTopSO(self, "#ee#ee#ad");
  52896   r = replaceCharCharSmallJsonG(self, '#','^', 0);
  52897   ck_assert_ptr_ne(r, null);
  52898   char *s = toStringO(r);
  52899   ck_assert_str_eq(s, "^ee^ee^ad");
  52900   free(s);
  52901   terminateO(self);
  52902 
  52903 }
  52904 
  52905 
  52906 void replaceSmallStringSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52907 
  52908   smallJsont* r;
  52909   smallJsont *self = allocG(rtSmallJsont);
  52910   setTopSO(self, "#ee#ee#ad");
  52911   smallStringt *olds = allocSmallString("");
  52912   smallStringt *news = allocSmallString("");
  52913 
  52914   setValO(olds, "#");
  52915   setValO(news, "^^");
  52916   r = replaceSmallStringSmallStringSmallJsonG(self, olds, news, 0);
  52917   ck_assert_ptr_ne(r, null);
  52918   char *s = toStringO(r);
  52919   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52920   free(s);
  52921   terminateO(olds);
  52922   terminateO(news);
  52923   terminateO(self);
  52924 
  52925 }
  52926 
  52927 
  52928 void replaceSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  52929 
  52930   smallJsont* r;
  52931   smallJsont *self = allocG(rtSmallJsont);
  52932   setTopSO(self, "#ee#ee#ad");
  52933   smallStringt *olds = allocSmallString("");
  52934   const char *news;
  52935 
  52936   // replace string, multiple character new delimeter
  52937   setValO(olds, "#");
  52938   news = "^^";
  52939   r = replaceSmallStringSSmallJsonG(self, olds, news, 0);
  52940   ck_assert_ptr_ne(r, null);
  52941   char *s = toStringO(r);
  52942   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52943   free(s);
  52944   terminateO(olds);
  52945   terminateO(self);
  52946 
  52947 }
  52948 
  52949 
  52950 void replaceSmallStringCharSmallJsonGT(CuTest *tc UNUSED) {
  52951 
  52952   smallJsont* r;
  52953   smallJsont *self = allocG(rtSmallJsont);
  52954   setTopSO(self, "#ee#ee#ad");
  52955   smallStringt *olds = allocSmallString("");
  52956   char news;
  52957 
  52958   // replace string, multiple character new delimeter
  52959   setValO(olds, "#");
  52960   news = '^';
  52961   r = replaceSmallStringCharSmallJsonG(self, olds, news, 0);
  52962   ck_assert_ptr_ne(r, null);
  52963   char *s = toStringO(r);
  52964   ck_assert_str_eq(s, "^ee^ee^ad");
  52965   free(s);
  52966   terminateO(olds);
  52967   terminateO(self);
  52968 
  52969 }
  52970 
  52971 
  52972 void replaceSSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52973 
  52974   smallJsont* r;
  52975   smallJsont *self = allocG(rtSmallJsont);
  52976   setTopSO(self, "#ee#ee#ad");
  52977   const char *olds;
  52978   smallStringt *news = allocSmallString("");
  52979 
  52980   // replace string, multiple character new delimeter
  52981   olds = "#";
  52982   setValO(news, "^^");
  52983   r = replaceSSmallStringSmallJsonG(self, olds, news, 0);
  52984   ck_assert_ptr_ne(r, null);
  52985   char *s = toStringO(r);
  52986   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  52987   free(s);
  52988   terminateO(news);
  52989   terminateO(self);
  52990 
  52991 }
  52992 
  52993 
  52994 void replaceCharSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  52995 
  52996   smallJsont* r;
  52997   smallJsont *self = allocG(rtSmallJsont);
  52998   setTopSO(self, "#ee#ee#ad");
  52999   char olds;
  53000   smallStringt *news = allocSmallString("");
  53001 
  53002   // replace string, multiple character new delimeter
  53003   olds = '#';
  53004   setValO(news, "^^");
  53005   r = replaceCharSmallStringSmallJsonG(self, olds, news, 0);
  53006   ck_assert_ptr_ne(r, null);
  53007   char *s = toStringO(r);
  53008   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53009   free(s);
  53010   terminateO(news);
  53011   terminateO(self);
  53012 
  53013 }
  53014 
  53015 
  53016 void replaceJsonJsonSmallJsonGT(CuTest *tc UNUSED) {
  53017 
  53018   smallJsont* r;
  53019   smallJsont *self = allocG(rtSmallJsont);
  53020   setTopSO(self, "#ee#ee#ad");
  53021   smallJsont *olds = allocSmallJson();
  53022   smallJsont *news = allocSmallJson();
  53023 
  53024   // replace string, multiple character new delimeter
  53025   setTopSO(olds, "#");
  53026   setTopSO(news, "^^");
  53027   r = replaceJsonJsonSmallJsonG(self, olds, news, 0);
  53028   ck_assert_ptr_ne(r, null);
  53029   char *s = toStringO(r);
  53030   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53031   free(s);
  53032   terminateO(olds);
  53033   terminateO(news);
  53034   terminateO(self);
  53035 
  53036 }
  53037 
  53038 
  53039 void replaceJsonSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  53040 
  53041   smallJsont* r;
  53042   smallJsont *self = allocG(rtSmallJsont);
  53043   setTopSO(self, "#ee#ee#ad");
  53044   smallJsont *olds   = allocSmallJson();
  53045   smallStringt *news = allocSmallString("");
  53046 
  53047   // replace string, multiple character new delimeter
  53048   freeO(olds);
  53049   setTopSO(olds, "#");
  53050   setValO(news, "^^");
  53051   r = replaceJsonSmallStringSmallJsonG(self, olds, news, 0);
  53052   ck_assert_ptr_ne(r, null);
  53053   char *s = toStringO(r);
  53054   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53055   free(s);
  53056   terminateO(olds);
  53057   terminateO(news);
  53058   terminateO(self);
  53059 
  53060 }
  53061 
  53062 
  53063 void replaceJsonSSmallJsonGT(CuTest *tc UNUSED) {
  53064 
  53065   smallJsont* r;
  53066   smallJsont *self = allocG(rtSmallJsont);
  53067   setTopSO(self, "#ee#ee#ad");
  53068   smallJsont *olds   = allocSmallJson();
  53069   const char *news;
  53070 
  53071   // replace string, multiple character new delimeter
  53072   freeO(olds);
  53073   setTopSO(olds, "#");
  53074   news = "^^";
  53075   r = replaceJsonSSmallJsonG(self, olds, news, 0);
  53076   ck_assert_ptr_ne(r, null);
  53077   char *s = toStringO(r);
  53078   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53079   free(s);
  53080   terminateO(olds);
  53081   terminateO(self);
  53082 
  53083 }
  53084 
  53085 
  53086 void replaceJsonCharSmallJsonGT(CuTest *tc UNUSED) {
  53087 
  53088   smallJsont* r;
  53089   smallJsont *self = allocG(rtSmallJsont);
  53090   setTopSO(self, "#ee#ee#ad");
  53091   smallJsont *olds = allocSmallJson();
  53092   char news;
  53093 
  53094   // replace string, multiple character new delimeter
  53095   freeO(olds);
  53096   setTopSO(olds, "#");
  53097   news = '^';
  53098   r = replaceJsonCharSmallJsonG(self, olds, news, 0);
  53099   ck_assert_ptr_ne(r, null);
  53100   char *s = toStringO(r);
  53101   ck_assert_str_eq(s, "^ee^ee^ad");
  53102   free(s);
  53103   terminateO(olds);
  53104   terminateO(self);
  53105 
  53106 }
  53107 
  53108 
  53109 void replaceSmallStringJsonSmallJsonGT(CuTest *tc UNUSED) {
  53110 
  53111   smallJsont* r;
  53112   smallJsont *self = allocG(rtSmallJsont);
  53113   setTopSO(self, "#ee#ee#ad");
  53114   smallStringt *olds = allocSmallString("");
  53115   smallJsont *news   = allocSmallJson();
  53116 
  53117   // replace string, multiple character new delimeter
  53118   setValO(olds, "#");
  53119   setTopSO(news, "^^");
  53120   r = replaceSmallStringJsonSmallJsonG(self, olds, news, 0);
  53121   ck_assert_ptr_ne(r, null);
  53122   char *s = toStringO(r);
  53123   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53124   free(s);
  53125   terminateO(olds);
  53126   terminateO(news);
  53127   terminateO(self);
  53128 
  53129 }
  53130 
  53131 
  53132 void replaceSJsonSmallJsonGT(CuTest *tc UNUSED) {
  53133 
  53134   smallJsont* r;
  53135   smallJsont *self = allocG(rtSmallJsont);
  53136   setTopSO(self, "#ee#ee#ad");
  53137   const char *olds;
  53138   smallJsont *news = allocSmallJson();
  53139 
  53140   // replace string, multiple character new delimeter
  53141   olds = "#";
  53142   setTopSO(news, "^^");
  53143   r = replaceSJsonSmallJsonG(self, olds, news, 0);
  53144   ck_assert_ptr_ne(r, null);
  53145   char *s = toStringO(r);
  53146   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53147   free(s);
  53148   terminateO(news);
  53149   terminateO(self);
  53150 
  53151 }
  53152 
  53153 
  53154 void replaceCharJsonSmallJsonGT(CuTest *tc UNUSED) {
  53155 
  53156   smallJsont* r;
  53157   smallJsont *self = allocG(rtSmallJsont);
  53158   setTopSO(self, "#ee#ee#ad");
  53159   char olds;
  53160   smallJsont *news = allocSmallJson();
  53161 
  53162   // replace string, multiple character new delimeter
  53163   olds = '#';
  53164   setTopSO(news, "^^");
  53165   r = replaceCharJsonSmallJsonG(self, olds, news, 0);
  53166   ck_assert_ptr_ne(r, null);
  53167   char *s = toStringO(r);
  53168   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53169   free(s);
  53170   terminateO(news);
  53171   terminateO(self);
  53172 
  53173 }
  53174 
  53175 
  53176 void icReplaceSmallJsonGT(CuTest *tc UNUSED) {
  53177 
  53178   smallJsont*  r;
  53179   smallJsont *self = allocG(rtSmallJsont);
  53180   setTopSO(self, "BeebeeBad");
  53181 
  53182   // replace string, multiple character new delimeter
  53183   r = icReplaceSmallJsonG(self, "b","^^", 0);
  53184   ck_assert_ptr_ne(r, null);
  53185   char *s = toStringO(r);
  53186   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53187   free(s);
  53188   terminateO(self);
  53189 
  53190 }
  53191 
  53192 
  53193 void icReplaceCharSSmallJsonGT(CuTest *tc UNUSED) {
  53194 
  53195   smallJsont* r;
  53196   smallJsont *self = allocG(rtSmallJsont);
  53197   setTopSO(self, "");
  53198 
  53199   // replace string, multiple character new delimeter
  53200   freeO(self);
  53201   setTopSO(self, "BeebeeBad");
  53202   r = icReplaceCharSSmallJsonG(self, 'B',"^^", 0);
  53203   ck_assert_ptr_ne(r, null);
  53204   char *s = toStringO(r);
  53205   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53206   free(s);
  53207   terminateO(self);
  53208 
  53209 }
  53210 
  53211 
  53212 void icReplaceSCharSmallJsonGT(CuTest *tc UNUSED) {
  53213 
  53214   smallJsont* r;
  53215   smallJsont *self = allocG(rtSmallJsont);
  53216   setTopSO(self, "");
  53217 
  53218   // replace string, multiple character new delimeter
  53219   freeO(self);
  53220   setTopSO(self, "BeebeeBad");
  53221   r = icReplaceSCharSmallJsonG(self, "b",'^',0);
  53222   ck_assert_ptr_ne(r, null);
  53223   char *s = toStringO(r);
  53224   ck_assert_str_eq(s, "^ee^ee^ad");
  53225   free(s);
  53226   terminateO(self);
  53227 
  53228 }
  53229 
  53230 
  53231 void icReplaceCharCharSmallJsonGT(CuTest *tc UNUSED) {
  53232 
  53233   smallJsont* r;
  53234   smallJsont *self = allocG(rtSmallJsont);
  53235   setTopSO(self, "");
  53236 
  53237   // replace string, multiple character new delimeter
  53238   freeO(self);
  53239   setTopSO(self, "beeBeebad");
  53240   r = icReplaceCharCharSmallJsonG(self, 'b','^', 0);
  53241   ck_assert_ptr_ne(r, null);
  53242   char *s = toStringO(r);
  53243   ck_assert_str_eq(s, "^ee^ee^ad");
  53244   free(s);
  53245   terminateO(self);
  53246 
  53247 }
  53248 
  53249 
  53250 void icReplaceSmallStringSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  53251 
  53252   smallJsont* r;
  53253   smallJsont *self = allocG(rtSmallJsont);
  53254   setTopSO(self, "beebeebad");
  53255   smallStringt *olds = allocSmallString("");
  53256   smallStringt *news = allocSmallString("");
  53257 
  53258   // replace string, multiple character new delimeter
  53259   setValO(olds, "B");
  53260   setValO(news, "^^");
  53261   r = icReplaceSmallStringSmallStringSmallJsonG(self, olds, news, 0);
  53262   ck_assert_ptr_ne(r, null);
  53263   char *s = toStringO(r);
  53264   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53265   free(s);
  53266   terminateO(olds);
  53267   terminateO(news);
  53268   terminateO(self);
  53269 
  53270 }
  53271 
  53272 
  53273 void icReplaceSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  53274 
  53275   smallJsont* r;
  53276   smallJsont *self = allocG(rtSmallJsont);
  53277   setTopSO(self, "beebeebad");
  53278   smallStringt *olds = allocSmallString("");
  53279   const char *news;
  53280 
  53281   // replace string, multiple character new delimeter
  53282   setValO(olds, "B");
  53283   news = "^^";
  53284   r = icReplaceSmallStringSSmallJsonG(self, olds, news, 0);
  53285   ck_assert_ptr_ne(r, null);
  53286   char *s = toStringO(r);
  53287   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53288   free(s);
  53289   terminateO(olds);
  53290   terminateO(self);
  53291 
  53292 }
  53293 
  53294 
  53295 void icReplaceSmallStringCharSmallJsonGT(CuTest *tc UNUSED) {
  53296 
  53297   smallJsont* r;
  53298   smallJsont *self = allocG(rtSmallJsont);
  53299   setTopSO(self, "beebeebad");
  53300   smallStringt *olds = allocSmallString("");
  53301   char news;
  53302 
  53303   // replace string, multiple character new delimeter
  53304   setValO(olds, "B");
  53305   news = '^';
  53306   r = icReplaceSmallStringCharSmallJsonG(self, olds, news, 0);
  53307   ck_assert_ptr_ne(r, null);
  53308   char *s = toStringO(r);
  53309   ck_assert_str_eq(s, "^ee^ee^ad");
  53310   free(s);
  53311   terminateO(olds);
  53312   terminateO(self);
  53313 
  53314 }
  53315 
  53316 
  53317 void icReplaceSSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  53318 
  53319   smallJsont* r;
  53320   smallJsont *self = allocG(rtSmallJsont);
  53321   setTopSO(self, "beebeebad");
  53322   const char *olds;
  53323   smallStringt *news = allocSmallString("");
  53324 
  53325   // replace string, multiple character new delimeter
  53326   olds = "B";
  53327   setValO(news, "^^");
  53328   r = icReplaceSSmallStringSmallJsonG(self, olds, news, 0);
  53329   ck_assert_ptr_ne(r, null);
  53330   char *s = toStringO(r);
  53331   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53332   free(s);
  53333   terminateO(news);
  53334   terminateO(self);
  53335 
  53336 }
  53337 
  53338 
  53339 void icReplaceCharSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  53340 
  53341   smallJsont* r;
  53342   smallJsont *self = allocG(rtSmallJsont);
  53343   setTopSO(self, "beebeebad");
  53344   char olds;
  53345   smallStringt *news = allocSmallString("");
  53346 
  53347   // replace string, multiple character new delimeter
  53348   olds = 'B';
  53349   setValO(news, "^^");
  53350   r = icReplaceCharSmallStringSmallJsonG(self, olds, news, 0);
  53351   ck_assert_ptr_ne(r, null);
  53352   char *s = toStringO(r);
  53353   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53354   free(s);
  53355   terminateO(news);
  53356   terminateO(self);
  53357 
  53358 }
  53359 
  53360 
  53361 void icReplaceJsonJsonSmallJsonGT(CuTest *tc UNUSED) {
  53362 
  53363   smallJsont* r;
  53364   smallJsont *self = allocG(rtSmallJsont);
  53365   setTopSO(self, "BeebeeBad");
  53366   smallJsont *olds = allocSmallJson();
  53367   smallJsont *news = allocSmallJson();
  53368 
  53369   // replace string, multiple character new delimeter
  53370   freeO(olds);
  53371   freeO(news);
  53372   setTopSO(olds, "B");
  53373   setTopSO(news, "^^");
  53374   r = icReplaceJsonJsonSmallJsonG(self, olds, news, 0);
  53375   ck_assert_ptr_ne(r, null);
  53376   char *s = toStringO(r);
  53377   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53378   free(s);
  53379   terminateO(olds);
  53380   terminateO(news);
  53381   terminateO(self);
  53382 
  53383 }
  53384 
  53385 
  53386 void icReplaceJsonSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  53387 
  53388   smallJsont* r;
  53389   smallJsont *self = allocG(rtSmallJsont);
  53390   setTopSO(self, "BeebeeBad");
  53391   smallJsont *olds   = allocSmallJson();
  53392   smallStringt *news = allocSmallString("");
  53393 
  53394   // replace string, multiple character new delimeter
  53395   freeO(olds);
  53396   setTopSO(olds, "B");
  53397   setValO(news, "^^");
  53398   r = icReplaceJsonSmallStringSmallJsonG(self, olds, news, 0);
  53399   ck_assert_ptr_ne(r, null);
  53400   char *s = toStringO(r);
  53401   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53402   free(s);
  53403   terminateO(olds);
  53404   terminateO(news);
  53405   terminateO(self);
  53406 
  53407 }
  53408 
  53409 
  53410 void icReplaceJsonSSmallJsonGT(CuTest *tc UNUSED) {
  53411 
  53412   smallJsont* r;
  53413   smallJsont *self = allocG(rtSmallJsont);
  53414   setTopSO(self, "BeebeeBad");
  53415   smallJsont *olds   = allocSmallJson();
  53416   const char *news;
  53417 
  53418   // replace string, multiple character new delimeter
  53419   freeO(olds);
  53420   setTopSO(olds, "b");
  53421   news = "^^";
  53422   r = icReplaceJsonSSmallJsonG(self, olds, news, 0);
  53423   ck_assert_ptr_ne(r, null);
  53424   char *s = toStringO(r);
  53425   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53426   free(s);
  53427   terminateO(olds);
  53428   terminateO(self);
  53429 
  53430 }
  53431 
  53432 
  53433 void icReplaceJsonCharSmallJsonGT(CuTest *tc UNUSED) {
  53434 
  53435   smallJsont* r;
  53436   smallJsont *self = allocG(rtSmallJsont);
  53437   setTopSO(self, "beeBeebad");
  53438   smallJsont *olds   = allocSmallJson();
  53439   char news;
  53440 
  53441   // replace string, multiple character new delimeter
  53442   freeO(olds);
  53443   setTopSO(olds, "B");
  53444   news = '^';
  53445   r = icReplaceJsonCharSmallJsonG(self, olds, news, 0);
  53446   ck_assert_ptr_ne(r, null);
  53447   char *s = toStringO(r);
  53448   ck_assert_str_eq(s, "^ee^ee^ad");
  53449   free(s);
  53450   terminateO(olds);
  53451   terminateO(self);
  53452 
  53453 }
  53454 
  53455 
  53456 void icReplaceSmallStringJsonSmallJsonGT(CuTest *tc UNUSED) {
  53457 
  53458   smallJsont* r;
  53459   smallJsont *self = allocG(rtSmallJsont);
  53460   setTopSO(self, "BeeBeeBad");
  53461   smallStringt *olds = allocSmallString("");
  53462   smallJsont *news   = allocSmallJson();
  53463 
  53464   // replace string, multiple character new delimeter
  53465   freeO(news);
  53466   setValO(olds, "b");
  53467   setTopSO(news, "^^");
  53468   r = icReplaceSmallStringJsonSmallJsonG(self, olds, news, 0);
  53469   ck_assert_ptr_ne(r, null);
  53470   char *s = toStringO(r);
  53471   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53472   free(s);
  53473   terminateO(olds);
  53474   terminateO(news);
  53475   terminateO(self);
  53476 
  53477 }
  53478 
  53479 
  53480 void icReplaceSJsonSmallJsonGT(CuTest *tc UNUSED) {
  53481 
  53482   smallJsont* r;
  53483   smallJsont *self = allocG(rtSmallJsont);
  53484   setTopSO(self, "beebeebad");
  53485   const char *olds;
  53486   smallJsont *news   = allocSmallJson();
  53487 
  53488   // replace string, multiple character new delimeter
  53489   freeO(news);
  53490   olds = "B";
  53491   setTopSO(news, "^^");
  53492   r = icReplaceSJsonSmallJsonG(self, olds, news, 0);
  53493   ck_assert_ptr_ne(r, null);
  53494   char *s = toStringO(r);
  53495   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53496   free(s);
  53497   terminateO(news);
  53498   terminateO(self);
  53499 
  53500 }
  53501 
  53502 
  53503 void icReplaceCharJsonSmallJsonGT(CuTest *tc UNUSED) {
  53504 
  53505   smallJsont* r;
  53506   smallJsont *self = allocG(rtSmallJsont);
  53507   setTopSO(self, "beebeebad");
  53508   char olds;
  53509   smallJsont *news   = allocSmallJson();
  53510 
  53511   // replace string, multiple character new delimeter
  53512   freeO(news);
  53513   olds = 'B';
  53514   setTopSO(news, "^^");
  53515   r = icReplaceCharJsonSmallJsonG(self, olds, news, 0);
  53516   ck_assert_ptr_ne(r, null);
  53517   char *s = toStringO(r);
  53518   ck_assert_str_eq(s, "^^ee^^ee^^ad");
  53519   free(s);
  53520   terminateO(news);
  53521   terminateO(self);
  53522 
  53523 }
  53524 
  53525 
  53526 void equalSmallJsonSmallArrayGT(CuTest *tc UNUSED) {
  53527 
  53528   bool r;
  53529   smallJsont *self   = allocG(rtSmallJsont);
  53530   smallArrayt *array = allocSmallArray();
  53531 
  53532   // empty arrays
  53533   setTypeArrayO(self);
  53534   r = equalSmallJsonSmallArrayG(self, array);
  53535   ck_assert(r);
  53536   // empty self, non empty array
  53537   array->f->pushInt(array, 1);
  53538   r = equalSmallJsonSmallArrayG(self, array);
  53539   ck_assert(!r);
  53540   terminateO(array);
  53541   terminateO(self);
  53542 
  53543 }
  53544 
  53545 
  53546 void equalSmallJsonArrayGT(CuTest *tc UNUSED) {
  53547 
  53548   bool r;
  53549   smallJsont *self = allocG(rtSmallJsont);
  53550   char ** p2       = NULL;
  53551 
  53552   // empty arrays
  53553   setTypeArrayO(self);
  53554   r = equalSmallJsonArrayG(self, NULL);
  53555   ck_assert(r);
  53556   // empty self, non empty array
  53557   p2 = listCreateS("a");
  53558   r = equalSmallJsonArrayG(self, p2);
  53559   ck_assert(!r);
  53560   listFreeS(p2);
  53561   terminateO(self);
  53562 
  53563 }
  53564 
  53565 
  53566 void equalSmallJsonCArrayGT(CuTest *tc UNUSED) {
  53567 
  53568   bool r;
  53569   smallJsont *self = allocG(rtSmallJsont);
  53570   const char *p2[] = {"a", null};
  53571 
  53572   self->f->pushS(self, "a");
  53573   r = equalSmallJsonCArrayG(self, p2);
  53574   ck_assert(r);
  53575   terminateO(self);
  53576 
  53577 }
  53578 
  53579 
  53580 void equalSmallJsonBaseGT(CuTest *tc UNUSED) {
  53581 
  53582   bool r;
  53583   smallJsont *self = allocG(rtSmallJsont);
  53584   baset* p2;
  53585 
  53586   // json bool
  53587   setTopBoolO(self, false);
  53588   p2 = (baset*) allocSmallBool(false);
  53589   r = equalSmallJsonBaseG(self, p2);
  53590   ck_assert(r);
  53591   freeO(self);
  53592   setTopBoolO(self, true);
  53593   r = equalSmallJsonBaseG(self, p2);
  53594   ck_assert(!r);
  53595   terminateO(p2);
  53596   terminateO(self);
  53597 
  53598 }
  53599 
  53600 
  53601 void equalSmallJsonChaGT(CuTest *tc UNUSED) {
  53602 
  53603   bool r;
  53604   smallJsont* self = allocG(rtSmallJsont);
  53605   setTopSO(self, "");
  53606 
  53607   r = equalSmallJsonChaG(self,'q');
  53608   ck_assert(!r);
  53609   freeO(self);
  53610   setTopSO(self, "q");
  53611   r = equalSmallJsonChaG(self,'q');
  53612   ck_assert(r);
  53613   terminateO(self);
  53614 
  53615 }
  53616 
  53617 
  53618 void equalSmallJsonCharGT(CuTest *tc UNUSED) {
  53619 
  53620   bool r;
  53621   smallJsont* self = allocG(rtSmallJsont);
  53622   setTopSO(self, "");
  53623 
  53624   r = equalSmallJsonCharG(self,"qwe");
  53625   ck_assert(!r);
  53626   freeO(self);
  53627   setTopSO(self, "qwe");
  53628   r = equalSmallJsonCharG(self,"qwe");
  53629   ck_assert(r);
  53630   terminateO(self);
  53631 
  53632 }
  53633 
  53634 
  53635 void equalSmallJsonBoolGT(CuTest *tc UNUSED) {
  53636 
  53637   bool r;
  53638   smallJsont* self = allocG(rtSmallJsont);
  53639 
  53640   // empty json
  53641   r = equalSmallJsonBoolG(self, false);
  53642   ck_assert(!r);
  53643   // json bool
  53644   freeO(self);
  53645   setTypeBoolO(self);
  53646   r = equalSmallJsonBoolG(self, false);
  53647   ck_assert(r);
  53648   terminateO(self);
  53649 
  53650 }
  53651 
  53652 
  53653 void equalSmallJsonDoubleGT(CuTest *tc UNUSED) {
  53654 
  53655   bool r;
  53656   smallJsont* self = allocG(rtSmallJsont);
  53657 
  53658   // empty json
  53659   r = equalSmallJsonDoubleG(self, 0);
  53660   ck_assert(!r);
  53661   // json bool
  53662   freeO(self);
  53663   setTypeBoolO(self);
  53664   r = equalSmallJsonDoubleG(self, 0);
  53665   ck_assert(r);
  53666   terminateO(self);
  53667 
  53668 }
  53669 
  53670 
  53671 void equalSmallJsonInt64GT(CuTest *tc UNUSED) {
  53672 
  53673   bool r;
  53674   smallJsont* self = allocG(rtSmallJsont);
  53675 
  53676   // empty json
  53677   r = equalSmallJsonInt64G(self, 0);
  53678   ck_assert(!r);
  53679   // json bool
  53680   freeO(self);
  53681   setTypeBoolO(self);
  53682   r = equalSmallJsonInt64G(self, 0);
  53683   ck_assert(r);
  53684   terminateO(self);
  53685 
  53686 }
  53687 
  53688 
  53689 void equalSmallJsonInt32GT(CuTest *tc UNUSED) {
  53690 
  53691   bool r;
  53692   smallJsont* self = allocG(rtSmallJsont);
  53693 
  53694   // empty json
  53695   r = equalSmallJsonInt32G(self, 0);
  53696   ck_assert(!r);
  53697   // json bool
  53698   freeO(self);
  53699   setTypeBoolO(self);
  53700   r = equalSmallJsonInt32G(self, 0);
  53701   ck_assert(r);
  53702   terminateO(self);
  53703 
  53704 }
  53705 
  53706 
  53707 void equalSmallJsonUint32GT(CuTest *tc UNUSED) {
  53708 
  53709   bool r;
  53710   smallJsont* self = allocG(rtSmallJsont);
  53711 
  53712   // empty json
  53713   r = equalSmallJsonUint32G(self, 0);
  53714   ck_assert(!r);
  53715   // json bool
  53716   freeO(self);
  53717   setTypeBoolO(self);
  53718   r = equalSmallJsonUint32G(self, 0);
  53719   ck_assert(r);
  53720   terminateO(self);
  53721 
  53722 }
  53723 
  53724 
  53725 void equalSmallJsonUint64GT(CuTest *tc UNUSED) {
  53726 
  53727   bool r;
  53728   smallJsont* self = allocG(rtSmallJsont);
  53729 
  53730   // empty json
  53731   r = equalSmallJsonUint64G(self, 0);
  53732   ck_assert(!r);
  53733   // json bool
  53734   freeO(self);
  53735   setTypeBoolO(self);
  53736   r = equalSmallJsonUint64G(self, 0);
  53737   ck_assert(r);
  53738   terminateO(self);
  53739 
  53740 }
  53741 
  53742 
  53743 void equalSmallJsonSmallBoolGT(CuTest *tc UNUSED) {
  53744 
  53745   bool r;
  53746   smallJsont* self = allocG(rtSmallJsont);
  53747   smallBoolt* p2   = allocSmallBool(false);
  53748 
  53749   // empty json
  53750   r = equalSmallJsonSmallBoolG(self, p2);
  53751   ck_assert(!r);
  53752   // not equal
  53753   setTopBoolO(self, true);
  53754   r = equalSmallJsonSmallBoolG(self, p2);
  53755   ck_assert(!r);
  53756   // equal
  53757   setValO(p2, true);
  53758   r = equalSmallJsonSmallBoolG(self, p2);
  53759   ck_assert(r);
  53760   terminateO(p2);
  53761   terminateO(self);
  53762 
  53763 }
  53764 
  53765 
  53766 void equalSmallJsonSmallBytesGT(CuTest *tc UNUSED) {
  53767 
  53768   smallJsont* self = allocG(rtSmallJsont);
  53769   smallBytest* p2  = allocSmallBytes("true", strlen("true"));
  53770 
  53771   // empty json
  53772   ck_assert(!equalSmallJsonSmallBytesG(self, p2));
  53773   // json bool
  53774   setTopBoolO(self, true);
  53775   ck_assert(!equalSmallJsonSmallBytesG(self, p2));
  53776   freeO(p2);
  53777   pushBufferO(p2, "true", sizeof("true"));
  53778   ck_assert(equalSmallJsonSmallBytesG(self, p2));
  53779   freeO(self);
  53780   terminateO(p2);
  53781   terminateO(self);
  53782 
  53783 }
  53784 
  53785 
  53786 void equalSmallJsonSmallDoubleGT(CuTest *tc UNUSED) {
  53787 
  53788   bool r;
  53789   smallJsont* self = allocG(rtSmallJsont);
  53790   smallDoublet* p2 = allocSmallDouble(0);
  53791 
  53792   // empty json
  53793   r = equalSmallJsonSmallDoubleG(self, p2);
  53794   ck_assert(!r);
  53795   // json bool
  53796   freeO(self);
  53797   setTypeBoolO(self);
  53798   r = equalSmallJsonSmallDoubleG(self, p2);
  53799   ck_assert(r);
  53800   terminateO(p2);
  53801   terminateO(self);
  53802 
  53803 }
  53804 
  53805 
  53806 void equalSmallJsonSmallIntGT(CuTest *tc UNUSED) {
  53807 
  53808   bool r;
  53809   smallJsont* self = allocG(rtSmallJsont);
  53810   smallIntt* p2    = allocSmallInt(0);
  53811 
  53812   // empty json
  53813   r = equalSmallJsonSmallIntG(self, p2);
  53814   ck_assert(!r);
  53815   // json bool
  53816   freeO(self);
  53817   setTypeBoolO(self);
  53818   r = equalSmallJsonSmallIntG(self, p2);
  53819   ck_assert(r);
  53820   terminateO(p2);
  53821   terminateO(self);
  53822 
  53823 }
  53824 
  53825 
  53826 void equalSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  53827 
  53828   bool r;
  53829   smallJsont* self = allocG(rtSmallJsont);
  53830   smallJsont* p2   = allocSmallJson();
  53831 
  53832   // empty json
  53833   r = equalSmallJsonSmallJsonG(self, p2);
  53834   ck_assert(!r);
  53835   // undefined
  53836   setTypeUndefinedO(p2);
  53837   ck_assert(!equalSmallJsonSmallJsonG(self, p2));
  53838   setTypeUndefinedO(self);
  53839   ck_assert(equalSmallJsonSmallJsonG(self, p2));
  53840   terminateO(p2);
  53841   terminateO(self);
  53842 
  53843 }
  53844 
  53845 
  53846 void equalSmallJsonSmallStringGT(CuTest *tc UNUSED) {
  53847 
  53848   bool r;
  53849   smallJsont* self = allocG(rtSmallJsont);
  53850   smallStringt* p2 = allocSmallString("");
  53851 
  53852   // empty json
  53853   r = equalSmallJsonSmallStringG(self, p2);
  53854   ck_assert(!r);
  53855   // json bool
  53856   setTypeBoolO(self);
  53857   setValO(p2, "false");
  53858   r = equalSmallJsonSmallStringG(self, p2);
  53859   ck_assert(r);
  53860   setValO(p2, "true");
  53861   r = equalSmallJsonSmallStringG(self, p2);
  53862   ck_assert(!r);
  53863   terminateO(p2);
  53864   terminateO(self);
  53865 
  53866 }
  53867 
  53868 
  53869 void equalSmallJsonSmallDictGT(CuTest *tc UNUSED) {
  53870 
  53871   bool r;
  53872   smallJsont* self = allocG(rtSmallJsont);
  53873   smallDictt* p2   = allocSmallDict();
  53874 
  53875   // empty json
  53876   r = equalSmallJsonSmallDictG(self, p2);
  53877   ck_assert(!r);
  53878   setTypeDictO(self);
  53879   r = equalSmallJsonSmallDictG(self, p2);
  53880   ck_assert(!r);
  53881   // equal
  53882   self->f->setInt(self, "a", 1);
  53883   self->f->setInt(self, "b", 2);
  53884   self->f->setInt(self, "c", 3);
  53885   p2->f->setInt(p2, "b", 2);
  53886   p2->f->setInt(p2, "a", 1);
  53887   p2->f->setInt(p2, "c", 3);
  53888   r = equalSmallJsonSmallDictG(self, p2);
  53889   ck_assert(r);
  53890   terminateO(p2);
  53891   terminateO(self);
  53892 
  53893 }
  53894 
  53895 
  53896 void icEqualSmallJsonSmallArrayGT(CuTest *tc UNUSED) {
  53897 
  53898   bool r;
  53899   smallJsont *self   = allocG(rtSmallJsont);
  53900   smallArrayt *array = allocSmallArray();
  53901 
  53902   self->f->pushS(self, "a");
  53903   array->f->pushS(array, "A");
  53904   r = icEqualSmallJsonSmallArrayG(self, array);
  53905   ck_assert(r);
  53906   terminateO(array);
  53907   terminateO(self);
  53908 
  53909 }
  53910 
  53911 
  53912 void icEqualSmallJsonArrayGT(CuTest *tc UNUSED) {
  53913 
  53914   bool r;
  53915   smallJsont *self = allocG(rtSmallJsont);
  53916   char ** p2       = NULL;
  53917 
  53918   listPushS(&p2, "a");
  53919   self->f->pushS(self, "A");
  53920   r = icEqualSmallJsonArrayG(self, p2);
  53921   ck_assert(r);
  53922   listFreeS(p2);
  53923   terminateO(self);
  53924 
  53925 }
  53926 
  53927 
  53928 void icEqualSmallJsonCArrayGT(CuTest *tc UNUSED) {
  53929 
  53930   bool r;
  53931   smallJsont *self = allocG(rtSmallJsont);
  53932   const char *p2[] = {"a", null};
  53933 
  53934   self->f->pushS(self, "A");
  53935   r = icEqualSmallJsonCArrayG(self, p2);
  53936   ck_assert(r);
  53937   terminateO(self);
  53938 
  53939 }
  53940 
  53941 
  53942 void icEqualSmallJsonBaseGT(CuTest *tc UNUSED) {
  53943 
  53944   bool r;
  53945   smallJsont *self = allocG(rtSmallJsont);
  53946   baset* p2;
  53947 
  53948   // json bool
  53949   setTopBoolO(self, false);
  53950   p2 = (baset*) allocSmallBool(false);
  53951   r = icEqualSmallJsonBaseG(self, p2);
  53952   ck_assert(r);
  53953   terminateO(p2);
  53954   terminateO(self);
  53955 
  53956 }
  53957 
  53958 
  53959 void icEqualSmallJsonSmallDictGT(CuTest *tc UNUSED) {
  53960 
  53961   bool r;
  53962   smallJsont* self = allocG(rtSmallJsont);
  53963   smallDictt* p2   = allocSmallDict();
  53964 
  53965   // equal
  53966   self->f->setS(self, "a", "a");
  53967   self->f->setInt(self, "b", 2);
  53968   self->f->setInt(self, "c", 3);
  53969   p2->f->setInt(p2, "b", 2);
  53970   p2->f->setS(p2, "a", "A");
  53971   p2->f->setInt(p2, "c", 3);
  53972   r = icEqualSmallJsonSmallDictG(self, p2);
  53973   ck_assert(r);
  53974   terminateO(p2);
  53975   terminateO(self);
  53976 
  53977 }
  53978 
  53979 
  53980 void icEqualSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  53981 
  53982   bool r;
  53983   smallJsont* self   = allocG(rtSmallJsont);
  53984   smallJsont *string = allocSmallJson();
  53985 
  53986   setTopSO(string, "qwe");
  53987   setTopSO(self, "QWE");
  53988   r = icEqualSmallJsonSmallJsonG(self, string);
  53989   ck_assert(r);
  53990   terminateO(string);
  53991   terminateO(self);
  53992 
  53993 }
  53994 
  53995 
  53996 void icEqualSmallJsonSmallStringGT(CuTest *tc UNUSED) {
  53997 
  53998   bool r;
  53999   smallJsont* self     = allocG(rtSmallJsont);
  54000   smallStringt *string = allocSmallString("qwe");
  54001 
  54002   setTopSO(self, "QWE");
  54003   r = icEqualSmallJsonSmallStringG(self, string);
  54004   ck_assert(r);
  54005   terminateO(string);
  54006   terminateO(self);
  54007 
  54008 }
  54009 
  54010 
  54011 void icEqualCharSmallJsonGT(CuTest *tc UNUSED) {
  54012 
  54013   bool r;
  54014   smallJsont *self = allocG(rtSmallJsont);
  54015   setTopSO(self, "");
  54016 
  54017   r = icEqualCharSmallJsonG(self,'q');
  54018   ck_assert(!r);
  54019   freeO(self);
  54020   setTopSO(self, "q");
  54021   r = icEqualCharSmallJsonG(self,'Q');
  54022   ck_assert(r);
  54023   terminateO(self);
  54024 
  54025 }
  54026 
  54027 
  54028 void icEqualSSmallJsonGT(CuTest *tc UNUSED) {
  54029 
  54030   bool r;
  54031   smallJsont *self = allocG(rtSmallJsont);
  54032 
  54033   // empty json
  54034   r = icEqualSSmallJsonG(self, "qwe");
  54035   ck_assert(!r);
  54036   // equal
  54037   setTopSO(self, "QWE");
  54038   r = icEqualSSmallJsonG(self, "qwe");
  54039   ck_assert(r);
  54040   terminateO(self);
  54041 
  54042 }
  54043 
  54044 
  54045 void equalISSmallJsonGT(CuTest *tc UNUSED) {
  54046 
  54047   smallJsont *self = allocG(rtSmallJsont);
  54048   setTopSO(self, "Ashee|");
  54049 
  54050   ck_assert(equalISSmallJsonG(self, "shee", 1));
  54051   terminateO(self);
  54052 
  54053 }
  54054 
  54055 
  54056 void equalICharSmallJsonGT(CuTest *tc UNUSED) {
  54057 
  54058   smallJsont *self = allocG(rtSmallJsont);
  54059   setTopSO(self, "Ashee");
  54060 
  54061   // identical strings
  54062   ck_assert(equalICharSmallJsonG(self, 's', 1));
  54063   terminateO(self);
  54064 
  54065 }
  54066 
  54067 
  54068 void equalIJsonSmallJsonGT(CuTest *tc UNUSED) {
  54069 
  54070   smallJsont *self = allocG(rtSmallJsont);
  54071   setTopSO(self, "Ashee|");
  54072   smallJsont *string = allocSmallJson();
  54073 
  54074   // identical strings
  54075   setTopSO(string, "shee");
  54076   ck_assert(equalIJsonSmallJsonG(self, string, 1));
  54077   terminateO(string);
  54078   terminateO(self);
  54079 
  54080 }
  54081 
  54082 
  54083 void equalISmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54084 
  54085   smallJsont *self = allocG(rtSmallJsont);
  54086   setTopSO(self, "Ashee|");
  54087   smallStringt *string = allocSmallString("shee");
  54088 
  54089   // identical strings
  54090   ck_assert(equalISmallStringSmallJsonG(self, string, 1));
  54091   terminateO(string);
  54092   terminateO(self);
  54093 
  54094 }
  54095 
  54096 
  54097 void startsWithSSmallJsonGT(CuTest *tc UNUSED) {
  54098 
  54099   smallJsont *self = allocG(rtSmallJsont);
  54100 
  54101   setTopSO(self, "sheepy");
  54102   ck_assert(startsWithSSmallJsonG(self, "shee"));
  54103   terminateO(self);
  54104 
  54105 }
  54106 
  54107 
  54108 void startsWithCharSmallJsonGT(CuTest *tc UNUSED) {
  54109 
  54110   smallJsont *self = allocG(rtSmallJsont);
  54111   setTopSO(self, "shee");
  54112 
  54113   // identical strings
  54114   ck_assert(startsWithCharSmallJsonG(self, 's'));
  54115   terminateO(self);
  54116 
  54117 }
  54118 
  54119 
  54120 void startsWithSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54121 
  54122   smallJsont *self = allocG(rtSmallJsont);
  54123   setTopSO(self, "sheepy");
  54124   smallStringt *string = allocSmallString("shee");
  54125 
  54126   // identical strings
  54127   ck_assert(startsWithSmallStringSmallJsonG(self, string));
  54128   terminateO(string);
  54129   terminateO(self);
  54130 
  54131 }
  54132 
  54133 
  54134 void startsWithJsonSmallJsonGT(CuTest *tc UNUSED) {
  54135 
  54136   smallJsont *self = allocG(rtSmallJsont);
  54137   setTopSO(self, "sheepy");
  54138   smallJsont *string = allocSmallJson();
  54139 
  54140   // identical strings
  54141   setTopSO(string, "shee");
  54142   ck_assert(startsWithJsonSmallJsonG(self, string));
  54143   terminateO(string);
  54144   terminateO(self);
  54145 
  54146 }
  54147 
  54148 
  54149 void endsWithSSmallJsonGT(CuTest *tc UNUSED) {
  54150 
  54151   smallJsont *self = allocG(rtSmallJsont);
  54152   setTopSO(self, "sheepy");
  54153 
  54154   ck_assert(endsWithSSmallJsonG(self, "eepy"));
  54155   terminateO(self);
  54156 
  54157 }
  54158 
  54159 
  54160 void endsWithCharSmallJsonGT(CuTest *tc UNUSED) {
  54161 
  54162   smallJsont *self = allocG(rtSmallJsont);
  54163   setTopSO(self, "shee");
  54164 
  54165   // identical strings
  54166   ck_assert(endsWithCharSmallJsonG(self, 'e'));
  54167   terminateO(self);
  54168 
  54169 }
  54170 
  54171 
  54172 void endsWithSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54173 
  54174   smallJsont *self = allocG(rtSmallJsont);
  54175   setTopSO(self, "shee");
  54176   smallStringt *string = allocSmallString("hee");
  54177 
  54178   // identical strings
  54179   ck_assert(endsWithSmallStringSmallJsonG(self, string));
  54180   terminateO(string);
  54181   terminateO(self);
  54182 
  54183 }
  54184 
  54185 
  54186 void endsWithJsonSmallJsonGT(CuTest *tc UNUSED) {
  54187 
  54188   smallJsont *self = allocG(rtSmallJsont);
  54189   setTopSO(self, "shee");
  54190   smallJsont *string = allocSmallJson();
  54191 
  54192   // identical strings
  54193   setTopSO(string, "hee");
  54194   ck_assert(endsWithJsonSmallJsonG(self, string));
  54195   terminateO(string);
  54196   terminateO(self);
  54197 
  54198 }
  54199 
  54200 
  54201 void countSSmallJsonGT(CuTest *tc UNUSED) {
  54202 
  54203   smallJsont *self = allocG(rtSmallJsont);
  54204   setTopSO(self, "sheepy");
  54205 
  54206   // positive count
  54207   ck_assert_int_eq(countSSmallJsonG(self, "shee"), 1);
  54208   terminateO(self);
  54209 
  54210 }
  54211 
  54212 
  54213 void countCharSmallJsonGT(CuTest *tc UNUSED) {
  54214 
  54215   smallJsont *self = allocG(rtSmallJsont);
  54216   setTopSO(self, "shee");
  54217 
  54218   // positive count
  54219   ck_assert_int_eq(countCharSmallJsonG(self, 's'), 1);
  54220   terminateO(self);
  54221 
  54222 }
  54223 
  54224 
  54225 void countSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54226 
  54227   smallJsont *self = allocG(rtSmallJsont);
  54228   setTopSO(self, "sheepy");
  54229   smallStringt *string = allocSmallString("shee");
  54230 
  54231   // positive count
  54232   ck_assert_int_eq(countSmallStringSmallJsonG(self, string), 1);
  54233   terminateO(string);
  54234   terminateO(self);
  54235 
  54236 }
  54237 
  54238 
  54239 void countJsonSmallJsonGT(CuTest *tc UNUSED) {
  54240 
  54241   smallJsont *self = allocG(rtSmallJsont);
  54242   setTopSO(self, "sheepy");
  54243   smallJsont *string = allocSmallJson();
  54244 
  54245   // positive count
  54246   setTopSO(string, "shee");
  54247   ck_assert_int_eq(countJsonSmallJsonG(self, string), 1);
  54248   terminateO(string);
  54249   terminateO(self);
  54250 
  54251 }
  54252 
  54253 
  54254 void icStartsWithSSmallJsonGT(CuTest *tc UNUSED) {
  54255 
  54256   smallJsont *self = allocG(rtSmallJsont);
  54257   setTopSO(self, "shee");
  54258 
  54259   ck_assert(icStartsWithSSmallJsonG(self, "SH"));
  54260   terminateO(self);
  54261 
  54262 }
  54263 
  54264 
  54265 void icStartsWithCharSmallJsonGT(CuTest *tc UNUSED) {
  54266 
  54267   smallJsont *self = allocG(rtSmallJsont);
  54268   setTopSO(self, "shee");
  54269 
  54270   ck_assert(icStartsWithCharSmallJsonG(self, 'S'));
  54271   terminateO(self);
  54272 
  54273 }
  54274 
  54275 
  54276 void icStartsWithSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54277 
  54278   smallJsont *self = allocG(rtSmallJsont);
  54279   setTopSO(self, "shee");
  54280   smallStringt *string = allocSmallString("SH");
  54281 
  54282   ck_assert(icStartsWithSmallStringSmallJsonG(self, string));
  54283   terminateO(string);
  54284   terminateO(self);
  54285 
  54286 }
  54287 
  54288 
  54289 void icStartsWithJsonSmallJsonGT(CuTest *tc UNUSED) {
  54290 
  54291   smallJsont *self = allocG(rtSmallJsont);
  54292   setTopSO(self, "shee");
  54293   smallJsont *string = allocSmallJson();
  54294 
  54295   setTopSO(string, "SH");
  54296   ck_assert(icStartsWithJsonSmallJsonG(self, string));
  54297   terminateO(string);
  54298   terminateO(self);
  54299 
  54300 }
  54301 
  54302 
  54303 void icEndsWithSSmallJsonGT(CuTest *tc UNUSED) {
  54304 
  54305   smallJsont *self = allocG(rtSmallJsont);
  54306 
  54307   setTopSO(self, "sheepy");
  54308   ck_assert(icEndsWithSSmallJsonG(self, "EEPY"));
  54309   terminateO(self);
  54310 
  54311 }
  54312 
  54313 
  54314 void icEndsWithCharSmallJsonGT(CuTest *tc UNUSED) {
  54315 
  54316   smallJsont *self = allocG(rtSmallJsont);
  54317   setTopSO(self, "shee");
  54318 
  54319   ck_assert(icEndsWithCharSmallJsonG(self, 'E'));
  54320   terminateO(self);
  54321 
  54322 }
  54323 
  54324 
  54325 void icEndsWithSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54326 
  54327   smallJsont *self = allocG(rtSmallJsont);
  54328   setTopSO(self, "sheepy");
  54329   smallStringt *string = allocSmallString("EEPY");
  54330 
  54331   ck_assert(icEndsWithSmallStringSmallJsonG(self, string));
  54332   terminateO(string);
  54333   terminateO(self);
  54334 
  54335 }
  54336 
  54337 
  54338 void icEndsWithJsonSmallJsonGT(CuTest *tc UNUSED) {
  54339 
  54340   smallJsont *self = allocG(rtSmallJsont);
  54341   setTopSO(self, "sheepy");
  54342   smallJsont *string = allocSmallJson();
  54343 
  54344   setTopSO(string, "EEPY");
  54345   ck_assert(icEndsWithJsonSmallJsonG(self, string));
  54346   terminateO(string);
  54347   terminateO(self);
  54348 
  54349 }
  54350 
  54351 
  54352 void icCountSSmallJsonGT(CuTest *tc UNUSED) {
  54353 
  54354   smallJsont *self = allocG(rtSmallJsont);
  54355   setTopSO(self, "sheepy");
  54356 
  54357   ck_assert_int_eq(icCountSSmallJsonG(self, "SH"), 1);
  54358   terminateO(self);
  54359 
  54360 }
  54361 
  54362 
  54363 void icCountCharSmallJsonGT(CuTest *tc UNUSED) {
  54364 
  54365   smallJsont *self = allocG(rtSmallJsont);
  54366   setTopSO(self, "shee");
  54367 
  54368   ck_assert_int_eq(icCountCharSmallJsonG(self, 'S'), 1);
  54369   terminateO(self);
  54370 
  54371 }
  54372 
  54373 
  54374 void icCountSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54375 
  54376   smallJsont *self = allocG(rtSmallJsont);
  54377   setTopSO(self, "sheepy");
  54378   smallStringt *string = allocSmallString("SHEE");
  54379 
  54380   ck_assert_int_eq(icCountSmallStringSmallJsonG(self, string), 1);
  54381   terminateO(string);
  54382   terminateO(self);
  54383 
  54384 }
  54385 
  54386 
  54387 void icCountJsonSmallJsonGT(CuTest *tc UNUSED) {
  54388 
  54389   smallJsont *self = allocG(rtSmallJsont);
  54390   setTopSO(self, "sheepy");
  54391   smallJsont *string = allocSmallJson();
  54392 
  54393   setTopSO(string, "SH");
  54394   ck_assert_int_eq(icCountJsonSmallJsonG(self, string), 1);
  54395   terminateO(string);
  54396   terminateO(self);
  54397 
  54398 }
  54399 
  54400 
  54401 void isNumberSmallJsonGT(CuTest *tc UNUSED) {
  54402 
  54403   smallJsont *self = allocG(rtSmallJsont);
  54404 
  54405   setTopSO(self, "-12.3");
  54406   ck_assert(isNumberSmallJsonG(self));
  54407   terminateO(self);
  54408 
  54409 }
  54410 
  54411 
  54412 void isIntSmallJsonGT(CuTest *tc UNUSED) {
  54413 
  54414   smallJsont *self = allocG(rtSmallJsont);
  54415 
  54416   setTopSO(self, "-123");
  54417   ck_assert(isIntSmallJsonG(self));
  54418   terminateO(self);
  54419 
  54420 }
  54421 
  54422 
  54423 void parseIntSmallJsonGT(CuTest *tc UNUSED) {
  54424 
  54425   smallJsont *self = allocG(rtSmallJsont);
  54426 
  54427   setTopSO(self, "123sheepy");
  54428   ck_assert_int_eq(parseIntSmallJsonG(self), 123);
  54429   terminateO(self);
  54430 
  54431 }
  54432 
  54433 
  54434 void parseDoubleSmallJsonGT(CuTest *tc UNUSED) {
  54435 
  54436   smallJsont *self = allocG(rtSmallJsont);
  54437 
  54438   setTopSO(self, "123.2sheepy");
  54439   ck_assert_int_eq(parseDoubleSmallJsonG(self), 123);
  54440   terminateO(self);
  54441 
  54442 }
  54443 
  54444 
  54445 void intToSmallJsonGT(CuTest *tc UNUSED) {
  54446 
  54447   smallJsont* r;
  54448   smallJsont *self = allocG(rtSmallJsont);
  54449 
  54450   r = intToSmallJsonG(self, 123);
  54451   ck_assert_ptr_ne(r, null);
  54452   char *s = toStringO(r);
  54453   ck_assert_str_eq(s, "123");
  54454   free(s);
  54455   terminateO(self);
  54456 
  54457 }
  54458 
  54459 
  54460 void doubleToSmallJsonGT(CuTest *tc UNUSED) {
  54461 
  54462   smallJsont* r;
  54463   smallJsont *self = allocG(rtSmallJsont);
  54464 
  54465   r = doubleToSmallJsonG(self, 123.4);
  54466   ck_assert_ptr_ne(r, null);
  54467   char *s = toStringO(r);
  54468   ck_assert_str_eq(s, "1.234000e+02");
  54469   free(s);
  54470   terminateO(self);
  54471 
  54472 }
  54473 
  54474 
  54475 void lenSmallJsonGT(CuTest *tc UNUSED) {
  54476 
  54477   size_t r;
  54478   smallJsont *self = allocSmallJson();
  54479 
  54480   self->f->pushInt(self, 1);
  54481   r = lenSmallJsonG(self);
  54482   ck_assert_int_eq(r, 1);
  54483   terminateO(self);
  54484 
  54485 }
  54486 
  54487 
  54488 void upperSmallJsonGT(CuTest *tc UNUSED) {
  54489 
  54490   smallJsont*    r;
  54491   smallJsont *self = allocG(rtSmallJsont);
  54492   setTopSO(self, "sheepy");
  54493 
  54494   // string
  54495   r = upperSmallJsonG(self);
  54496   ck_assert_ptr_ne(r, null);
  54497   char *s = toStringO(r);
  54498   ck_assert_str_eq(s, "SHEEPY");
  54499   free(s);
  54500   terminateO(self);
  54501 
  54502 }
  54503 
  54504 
  54505 void lowerSmallJsonGT(CuTest *tc UNUSED) {
  54506 
  54507   smallJsont*    r;
  54508   smallJsont *self = allocG(rtSmallJsont);
  54509   setTopSO(self, "SHeePY");
  54510 
  54511   // string
  54512   r = lowerSmallJsonG(self);
  54513   ck_assert_ptr_ne(r, null);
  54514   char *s = toStringO(r);
  54515   ck_assert_str_eq(s, "sheepy");
  54516   free(s);
  54517   terminateO(self);
  54518 
  54519 }
  54520 
  54521 
  54522 void trimSmallJsonGT(CuTest *tc UNUSED) {
  54523 
  54524   smallJsont* r;
  54525   smallJsont *self = allocSmallJson();
  54526 
  54527   self->f->pushInt(self, 1);
  54528   delElemIndexO(self, 0);
  54529   r = trimSmallJsonG(self);
  54530   ck_assert_ptr_ne(r, null);
  54531   ck_assert_int_eq(lenSmallJsonG(self), 0);
  54532   terminateO(self);
  54533 
  54534 }
  54535 
  54536 
  54537 void lTrimSmallJsonGT(CuTest *tc UNUSED) {
  54538 
  54539   smallJsont*    r;
  54540   smallJsont *self = allocG(rtSmallJsont);
  54541 
  54542   setTopSO(self, "  SHeePY");
  54543   r = lTrimSmallJsonG(self);
  54544   ck_assert_ptr_ne(r, null);
  54545   char *s = toStringO(r);
  54546   ck_assert_str_eq(s, "SHeePY");
  54547   free(s);
  54548   terminateO(self);
  54549 
  54550 }
  54551 
  54552 
  54553 void rTrimSmallJsonGT(CuTest *tc UNUSED) {
  54554 
  54555   smallJsont*    r;
  54556   smallJsont *self = allocG(rtSmallJsont);
  54557 
  54558   setTopSO(self, "SHeePY	");
  54559   r = rTrimSmallJsonG(self);
  54560   ck_assert_ptr_ne(r, null);
  54561   char *s = toStringO(r);
  54562   ck_assert_str_eq(s, "SHeePY");
  54563   free(s);
  54564   terminateO(self);
  54565 
  54566 }
  54567 
  54568 
  54569 void compactSmallJsonGT(CuTest *tc UNUSED) {
  54570 
  54571   smallJsont* r;
  54572   smallJsont *self = allocSmallJson();
  54573 
  54574   self->f->pushUndefined(self);
  54575   //  null element
  54576   self->f->pushUndefined(self);
  54577   delElemIndexO(self, 1);
  54578   self->f->pushBool(self, true);
  54579   createSmallContainer(c);
  54580   self->f->pushSmallContainer(self, &c);
  54581   //  empty dict
  54582   createSmallDict(d);
  54583   self->f->pushDict(self, &d);
  54584   resetO(&d);
  54585   (&d)->f->setInt(&d, "a", 1);
  54586   self->f->pushDict(self, &d);
  54587   self->f->pushDouble(self, 2);
  54588   self->f->pushInt(self, 5);
  54589   self->f->pushS(self, "   ");
  54590   self->f->pushS(self, "asd");
  54591   //  empty Array
  54592   createSmallArray(a);
  54593   self->f->pushArray(self, &a);
  54594   resetO(&a);
  54595   (&a)->f->pushInt(&a, 1);
  54596   self->f->pushArray(self, &a);
  54597   //  empty bytes
  54598   createSmallBytes(b);
  54599   self->f->pushSmallBytes(self, &b);
  54600   smallBytest *B = allocSmallBytes("asd", 4);
  54601   self->f->pushNFreeSmallBytes(self, B);
  54602   r = compactSmallJsonG(self);
  54603   ck_assert_ptr_ne(r, NULL);
  54604   ck_assert_int_eq(lenO(r), 8);
  54605   char *s = toStringO(r);
  54606   ck_assert_str_eq(s, "[true,\"<data container>\",{\"a\":1},2.000000e+00,5,\"asd\",[1],[0x61,0x73,0x64,0x00]]");
  54607   free(s);
  54608   terminateO(self);
  54609 
  54610 }
  54611 
  54612 
  54613 void emptySmallJsonGT(CuTest *tc UNUSED) {
  54614 
  54615   smallJsont* r;
  54616   smallJsont *self = allocSmallJson();
  54617 
  54618   self->f->pushInt(self, 1);
  54619   r = emptySmallJsonG(self);
  54620   ck_assert_ptr_ne(r, null);
  54621   char *s = toStringO(r);
  54622   ck_assert_str_eq(s, "[]");
  54623   free(s);
  54624   terminateO(self);
  54625 
  54626 }
  54627 
  54628 
  54629 void isEmptySmallJsonGT(CuTest *tc UNUSED) {
  54630 
  54631   bool r;
  54632   smallJsont *self = allocSmallJson();
  54633 
  54634   r = isEmptySmallJsonG(self);
  54635   ck_assert(r);
  54636   terminateO(self);
  54637 
  54638 }
  54639 
  54640 
  54641 void isBlankSmallJsonGT(CuTest *tc UNUSED) {
  54642 
  54643   bool r;
  54644   smallJsont *self = allocSmallJson();
  54645 
  54646   r = isBlankSmallJsonG(self);
  54647   ck_assert(r);
  54648   terminateO(self);
  54649 
  54650 }
  54651 
  54652 
  54653 void joinSmallJsonGT(CuTest *tc UNUSED) {
  54654 
  54655   smallStringt* r;
  54656   smallJsont *self = allocSmallJson();
  54657 
  54658   self->f->pushS(self, "a");
  54659   self->f->pushS(self, "b");
  54660   r = joinSmallJsonG(self, "|");
  54661   ck_assert_ptr_ne(r, null);
  54662   char *s = toStringO(r);
  54663   ck_assert_str_eq(s, "a|b");
  54664   free(s);
  54665   terminateO(r);
  54666   terminateO(self);
  54667 
  54668 }
  54669 
  54670 
  54671 void joinCharSmallJsonGT(CuTest *tc UNUSED) {
  54672 
  54673   smallStringt* r;
  54674   smallJsont *self = allocSmallJson();
  54675 
  54676   self->f->pushS(self, "a");
  54677   self->f->pushS(self, "b");
  54678   r = joinCharSmallJsonG(self, '|');
  54679   ck_assert_ptr_ne(r, null);
  54680   char *s = toStringO(r);
  54681   ck_assert_str_eq(s, "a|b");
  54682   free(s);
  54683   terminateO(r);
  54684   terminateO(self);
  54685 
  54686 }
  54687 
  54688 
  54689 void joinSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  54690 
  54691   smallStringt* r;
  54692   smallJsont *self = allocSmallJson();
  54693 
  54694   r = joinSmallJsonSmallJsonG(self, null);
  54695   ck_assert_ptr_eq(r, null);
  54696   terminateO(self);
  54697 
  54698 }
  54699 
  54700 
  54701 void joinSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54702 
  54703   smallStringt* r;
  54704   smallJsont *self = allocSmallJson();
  54705 
  54706   r = joinSmallStringSmallJsonG(self, null);
  54707   ck_assert_ptr_eq(r, null);
  54708   terminateO(self);
  54709 
  54710 }
  54711 
  54712 
  54713 void joinSSmallJsonGT(CuTest *tc UNUSED) {
  54714 
  54715   char* r;
  54716   smallJsont *self = allocSmallJson();
  54717 
  54718   r = joinSSmallJsonG(self, null);
  54719   ck_assert_ptr_eq(r, null);
  54720   terminateO(self);
  54721 
  54722 }
  54723 
  54724 
  54725 void joinCharSSmallJsonGT(CuTest *tc UNUSED) {
  54726 
  54727   char* r;
  54728   smallJsont *self = allocSmallJson();
  54729 
  54730   r = joinCharSSmallJsonG(self, '#');
  54731   ck_assert_ptr_eq(r, null);
  54732   terminateO(self);
  54733 
  54734 }
  54735 
  54736 
  54737 void joinSmallJsonSSmallJsonGT(CuTest *tc UNUSED) {
  54738 
  54739   char* r;
  54740   smallJsont *self = allocSmallJson();
  54741 
  54742   r = joinSmallJsonSSmallJsonG(self, null);
  54743   ck_assert_ptr_eq(r, null);
  54744   terminateO(self);
  54745 
  54746 }
  54747 
  54748 
  54749 void joinSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  54750 
  54751   char* r;
  54752   smallJsont *self = allocSmallJson();
  54753 
  54754   r = joinSmallStringSSmallJsonG(self, null);
  54755   ck_assert_ptr_eq(r, null);
  54756   terminateO(self);
  54757 
  54758 }
  54759 
  54760 
  54761 void splitSmallJsonGT(CuTest *tc UNUSED) {
  54762 
  54763   smallJsont* r;
  54764   smallJsont *self = allocG(rtSmallJsont);
  54765 
  54766   setTopSO(self, "one/two");
  54767   r = splitSmallJsonG(self, "/");
  54768   ck_assert_ptr_ne(r, null);
  54769   char *s = toStringO(r);
  54770   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54771   free(s);
  54772   terminateO(r);
  54773   terminateO(self);
  54774 
  54775 }
  54776 
  54777 
  54778 void splitCharSmallJsonGT(CuTest *tc UNUSED) {
  54779 
  54780   smallJsont* r;
  54781   smallJsont *self = allocG(rtSmallJsont);
  54782 
  54783   setTopSO(self, "one/two");
  54784   r = splitCharSmallJsonG(self, '/');
  54785   ck_assert_ptr_ne(r, null);
  54786   char *s = toStringO(r);
  54787   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54788   free(s);
  54789   terminateO(r);
  54790   terminateO(self);
  54791 
  54792 }
  54793 
  54794 
  54795 void splitSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  54796 
  54797   smallJsont* r;
  54798   smallJsont *self = allocG(rtSmallJsont);
  54799   smallJsont *delim  = allocSmallJson();
  54800 
  54801   setTopSO(self, "one/two");
  54802   setTopSO(delim, "/");
  54803   r = splitSmallJsonSmallJsonG(self, delim);
  54804   ck_assert_ptr_ne(r, null);
  54805   char *s = toStringO(r);
  54806   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54807   free(s);
  54808   terminateO(r);
  54809   terminateO(delim);
  54810   terminateO(self);
  54811 
  54812 }
  54813 
  54814 
  54815 void splitSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54816 
  54817   smallJsont* r;
  54818   smallJsont *self = allocG(rtSmallJsont);
  54819   smallStringt *delim = allocSmallString("/");
  54820 
  54821   setTopSO(self, "one/two");
  54822   r = splitSmallStringSmallJsonG(self, delim);
  54823   ck_assert_ptr_ne(r, null);
  54824   char *s = toStringO(r);
  54825   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  54826   free(s);
  54827   terminateO(r);
  54828   terminateO(delim);
  54829   terminateO(self);
  54830 
  54831 }
  54832 
  54833 
  54834 void splitSSmallJsonGT(CuTest *tc UNUSED) {
  54835 
  54836   char** r;
  54837   smallJsont *self = allocG(rtSmallJsont);
  54838 
  54839   setTopSO(self, "one/two");
  54840   r = splitSSmallJsonG(self, "/");
  54841   ck_assert_uint_eq(listLengthS(r),2);
  54842   ck_assert_str_eq(r[0], "one");
  54843   ck_assert_str_eq(r[1], "two");
  54844   listFreeS(r);
  54845   terminateO(self);
  54846 
  54847 }
  54848 
  54849 
  54850 void splitCharSSmallJsonGT(CuTest *tc UNUSED) {
  54851 
  54852   char** r;
  54853   smallJsont *self = allocG(rtSmallJsont);
  54854 
  54855   setTopSO(self, "one/two");
  54856   r = splitCharSSmallJsonG(self, '/');
  54857   ck_assert_uint_eq(listLengthS(r),2);
  54858   ck_assert_str_eq(r[0], "one");
  54859   ck_assert_str_eq(r[1], "two");
  54860   listFreeS(r);
  54861   terminateO(self);
  54862 
  54863 }
  54864 
  54865 
  54866 void splitSmallJsonSSmallJsonGT(CuTest *tc UNUSED) {
  54867 
  54868   char** r;
  54869   smallJsont *self  = allocG(rtSmallJsont);
  54870   smallJsont *delim = allocSmallJson();
  54871 
  54872   setTopSO(self, "one/two");
  54873   setTopSO(delim, "/");
  54874   r = splitSmallJsonSSmallJsonG(self, delim);
  54875   ck_assert_uint_eq(listLengthS(r),2);
  54876   ck_assert_str_eq(r[0], "one");
  54877   ck_assert_str_eq(r[1], "two");
  54878   listFreeS(r);
  54879   terminateO(delim);
  54880   terminateO(self);
  54881 
  54882 }
  54883 
  54884 
  54885 void splitSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  54886 
  54887   char** r;
  54888   smallJsont *self    = allocG(rtSmallJsont);
  54889   smallStringt *delim = allocSmallString("/");
  54890 
  54891   setTopSO(self, "one/two");
  54892   r = splitSmallStringSSmallJsonG(self, delim);
  54893   ck_assert_uint_eq(listLengthS(r),2);
  54894   ck_assert_str_eq(r[0], "one");
  54895   ck_assert_str_eq(r[1], "two");
  54896   listFreeS(r);
  54897   terminateO(delim);
  54898   terminateO(self);
  54899 
  54900 }
  54901 
  54902 
  54903 void extractSmallJsonGT(CuTest *tc UNUSED) {
  54904 
  54905   smallJsont* r;
  54906   smallJsont *self = allocG(rtSmallJsont);
  54907 
  54908   setTopSO(self, "one/two|");
  54909   r = extractSmallJsonG(self, "/", "|");
  54910   ck_assert_ptr_ne(r, null);
  54911   char *s = toStringO(r);
  54912   ck_assert_str_eq(s, "[\"two\"]");
  54913   free(s);
  54914   terminateO(r);
  54915   terminateO(self);
  54916 
  54917 }
  54918 
  54919 
  54920 void extractCharSSmallJsonGT(CuTest *tc UNUSED) {
  54921 
  54922   smallJsont* r;
  54923   smallJsont *self = allocG(rtSmallJsont);
  54924 
  54925   setTopSO(self, "one/two|");
  54926   r = extractCharSSmallJsonG(self, '/', "|");
  54927   ck_assert_ptr_ne(r, null);
  54928   char *s = toStringO(r);
  54929   ck_assert_str_eq(s, "[\"two\"]");
  54930   free(s);
  54931   terminateO(r);
  54932   terminateO(self);
  54933 
  54934 }
  54935 
  54936 
  54937 void extractSCharSmallJsonGT(CuTest *tc UNUSED) {
  54938 
  54939   smallJsont* r;
  54940   smallJsont *self = allocG(rtSmallJsont);
  54941 
  54942   setTopSO(self, "one/two|");
  54943   r = extractSCharSmallJsonG(self, "/", '|');
  54944   ck_assert_ptr_ne(r, null);
  54945   char *s = toStringO(r);
  54946   ck_assert_str_eq(s, "[\"two\"]");
  54947   free(s);
  54948   terminateO(r);
  54949   terminateO(self);
  54950 
  54951 }
  54952 
  54953 
  54954 void extractCharCharSmallJsonGT(CuTest *tc UNUSED) {
  54955 
  54956   smallJsont* r;
  54957   smallJsont *self = allocG(rtSmallJsont);
  54958 
  54959   setTopSO(self, "one/two|");
  54960   r = extractCharCharSmallJsonG(self, '/', '|');
  54961   ck_assert_ptr_ne(r, null);
  54962   char *s = toStringO(r);
  54963   ck_assert_str_eq(s, "[\"two\"]");
  54964   free(s);
  54965   terminateO(r);
  54966   terminateO(self);
  54967 
  54968 }
  54969 
  54970 
  54971 void extractSmallJsonSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  54972 
  54973   smallJsont* r;
  54974   smallJsont *self   = allocG(rtSmallJsont);
  54975   smallJsont* delim1 = allocSmallJson();
  54976   smallJsont* delim2 = allocSmallJson();
  54977 
  54978   setTopSO(self, "one/two|");
  54979   setTopSO(delim1, "/");
  54980   setTopSO(delim2, "|");
  54981   r = extractSmallJsonSmallJsonSmallJsonG(self, delim1, delim2);
  54982   ck_assert_ptr_ne(r, null);
  54983   char *s = toStringO(r);
  54984   ck_assert_str_eq(s, "[\"two\"]");
  54985   free(s);
  54986   terminateO(r);
  54987   terminateO(delim1);
  54988   terminateO(delim2);
  54989   terminateO(self);
  54990 
  54991 }
  54992 
  54993 
  54994 void extractSmallJsonSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  54995 
  54996   smallJsont* r;
  54997   smallJsont *self     = allocG(rtSmallJsont);
  54998   smallJsont* delim1   = allocSmallJson();
  54999   smallStringt* delim2 = allocSmallString("|");
  55000 
  55001   setTopSO(self, "one/two|");
  55002   setTopSO(delim1, "/");
  55003   r = extractSmallJsonSmallStringSmallJsonG(self, delim1, delim2);
  55004   ck_assert_ptr_ne(r, null);
  55005   char *s = toStringO(r);
  55006   ck_assert_str_eq(s, "[\"two\"]");
  55007   free(s);
  55008   terminateO(r);
  55009   terminateO(delim1);
  55010   terminateO(delim2);
  55011   terminateO(self);
  55012 
  55013 }
  55014 
  55015 
  55016 void extractSmallJsonSSmallJsonGT(CuTest *tc UNUSED) {
  55017 
  55018   smallJsont* r;
  55019   smallJsont *self   = allocG(rtSmallJsont);
  55020   smallJsont* delim1 = allocSmallJson();
  55021 
  55022   setTopSO(self, "one/two|");
  55023   setTopSO(delim1, "/");
  55024   r = extractSmallJsonSSmallJsonG(self, delim1, "|");
  55025   ck_assert_ptr_ne(r, null);
  55026   char *s = toStringO(r);
  55027   ck_assert_str_eq(s, "[\"two\"]");
  55028   free(s);
  55029   terminateO(r);
  55030   terminateO(delim1);
  55031   terminateO(self);
  55032 
  55033 }
  55034 
  55035 
  55036 void extractSmallJsonCharSmallJsonGT(CuTest *tc UNUSED) {
  55037 
  55038   smallJsont* r;
  55039   smallJsont *self   = allocG(rtSmallJsont);
  55040   smallJsont* delim1 = allocSmallJson();
  55041 
  55042   setTopSO(self, "one/two|");
  55043   setTopSO(delim1, "/");
  55044   r = extractSmallJsonCharSmallJsonG(self, delim1, '|');
  55045   ck_assert_ptr_ne(r, null);
  55046   char *s = toStringO(r);
  55047   ck_assert_str_eq(s, "[\"two\"]");
  55048   free(s);
  55049   terminateO(r);
  55050   terminateO(delim1);
  55051   terminateO(self);
  55052 
  55053 }
  55054 
  55055 
  55056 void extractSmallStringSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55057 
  55058   smallJsont* r;
  55059   smallJsont *self     = allocG(rtSmallJsont);
  55060   smallStringt* delim1 = allocSmallString("/");
  55061   smallJsont* delim2   = allocSmallJson();
  55062 
  55063   setTopSO(self, "one/two|");
  55064   setTopSO(delim2, "|");
  55065   r = extractSmallStringSmallJsonSmallJsonG(self, delim1, delim2);
  55066   ck_assert_ptr_ne(r, null);
  55067   char *s = toStringO(r);
  55068   ck_assert_str_eq(s, "[\"two\"]");
  55069   free(s);
  55070   terminateO(r);
  55071   terminateO(delim1);
  55072   terminateO(delim2);
  55073   terminateO(self);
  55074 
  55075 }
  55076 
  55077 
  55078 void extractSmallStringSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55079 
  55080   smallJsont* r;
  55081   smallJsont *self     = allocG(rtSmallJsont);
  55082   smallStringt* delim1 = allocSmallString("/");
  55083   smallStringt* delim2 = allocSmallString("|");
  55084 
  55085   setTopSO(self, "one/two|");
  55086   r = extractSmallStringSmallStringSmallJsonG(self, delim1, delim2);
  55087   ck_assert_ptr_ne(r, null);
  55088   char *s = toStringO(r);
  55089   ck_assert_str_eq(s, "[\"two\"]");
  55090   free(s);
  55091   terminateO(r);
  55092   terminateO(delim1);
  55093   terminateO(delim2);
  55094   terminateO(self);
  55095 
  55096 }
  55097 
  55098 
  55099 void extractSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  55100 
  55101   smallJsont* r;
  55102   smallJsont *self     = allocG(rtSmallJsont);
  55103   smallStringt* delim1 = allocSmallString("/");
  55104 
  55105   setTopSO(self, "one/two|");
  55106   r = extractSmallStringSSmallJsonG(self, delim1, "|");
  55107   ck_assert_ptr_ne(r, null);
  55108   char *s = toStringO(r);
  55109   ck_assert_str_eq(s, "[\"two\"]");
  55110   free(s);
  55111   terminateO(r);
  55112   terminateO(delim1);
  55113   terminateO(self);
  55114 
  55115 }
  55116 
  55117 
  55118 void extractSmallStringCharSmallJsonGT(CuTest *tc UNUSED) {
  55119 
  55120   smallJsont* r;
  55121   smallJsont *self     = allocG(rtSmallJsont);
  55122   smallStringt* delim1 = allocSmallString("/");
  55123 
  55124   setTopSO(self, "one/two|");
  55125   r = extractSmallStringCharSmallJsonG(self, delim1, '|');
  55126   ck_assert_ptr_ne(r, null);
  55127   char *s = toStringO(r);
  55128   ck_assert_str_eq(s, "[\"two\"]");
  55129   free(s);
  55130   terminateO(r);
  55131   terminateO(delim1);
  55132   terminateO(self);
  55133 
  55134 }
  55135 
  55136 
  55137 void extractSSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55138 
  55139   smallJsont* r;
  55140   smallJsont *self   = allocG(rtSmallJsont);
  55141   smallJsont* delim2 = allocSmallJson();
  55142 
  55143   setTopSO(self, "one/two|");
  55144   setTopSO(delim2, "|");
  55145   r = extractSSmallJsonSmallJsonG(self, "/", delim2);
  55146   ck_assert_ptr_ne(r, null);
  55147   char *s = toStringO(r);
  55148   ck_assert_str_eq(s, "[\"two\"]");
  55149   free(s);
  55150   terminateO(r);
  55151   terminateO(delim2);
  55152   terminateO(self);
  55153 
  55154 }
  55155 
  55156 
  55157 void extractSSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55158 
  55159   smallJsont* r;
  55160   smallJsont *self     = allocG(rtSmallJsont);
  55161   smallStringt* delim2 = allocSmallString("|");
  55162 
  55163   setTopSO(self, "one/two|");
  55164   setValO(delim2, "|");
  55165   r = extractSSmallStringSmallJsonG(self, "/", delim2);
  55166   ck_assert_ptr_ne(r, null);
  55167   char *s = toStringO(r);
  55168   ck_assert_str_eq(s, "[\"two\"]");
  55169   free(s);
  55170   terminateO(r);
  55171   terminateO(delim2);
  55172   terminateO(self);
  55173 
  55174 }
  55175 
  55176 
  55177 void extractCharSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55178 
  55179   smallJsont* r;
  55180   smallJsont *self   = allocG(rtSmallJsont);
  55181   smallJsont* delim2 = allocSmallJson();
  55182 
  55183   setTopSO(self, "one/two|");
  55184   setTopSO(delim2, "|");
  55185   r = extractCharSmallJsonSmallJsonG(self, '/', delim2);
  55186   ck_assert_ptr_ne(r, null);
  55187   char *s = toStringO(r);
  55188   ck_assert_str_eq(s, "[\"two\"]");
  55189   free(s);
  55190   terminateO(r);
  55191   terminateO(delim2);
  55192   terminateO(self);
  55193 
  55194 }
  55195 
  55196 
  55197 void extractCharSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55198 
  55199   smallJsont* r;
  55200   smallJsont *self     = allocG(rtSmallJsont);
  55201   smallStringt* delim2 = allocSmallString("|");
  55202 
  55203   setTopSO(self, "one/two|");
  55204   setValO(delim2, "|");
  55205   r = extractCharSmallStringSmallJsonG(self, '/', delim2);
  55206   ck_assert_ptr_ne(r, null);
  55207   char *s = toStringO(r);
  55208   ck_assert_str_eq(s, "[\"two\"]");
  55209   free(s);
  55210   terminateO(r);
  55211   terminateO(delim2);
  55212   terminateO(self);
  55213 
  55214 }
  55215 
  55216 
  55217 void icSplitSmallJsonGT(CuTest *tc UNUSED) {
  55218 
  55219   smallJsont* r;
  55220   smallJsont *self = allocG(rtSmallJsont);
  55221 
  55222   setTopSO(self, "one/two");
  55223   r = icSplitSmallJsonG(self, "/");
  55224   ck_assert_ptr_ne(r, null);
  55225   char *s = toStringO(r);
  55226   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55227   free(s);
  55228   terminateO(r);
  55229   terminateO(self);
  55230 
  55231 }
  55232 
  55233 
  55234 void icSplitCharSmallJsonGT(CuTest *tc UNUSED) {
  55235 
  55236   smallJsont* r;
  55237   smallJsont *self = allocG(rtSmallJsont);
  55238 
  55239   setTopSO(self, "one/two");
  55240   r = icSplitCharSmallJsonG(self, 'T');
  55241   ck_assert_ptr_ne(r, null);
  55242   char *s = toStringO(r);
  55243   ck_assert_str_eq(s, "[\"one/\",\"wo\"]");
  55244   free(s);
  55245   terminateO(r);
  55246   terminateO(self);
  55247 
  55248 }
  55249 
  55250 
  55251 void icSplitSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55252 
  55253   smallJsont* r;
  55254   smallJsont *self = allocG(rtSmallJsont);
  55255   smallJsont *delim  = allocSmallJson();
  55256 
  55257   setTopSO(self, "one/two");
  55258   setTopSO(delim, "/");
  55259   r = icSplitSmallJsonSmallJsonG(self, delim);
  55260   ck_assert_ptr_ne(r, null);
  55261   char *s = toStringO(r);
  55262   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55263   free(s);
  55264   terminateO(r);
  55265   terminateO(delim);
  55266   terminateO(self);
  55267 
  55268 }
  55269 
  55270 
  55271 void icSplitSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55272 
  55273   smallJsont* r;
  55274   smallJsont *self = allocG(rtSmallJsont);
  55275   smallStringt *delim = allocSmallString("/");
  55276 
  55277   setTopSO(self, "one/two");
  55278   r = icSplitSmallStringSmallJsonG(self, delim);
  55279   ck_assert_ptr_ne(r, null);
  55280   char *s = toStringO(r);
  55281   ck_assert_str_eq(s, "[\"one\",\"two\"]");
  55282   free(s);
  55283   terminateO(r);
  55284   terminateO(delim);
  55285   terminateO(self);
  55286 
  55287 }
  55288 
  55289 
  55290 void icSplitSSmallJsonGT(CuTest *tc UNUSED) {
  55291 
  55292   char** r;
  55293   smallJsont *self = allocG(rtSmallJsont);
  55294 
  55295   setTopSO(self, "one/two");
  55296   r = icSplitSSmallJsonG(self, "/");
  55297   ck_assert_uint_eq(listLengthS(r),2);
  55298   ck_assert_str_eq(r[0], "one");
  55299   ck_assert_str_eq(r[1], "two");
  55300   listFreeS(r);
  55301   terminateO(self);
  55302 
  55303 }
  55304 
  55305 
  55306 void icSplitCharSSmallJsonGT(CuTest *tc UNUSED) {
  55307 
  55308   char** r;
  55309   smallJsont *self = allocG(rtSmallJsont);
  55310 
  55311   setTopSO(self, "one/two");
  55312   r = icSplitCharSSmallJsonG(self, 'T');
  55313   ck_assert_uint_eq(listLengthS(r),2);
  55314   ck_assert_str_eq(r[0], "one/");
  55315   ck_assert_str_eq(r[1], "wo");
  55316   listFreeS(r);
  55317   terminateO(self);
  55318 
  55319 }
  55320 
  55321 
  55322 void icSplitSmallJsonSSmallJsonGT(CuTest *tc UNUSED) {
  55323 
  55324   char** r;
  55325   smallJsont *self  = allocG(rtSmallJsont);
  55326   smallJsont *delim = allocSmallJson();
  55327 
  55328   setTopSO(self, "one/two");
  55329   setTopSO(delim, "/");
  55330   r = icSplitSmallJsonSSmallJsonG(self, delim);
  55331   ck_assert_uint_eq(listLengthS(r),2);
  55332   ck_assert_str_eq(r[0], "one");
  55333   ck_assert_str_eq(r[1], "two");
  55334   listFreeS(r);
  55335   terminateO(delim);
  55336   terminateO(self);
  55337 
  55338 }
  55339 
  55340 
  55341 void icSplitSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  55342 
  55343   char** r;
  55344   smallJsont *self    = allocG(rtSmallJsont);
  55345   smallStringt *delim = allocSmallString("/");
  55346 
  55347   setTopSO(self, "one/two");
  55348   r = icSplitSmallStringSSmallJsonG(self, delim);
  55349   ck_assert_uint_eq(listLengthS(r),2);
  55350   ck_assert_str_eq(r[0], "one");
  55351   ck_assert_str_eq(r[1], "two");
  55352   listFreeS(r);
  55353   terminateO(delim);
  55354   terminateO(self);
  55355 
  55356 }
  55357 
  55358 
  55359 void icExtractSmallJsonGT(CuTest *tc UNUSED) {
  55360 
  55361   smallJsont* r;
  55362   smallJsont *self = allocG(rtSmallJsont);
  55363 
  55364   setTopSO(self, "one/twos");
  55365   r = icExtractSmallJsonG(self, "E", "S");
  55366   ck_assert_ptr_ne(r, null);
  55367   char *s = toStringO(r);
  55368   ck_assert_str_eq(s, "[\"/two\"]");
  55369   free(s);
  55370   terminateO(r);
  55371   terminateO(self);
  55372 
  55373 }
  55374 
  55375 
  55376 void icExtractCharSSmallJsonGT(CuTest *tc UNUSED) {
  55377 
  55378   smallJsont* r;
  55379   smallJsont *self = allocG(rtSmallJsont);
  55380 
  55381   setTopSO(self, "one/twos");
  55382   r = icExtractCharSSmallJsonG(self, 'E', "S");
  55383   ck_assert_ptr_ne(r, null);
  55384   char *s = toStringO(r);
  55385   ck_assert_str_eq(s, "[\"/two\"]");
  55386   free(s);
  55387   terminateO(r);
  55388   terminateO(self);
  55389 
  55390 }
  55391 
  55392 
  55393 void icExtractSCharSmallJsonGT(CuTest *tc UNUSED) {
  55394 
  55395   smallJsont* r;
  55396   smallJsont *self = allocG(rtSmallJsont);
  55397 
  55398   setTopSO(self, "one/twos");
  55399   r = icExtractSCharSmallJsonG(self, "E", 'S');
  55400   ck_assert_ptr_ne(r, null);
  55401   char *s = toStringO(r);
  55402   ck_assert_str_eq(s, "[\"/two\"]");
  55403   free(s);
  55404   terminateO(r);
  55405   terminateO(self);
  55406 
  55407 }
  55408 
  55409 
  55410 void icExtractCharCharSmallJsonGT(CuTest *tc UNUSED) {
  55411 
  55412   smallJsont* r;
  55413   smallJsont *self = allocG(rtSmallJsont);
  55414 
  55415   setTopSO(self, "one/twos");
  55416   r = icExtractCharCharSmallJsonG(self, 'E', 'S');
  55417   ck_assert_ptr_ne(r, null);
  55418   char *s = toStringO(r);
  55419   ck_assert_str_eq(s, "[\"/two\"]");
  55420   free(s);
  55421   terminateO(r);
  55422   terminateO(self);
  55423 
  55424 }
  55425 
  55426 
  55427 void icExtractSmallJsonSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55428 
  55429   smallJsont* r;
  55430   smallJsont *self   = allocG(rtSmallJsont);
  55431   smallJsont* delim1 = allocSmallJson();
  55432   smallJsont* delim2 = allocSmallJson();
  55433 
  55434   setTopSO(self, "one/twos");
  55435   setTopSO(delim1, "E");
  55436   setTopSO(delim2, "S");
  55437   r = icExtractSmallJsonSmallJsonSmallJsonG(self, delim1, delim2);
  55438   ck_assert_ptr_ne(r, null);
  55439   char *s = toStringO(r);
  55440   ck_assert_str_eq(s, "[\"/two\"]");
  55441   free(s);
  55442   terminateO(r);
  55443   terminateO(delim1);
  55444   terminateO(delim2);
  55445   terminateO(self);
  55446 
  55447 }
  55448 
  55449 
  55450 void icExtractSmallJsonSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55451 
  55452   smallJsont* r;
  55453   smallJsont *self     = allocG(rtSmallJsont);
  55454   smallJsont* delim1   = allocSmallJson();
  55455   smallStringt* delim2 = allocSmallString("S");
  55456 
  55457   setTopSO(self, "one/twos");
  55458   setTopSO(delim1, "E");
  55459   r = icExtractSmallJsonSmallStringSmallJsonG(self, delim1, delim2);
  55460   ck_assert_ptr_ne(r, null);
  55461   char *s = toStringO(r);
  55462   ck_assert_str_eq(s, "[\"/two\"]");
  55463   free(s);
  55464   terminateO(r);
  55465   terminateO(delim1);
  55466   terminateO(delim2);
  55467   terminateO(self);
  55468 
  55469 }
  55470 
  55471 
  55472 void icExtractSmallJsonSSmallJsonGT(CuTest *tc UNUSED) {
  55473 
  55474   smallJsont* r;
  55475   smallJsont *self   = allocG(rtSmallJsont);
  55476   smallJsont* delim1 = allocSmallJson();
  55477 
  55478   setTopSO(self, "one/twos");
  55479   setTopSO(delim1, "E");
  55480   r = icExtractSmallJsonSSmallJsonG(self, delim1, "S");
  55481   ck_assert_ptr_ne(r, null);
  55482   char *s = toStringO(r);
  55483   ck_assert_str_eq(s, "[\"/two\"]");
  55484   free(s);
  55485   terminateO(r);
  55486   terminateO(delim1);
  55487   terminateO(self);
  55488 
  55489 }
  55490 
  55491 
  55492 void icExtractSmallJsonCharSmallJsonGT(CuTest *tc UNUSED) {
  55493 
  55494   smallJsont* r;
  55495   smallJsont *self   = allocG(rtSmallJsont);
  55496   smallJsont* delim1 = allocSmallJson();
  55497 
  55498   setTopSO(self, "one/twos");
  55499   setTopSO(delim1, "E");
  55500   r = icExtractSmallJsonCharSmallJsonG(self, delim1, 'S');
  55501   ck_assert_ptr_ne(r, null);
  55502   char *s = toStringO(r);
  55503   ck_assert_str_eq(s, "[\"/two\"]");
  55504   free(s);
  55505   terminateO(r);
  55506   terminateO(delim1);
  55507   terminateO(self);
  55508 
  55509 }
  55510 
  55511 
  55512 void icExtractSmallStringSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55513 
  55514   smallJsont* r;
  55515   smallJsont *self     = allocG(rtSmallJsont);
  55516   smallStringt* delim1 = allocSmallString("E");
  55517   smallJsont* delim2   = allocSmallJson();
  55518 
  55519   setTopSO(self, "one/twos");
  55520   setTopSO(delim2, "S");
  55521   r = icExtractSmallStringSmallJsonSmallJsonG(self, delim1, delim2);
  55522   ck_assert_ptr_ne(r, null);
  55523   char *s = toStringO(r);
  55524   ck_assert_str_eq(s, "[\"/two\"]");
  55525   free(s);
  55526   terminateO(r);
  55527   terminateO(delim1);
  55528   terminateO(delim2);
  55529   terminateO(self);
  55530 
  55531 }
  55532 
  55533 
  55534 void icExtractSmallStringSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55535 
  55536   smallJsont* r;
  55537   smallJsont *self     = allocG(rtSmallJsont);
  55538   smallStringt* delim1 = allocSmallString("E");
  55539   smallStringt* delim2 = allocSmallString("|");
  55540 
  55541   setTopSO(self, "one/twos");
  55542   setValO(delim2, "S");
  55543   r = icExtractSmallStringSmallStringSmallJsonG(self, delim1, delim2);
  55544   ck_assert_ptr_ne(r, null);
  55545   char *s = toStringO(r);
  55546   ck_assert_str_eq(s, "[\"/two\"]");
  55547   free(s);
  55548   terminateO(r);
  55549   terminateO(delim1);
  55550   terminateO(delim2);
  55551   terminateO(self);
  55552 
  55553 }
  55554 
  55555 
  55556 void icExtractSmallStringSSmallJsonGT(CuTest *tc UNUSED) {
  55557 
  55558   smallJsont* r;
  55559   smallJsont *self     = allocG(rtSmallJsont);
  55560   smallStringt* delim1 = allocSmallString("E");
  55561 
  55562   setTopSO(self, "one/twos");
  55563   r = icExtractSmallStringSSmallJsonG(self, delim1, "S");
  55564   ck_assert_ptr_ne(r, null);
  55565   char *s = toStringO(r);
  55566   ck_assert_str_eq(s, "[\"/two\"]");
  55567   free(s);
  55568   terminateO(r);
  55569   terminateO(delim1);
  55570   terminateO(self);
  55571 
  55572 }
  55573 
  55574 
  55575 void icExtractSmallStringCharSmallJsonGT(CuTest *tc UNUSED) {
  55576 
  55577   smallJsont* r;
  55578   smallJsont *self     = allocG(rtSmallJsont);
  55579   smallStringt* delim1 = allocSmallString("E");
  55580 
  55581   setTopSO(self, "one/twos");
  55582   r = icExtractSmallStringCharSmallJsonG(self, delim1, 'S');
  55583   ck_assert_ptr_ne(r, null);
  55584   char *s = toStringO(r);
  55585   ck_assert_str_eq(s, "[\"/two\"]");
  55586   free(s);
  55587   terminateO(r);
  55588   terminateO(delim1);
  55589   terminateO(self);
  55590 
  55591 }
  55592 
  55593 
  55594 void icExtractSSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55595 
  55596   smallJsont* r;
  55597   smallJsont *self   = allocG(rtSmallJsont);
  55598   smallJsont* delim2 = allocSmallJson();
  55599 
  55600   setTopSO(self, "one/twos");
  55601   setTopSO(delim2, "S");
  55602   r = icExtractSSmallJsonSmallJsonG(self, "E", delim2);
  55603   ck_assert_ptr_ne(r, null);
  55604   char *s = toStringO(r);
  55605   ck_assert_str_eq(s, "[\"/two\"]");
  55606   free(s);
  55607   terminateO(r);
  55608   terminateO(delim2);
  55609   terminateO(self);
  55610 
  55611 }
  55612 
  55613 
  55614 void icExtractSSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55615 
  55616   smallJsont* r;
  55617   smallJsont *self     = allocG(rtSmallJsont);
  55618   smallStringt* delim2 = allocSmallString("|");
  55619 
  55620   setTopSO(self, "one/twos");
  55621   setValO(delim2, "S");
  55622   r = icExtractSSmallStringSmallJsonG(self, "E", delim2);
  55623   ck_assert_ptr_ne(r, null);
  55624   char *s = toStringO(r);
  55625   ck_assert_str_eq(s, "[\"/two\"]");
  55626   free(s);
  55627   terminateO(r);
  55628   terminateO(delim2);
  55629   terminateO(self);
  55630 
  55631 }
  55632 
  55633 
  55634 void icExtractCharSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  55635 
  55636   smallJsont* r;
  55637   smallJsont *self   = allocG(rtSmallJsont);
  55638   smallJsont* delim2 = allocSmallJson();
  55639 
  55640   setTopSO(self, "one/twos");
  55641   setTopSO(delim2, "S");
  55642   r = icExtractCharSmallJsonSmallJsonG(self, 'E', delim2);
  55643   ck_assert_ptr_ne(r, null);
  55644   char *s = toStringO(r);
  55645   ck_assert_str_eq(s, "[\"/two\"]");
  55646   free(s);
  55647   terminateO(r);
  55648   terminateO(delim2);
  55649   terminateO(self);
  55650 
  55651 }
  55652 
  55653 
  55654 void icExtractCharSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  55655 
  55656   smallJsont* r;
  55657   smallJsont *self     = allocG(rtSmallJsont);
  55658   smallStringt* delim2 = allocSmallString("|");
  55659 
  55660   setTopSO(self, "one/twos");
  55661   setValO(delim2, "S");
  55662   r = icExtractCharSmallStringSmallJsonG(self, 'E', delim2);
  55663   ck_assert_ptr_ne(r, null);
  55664   char *s = toStringO(r);
  55665   ck_assert_str_eq(s, "[\"/two\"]");
  55666   free(s);
  55667   terminateO(r);
  55668   terminateO(delim2);
  55669   terminateO(self);
  55670 
  55671 }
  55672 
  55673 
  55674 void zipSmallJsonGT(CuTest *tc UNUSED) {
  55675 
  55676   smallJsont* r;
  55677   smallJsont *self = allocSmallJson();
  55678   smallArrayt *array1 = allocSmallArray();
  55679   smallArrayt *array2 = allocSmallArray();
  55680 
  55681   // zip arrays
  55682   // add an element to self
  55683   // array1 has 2 elements
  55684   // array2 has 3 elements
  55685   // only 2 elements are zipped
  55686   self->f->pushS(self, "qwe");
  55687   array1->f->pushS(array1, "a");
  55688   array1->f->pushS(array1, "b");
  55689   array2->f->pushInt(array2, 1);
  55690   array2->f->pushInt(array2, 2);
  55691   array2->f->pushInt(array2, 3);
  55692   r = zipSmallJsonG(self, array1, array2);
  55693   ck_assert_ptr_ne(r, NULL);
  55694   char *s = toStringO(r);
  55695   ck_assert_str_eq(s, "[\"qwe\",[\"a\",1],[\"b\",2]]");
  55696   free(s);
  55697   //    delete the element not in self
  55698   delElemO(array2, 2);
  55699   terminateO(self);
  55700   smashO(array1);
  55701   smashO(array2);
  55702 
  55703 }
  55704 
  55705 
  55706 void zipArraySmallJsonGT(CuTest *tc UNUSED) {
  55707 
  55708   smallJsont* r;
  55709   smallJsont *self = allocSmallJson();
  55710   char** array1;
  55711   smallArrayt *array2 = allocSmallArray();
  55712 
  55713   self->f->pushS(self, "qwe");
  55714   array1  = listCreateS("a", "b");
  55715   array2->f->pushS(array2, "1");
  55716   array2->f->pushS(array2, "2");
  55717   r = zipArraySmallJsonG(self, array1, array2);
  55718   ck_assert_ptr_ne(r, NULL);
  55719   char *s = toStringO(r);
  55720   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55721   free(s);
  55722   terminateO(self);
  55723   free(array1);
  55724   smashO(array2);
  55725 
  55726 }
  55727 
  55728 
  55729 void zipCArraySmallJsonGT(CuTest *tc UNUSED) {
  55730 
  55731   smallJsont* r;
  55732   smallJsont *self    = allocSmallJson();
  55733   const char* array1[] = {"a", "b", null};
  55734   smallArrayt *array2  = allocSmallArray();
  55735 
  55736   self->f->pushS(self, "qwe");
  55737   array2->f->pushS(array2, "1");
  55738   array2->f->pushS(array2, "2");
  55739   r = zipCArraySmallJsonG(self, array1, array2);
  55740   ck_assert_ptr_ne(r, NULL);
  55741   char *s = toStringO(r);
  55742   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55743   free(s);
  55744   terminateO(self);
  55745   smashO(array2);
  55746 
  55747 }
  55748 
  55749 
  55750 void zipCharSmallJsonGT(CuTest *tc UNUSED) {
  55751 
  55752   smallJsont* r;
  55753   smallJsont *self   = allocSmallJson();
  55754   smallArrayt *array1 = allocSmallArray();
  55755   char** array2;
  55756 
  55757   self->f->pushS(self, "qwe");
  55758   array1->f->pushS(array1, "a");
  55759   array1->f->pushS(array1, "b");
  55760   array2  = listCreateS("1", "2");
  55761   r = zipCharSmallJsonG(self, array1, array2);
  55762   ck_assert_ptr_ne(r, NULL);
  55763   char *s = toStringO(r);
  55764   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55765   free(s);
  55766   terminateO(self);
  55767   smashO(array1);
  55768   free(array2);
  55769 
  55770 }
  55771 
  55772 
  55773 void zipCCharSmallJsonGT(CuTest *tc UNUSED) {
  55774 
  55775   smallJsont* r;
  55776   smallJsont *self    = allocSmallJson();
  55777   smallArrayt *array1  = allocSmallArray();
  55778   const char* array2[] = {"1", "2", "3", null};
  55779 
  55780   self->f->pushS(self, "qwe");
  55781   array1->f->pushS(array1, "a");
  55782   array1->f->pushS(array1, "b");
  55783   r = zipCCharSmallJsonG(self, array1, array2);
  55784   ck_assert_ptr_ne(r, NULL);
  55785   char *s = toStringO(r);
  55786   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55787   free(s);
  55788   terminateO(self);
  55789   smashO(array1);
  55790 
  55791 }
  55792 
  55793 
  55794 void zipArrayCharSmallJsonGT(CuTest *tc UNUSED) {
  55795 
  55796   smallJsont* r;
  55797   smallJsont *self = allocSmallJson();
  55798   char** array1;
  55799   char** array2;
  55800 
  55801   self->f->pushS(self, "qwe");
  55802   array1  = listCreateS("a", "b");
  55803   array2  = listCreateS("1", "2");
  55804   r = zipArrayCharSmallJsonG(self, array1, array2);
  55805   ck_assert_ptr_ne(r, NULL);
  55806   char *s = toStringO(r);
  55807   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55808   free(s);
  55809   terminateO(self);
  55810   free(array1);
  55811   free(array2);
  55812 
  55813 }
  55814 
  55815 
  55816 void zipArrayCCharSmallJsonGT(CuTest *tc UNUSED) {
  55817 
  55818   smallJsont* r;
  55819   smallJsont *self    = allocSmallJson();
  55820   char** array1;
  55821   const char* array2[] = {"1", "2", "3", null};
  55822 
  55823   self->f->pushS(self, "qwe");
  55824   array1  = listCreateS("a", "b");
  55825   r = zipArrayCCharSmallJsonG(self, array1, array2);
  55826   ck_assert_ptr_ne(r, NULL);
  55827   char *s = toStringO(r);
  55828   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55829   free(s);
  55830   terminateO(self);
  55831   free(array1);
  55832 
  55833 }
  55834 
  55835 
  55836 void zipCArrayCharSmallJsonGT(CuTest *tc UNUSED) {
  55837 
  55838   smallJsont* r;
  55839   smallJsont *self    = allocSmallJson();
  55840   const char* array1[] = {"a", "b", null};
  55841   char** array2;
  55842 
  55843   self->f->pushS(self, "qwe");
  55844   array2  = listCreateS("1", "2");
  55845   r = zipCArrayCharSmallJsonG(self, array1, array2);
  55846   ck_assert_ptr_ne(r, NULL);
  55847   char *s = toStringO(r);
  55848   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55849   free(s);
  55850   terminateO(self);
  55851   free(array2);
  55852 
  55853 }
  55854 
  55855 
  55856 void zipCArrayCCharSmallJsonGT(CuTest *tc UNUSED) {
  55857 
  55858   smallJsont* r;
  55859   smallJsont *self    = allocSmallJson();
  55860   const char* array1[] = {"a", "b", null};
  55861   const char* array2[] = {"1", "2", "3", null};
  55862 
  55863   self->f->pushS(self, "qwe");
  55864   r = zipCArrayCCharSmallJsonG(self, array1, array2);
  55865   ck_assert_ptr_ne(r, NULL);
  55866   char *s = toStringO(r);
  55867   ck_assert_str_eq(s, "[\"qwe\",[\"a\",\"1\"],[\"b\",\"2\"]]");
  55868   free(s);
  55869   terminateO(self);
  55870 
  55871 }
  55872 
  55873 
  55874 void zipJsonSmallJsonGT(CuTest *tc UNUSED) {
  55875 
  55876   smallJsont* r;
  55877   smallJsont *self   = allocSmallJson();
  55878   smallJsont *keys   = allocSmallJson();
  55879   smallJsont *values = allocSmallJson();
  55880 
  55881   self->f->setInt(self, "", 1);
  55882   // 3 elements in keys
  55883   // 2 elements in values
  55884   // only 2 key/values are zipped
  55885   keys->f->pushS(keys, "a");
  55886   keys->f->pushS(keys, "b");
  55887   keys->f->pushS(keys, "c");
  55888   values->f->pushInt(values, 1);
  55889   values->f->pushInt(values, 2);
  55890   r = zipJsonSmallJsonG(self, keys, values);
  55891   terminateO(keys);
  55892   smashO(values);
  55893   ck_assert_ptr_ne(r, NULL);
  55894   char *s = toStringO(r);
  55895   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  55896   free(s);
  55897   terminateO(self);
  55898 
  55899 }
  55900 
  55901 
  55902 void zipJsonSmallArraySmallJsonGT(CuTest *tc UNUSED) {
  55903 
  55904   smallJsont* r;
  55905   smallJsont *self    = allocSmallJson();
  55906   smallJsont *keys    = allocSmallJson();
  55907   smallArrayt *values = allocSmallArray();
  55908 
  55909   self->f->setInt(self, "", 1);
  55910   // 3 elements in keys
  55911   // 2 elements in values
  55912   // only 2 key/values are zipped
  55913   keys->f->pushS(keys, "a");
  55914   keys->f->pushS(keys, "b");
  55915   keys->f->pushS(keys, "c");
  55916   values->f->pushInt(values, 1);
  55917   values->f->pushInt(values, 2);
  55918   r = zipJsonSmallArraySmallJsonG(self, keys, values);
  55919   terminateO(keys);
  55920   smashO(values);
  55921   ck_assert_ptr_ne(r, NULL);
  55922   char *s = toStringO(r);
  55923   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  55924   free(s);
  55925   terminateO(self);
  55926 
  55927 }
  55928 
  55929 
  55930 void zipJsonArraySmallJsonGT(CuTest *tc UNUSED) {
  55931 
  55932   smallJsont* r;
  55933   smallJsont *self = allocSmallJson();
  55934   smallJsont *keys = allocSmallJson();
  55935   char **values;
  55936 
  55937   self->f->setInt(self, "", 1);
  55938   // 3 elements in keys
  55939   // 2 elements in values
  55940   // only 2 key/values are zipped
  55941   keys->f->pushS(keys, "a");
  55942   keys->f->pushS(keys, "b");
  55943   keys->f->pushS(keys, "c");
  55944   values = listCreateS("1", "2");
  55945   r = zipJsonArraySmallJsonG(self, keys, values);
  55946   terminateO(keys);
  55947   listFreeS(values);
  55948   ck_assert_ptr_ne(r, NULL);
  55949   char *s = toStringO(r);
  55950   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  55951   free(s);
  55952   terminateO(self);
  55953 
  55954 }
  55955 
  55956 
  55957 void zipJsonCArraySmallJsonGT(CuTest *tc UNUSED) {
  55958 
  55959   smallJsont* r;
  55960   smallJsont *self     = allocG(rtSmallJsont);
  55961   smallJsont *keys     = allocSmallJson();
  55962   const char* values[] = {"1", "2", null};
  55963 
  55964   self->f->setInt(self, "", 1);
  55965   // 3 elements in keys
  55966   // 2 elements in values
  55967   // only 2 key/values are zipped
  55968   keys->f->pushS(keys, "a");
  55969   keys->f->pushS(keys, "b");
  55970   keys->f->pushS(keys, "c");
  55971   r = zipJsonCArraySmallJsonG(self, keys, values);
  55972   terminateO(keys);
  55973   ck_assert_ptr_ne(r, NULL);
  55974   char *s = toStringO(r);
  55975   ck_assert_str_eq(s, "{\"\":1,\"a\":\"1\",\"b\":\"2\"}");
  55976   free(s);
  55977   terminateO(self);
  55978 
  55979 }
  55980 
  55981 
  55982 void zipSmallArrayJsonSmallJsonGT(CuTest *tc UNUSED) {
  55983 
  55984   smallJsont* r;
  55985   smallJsont *self   = allocSmallJson();
  55986   smallArrayt *keys  = allocSmallArray();
  55987   smallJsont *values = allocSmallJson();
  55988 
  55989   self->f->setInt(self, "", 1);
  55990   // 3 elements in keys
  55991   // 2 elements in values
  55992   // only 2 key/values are zipped
  55993   keys->f->pushS(keys, "a");
  55994   keys->f->pushS(keys, "b");
  55995   keys->f->pushS(keys, "c");
  55996   values->f->pushInt(values, 1);
  55997   values->f->pushInt(values, 2);
  55998   r = zipSmallArrayJsonSmallJsonG(self, keys, values);
  55999   terminateO(keys);
  56000   smashO(values);
  56001   ck_assert_ptr_ne(r, NULL);
  56002   char *s = toStringO(r);
  56003   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  56004   free(s);
  56005   terminateO(self);
  56006 
  56007 }
  56008 
  56009 
  56010 void zipArrayJsonSmallJsonGT(CuTest *tc UNUSED) {
  56011 
  56012   smallJsont* r;
  56013   smallJsont *self   = allocSmallJson();
  56014   char** keys;
  56015   smallJsont *values = allocSmallJson();
  56016 
  56017   self->f->setInt(self, "", 1);
  56018   // 3 elements in keys
  56019   // 2 elements in values
  56020   // only 2 key/values are zipped
  56021   keys = listCreateS("a", "b", "c");
  56022   values->f->pushInt(values, 1);
  56023   values->f->pushInt(values, 2);
  56024   r = zipArrayJsonSmallJsonG(self, keys, values);
  56025   listFreeS(keys);
  56026   smashO(values);
  56027   ck_assert_ptr_ne(r, NULL);
  56028   char *s = toStringO(r);
  56029   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  56030   free(s);
  56031   terminateO(self);
  56032 
  56033 }
  56034 
  56035 
  56036 void zipCArrayJsonSmallJsonGT(CuTest *tc UNUSED) {
  56037 
  56038   smallJsont* r;
  56039   smallJsont *self   = allocG(rtSmallJsont);
  56040   const char* keys[] = {"a", "b", "c", null};
  56041   smallJsont *values = allocSmallJson();
  56042 
  56043   self->f->setInt(self, "", 1);
  56044   // 3 elements in keys
  56045   // 2 elements in values
  56046   // only 2 key/values are zipped
  56047   values->f->pushInt(values, 1);
  56048   values->f->pushInt(values, 2);
  56049   r = zipCArrayJsonSmallJsonG(self, keys, values);
  56050   smashO(values);
  56051   ck_assert_ptr_ne(r, NULL);
  56052   char *s = toStringO(r);
  56053   ck_assert_str_eq(s, "{\"\":1,\"a\":1,\"b\":2}");
  56054   free(s);
  56055   terminateO(self);
  56056 
  56057 }
  56058 
  56059 
  56060 void stringifySmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56061 
  56062   smallStringt* r;
  56063   smallJsont *self = allocG(rtSmallJsont);
  56064 
  56065   self->f->setS(self, "\\\\", "\\erw\\\"");
  56066   r = stringifySmallStringSmallJsonG(self, 2);
  56067   ck_assert_ptr_ne(r, null);
  56068   char *s = toStringO(r);
  56069   terminateO(r);
  56070   ck_assert_str_eq(s, "{\n  \"\\\\\": \"\\\\erw\\\\\\\"\"\n}\n");
  56071   free(s);
  56072   terminateO(self);
  56073 
  56074 }
  56075 
  56076 
  56077 void toYMLSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56078 
  56079   smallStringt* r;
  56080   smallJsont *self = allocG(rtSmallJsont);
  56081 
  56082   self->f->pushS(self, "qwe");
  56083   r = toYMLSmallStringSmallJsonG(self, 2);
  56084   ck_assert_ptr_ne(r, null);
  56085   char *s = toStringO(r);
  56086   ck_assert_str_eq(s, "---\n  - qwe\n");
  56087   free(s);
  56088   terminateO(r);
  56089   terminateO(self);
  56090 
  56091 }
  56092 
  56093 
  56094 void parseSmallJsonGT(CuTest *tc UNUSED) {
  56095 
  56096   bool r;
  56097   smallJsont *self = allocG(rtSmallJsont);
  56098 
  56099   r = parseSmallJsonG(self, "true");
  56100   ck_assert(r);
  56101   char *s = toStringO(self);
  56102   ck_assert_str_eq(s, "true");
  56103   free(s);
  56104   terminateO(self);
  56105 
  56106 }
  56107 
  56108 
  56109 void parseSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  56110 
  56111   bool r;
  56112   smallJsont *self  = allocG(rtSmallJsont);
  56113   smallJsont *input = allocSmallJson();
  56114 
  56115   // non json string
  56116   r = parseSmallJsonSmallJsonG(self, input);
  56117   ck_assert(!r);
  56118   // json string
  56119   setTopSO(input, "true");
  56120   r = parseSmallJsonSmallJsonG(self, input);
  56121   ck_assert(r);
  56122   terminateO(input);
  56123   char *s = toStringO(self);
  56124   ck_assert_str_eq(s, "true");
  56125   free(s);
  56126   terminateO(self);
  56127 
  56128 }
  56129 
  56130 
  56131 void parseSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56132 
  56133   bool r;
  56134   smallJsont *self    = allocG(rtSmallJsont);
  56135   smallStringt *input = allocSmallString("true");
  56136 
  56137   // string
  56138   r = parseSmallStringSmallJsonG(self, input);
  56139   ck_assert(r);
  56140   terminateO(input);
  56141   char *s = toStringO(self);
  56142   ck_assert_str_eq(s, "true");
  56143   free(s);
  56144   terminateO(self);
  56145 
  56146 }
  56147 
  56148 
  56149 void parseYMLSmallJsonGT(CuTest *tc UNUSED) {
  56150 
  56151   bool r;
  56152   smallJsont *self = allocG(rtSmallJsont);
  56153 
  56154   //r = parseYMLSmallJsonG(self);
  56155   r = parseYMLSmallJsonG(self, "---\n - qwe");
  56156   ck_assert(r);
  56157   char *s = toStringO(self);
  56158   ck_assert_str_eq(s, "[\"qwe\"]");
  56159   free(s);
  56160   terminateO(self);
  56161 
  56162 }
  56163 
  56164 
  56165 void parseYMLSmallJsonSmallJsonGT(CuTest *tc UNUSED) {
  56166 
  56167   bool r;
  56168   smallJsont *self  = allocG(rtSmallJsont);
  56169   smallJsont *input = allocSmallJson();
  56170 
  56171   // non json string
  56172   r = parseYMLSmallJsonSmallJsonG(self, input);
  56173   ck_assert(!r);
  56174   // json string
  56175   setTopSO(input, "---\n - qwe");
  56176   r = parseYMLSmallJsonSmallJsonG(self, input);
  56177   ck_assert(r);
  56178   terminateO(input);
  56179   char *s = toStringO(self);
  56180   ck_assert_str_eq(s, "[\"qwe\"]");
  56181   free(s);
  56182   terminateO(self);
  56183 
  56184 }
  56185 
  56186 
  56187 void parseYMLSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56188 
  56189   bool r;
  56190   smallJsont *self    = allocG(rtSmallJsont);
  56191   smallStringt *input = allocSmallString("---\n - qwe");
  56192 
  56193   // string
  56194   r = parseYMLSmallStringSmallJsonG(self, input);
  56195   ck_assert(r);
  56196   terminateO(input);
  56197   char *s = toStringO(self);
  56198   ck_assert_str_eq(s, "[\"qwe\"]");
  56199   free(s);
  56200   terminateO(self);
  56201 
  56202 }
  56203 
  56204 
  56205 void logSmallJsonGT(CuTest *tc UNUSED) {
  56206 
  56207   smallJsont *self = allocSmallJson();
  56208 
  56209   self->f->pushS(self, "qwe");
  56210   self->f->pushS(self, "asd");
  56211   delElemIndexO(self, 0);
  56212   logSmallJsonG(self);
  56213   terminateO(self);
  56214 
  56215 }
  56216 
  56217 
  56218 void readFileSmallJsonGT(CuTest *tc UNUSED) {
  56219 
  56220   smallJsont *self = allocG(rtSmallJsont);
  56221 
  56222   self->f->setS(self, "key", "value");
  56223   writeFileO(self, "read.JSON");
  56224   freeO(self);
  56225   ck_assert_ptr_ne(readFileSmallJsonG(self, "read.JSON"), null);
  56226   rmAll("read.JSON");
  56227   char *s = toStringO(self);
  56228   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56229   free(s);
  56230   terminateO(self);
  56231 
  56232 }
  56233 
  56234 
  56235 void readFileSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56236 
  56237   smallJsont *self = allocG(rtSmallJsont);
  56238   smallStringt *filePath = allocSmallString("read.json");
  56239 
  56240   self->f->setS(self, "key", "value");
  56241   writeFileO(self, "read.json");
  56242   freeO(self);
  56243   ck_assert_ptr_ne(readFileSmallStringSmallJsonG(self, filePath), null);
  56244   char *s = toStringO(self);
  56245   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56246   free(s);
  56247   rmAll("read.json");
  56248   terminateO(filePath);
  56249   terminateO(self);
  56250 
  56251 }
  56252 
  56253 
  56254 void readFileJsonSmallJsonGT(CuTest *tc UNUSED) {
  56255 
  56256   smallJsont *self     = allocG(rtSmallJsont);
  56257   smallJsont *filePath = allocSmallJson();
  56258 
  56259   setTopSO(filePath, "read.json");
  56260   self->f->setS(self, "key", "value");
  56261   writeFileO(self, "read.json");
  56262   freeO(self);
  56263   ck_assert_ptr_ne(readFileJsonSmallJsonG(self, filePath), null);
  56264   char *s = toStringO(self);
  56265   ck_assert_str_eq(s, "{\"key\":\"value\"}");
  56266   free(s);
  56267   rmAll("read.json");
  56268   terminateO(filePath);
  56269   terminateO(self);
  56270 
  56271 }
  56272 
  56273 
  56274 void readStreamSmallJsonGT(CuTest *tc UNUSED) {
  56275 
  56276   smallJsont* r;
  56277   smallJsont *self = allocG(rtSmallJsont);
  56278   FILE *fp;
  56279 
  56280   // stream
  56281   fp = fopen("file.json", "r");
  56282   r = readStreamSmallJsonG(self, fp);
  56283   fclose(fp);
  56284   ck_assert_ptr_ne(r, NULL);
  56285   char *s = toStringO(r);
  56286   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  56287   free(s);
  56288   terminateO(self);
  56289 
  56290 }
  56291 
  56292 
  56293 void writeFileSmallJsonGT(CuTest *tc UNUSED) {
  56294 
  56295   int r;
  56296   smallJsont *self = allocG(rtSmallJsont);
  56297 
  56298   self->f->setInt(self, "", 1);
  56299   self->f->setInt(self, "b", 2);
  56300   r = writeFileSmallJsonG(self, "smallDictFile.json");
  56301   ck_assert(r);
  56302   ck_assert(fileExists("smallDictFile.json"));
  56303   char *s = readFileToS("smallDictFile.json");
  56304   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56305   free(s);
  56306   rmAll("smallDictFile.json");
  56307   terminateO(self);
  56308 
  56309 }
  56310 
  56311 
  56312 void writeFileSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56313 
  56314   bool        r;
  56315   smallJsont *self = allocSmallJson();
  56316   smallStringt *filePath = allocSmallString("smallDictFile.json");
  56317 
  56318   self->f->setInt(self, "", 1);
  56319   self->f->setInt(self, "b", 2);
  56320   r = writeFileSmallStringSmallJsonG(self, filePath);
  56321   ck_assert(r);
  56322   ck_assert(fileExists("smallDictFile.json"));
  56323   char *s = readFileToS("smallDictFile.json");
  56324   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56325   free(s);
  56326   rmAll("smallDictFile.json");
  56327   terminateO(filePath);
  56328   terminateO(self);
  56329 
  56330 }
  56331 
  56332 
  56333 void writeFileJsonSmallJsonGT(CuTest *tc UNUSED) {
  56334 
  56335   bool        r;
  56336   smallJsont *self     = allocSmallJson();
  56337   smallJsont *filePath = allocSmallJson();
  56338 
  56339   self->f->setInt(self, "", 1);
  56340   self->f->setInt(self, "b", 2);
  56341   setTopSO(filePath, "smallDictFile.json");
  56342   r = writeFileJsonSmallJsonG(self, filePath);
  56343   ck_assert(r);
  56344   ck_assert(fileExists("smallDictFile.json"));
  56345   char *s = readFileToS("smallDictFile.json");
  56346   ck_assert_str_eq(s, "{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56347   free(s);
  56348   rmAll("smallDictFile.json");
  56349   terminateO(filePath);
  56350   terminateO(self);
  56351 
  56352 }
  56353 
  56354 
  56355 void writeStreamSmallJsonGT(CuTest *tc UNUSED) {
  56356 
  56357   int r;
  56358   smallJsont *self = allocG(rtSmallJsont);
  56359   FILE *fp;
  56360 
  56361   // write textOutTest.null
  56362   fp = fopen("file.json", "r");
  56363   smallJsont *r2 = readStreamO(self, fp);
  56364   fclose(fp);
  56365   ck_assert_ptr_ne(r2, NULL);
  56366   fp = fopen("outTest.json", "w");
  56367   r = writeStreamSmallJsonG(self, fp);
  56368   ck_assert(r);
  56369   fclose(fp);
  56370     // check textOutTest.null
  56371   fp = fopen("outTest.json", "r");
  56372   r2 = readStreamO(self, fp);
  56373   fclose(fp);
  56374   ck_assert_ptr_ne(r2, NULL);
  56375   char *s = toStringO(r2);
  56376   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  56377   free(s);
  56378   rmAll("outTest.json");
  56379   terminateO(self);
  56380 
  56381 }
  56382 
  56383 
  56384 void appendFileSmallJsonGT(CuTest *tc UNUSED) {
  56385 
  56386   bool        r;
  56387   smallJsont *self = allocSmallJson();
  56388 
  56389   self->f->setInt(self, "", 1);
  56390   self->f->setInt(self, "b", 2);
  56391   writeFileS("smallDictFile.json", "-");
  56392   r = appendFileSmallJsonG(self, "smallDictFile.json");
  56393   ck_assert(r);
  56394   ck_assert(fileExists("smallDictFile.json"));
  56395   char *s = readFileToS("smallDictFile.json");
  56396   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56397   free(s);
  56398   rmAll("smallDictFile.json");
  56399   terminateO(self);
  56400 
  56401 }
  56402 
  56403 
  56404 void appendFileSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56405 
  56406   bool        r;
  56407   smallJsont *self       = allocSmallJson();
  56408   smallStringt *filePath = allocSmallString("smallDictFile.json");
  56409 
  56410   self->f->setInt(self, "", 1);
  56411   self->f->setInt(self, "b", 2);
  56412   writeFileS("smallDictFile.json", "-");
  56413   r = appendFileSmallStringSmallJsonG(self, filePath);
  56414   ck_assert(r);
  56415   ck_assert(fileExists("smallDictFile.json"));
  56416   char *s = readFileToS("smallDictFile.json");
  56417   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56418   free(s);
  56419   rmAll("smallDictFile.json");
  56420   terminateO(filePath);
  56421   terminateO(self);
  56422 
  56423 }
  56424 
  56425 
  56426 void appendFileJsonSmallJsonGT(CuTest *tc UNUSED) {
  56427 
  56428   int r;
  56429   smallJsont *self     = allocG(rtSmallJsont);
  56430   smallJsont *filePath = allocSmallJson();
  56431 
  56432   setTopSO(filePath, "smallDictFile.json");
  56433   self->f->setInt(self, "", 1);
  56434   self->f->setInt(self, "b", 2);
  56435   writeFileS("smallDictFile.json", "-");
  56436   r = appendFileJsonSmallJsonG(self, filePath);
  56437   ck_assert(r);
  56438   ck_assert(fileExists("smallDictFile.json"));
  56439   char *s = readFileToS("smallDictFile.json");
  56440   ck_assert_str_eq(s, "-{\n  \"\": 1,\n  \"b\": 2\n}\n");
  56441   free(s);
  56442   rmAll("smallDictFile.json");
  56443   terminateO(filePath);
  56444   terminateO(self);
  56445 
  56446 }
  56447 
  56448 
  56449 void readTextSmallJsonGT(CuTest *tc UNUSED) {
  56450 
  56451   smallJsont* r;
  56452   smallJsont *self = allocSmallJson();
  56453 
  56454   r = readTextSmallJsonG(self, "../textTest.null");
  56455   ck_assert_ptr_ne(r, NULL);
  56456   char *s = toStringO(r);
  56457   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56458   free(s);
  56459   terminateO(self);
  56460 
  56461 }
  56462 
  56463 
  56464 void readTextSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56465 
  56466   smallJsont* r;
  56467   smallJsont *self       = allocSmallJson();
  56468   smallStringt *filePath = allocSmallString("");
  56469 
  56470   // text
  56471   setValO(filePath, "../textTest.null");
  56472   r = readTextSmallStringSmallJsonG(self, filePath);
  56473   ck_assert_ptr_ne(r, NULL);
  56474   char *s = toStringO(r);
  56475   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56476   free(s);
  56477   terminateO(self);
  56478   terminateO(filePath);
  56479 
  56480 }
  56481 
  56482 
  56483 void readTextJsonSmallJsonGT(CuTest *tc UNUSED) {
  56484 
  56485   smallJsont* r;
  56486   smallJsont *self     = allocG(rtSmallJsont);
  56487   smallJsont *filePath = allocSmallJson();
  56488 
  56489   // text
  56490   setTopSO(filePath, "../textTest.null");
  56491   r = readTextJsonSmallJsonG(self, filePath);
  56492   ck_assert_ptr_ne(r, NULL);
  56493   char *s = toStringO(r);
  56494   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56495   free(s);
  56496   terminateO(filePath);
  56497   terminateO(self);
  56498 
  56499 }
  56500 
  56501 
  56502 void readTextStreamSmallJsonGT(CuTest *tc UNUSED) {
  56503 
  56504   smallJsont* r;
  56505   smallJsont *self = allocG(rtSmallJsont);
  56506   FILE *fp;
  56507 
  56508   fp = fopen("../textTest.null", "r");
  56509   r = readTextStreamSmallJsonG(self, fp);
  56510   fclose(fp);
  56511   ck_assert_ptr_ne(r, NULL);
  56512   char *s = toStringO(r);
  56513   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56514   free(s);
  56515   terminateO(self);
  56516 
  56517 }
  56518 
  56519 
  56520 void writeTextSmallJsonGT(CuTest *tc UNUSED) {
  56521 
  56522   bool r;
  56523   smallJsont *self = allocSmallJson();
  56524 
  56525   smallJsont *r2 = readTextO(self, "../textTest.null");
  56526   ck_assert_ptr_ne(r2, NULL);
  56527   r = writeTextSmallJsonG(self, "../textOutTest.null");
  56528   ck_assert(r);
  56529     // check textOutTest.null
  56530   emptyO(self);
  56531   r2 = readTextO(self, "../textOutTest.null");
  56532   ck_assert_ptr_ne(r2, NULL);
  56533   char *s = toStringO(r2);
  56534   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56535   free(s);
  56536   rmAll("../textOutTest.null");
  56537   terminateO(self);
  56538 
  56539 }
  56540 
  56541 
  56542 void writeTextSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56543 
  56544   bool r;
  56545   smallJsont *self      = allocSmallJson();
  56546   smallStringt *filePath = allocSmallString("");
  56547 
  56548   // write textOutTest.null
  56549   smallJsont *r2 = readTextO(self, "../textTest.null");
  56550   ck_assert_ptr_ne(r2, NULL);
  56551   setValO(filePath, "../textOutTest.null");
  56552   r = writeTextSmallStringSmallJsonG(self, filePath);
  56553   ck_assert(r);
  56554     // check textOutTest.null
  56555   emptyO(self);
  56556   r2 = readTextO(self, "../textOutTest.null");
  56557   ck_assert_ptr_ne(r2, NULL);
  56558   char *s = toStringO(r2);
  56559   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56560   free(s);
  56561   rmAll("../textOutTest.null");
  56562   terminateO(self);
  56563   terminateO(filePath);
  56564 
  56565 }
  56566 
  56567 
  56568 void writeTextJsonSmallJsonGT(CuTest *tc UNUSED) {
  56569 
  56570   bool r;
  56571   smallJsont *self     = allocG(rtSmallJsont);
  56572   smallJsont *filePath = allocSmallJson();
  56573 
  56574   // write textOutTest.null
  56575   smallJsont *r2 = readTextO(self, "../textTest.null");
  56576   ck_assert_ptr_ne(r2, NULL);
  56577   freeO(filePath);
  56578   setTopSO(filePath, "../textOutTest.null");
  56579   r = writeTextJsonSmallJsonG(self, filePath);
  56580   ck_assert(r);
  56581     // check textOutTest.null
  56582   emptyO(self);
  56583   r2 = readTextO(self, "../textOutTest.null");
  56584   ck_assert_ptr_ne(r2, NULL);
  56585   char *s = toStringO(r2);
  56586   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\"]");
  56587   free(s);
  56588   rmAll("../textOutTest.null");
  56589   terminateO(filePath);
  56590   terminateO(self);
  56591 
  56592 }
  56593 
  56594 
  56595 void writeTextStreamSmallJsonGT(CuTest *tc UNUSED) {
  56596 
  56597   bool r;
  56598   smallJsont *self = allocG(rtSmallJsont);
  56599   FILE *fp;
  56600 
  56601   // non json array
  56602   fp = fopen("../textTest.null", "r");
  56603   r = writeTextStreamSmallJsonG(self, fp);
  56604   ck_assert(!r);
  56605   // write textOutTest.null
  56606   smallJsont *r2 = self->f->readTextStream(self, fp);
  56607   fclose(fp);
  56608   ck_assert_ptr_ne(r2, NULL);
  56609   fp = fopen("../textOutTest.null", "w");
  56610   r = writeTextStreamSmallJsonG(self, fp);
  56611   fclose(fp);
  56612   ck_assert(r);
  56613   rmAll("../textOutTest.null");
  56614   terminateO(self);
  56615 
  56616 }
  56617 
  56618 
  56619 void appendTextSmallStringSmallJsonGT(CuTest *tc UNUSED) {
  56620 
  56621   bool r;
  56622   smallJsont *self       = allocSmallJson();
  56623   smallStringt *filePath = allocSmallString("");
  56624 
  56625   // append to textOutTest.null
  56626   smallJsont *r2 = readTextO(self, "../textTest.null");
  56627   ck_assert_ptr_ne(r2, NULL);
  56628   r = writeTextO(self, "../textOutTest.null");
  56629   ck_assert(r);
  56630   emptyO(self);
  56631   self->f->pushS(self, "A");
  56632   self->f->pushS(self, "B");
  56633   setValO(filePath, "../textOutTest.null");
  56634   r = appendTextSmallStringSmallJsonG(self, filePath);
  56635     // check textOutTest.null
  56636   emptyO(self);
  56637   r2 = readTextO(self, "../textOutTest.null");
  56638   char *s = toStringO(r2);
  56639   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  56640   free(s);
  56641   terminateO(self);
  56642   terminateO(filePath);
  56643 
  56644 }
  56645 
  56646 
  56647 void appendTextJsonSmallJsonGT(CuTest *tc UNUSED) {
  56648 
  56649   bool r;
  56650   smallJsont *self     = allocG(rtSmallJsont);
  56651   smallJsont *filePath = allocSmallJson();
  56652 
  56653   // append to textOutTest.null
  56654   smallJsont *r2 = readTextO(self, "../textTest.null");
  56655   ck_assert_ptr_ne(r2, NULL);
  56656   r = writeTextO(self, "../textOutTest.null");
  56657   ck_assert(r);
  56658   emptyO(self);
  56659   self->f->pushS(self, "A");
  56660   self->f->pushS(self, "B");
  56661   freeO(filePath);
  56662   setTopSO(filePath, "../textOutTest.null");
  56663   r = appendTextJsonSmallJsonG(self, filePath);
  56664     // check textOutTest.null
  56665   emptyO(self);
  56666   r2 = readTextO(self, "../textOutTest.null");
  56667   ck_assert_ptr_ne(r2, NULL);
  56668   char *s = toStringO(r2);
  56669   ck_assert_str_eq(s, "[\"LINE 1\",\"ANOTHER line\",\"A\",\"B\"]");
  56670   free(s);
  56671   rmAll("../textOutTest.null");
  56672   terminateO(filePath);
  56673   terminateO(self);
  56674 
  56675 }
  56676 
  56677 
  56678 void cSmallJsonT(CuTest *tc UNUSED) {
  56679 
  56680   // local object
  56681   createSmallJson(obj);
  56682   ck_assert_str_eq(obj.type, "smallJson");
  56683   // object
  56684   createAllocateSmallJson(obj2);
  56685   ck_assert_str_eq(obj2->type, "smallJson");
  56686   // toString
  56687   char *s = obj2->f->toString(obj2);
  56688   ck_assert_str_eq(s, "{}");
  56689   free(s);
  56690   createAllocateSmallInt(oInt);
  56691   oInt->f->set(oInt, 123);
  56692   obj2->f->set(obj2, "int", (baset *) oInt);
  56693   finishO(oInt);
  56694   initiateAllocateSmallInt(&oInt);
  56695   oInt->f->set(oInt, 123);
  56696   obj2->f->set(obj2, "int2", (baset *) oInt);
  56697   finishO(oInt);
  56698     // no effect - no push to dictionary
  56699   initiateAllocateSmallInt(&oInt);
  56700   obj2->f->push(obj2, (baset *) oInt);
  56701   finishO(oInt);
  56702   s = obj2->f->toString(obj2);
  56703   ck_assert_str_eq(s, "{\"int\":123,\"int2\":123}");
  56704   free(s);
  56705   terminateO(obj2);
  56706   initiateAllocateSmallJson(&obj2);
  56707   smallJsont *r = obj2->f->push(obj2, null);
  56708   ck_assert_ptr_eq(r, null);
  56709   createAllocateSmallInt(oInt2);
  56710   oInt2->f->set(oInt2, 123);
  56711   obj2->f->push(obj2, (baset *) oInt2);
  56712   finishO(oInt2);
  56713   initiateAllocateSmallInt(&oInt2);
  56714   oInt2->f->set(oInt2, 123);
  56715   obj2->f->push(obj2, (baset *) oInt2);
  56716   finishO(oInt2);
  56717     // no effect - no set with key to array
  56718   initiateAllocateSmallInt(&oInt2);
  56719   obj2->f->set(obj2, "noEffect", (baset *) oInt2);
  56720   finishO(oInt2);
  56721   s = obj2->f->toString(obj2);
  56722   ck_assert_str_eq(s, "[123,123]");
  56723   free(s);
  56724   // duplicate
  56725   smallJsont *o;
  56726   o = obj2->f->duplicate(obj2);
  56727   s = toStringO(o);
  56728   ck_assert_str_eq(s, "[123,123]");
  56729   free(s);
  56730   terminateO(o);
  56731   terminateO(obj2);
  56732   initiateAllocateSmallJson(&obj2);
  56733   createAllocateSmallInt(oInt3);
  56734   oInt3->f->set(oInt3, 123);
  56735   obj2->f->set(obj2, "int", (baset *) oInt3);
  56736   finishO(oInt3);
  56737   o = obj2->f->duplicate(obj2);
  56738   s = toStringO(o);
  56739   ck_assert_str_eq(s, "{\"int\":123}");
  56740   free(s);
  56741   terminateO(o);
  56742   // dispose
  56743     // array
  56744   initiateAllocateSmallJson(&o);
  56745   initiateAllocateSmallInt(&oInt);
  56746   oInt->f->set(oInt, 123);
  56747   o->f->push(o, (baset*)oInt);
  56748   finishO(oInt);
  56749   ck_assert_uint_eq(o->topA->count, 1);
  56750   smallt *i = sArrayGetTiny(o->topA, 0);
  56751   o->f->dispose(o);
  56752   ck_assert_ptr_eq(o->topA, NULL);
  56753   sFree(i);
  56754   terminateO(o);
  56755     // dictionary
  56756   initiateAllocateSmallJson(&o);
  56757   initiateAllocateSmallInt(&oInt);
  56758   oInt->f->set(oInt, 123);
  56759   o->f->set(o, "in", (baset*)oInt);
  56760   finishO(oInt);
  56761   ck_assert_uint_eq(o->top->count, 1);
  56762   smallt *data = o->top->elements.data;
  56763   sFree(data);
  56764   o->f->dispose(o);
  56765   ck_assert_ptr_eq(o->top, NULL);
  56766   terminateO(o);
  56767   // smash
  56768   initiateAllocateSmallJson(&o);
  56769     // array
  56770   initiateAllocateSmallInt(&oInt);
  56771   oInt->f->set(oInt, 123);
  56772   o->f->push(o, (baset*)oInt);
  56773   finishO(oInt);
  56774   ck_assert_uint_eq(o->topA->count, 1);
  56775   i = sArrayGetTiny(o->topA, 0);
  56776   o->f->smash(&o);
  56777   ck_assert_ptr_eq(o, NULL);
  56778   sFree(i);
  56779     // dict
  56780   initiateAllocateSmallJson(&o);
  56781   initiateAllocateSmallInt(&oInt);
  56782   oInt->f->set(oInt, 123);
  56783   o->f->set(o, "in", (baset*)oInt);
  56784   finishO(oInt);
  56785   ck_assert_uint_eq(o->top->count, 1);
  56786   data = o->top->elements.data;
  56787   sFree(data);
  56788   o->f->smash(&o);
  56789   ck_assert_ptr_eq(o, NULL);
  56790   // setType*
  56791   initiateAllocateSmallJson(&o);
  56792   o->f->setTypeUndefined(o);
  56793   ck_assert_str_eq(o->f->getTopType(o), "undefined");
  56794   o->f->setTypeBool(o);
  56795   ck_assert_str_eq(o->f->getTopType(o), "bool");
  56796   o->f->setTypeDouble(o);
  56797   ck_assert_str_eq(o->f->getTopType(o), "double");
  56798   o->f->setTypeInt(o);
  56799   ck_assert_str_eq(o->f->getTopType(o), "int");
  56800   o->f->setTypeString(o);
  56801   ck_assert_str_eq(o->f->getTopType(o), "string");
  56802   o->f->setTypeDict(o);
  56803   ck_assert_str_eq(o->f->getTopType(o), "dict");
  56804   o->f->setTypeArray(o);
  56805   ck_assert_str_eq(o->f->getTopType(o), "array");
  56806   terminateO(o);
  56807   // getTopTypeJson setTopJson getTopJson - undefined bool double int string
  56808   baset *b;
  56809   smallJsont *o2;
  56810   initiateAllocateSmallJson(&o);
  56811   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56812     // non json object
  56813   createAllocateSmallContainer(jcontainer);
  56814       // setTop
  56815         // null value
  56816   ck_assert_ptr_eq(o->f->setTop(o, null), null);
  56817   o->f->setTop(o, (baset *)jcontainer);
  56818   terminateO(jcontainer);
  56819   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56820       // getTop
  56821   b = o->f->getTop(o);
  56822   ck_assert_ptr_eq(b, NULL);
  56823     // undefined
  56824   createAllocateUndefined(jUndef);
  56825       // setTop
  56826   o->f->setTop(o, (baset *)jUndef);
  56827   finishO(jUndef);
  56828       // getTopType
  56829   ck_assert_str_eq(o->f->getTopType(o), "undefined");
  56830       // getTop
  56831   b = o->f->getTop(o);
  56832   ck_assert_str_eq(b->type, "undefined");
  56833   finishO(b);
  56834       // duplicateO
  56835   o2 = duplicateO(o);
  56836       // toStringO
  56837   s  = toStringO(o2);
  56838   ck_assert_str_eq(s, "null");
  56839   free(s);
  56840       // stringify
  56841   s = o->f->stringify(o,2);
  56842   ck_assert_str_eq(s, "null");
  56843   free(s);
  56844       // toYML
  56845   s = o->f->toYML(o,2);
  56846   ck_assert_str_eq(s, "---\n  null");
  56847   free(s);
  56848       // smash
  56849   o2->f->smash(&o2);
  56850       // freeO
  56851   freeO(o);
  56852   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56853   terminateO(o);
  56854     // cBool
  56855   initiateAllocateSmallJson(&o);
  56856   createAllocateSmallBool(jBool);
  56857       // setTop
  56858   o->f->setTop(o, (baset *)jBool);
  56859   finishO(jBool);
  56860       // getTopType
  56861   ck_assert_str_eq(o->f->getTopType(o), "bool");
  56862       // getTop
  56863   b = o->f->getTop(o);
  56864   ck_assert_str_eq(b->type, "smallBool");
  56865   finishO(b);
  56866       // duplicateO
  56867   o2 = duplicateO(o);
  56868       // toStringO
  56869   s  = toStringO(o2);
  56870   ck_assert_str_eq(s, "false");
  56871   free(s);
  56872       // stringify
  56873   s = o->f->stringify(o,2);
  56874   ck_assert_str_eq(s, "false");
  56875   free(s);
  56876       // toYML
  56877   s = o->f->toYML(o,2);
  56878   ck_assert_str_eq(s, "---\n  false");
  56879   free(s);
  56880       // smash
  56881   o2->f->smash(&o2);
  56882       // freeO
  56883   freeO(o);
  56884   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56885   terminateO(o);
  56886     // cDouble
  56887   initiateAllocateSmallJson(&o);
  56888   createAllocateSmallDouble(jDouble);
  56889       // setTop
  56890   o->f->setTop(o, (baset *)jDouble);
  56891   finishO(jDouble);
  56892       // getTopType
  56893   ck_assert_str_eq(o->f->getTopType(o), "double");
  56894       // getTop
  56895   b = o->f->getTop(o);
  56896   ck_assert_str_eq(b->type, "smallDouble");
  56897   finishO(b);
  56898       // duplicateO
  56899   o2 = duplicateO(o);
  56900       // toStringO
  56901   s  = toStringO(o2);
  56902   ck_assert_str_eq(s, "0.000000e+00");
  56903   free(s);
  56904       // stringify
  56905   s = o->f->stringify(o,2);
  56906   ck_assert_str_eq(s, "0.000000e+00");
  56907   free(s);
  56908       // toYML
  56909   s = o->f->toYML(o,2);
  56910   ck_assert_str_eq(s, "---\n  0.000000e+00");
  56911   free(s);
  56912       // smash
  56913   o2->f->smash(&o2);
  56914       // freeO
  56915   freeO(o);
  56916   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56917   terminateO(o);
  56918     // cInt
  56919   initiateAllocateSmallJson(&o);
  56920   createAllocateSmallInt(jInt);
  56921       // setTop
  56922   o->f->setTop(o, (baset *)jInt);
  56923   finishO(jInt);
  56924       // getTopType
  56925   ck_assert_str_eq(o->f->getTopType(o), "int");
  56926       // getTop
  56927   b = o->f->getTop(o);
  56928   ck_assert_str_eq(b->type, "smallInt");
  56929   finishO(b);
  56930       // duplicateO
  56931   o2 = duplicateO(o);
  56932       // toStringO
  56933   s  = toStringO(o2);
  56934   ck_assert_str_eq(s, "0");
  56935   free(s);
  56936       // stringify
  56937   s = o->f->stringify(o,2);
  56938   ck_assert_str_eq(s, "0");
  56939   free(s);
  56940       // toYML
  56941   s = o->f->toYML(o,2);
  56942   ck_assert_str_eq(s, "---\n  0");
  56943   free(s);
  56944       // smash
  56945   o2->f->smash(&o2);
  56946       // freeO
  56947   freeO(o);
  56948   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56949   terminateO(o);
  56950     // string
  56951   initiateAllocateSmallJson(&o);
  56952   createAllocateSmallString(jString);
  56953   jString->f->set(jString, "sheepy");
  56954       // setTop
  56955   o->f->setTop(o, (baset *)jString);
  56956   finishO(jString);
  56957       // getTopType
  56958   ck_assert_str_eq(o->f->getTopType(o), "string");
  56959       // getTop
  56960   b = o->f->getTop(o);
  56961   ck_assert_str_eq(b->type, "smallString");
  56962   finishO(b);
  56963       // duplicateO
  56964   o2 = duplicateO(o);
  56965       // toStringO
  56966   s  = toStringO(o2);
  56967   ck_assert_str_eq(s, "sheepy");
  56968   free(s);
  56969       // stringify
  56970   s = o->f->stringify(o,2);
  56971   ck_assert_str_eq(s, "\"sheepy\"");
  56972   free(s);
  56973       // toYML
  56974   s = o->f->toYML(o,2);
  56975   ck_assert_str_eq(s, "---\n  \"sheepy\"");
  56976   free(s);
  56977       // smash
  56978   o2->f->smash(&o2);
  56979       // freeO
  56980   freeO(o);
  56981   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  56982   terminateO(o);
  56983     // dict
  56984   initiateAllocateSmallJson(&o);
  56985   o->f->setS(o, "1", "2");
  56986   createAllocateSmallDict(jdict);
  56987       // setTop
  56988         // start iteration before setTop to check if
  56989         // iterElement is finished
  56990   iterStartO(o);
  56991         // set json type to SMALLJSON_IS_EMPTY because as of today
  56992         // setTop only works when the object is empty
  56993   o->topIsA = 0;
  56994   o->f->setTop(o, (baset *)jdict);
  56995   finishO(jdict);
  56996       // getTopType
  56997   ck_assert_str_eq(o->f->getTopType(o), "dict");
  56998       // getTop
  56999   b = o->f->getTop(o);
  57000   ck_assert_str_eq(b->type, "smallDict");
  57001   finishO(b);
  57002       // duplicateO
  57003   o2 = duplicateO(o);
  57004       // toStringO
  57005   s  = toStringO(o2);
  57006   ck_assert_str_eq(s, "{}");
  57007   free(s);
  57008       // stringify
  57009   s = o->f->stringify(o,2);
  57010   ck_assert_str_eq(s, "{}\n");
  57011   free(s);
  57012       // toYML
  57013   s = o->f->toYML(o,2);
  57014   ck_assert_str_eq(s, "---\n  {}\n");
  57015   free(s);
  57016       // smash
  57017   o2->f->smash(&o2);
  57018       // freeO
  57019   freeO(o);
  57020   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  57021   terminateO(o);
  57022     // array
  57023   initiateAllocateSmallJson(&o);
  57024   createAllocateSmallArray(jArray);
  57025       // setTop
  57026   o->f->setTop(o, (baset *)jArray);
  57027   finishO(jArray);
  57028       // getTopType
  57029   ck_assert_str_eq(o->f->getTopType(o), "array");
  57030       // getTop
  57031   b = o->f->getTop(o);
  57032   ck_assert_str_eq(b->type, "smallArray");
  57033   finishO(b);
  57034       // duplicateO
  57035   o2 = duplicateO(o);
  57036       // toStringO
  57037   s  = toStringO(o2);
  57038   ck_assert_str_eq(s, "[]");
  57039   free(s);
  57040       // stringify
  57041   s = o->f->stringify(o,2);
  57042   ck_assert_str_eq(s, "[]\n");
  57043   free(s);
  57044       // toYML
  57045   s = o->f->toYML(o,2);
  57046   ck_assert_str_eq(s, "---\n  []\n");
  57047   free(s);
  57048       // smash
  57049   o2->f->smash(&o2);
  57050       // freeO
  57051   freeO(o);
  57052   ck_assert_ptr_eq(o->f->getTopType(o), NULL);
  57053   terminateO(o);
  57054   // get
  57055   smallIntt *in = (smallIntt *) obj2->f->get(obj2, "int");
  57056   ck_assert(in->value->value == 123);
  57057   createAllocateSmallDict(oD2);
  57058   smallIntt *in2 = duplicateO(in);
  57059   oD2->f->set(oD2, "int", (baset *)in2);
  57060   finishO(in2);
  57061   in2 = duplicateO(in);
  57062   oD2->f->set(oD2, "int2", (baset *)in2);
  57063   finishO(in2);
  57064   obj2->f->set(obj2, "dict", (baset *)oD2);
  57065   finishO(oD2);
  57066   createAllocateSmallArray(oTA2);
  57067   in2 = duplicateO(in);
  57068   oTA2->f->push(oTA2, (baset *)in2);
  57069   finishO(in2);
  57070   in2 = duplicateO(in);
  57071   oTA2->f->push(oTA2, (baset *)in2);
  57072   finishO(in2);
  57073   smashO(in);
  57074   obj2->f->set(obj2, "array", (baset *)oTA2);
  57075   finishO(oTA2);
  57076     // get dict element
  57077   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"int2\"");
  57078   ck_assert(in->value->value == 123);
  57079   smashO(in);
  57080     // non existing element
  57081   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"void\"");
  57082   ck_assert_ptr_eq(in, NULL);
  57083     // missing " at the end
  57084   in = (smallIntt *) obj2->f->get(obj2, "\"dict\".\"int2");
  57085   ck_assert_ptr_eq(in, NULL);
  57086     // get array element
  57087   in = (smallIntt *) obj2->f->get(obj2, "\"array\"[0]");
  57088   ck_assert(in->value->value == 123);
  57089   smashO(in);
  57090     // missing ] at the end
  57091   in = (smallIntt *) obj2->f->get(obj2, "\"array\"[0");
  57092   ck_assert_ptr_eq(in, NULL);
  57093     // json array
  57094   createAllocateSmallJson(json);
  57095   createAllocateSmallInt(oInt4);
  57096   oInt4->f->set(oInt4, 345);
  57097   json->f->push(json, (baset *) oInt4);
  57098   finishO(oInt4);
  57099   in = (smallIntt *) json->f->get(json, "[0]");
  57100   ck_assert(in->value->value == 345);
  57101   smashO(in);
  57102   // set get json path
  57103   createSmallJson(jpath);
  57104     // dict is top
  57105   jpath.f->parse(&jpath, "{ \"a\": {\"a\": true}, \"b\": 234, \"c\": [\"qwe\",32]}");
  57106       // get non existing element in 'c' array
  57107   b = jpath.f->get(&jpath,"\"c\"[3]");
  57108   ck_assert_ptr_eq(b, NULL);
  57109   finishO(b);
  57110       // dictionary keys should not be unescaped
  57111   createSmallBool(ba);
  57112   jpath.f->set(&jpath, "b\\\\", cBa(&ba));
  57113   jBool = (smallBoolt*)jpath.f->get(&jpath,"b\\\\");
  57114   ck_assert(jBool->value->value == false);
  57115   finishO(jBool);
  57116       // keys in json paths should be unescaped
  57117   createSmallBool(bb);
  57118   bb.f->set(&bb, true);
  57119   jpath.f->set(&jpath, "\"b\\\\\"", (baset*)&bb);
  57120   jBool = (smallBoolt*)jpath.f->get(&jpath,"\"b\\\\\"");
  57121   ck_assert(jBool->value->value == true);
  57122   finishO(jBool);
  57123   freeO(&jpath);
  57124     // array is top
  57125     // get dict in dict
  57126   jpath.f->parse(&jpath, "[1,{\"a\": {\"a\": true}, \"b\": 234, \"c\": [\"qwe\",32]}, [[11],22,33]]");
  57127   b = jpath.f->get(&jpath,"[1].\"a\"");
  57128   ck_assert_str_eq(b->type, "smallDict");
  57129   finishO(b);
  57130     // get bool in dict
  57131   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"a\"");
  57132   ck_assert(jBool->value->value == true);
  57133   finishO(jBool);
  57134     // get array in array
  57135   jArray = (smallArrayt*)jpath.f->get(&jpath,"[2][0]");
  57136   ck_assert_str_eq(jArray->type, "smallArray");
  57137   ck_assert_uint_eq(lenO(jArray), 1);
  57138   finishG(jArray);
  57139     // get element in array
  57140   in = (smallIntt*)(jpath.f->get(&jpath,"[2][0][0]"));
  57141   ck_assert_uint_eq(in->value->value, 11);
  57142   finishG(in);
  57143     // set element in array with negative index
  57144   createSmallBool(be);
  57145   jpath.f->set(&jpath, "[-1][0][0]", (baset*)&be);
  57146     // get element in array with negative index
  57147   jBool = (smallBoolt*)jpath.f->get(&jpath,"[-1][0][0]");
  57148   ck_assert(jBool->value->value == false);
  57149   finishG(jBool);
  57150     // set new element in dict
  57151   createSmallBool(b2);
  57152   o2 = jpath.f->set(&jpath, "[1]\"a\"\"b\\\"\"", (baset*)&b2);
  57153   ck_assert_ptr_ne(o2, NULL);
  57154   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"b\\\"\"");
  57155   ck_assert(jBool->value->value == false);
  57156   finishG(jBool);
  57157   createSmallBool(b3);
  57158   o2 = jpath.f->set(&jpath, "[1]\"a\"\"b\\\\\"", (baset*)&b3);
  57159   ck_assert_ptr_ne(o2, NULL);
  57160   jBool = (smallBoolt*)jpath.f->get(&jpath,"[1]\"a\"\"b\\\\\"");
  57161   ck_assert(jBool->value->value == false);
  57162   finishG(jBool);
  57163     // escape key in json path
  57164     // \\\""
  57165   char *ks = jpath.f->makeKey(&jpath, "\\\\\\\"\"");
  57166   ck_assert_str_eq(ks, "\"\\\\\\\\\\\\\\\"\\\"\"");
  57167   createSmallBool(b4);
  57168   iPrependS(&ks, "[1]");
  57169   o2 = jpath.f->set(&jpath, ks, (baset*)&b4);
  57170   ck_assert_ptr_ne(o2, NULL);
  57171   jBool = (smallBoolt*)jpath.f->get(&jpath,ks);
  57172   ck_assert(jBool->value->value == false);
  57173   finishG(jBool);
  57174   free(ks);
  57175     // wrong path
  57176   b = jpath.f->get(&jpath,"[3][0][0]");
  57177   ck_assert_ptr_eq(b, NULL);
  57178   finishG(b);
  57179     // missing index
  57180   b = jpath.f->get(&jpath,"[][0][0]");
  57181   ck_assert_ptr_eq(b, NULL);
  57182   finishG(b);
  57183     // try to assign dictionary key to array, wrong
  57184   createSmallBool(b0);
  57185   o2 = jpath.f->set(&jpath, "[2][0]\"sdf\\\"", (baset*)&b0);
  57186   ck_assert_ptr_eq(o2, NULL);
  57187   freeO(&jpath);
  57188   // len
  57189   initiateAllocateSmallJson(&o);
  57190   ck_assert_uint_eq(o->f->len(o), 0);
  57191   o->f->setTypeUndefined(o);
  57192   ck_assert_uint_eq(o->f->len(o), 1);
  57193   o->f->setTypeBool(o);
  57194   ck_assert_uint_eq(o->f->len(o), 1);
  57195   o->f->setTypeDouble(o);
  57196   ck_assert_uint_eq(o->f->len(o), 1);
  57197   o->f->setTypeInt(o);
  57198   ck_assert_uint_eq(o->f->len(o), 1);
  57199   o->f->setTypeString(o);
  57200   ck_assert_uint_eq(o->f->len(o), 0);
  57201   o->f->setTypeDict(o);
  57202   ck_assert_uint_eq(o->f->len(o), 0);
  57203   o->f->setTypeArray(o);
  57204   ck_assert_uint_eq(o->f->len(o), 0);
  57205   terminateO(o);
  57206   // empty
  57207   initiateAllocateSmallJson(&o);
  57208     // empty empty
  57209   o->f->empty(o);
  57210   o->f->setTypeString(o);
  57211   sFree((smallt *)o->topS);
  57212   o->topS = allocSStringTiny("er");
  57213   o->f->empty(o);
  57214   ck_assert_uint_eq(o->f->len(o), 0);
  57215   o->f->setTypeDict(o);
  57216   initiateAllocateSmallInt(&in);
  57217   o->f->set(o, "wer", (baset *)in);
  57218   finishO(in);
  57219   o->f->empty(o);
  57220   ck_assert_uint_eq(o->f->len(o), 0);
  57221   o->f->setTypeArray(o);
  57222   initiateAllocateSmallInt(&in);
  57223   o->f->push(o, (baset *)in);
  57224   finishO(in);
  57225   o->f->empty(o);
  57226   ck_assert_uint_eq(o->f->len(o), 0);
  57227   terminateO(o);
  57228   // stringify
  57229     // array
  57230   initiateAllocateSmallString(&jString);
  57231   jString->f->set(jString, "sheepy");
  57232   json->f->push(json, (baset *) jString);
  57233   finishO(jString);
  57234   initiateAllocateSmallDict(&jdict);
  57235   json->f->push(json, (baset *) jdict);
  57236   finishO(jdict);
  57237   initiateAllocateSmallArray(&jArray);
  57238   json->f->push(json, (baset *) jArray);
  57239   finishO(jArray);
  57240   initiateAllocateSmallDict(&jdict);
  57241   initiateAllocateSmallString(&jString);
  57242   jString->f->set(jString, "sheepy");
  57243   jdict->f->set(jdict, "string", (baset *) jString);
  57244   finishO(jString);
  57245   initiateAllocateSmallContainer(&jcontainer);
  57246   jdict->f->set(jdict, "container", (baset *) jcontainer);
  57247   finishO(jcontainer);
  57248   json->f->push(json, (baset *) jdict);
  57249   finishO(jdict);
  57250   initiateAllocateSmallArray(&jArray);
  57251   initiateAllocateSmallString(&jString);
  57252   jString->f->set(jString, "sheepy");
  57253   jArray->f->push(jArray, (baset *) jString);
  57254   finishO(jString);
  57255   initiateAllocateSmallContainer(&jcontainer);
  57256   jArray->f->push(jArray, (baset *) jcontainer);
  57257   finishO(jcontainer);
  57258   json->f->push(json, (baset *) jArray);
  57259   finishO(jArray);
  57260 
  57261   s = json->f->stringify(json, 2);
  57262   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");
  57263   free(s);
  57264     // empty
  57265   createAllocateSmallJson(json2);
  57266   s = json2->f->stringify(json2, 2);
  57267   ck_assert_str_eq(s, "{}");
  57268   free(s);
  57269     // dict
  57270   initiateAllocateSmallString(&jString);
  57271   jString->f->set(jString, "sheepy");
  57272   json2->f->set(json2, "s", (baset *) jString);
  57273   finishO(jString);
  57274   initiateAllocateSmallDict(&jdict);
  57275   json2->f->set(json2, "d",(baset *) jdict);
  57276   finishO(jdict);
  57277   initiateAllocateSmallArray(&jArray);
  57278   json2->f->set(json2, "a", (baset *) jArray);
  57279   finishO(jArray);
  57280   initiateAllocateSmallDict(&jdict);
  57281   initiateAllocateSmallString(&jString);
  57282   jString->f->set(jString, "sheepy");
  57283   jdict->f->set(jdict, "string", (baset *) jString);
  57284   finishO(jString);
  57285   initiateAllocateSmallContainer(&jcontainer);
  57286   jdict->f->set(jdict, "container", (baset *) jcontainer);
  57287   finishO(jcontainer);
  57288   json2->f->set(json2, "d2",(baset *) jdict);
  57289   finishO(jdict);
  57290   initiateAllocateSmallArray(&jArray);
  57291   initiateAllocateSmallString(&jString);
  57292   jString->f->set(jString, "sheepy");
  57293   jArray->f->push(jArray, (baset *) jString);
  57294   finishO(jString);
  57295   initiateAllocateSmallContainer(&jcontainer);
  57296   jArray->f->push(jArray, (baset *) jcontainer);
  57297   finishO(jcontainer);
  57298   json2->f->set(json2, "a2", (baset *) jArray);
  57299   finishO(jArray);
  57300   initiateAllocateSmallInt(&oInt4);
  57301   oInt4->f->set(oInt4, 345);
  57302   json2->f->set(json2, "int", (baset *) oInt4);
  57303   finishO(oInt4);
  57304   s = json2->f->stringify(json2, 2);
  57305   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");
  57306   free(s);
  57307   // toYML
  57308     // array
  57309   s = json->f->toYML(json, 2);
  57310   ck_assert_str_eq(s, "---\n  - 345\n  - sheepy\n  - {}\n  - []\n  - string: sheepy\n    container: \"<data container>\"\n  - - sheepy\n    - \"<data container>\"\n");
  57311   free(s);
  57312     // empty
  57313   createAllocateSmallJson(json3);
  57314   s = json3->f->toYML(json3, 2);
  57315   ck_assert_str_eq(s, "---\n");
  57316   free(s);
  57317   terminateO(json3);
  57318     // dict
  57319   s = json2->f->toYML(json2, 2);
  57320   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");
  57321   free(s);
  57322   terminateO(json2);
  57323   terminateO(json);
  57324   // parse
  57325     // top null - undefined
  57326   initiateAllocateSmallJson(&json);
  57327   json->f->parse(json, "null");
  57328   ck_assert_str_eq(json->f->getTopType(json), "undefined");
  57329   terminateO(json);
  57330     // top bool
  57331   initiateAllocateSmallJson(&json);
  57332   json->f->parse(json, "true");
  57333   ck_assert_str_eq(json->f->getTopType(json), "bool");
  57334   terminateO(json);
  57335     // top double
  57336   initiateAllocateSmallJson(&json);
  57337   json->f->parse(json, "0.01");
  57338   ck_assert_str_eq(json->f->getTopType(json), "double");
  57339   terminateO(json);
  57340     // top int
  57341   initiateAllocateSmallJson(&json);
  57342   json->f->parse(json, "10");
  57343   ck_assert_str_eq(json->f->getTopType(json), "int");
  57344   terminateO(json);
  57345     // top string
  57346   initiateAllocateSmallJson(&json);
  57347   json->f->parse(json, "\"wef\"");
  57348   ck_assert_str_eq(json->f->getTopType(json), "string");
  57349   terminateO(json);
  57350     // from file dictionary
  57351   char **file = readText("file.json");
  57352   char *jsonText = join(file, "\n");
  57353   createAllocateSmallJson(jsOfromF);
  57354   jsOfromF->f->parse(jsOfromF, jsonText);
  57355   s = toStringO(jsOfromF);
  57356   //printf("JSON FILE: %s\n", s);
  57357   ck_assert_str_eq(s, "{\"dasd\":\"asd\",\"asd\":234,\"dict\":{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01},\"bool\":false,\"zzz\":null}");
  57358   free(s);
  57359   free(jsonText);
  57360   listFreeS(file);
  57361   terminateO(jsOfromF);
  57362     // json array top
  57363   file = readText("fileA.json");
  57364   jsonText = join(file, "\n");
  57365   initiateAllocateSmallJson(&jsOfromF);
  57366   jsOfromF->f->parse(jsOfromF, jsonText);
  57367   s = toStringO(jsOfromF);
  57368   ck_assert_str_eq(s, "[\"asd\",234,{\"array\":[1,1],\"asd\":true,\"float\":3.434000e+01}]");
  57369   free(s);
  57370   free(jsonText);
  57371   listFreeS(file);
  57372   terminateO(jsOfromF);
  57373     // wrong json incomplete dict
  57374   initiateAllocateSmallJson(&json);
  57375   json->f->parse(json, "{\"wef\": {");
  57376   s = toStringO(json);
  57377   ck_assert_str_eq(s, "{}");
  57378   free(s);
  57379   terminateO(json);
  57380     // wrong json incomplete array
  57381   initiateAllocateSmallJson(&json);
  57382   json->f->parse(json, "{\"wef\": [");
  57383   s = toStringO(json);
  57384   ck_assert_str_eq(s, "{}");
  57385   free(s);
  57386   terminateO(json);
  57387     // wrong json incomplete string
  57388   initiateAllocateSmallJson(&json);
  57389   json->f->parse(json, "{\"wef\": \"wer");
  57390   s = toStringO(json);
  57391   ck_assert_str_eq(s, "{}");
  57392   free(s);
  57393   terminateO(json);
  57394     // wrong json incomplete top dict
  57395   initiateAllocateSmallJson(&json);
  57396   json->f->parse(json, "{ \"wef");
  57397   s = toStringO(json);
  57398   ck_assert_str_eq(s, "{}");
  57399   free(s);
  57400   terminateO(json);
  57401     // wrong json incomplete top array
  57402   initiateAllocateSmallJson(&json);
  57403   json->f->parse(json, "[\"wef");
  57404   s = toStringO(json);
  57405   ck_assert_str_eq(s, "{}");
  57406   free(s);
  57407   terminateO(json);
  57408     // wrong json incomplete top string
  57409   initiateAllocateSmallJson(&json);
  57410   json->f->parse(json, "\"wef");
  57411   s = toStringO(json);
  57412   ck_assert_str_eq(s, "{}");
  57413   free(s);
  57414   terminateO(json);
  57415   // parseYML
  57416     // yml only top dict or array - NO: top null undefined top bool top double top int top string
  57417     // from file dictionary
  57418   file = readText("file.yml");
  57419   jsonText = join(file, "\n");
  57420   initiateAllocateSmallJson(&jsOfromF);
  57421   jsOfromF->f->parseYML(jsOfromF, jsonText);
  57422   s = toStringO(jsOfromF);
  57423   ck_assert_str_eq(s, "{\"dict\":{\"array\":[1,1],\"float\":3.434000e+01,\"asd\":true},\"dasd\":\"asd\",\"asd\":234,\"bool\":false,\"zzz\":null}");
  57424   free(s);
  57425   free(jsonText);
  57426   listFreeS(file);
  57427   terminateO(jsOfromF);
  57428     // json array top
  57429   file = readText("fileA.yml");
  57430   jsonText = join(file, "\n");
  57431   initiateAllocateSmallJson(&jsOfromF);
  57432   jsOfromF->f->parseYML(jsOfromF, jsonText);
  57433   s = toStringO(jsOfromF);
  57434   //printf("JSON FILE: %s\n", toStringO(jsOfromF));
  57435   ck_assert_str_eq(s, "[{\"dict\":\"hello\",\"array\":[1,1],\"float\":3.434000e+01,\"asd\":true},\"asd\",234]");
  57436   free(s);
  57437   free(jsonText);
  57438   listFreeS(file);
  57439   terminateO(jsOfromF);
  57440   // serial deserial
  57441   smallBytest *B;
  57442   initiateAllocateSmallJson(&o);
  57443   ck_assert_ptr_eq(o->f->serial(o), NULL);
  57444     // non json object
  57445   initiateAllocateSmallContainer(&jcontainer);
  57446   o->f->setTop(o, (baset *)jcontainer);
  57447   ck_assert_ptr_eq(o->f->serial(o), NULL);
  57448   terminateO(jcontainer);
  57449     // undefined
  57450   undefinedt *oU = allocUndefined();
  57451   o->f->setTop(o, (baset *)oU);
  57452   finishO(oU);
  57453   B = o->f->serial(o);
  57454   s = sToString((smallt *) B->B);
  57455   ck_assert_str_eq(s, "[0x01]");
  57456   free(s);
  57457   freeO(o);
  57458   o->f->deserial(o, B);
  57459   s = toStringO(o);
  57460   ck_assert_str_eq(s, "null");
  57461   free(s);
  57462   terminateO(B);
  57463   terminateO(o);
  57464     // Bool
  57465   initiateAllocateSmallJson(&o);
  57466   smallBoolt *oBool = allocSmallBool(true);
  57467   o->f->setTop(o, (baset *)oBool);
  57468   finishO(oBool);
  57469   B = o->f->serial(o);
  57470   s = sToString((smallt *) B->B);
  57471   ck_assert_str_eq(s, "[0x02,0x01]");
  57472   free(s);
  57473   o->f->deserial(o, B);
  57474   s = toStringO(o);
  57475   ck_assert_str_eq(s, "true");
  57476   free(s);
  57477   terminateO(B);
  57478   terminateO(o);
  57479     // Double
  57480   initiateAllocateSmallJson(&o);
  57481   smallDoublet *od = allocSmallDouble(10);
  57482   o->f->setTop(o, (baset *)od);
  57483   finishO(od);
  57484   B = o->f->serial(o);
  57485   s = sToString((smallt *) B->B);
  57486   ck_assert_str_eq(s, "[0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40]");
  57487   free(s);
  57488   o->f->deserial(o, B);
  57489   s = toStringO(o);
  57490   ck_assert_str_eq(s, "1.000000e+01");
  57491   free(s);
  57492   terminateO(B);
  57493   terminateO(o);
  57494     // Int
  57495   initiateAllocateSmallJson(&o);
  57496   oInt = allocSmallInt(85);
  57497   o->f->setTop(o, (baset *)oInt);
  57498   finishO(oInt);
  57499   B = o->f->serial(o);
  57500   s = sToString((smallt *) B->B);
  57501   ck_assert_str_eq(s, "[0x07,0x55,0x00,0x00,0x00,0x00,0x00,0x00,0x00]");
  57502   free(s);
  57503   o->f->deserial(o, B);
  57504   s = toStringO(o);
  57505   ck_assert_str_eq(s, "85");
  57506   free(s);
  57507   terminateO(B);
  57508   terminateO(o);
  57509     // string
  57510   initiateAllocateSmallJson(&o);
  57511   smallStringt *st = allocSmallString("sheepy");
  57512   o->f->setTop(o, (baset *)st);
  57513   finishO(st);
  57514   B = o->f->serial(o);
  57515   s = sToString((smallt *) B->B);
  57516   ck_assert_str_eq(s, "[0x08,0x73,0x68,0x65,0x65,0x70,0x79,0x00]");
  57517   free(s);
  57518   o->f->deserial(o, B);
  57519   s = toStringO(o);
  57520   ck_assert_str_eq(s, "sheepy");
  57521   free(s);
  57522   terminateO(B);
  57523   terminateO(o);
  57524     // dict
  57525   initiateAllocateSmallJson(&o);
  57526   smallDictt *sDD = allocSmallDict();
  57527   o->f->setTop(o, (baset *)sDD);
  57528   finishO(sDD);
  57529   B = o->f->serial(o);
  57530   s = sToString((smallt *) B->B);
  57531   ck_assert_str_eq(s, "[0x04,0x00,0x00,0x00,0x00]");
  57532   free(s);
  57533   o->f->deserial(o, B);
  57534   s = toStringO(o);
  57535   ck_assert_str_eq(s, "{}");
  57536   free(s);
  57537   terminateO(B);
  57538   terminateO(o);
  57539     // array
  57540   initiateAllocateSmallJson(&o);
  57541   smallArrayt *sAA = allocSmallArray();
  57542   o->f->setTop(o, (baset *)sAA);
  57543   finishO(sAA);
  57544   B = o->f->serial(o);
  57545   s = sToString((smallt *) B->B);
  57546   ck_assert_str_eq(s, "[0x0a,0x00,0x00,0x00,0x00]");
  57547   free(s);
  57548   o->f->deserial(o, B);
  57549   s = toStringO(o);
  57550   ck_assert_str_eq(s, "[]");
  57551   free(s);
  57552   terminateO(B);
  57553   terminateO(o);
  57554     // deserial non json object
  57555   initiateAllocateSmallJson(&o);
  57556   initiateAllocateSmallBytes(&B);
  57557   sContainert *c = allocSContainer(NULL);
  57558   B->B = sSerial((smallt *) c);
  57559   sFree((smallt *) c);
  57560   o->f->deserial(o, B);
  57561   ck_assert_uint_eq(o->topIsA, 0/*=JSON_IS_EMPTY*/);
  57562   terminateO(B);
  57563   terminateO(o);
  57564     // deserial empty sBytest
  57565   initiateAllocateSmallJson(&o);
  57566   initiateAllocateSmallBytes(&B);
  57567   o->f->deserial(o, B);
  57568   ck_assert_uint_eq(o->topIsA, 0/*=JSON_IS_EMPTY*/);
  57569   terminateO(B);
  57570   terminateO(o);
  57571     // NULL object
  57572   initiateAllocateSmallJson(&o);
  57573   o->f->setTypeUndefined(o);
  57574   sFree((smallt *) o->topU);
  57575   o->topU = NULL;
  57576   ck_assert_ptr_eq(o->f->serial(o),NULL);
  57577   o->f->deserial(o, NULL);
  57578   terminateO(o);
  57579   // free local object
  57580   obj.f->free(&obj);
  57581   ck_assert_str_eq(obj.type, "smallJson");
  57582   // free object
  57583   obj2->f->terminate(&obj2);
  57584   ck_assert_ptr_eq(obj2, NULL);
  57585   initiateAllocateSmallJson(&o);
  57586   terminateO(o);
  57587   ck_assert_ptr_eq(o, NULL);
  57588     // undefined
  57589   initiateAllocateSmallJson(&o);
  57590   o->f->setTypeUndefined(o);
  57591   terminateO(o);
  57592   ck_assert_ptr_eq(o, NULL);
  57593     // bool
  57594   initiateAllocateSmallJson(&o);
  57595   o->f->setTypeBool(o);
  57596   terminateO(o);
  57597   ck_assert_ptr_eq(o, NULL);
  57598     // double
  57599   initiateAllocateSmallJson(&o);
  57600   o->f->setTypeDouble(o);
  57601   terminateO(o);
  57602   ck_assert_ptr_eq(o, NULL);
  57603     // int
  57604   initiateAllocateSmallJson(&o);
  57605   o->f->setTypeInt(o);
  57606   terminateO(o);
  57607   ck_assert_ptr_eq(o, NULL);
  57608     // string
  57609   initiateAllocateSmallJson(&o);
  57610   o->f->setTypeString(o);
  57611   terminateO(o);
  57612   ck_assert_ptr_eq(o, NULL);
  57613     // dict
  57614   initiateAllocateSmallJson(&o);
  57615   o->f->setTypeDict(o);
  57616   terminateO(o);
  57617   ck_assert_ptr_eq(o, NULL);
  57618     // array
  57619   initiateAllocateSmallJson(&o);
  57620   o->f->setTypeArray(o);
  57621   terminateO(o);
  57622   ck_assert_ptr_eq(o, NULL);
  57623 
  57624 }
  57625 
  57626 
  57627 
  57628 
  57629 int main(int n UNUSED, char**v UNUSED) {
  57630   // disable btrace to make the test run faster
  57631   btraceDisable();
  57632   CuString *output = CuStringNew();
  57633   CuSuite *suite = CuSuiteNew();
  57634 
  57635   SUITE_ADD_TEST(suite, createSJFT);
  57636   SUITE_ADD_TEST(suite, getsoSmallJsonT);
  57637   SUITE_ADD_TEST(suite, setsoSmallJsonT);
  57638   SUITE_ADD_TEST(suite, mirrorSmallJsonT);
  57639   SUITE_ADD_TEST(suite, setTopBoolSmallJsonT);
  57640   SUITE_ADD_TEST(suite, setTopDoubleSmallJsonT);
  57641   SUITE_ADD_TEST(suite, setTopIntSmallJsonT);
  57642   SUITE_ADD_TEST(suite, setTopStringSmallJsonT);
  57643   SUITE_ADD_TEST(suite, setTopCharSmallJsonT);
  57644   SUITE_ADD_TEST(suite, setTopDictSmallJsonT);
  57645   SUITE_ADD_TEST(suite, setTopArraySmallJsonT);
  57646   SUITE_ADD_TEST(suite, setTopArraycSmallJsonT);
  57647   SUITE_ADD_TEST(suite, setTopSmallBoolSmallJsonT);
  57648   SUITE_ADD_TEST(suite, setTopSmallDoubleSmallJsonT);
  57649   SUITE_ADD_TEST(suite, setTopSmallIntSmallJsonT);
  57650   SUITE_ADD_TEST(suite, setTopSmallJsonSmallJsonT);
  57651   SUITE_ADD_TEST(suite, setTopSmallStringSmallJsonT);
  57652   SUITE_ADD_TEST(suite, setTopNFreeSmallJsonT);
  57653   SUITE_ADD_TEST(suite, setTopNFreeBoolSmallJsonT);
  57654   SUITE_ADD_TEST(suite, setTopNFreeDoubleSmallJsonT);
  57655   SUITE_ADD_TEST(suite, setTopNFreeIntSmallJsonT);
  57656   SUITE_ADD_TEST(suite, setTopNFreeStringSmallJsonT);
  57657   SUITE_ADD_TEST(suite, setTopNFreeDictSmallJsonT);
  57658   SUITE_ADD_TEST(suite, setTopNFreeArraySmallJsonT);
  57659   SUITE_ADD_TEST(suite, setTopNFreeArraycSmallJsonT);
  57660   SUITE_ADD_TEST(suite, setTopNFreeSmallBoolSmallJsonT);
  57661   SUITE_ADD_TEST(suite, setTopNFreeSmallDoubleSmallJsonT);
  57662   SUITE_ADD_TEST(suite, setTopNFreeSmallIntSmallJsonT);
  57663   SUITE_ADD_TEST(suite, setTopNFreeSmallJsonSmallJsonT);
  57664   SUITE_ADD_TEST(suite, setTopNFreeSmallStringSmallJsonT);
  57665   SUITE_ADD_TEST(suite, fromArraySmallJsonT);
  57666   SUITE_ADD_TEST(suite, fromArrayNFreeSmallJsonT);
  57667   SUITE_ADD_TEST(suite, fromArrayDictSmallJsonT);
  57668   SUITE_ADD_TEST(suite, toArrayDictSmallJsonT);
  57669   SUITE_ADD_TEST(suite, getTopUndefinedSmallJsonT);
  57670   SUITE_ADD_TEST(suite, getTopBoolSmallJsonT);
  57671   SUITE_ADD_TEST(suite, getTopBoolPSmallJsonT);
  57672   SUITE_ADD_TEST(suite, getTopDoubleSmallJsonT);
  57673   SUITE_ADD_TEST(suite, getTopDoublePSmallJsonT);
  57674   SUITE_ADD_TEST(suite, getTopIntSmallJsonT);
  57675   SUITE_ADD_TEST(suite, getTopIntPSmallJsonT);
  57676   SUITE_ADD_TEST(suite, getTopInt32SmallJsonT);
  57677   SUITE_ADD_TEST(suite, getTopInt32PSmallJsonT);
  57678   SUITE_ADD_TEST(suite, getTopUintSmallJsonT);
  57679   SUITE_ADD_TEST(suite, getTopUintPSmallJsonT);
  57680   SUITE_ADD_TEST(suite, getTopUint32SmallJsonT);
  57681   SUITE_ADD_TEST(suite, getTopUint32PSmallJsonT);
  57682   SUITE_ADD_TEST(suite, getTopSSmallJsonT);
  57683   SUITE_ADD_TEST(suite, getTopDictSmallJsonT);
  57684   SUITE_ADD_TEST(suite, getTopArraySmallJsonT);
  57685   SUITE_ADD_TEST(suite, getTopSmallBoolSmallJsonT);
  57686   SUITE_ADD_TEST(suite, getTopSmallDoubleSmallJsonT);
  57687   SUITE_ADD_TEST(suite, getTopSmallIntSmallJsonT);
  57688   SUITE_ADD_TEST(suite, getTopSmallStringSmallJsonT);
  57689   SUITE_ADD_TEST(suite, keyIsSmallJsonT);
  57690   SUITE_ADD_TEST(suite, keyIsSSmallJsonT);
  57691   SUITE_ADD_TEST(suite, makeKeySmallJsonT);
  57692   SUITE_ADD_TEST(suite, iMakeKeySmallJsonT);
  57693   SUITE_ADD_TEST(suite, bMakeKeySmallJsonT);
  57694   SUITE_ADD_TEST(suite, bLMakeKeySmallJsonT);
  57695   SUITE_ADD_TEST(suite, makeKeyLenSmallJsonT);
  57696   SUITE_ADD_TEST(suite, setSmallJsonT);
  57697   SUITE_ADD_TEST(suite, setUndefinedSmallJsonT);
  57698   SUITE_ADD_TEST(suite, setBoolSmallJsonT);
  57699   SUITE_ADD_TEST(suite, setDoubleSmallJsonT);
  57700   SUITE_ADD_TEST(suite, setIntSmallJsonT);
  57701   SUITE_ADD_TEST(suite, setSSmallJsonT);
  57702   SUITE_ADD_TEST(suite, setCharSmallJsonT);
  57703   SUITE_ADD_TEST(suite, setDictSmallJsonT);
  57704   SUITE_ADD_TEST(suite, setArraySmallJsonT);
  57705   SUITE_ADD_TEST(suite, setArraycSmallJsonT);
  57706   SUITE_ADD_TEST(suite, setSmallBoolSmallJsonT);
  57707   SUITE_ADD_TEST(suite, setSmallBytesSmallJsonT);
  57708   SUITE_ADD_TEST(suite, setSmallDoubleSmallJsonT);
  57709   SUITE_ADD_TEST(suite, setSmallIntSmallJsonT);
  57710   SUITE_ADD_TEST(suite, setSmallJsonSmallJsonT);
  57711   SUITE_ADD_TEST(suite, setSmallStringSmallJsonT);
  57712   SUITE_ADD_TEST(suite, setSmallContainerSmallJsonT);
  57713   SUITE_ADD_TEST(suite, setNFreeSmallJsonT);
  57714   SUITE_ADD_TEST(suite, setNFreeUndefinedSmallJsonT);
  57715   SUITE_ADD_TEST(suite, setNFreeSSmallJsonT);
  57716   SUITE_ADD_TEST(suite, setNFreeDictSmallJsonT);
  57717   SUITE_ADD_TEST(suite, setNFreeArraySmallJsonT);
  57718   SUITE_ADD_TEST(suite, setNFreeArraycSmallJsonT);
  57719   SUITE_ADD_TEST(suite, setNFreeSmallBoolSmallJsonT);
  57720   SUITE_ADD_TEST(suite, setNFreeSmallBytesSmallJsonT);
  57721   SUITE_ADD_TEST(suite, setNFreeSmallDoubleSmallJsonT);
  57722   SUITE_ADD_TEST(suite, setNFreeSmallIntSmallJsonT);
  57723   SUITE_ADD_TEST(suite, setNFreeSmallJsonSmallJsonT);
  57724   SUITE_ADD_TEST(suite, setNFreeSmallStringSmallJsonT);
  57725   SUITE_ADD_TEST(suite, setNFreeSmallContainerSmallJsonT);
  57726   SUITE_ADD_TEST(suite, setPDictSmallJsonT);
  57727   SUITE_ADD_TEST(suite, setPArraySmallJsonT);
  57728   SUITE_ADD_TEST(suite, setPSmallJsonSmallJsonT);
  57729   SUITE_ADD_TEST(suite, setPSmallStringSmallJsonT);
  57730   SUITE_ADD_TEST(suite, setNFreePDictSmallJsonT);
  57731   SUITE_ADD_TEST(suite, setNFreePArraySmallJsonT);
  57732   SUITE_ADD_TEST(suite, setNFreePSmallJsonSmallJsonT);
  57733   SUITE_ADD_TEST(suite, setNFreePSmallStringSmallJsonT);
  57734   SUITE_ADD_TEST(suite, setAtSmallJsonT);
  57735   SUITE_ADD_TEST(suite, setAtUndefinedSmallJsonT);
  57736   SUITE_ADD_TEST(suite, setAtBoolSmallJsonT);
  57737   SUITE_ADD_TEST(suite, setAtDoubleSmallJsonT);
  57738   SUITE_ADD_TEST(suite, setAtIntSmallJsonT);
  57739   SUITE_ADD_TEST(suite, setAtSSmallJsonT);
  57740   SUITE_ADD_TEST(suite, setAtCharSmallJsonT);
  57741   SUITE_ADD_TEST(suite, setAtDictSmallJsonT);
  57742   SUITE_ADD_TEST(suite, setAtArraySmallJsonT);
  57743   SUITE_ADD_TEST(suite, setAtArraycSmallJsonT);
  57744   SUITE_ADD_TEST(suite, setAtSmallBoolSmallJsonT);
  57745   SUITE_ADD_TEST(suite, setAtSmallBytesSmallJsonT);
  57746   SUITE_ADD_TEST(suite, setAtSmallDoubleSmallJsonT);
  57747   SUITE_ADD_TEST(suite, setAtSmallIntSmallJsonT);
  57748   SUITE_ADD_TEST(suite, setAtSmallJsonSmallJsonT);
  57749   SUITE_ADD_TEST(suite, setAtSmallStringSmallJsonT);
  57750   SUITE_ADD_TEST(suite, setAtSmallContainerSmallJsonT);
  57751   SUITE_ADD_TEST(suite, setAtNFreeSmallJsonT);
  57752   SUITE_ADD_TEST(suite, setAtNFreeUndefinedSmallJsonT);
  57753   SUITE_ADD_TEST(suite, setAtNFreeSSmallJsonT);
  57754   SUITE_ADD_TEST(suite, setAtNFreeDictSmallJsonT);
  57755   SUITE_ADD_TEST(suite, setAtNFreeArraySmallJsonT);
  57756   SUITE_ADD_TEST(suite, setAtNFreeArraycSmallJsonT);
  57757   SUITE_ADD_TEST(suite, setAtNFreeSmallBoolSmallJsonT);
  57758   SUITE_ADD_TEST(suite, setAtNFreeSmallBytesSmallJsonT);
  57759   SUITE_ADD_TEST(suite, setAtNFreeSmallDoubleSmallJsonT);
  57760   SUITE_ADD_TEST(suite, setAtNFreeSmallIntSmallJsonT);
  57761   SUITE_ADD_TEST(suite, setAtNFreeSmallJsonSmallJsonT);
  57762   SUITE_ADD_TEST(suite, setAtNFreeSmallStringSmallJsonT);
  57763   SUITE_ADD_TEST(suite, setAtNFreeSmallContainerSmallJsonT);
  57764   SUITE_ADD_TEST(suite, setPAtDictSmallJsonT);
  57765   SUITE_ADD_TEST(suite, setPAtArraySmallJsonT);
  57766   SUITE_ADD_TEST(suite, setPAtSmallJsonSmallJsonT);
  57767   SUITE_ADD_TEST(suite, setPAtSmallStringSmallJsonT);
  57768   SUITE_ADD_TEST(suite, setPAtNFreeDictSmallJsonT);
  57769   SUITE_ADD_TEST(suite, setPAtNFreeArraySmallJsonT);
  57770   SUITE_ADD_TEST(suite, setPAtNFreeSmallJsonSmallJsonT);
  57771   SUITE_ADD_TEST(suite, setPAtNFreeSmallStringSmallJsonT);
  57772   SUITE_ADD_TEST(suite, pushUndefinedSmallJsonT);
  57773   SUITE_ADD_TEST(suite, pushBoolSmallJsonT);
  57774   SUITE_ADD_TEST(suite, pushDoubleSmallJsonT);
  57775   SUITE_ADD_TEST(suite, pushIntSmallJsonT);
  57776   SUITE_ADD_TEST(suite, pushSSmallJsonT);
  57777   SUITE_ADD_TEST(suite, pushCharSmallJsonT);
  57778   SUITE_ADD_TEST(suite, pushDictSmallJsonT);
  57779   SUITE_ADD_TEST(suite, pushArraySmallJsonT);
  57780   SUITE_ADD_TEST(suite, pushArraycSmallJsonT);
  57781   SUITE_ADD_TEST(suite, pushSmallBoolSmallJsonT);
  57782   SUITE_ADD_TEST(suite, pushSmallBytesSmallJsonT);
  57783   SUITE_ADD_TEST(suite, pushSmallDoubleSmallJsonT);
  57784   SUITE_ADD_TEST(suite, pushSmallIntSmallJsonT);
  57785   SUITE_ADD_TEST(suite, pushSmallJsonSmallJsonT);
  57786   SUITE_ADD_TEST(suite, pushSmallStringSmallJsonT);
  57787   SUITE_ADD_TEST(suite, pushSmallContainerSmallJsonT);
  57788   SUITE_ADD_TEST(suite, pushNFreeSmallJsonT);
  57789   SUITE_ADD_TEST(suite, pushNFreeUndefinedSmallJsonT);
  57790   SUITE_ADD_TEST(suite, pushNFreeSSmallJsonT);
  57791   SUITE_ADD_TEST(suite, pushNFreeDictSmallJsonT);
  57792   SUITE_ADD_TEST(suite, pushNFreeArraySmallJsonT);
  57793   SUITE_ADD_TEST(suite, pushNFreeArraycSmallJsonT);
  57794   SUITE_ADD_TEST(suite, pushNFreeSmallBoolSmallJsonT);
  57795   SUITE_ADD_TEST(suite, pushNFreeSmallBytesSmallJsonT);
  57796   SUITE_ADD_TEST(suite, pushNFreeSmallDoubleSmallJsonT);
  57797   SUITE_ADD_TEST(suite, pushNFreeSmallIntSmallJsonT);
  57798   SUITE_ADD_TEST(suite, pushNFreeSmallJsonSmallJsonT);
  57799   SUITE_ADD_TEST(suite, pushNFreeSmallStringSmallJsonT);
  57800   SUITE_ADD_TEST(suite, pushNFreeSmallContainerSmallJsonT);
  57801   SUITE_ADD_TEST(suite, pushManySmallJsonT);
  57802   SUITE_ADD_TEST(suite, pushManySSmallJsonT);
  57803   SUITE_ADD_TEST(suite, pushNFreeManySmallJsonT);
  57804   SUITE_ADD_TEST(suite, pushNFreeManySSmallJsonT);
  57805   SUITE_ADD_TEST(suite, popSmallJsonT);
  57806   SUITE_ADD_TEST(suite, popUndefinedSmallJsonT);
  57807   SUITE_ADD_TEST(suite, popBoolSmallJsonT);
  57808   SUITE_ADD_TEST(suite, popDoubleSmallJsonT);
  57809   SUITE_ADD_TEST(suite, popIntSmallJsonT);
  57810   SUITE_ADD_TEST(suite, popInt32SmallJsonT);
  57811   SUITE_ADD_TEST(suite, popUintSmallJsonT);
  57812   SUITE_ADD_TEST(suite, popUint32SmallJsonT);
  57813   SUITE_ADD_TEST(suite, popSSmallJsonT);
  57814   SUITE_ADD_TEST(suite, popDictSmallJsonT);
  57815   SUITE_ADD_TEST(suite, popArraySmallJsonT);
  57816   SUITE_ADD_TEST(suite, popSmallBoolSmallJsonT);
  57817   SUITE_ADD_TEST(suite, popSmallBytesSmallJsonT);
  57818   SUITE_ADD_TEST(suite, popSmallDoubleSmallJsonT);
  57819   SUITE_ADD_TEST(suite, popSmallIntSmallJsonT);
  57820   SUITE_ADD_TEST(suite, popSmallJsonSmallJsonT);
  57821   SUITE_ADD_TEST(suite, popSmallStringSmallJsonT);
  57822   SUITE_ADD_TEST(suite, popVoidSmallJsonT);
  57823   SUITE_ADD_TEST(suite, popSmallContainerSmallJsonT);
  57824   SUITE_ADD_TEST(suite, popNumSmallJsonT);
  57825   SUITE_ADD_TEST(suite, prependSmallJsonT);
  57826   SUITE_ADD_TEST(suite, prependUndefinedSmallJsonT);
  57827   SUITE_ADD_TEST(suite, prependBoolSmallJsonT);
  57828   SUITE_ADD_TEST(suite, prependDoubleSmallJsonT);
  57829   SUITE_ADD_TEST(suite, prependIntSmallJsonT);
  57830   SUITE_ADD_TEST(suite, prependSSmallJsonT);
  57831   SUITE_ADD_TEST(suite, prependCharSmallJsonT);
  57832   SUITE_ADD_TEST(suite, prependDictSmallJsonT);
  57833   SUITE_ADD_TEST(suite, prependArraySmallJsonT);
  57834   SUITE_ADD_TEST(suite, prependArraycSmallJsonT);
  57835   SUITE_ADD_TEST(suite, prependSmallBoolSmallJsonT);
  57836   SUITE_ADD_TEST(suite, prependSmallBytesSmallJsonT);
  57837   SUITE_ADD_TEST(suite, prependSmallDoubleSmallJsonT);
  57838   SUITE_ADD_TEST(suite, prependSmallIntSmallJsonT);
  57839   SUITE_ADD_TEST(suite, prependSmallJsonSmallJsonT);
  57840   SUITE_ADD_TEST(suite, prependSmallStringSmallJsonT);
  57841   SUITE_ADD_TEST(suite, prependSmallContainerSmallJsonT);
  57842   SUITE_ADD_TEST(suite, prependNFreeSmallJsonT);
  57843   SUITE_ADD_TEST(suite, prependNFreeUndefinedSmallJsonT);
  57844   SUITE_ADD_TEST(suite, prependNFreeSSmallJsonT);
  57845   SUITE_ADD_TEST(suite, prependNFreeDictSmallJsonT);
  57846   SUITE_ADD_TEST(suite, prependNFreeArraySmallJsonT);
  57847   SUITE_ADD_TEST(suite, prependNFreeArraycSmallJsonT);
  57848   SUITE_ADD_TEST(suite, prependNFreeSmallBoolSmallJsonT);
  57849   SUITE_ADD_TEST(suite, prependNFreeSmallBytesSmallJsonT);
  57850   SUITE_ADD_TEST(suite, prependNFreeSmallDoubleSmallJsonT);
  57851   SUITE_ADD_TEST(suite, prependNFreeSmallIntSmallJsonT);
  57852   SUITE_ADD_TEST(suite, prependNFreeSmallJsonSmallJsonT);
  57853   SUITE_ADD_TEST(suite, prependNFreeSmallStringSmallJsonT);
  57854   SUITE_ADD_TEST(suite, prependNFreeSmallContainerSmallJsonT);
  57855   SUITE_ADD_TEST(suite, dequeueSmallJsonT);
  57856   SUITE_ADD_TEST(suite, dequeueUndefinedSmallJsonT);
  57857   SUITE_ADD_TEST(suite, dequeueBoolSmallJsonT);
  57858   SUITE_ADD_TEST(suite, dequeueDoubleSmallJsonT);
  57859   SUITE_ADD_TEST(suite, dequeueIntSmallJsonT);
  57860   SUITE_ADD_TEST(suite, dequeueInt32SmallJsonT);
  57861   SUITE_ADD_TEST(suite, dequeueUintSmallJsonT);
  57862   SUITE_ADD_TEST(suite, dequeueUint32SmallJsonT);
  57863   SUITE_ADD_TEST(suite, dequeueSSmallJsonT);
  57864   SUITE_ADD_TEST(suite, dequeueDictSmallJsonT);
  57865   SUITE_ADD_TEST(suite, dequeueArraySmallJsonT);
  57866   SUITE_ADD_TEST(suite, dequeueSmallBoolSmallJsonT);
  57867   SUITE_ADD_TEST(suite, dequeueSmallBytesSmallJsonT);
  57868   SUITE_ADD_TEST(suite, dequeueSmallDoubleSmallJsonT);
  57869   SUITE_ADD_TEST(suite, dequeueSmallIntSmallJsonT);
  57870   SUITE_ADD_TEST(suite, dequeueSmallJsonSmallJsonT);
  57871   SUITE_ADD_TEST(suite, dequeueSmallStringSmallJsonT);
  57872   SUITE_ADD_TEST(suite, dequeueVoidSmallJsonT);
  57873   SUITE_ADD_TEST(suite, dequeueSmallContainerSmallJsonT);
  57874   SUITE_ADD_TEST(suite, dequeueNumSmallJsonT);
  57875   SUITE_ADD_TEST(suite, reverseSmallJsonT);
  57876   SUITE_ADD_TEST(suite, catSmallJsonT);
  57877   SUITE_ADD_TEST(suite, mergeDictSmallJsonT);
  57878   SUITE_ADD_TEST(suite, mergeDictNSmashSmallJsonT);
  57879   SUITE_ADD_TEST(suite, mergeSmallJsonT);
  57880   SUITE_ADD_TEST(suite, mergeNSmashSmallJsonT);
  57881   SUITE_ADD_TEST(suite, appendSmallJsonT);
  57882   SUITE_ADD_TEST(suite, appendNSmashSmallJsonT);
  57883   SUITE_ADD_TEST(suite, appendArraySmallJsonT);
  57884   SUITE_ADD_TEST(suite, appendNSmashArraySmallJsonT);
  57885   SUITE_ADD_TEST(suite, shiftSmallJsonT);
  57886   SUITE_ADD_TEST(suite, shiftNSmashSmallJsonT);
  57887   SUITE_ADD_TEST(suite, shiftSmallJsonSmallJsonT);
  57888   SUITE_ADD_TEST(suite, shiftNSmashSmallJsonSmallJsonT);
  57889   SUITE_ADD_TEST(suite, addSmallJsonT);
  57890   SUITE_ADD_TEST(suite, addJsonSmallJsonT);
  57891   SUITE_ADD_TEST(suite, sliceSmallJsonT);
  57892   SUITE_ADD_TEST(suite, cropSmallJsonT);
  57893   SUITE_ADD_TEST(suite, cropSSmallJsonT);
  57894   SUITE_ADD_TEST(suite, cropSmallStringSmallJsonT);
  57895   SUITE_ADD_TEST(suite, cropElemAtSmallJsonT);
  57896   SUITE_ADD_TEST(suite, cropElemAtUndefinedSmallJsonT);
  57897   SUITE_ADD_TEST(suite, cropElemAtBoolSmallJsonT);
  57898   SUITE_ADD_TEST(suite, cropElemAtDoubleSmallJsonT);
  57899   SUITE_ADD_TEST(suite, cropElemAtIntSmallJsonT);
  57900   SUITE_ADD_TEST(suite, cropElemAtInt32SmallJsonT);
  57901   SUITE_ADD_TEST(suite, cropElemAtUintSmallJsonT);
  57902   SUITE_ADD_TEST(suite, cropElemAtUint32SmallJsonT);
  57903   SUITE_ADD_TEST(suite, cropElemAtSSmallJsonT);
  57904   SUITE_ADD_TEST(suite, cropElemAtCharSmallJsonT);
  57905   SUITE_ADD_TEST(suite, cropElemAtDictSmallJsonT);
  57906   SUITE_ADD_TEST(suite, cropElemAtArraySmallJsonT);
  57907   SUITE_ADD_TEST(suite, cropElemAtSmallBoolSmallJsonT);
  57908   SUITE_ADD_TEST(suite, cropElemAtSmallBytesSmallJsonT);
  57909   SUITE_ADD_TEST(suite, cropElemAtSmallDoubleSmallJsonT);
  57910   SUITE_ADD_TEST(suite, cropElemAtSmallIntSmallJsonT);
  57911   SUITE_ADD_TEST(suite, cropElemAtSmallJsonSmallJsonT);
  57912   SUITE_ADD_TEST(suite, cropElemAtSmallStringSmallJsonT);
  57913   SUITE_ADD_TEST(suite, cropElemAtVoidSmallJsonT);
  57914   SUITE_ADD_TEST(suite, cropElemAtSmallContainerSmallJsonT);
  57915   SUITE_ADD_TEST(suite, cropElemKeySmallJsonT);
  57916   SUITE_ADD_TEST(suite, cropElemKeyUndefinedSmallJsonT);
  57917   SUITE_ADD_TEST(suite, cropElemKeyBoolSmallJsonT);
  57918   SUITE_ADD_TEST(suite, cropElemKeyDoubleSmallJsonT);
  57919   SUITE_ADD_TEST(suite, cropElemKeyIntSmallJsonT);
  57920   SUITE_ADD_TEST(suite, cropElemKeyInt32SmallJsonT);
  57921   SUITE_ADD_TEST(suite, cropElemKeyUintSmallJsonT);
  57922   SUITE_ADD_TEST(suite, cropElemKeyUint32SmallJsonT);
  57923   SUITE_ADD_TEST(suite, cropElemKeySSmallJsonT);
  57924   SUITE_ADD_TEST(suite, cropElemKeyDictSmallJsonT);
  57925   SUITE_ADD_TEST(suite, cropElemKeyArraySmallJsonT);
  57926   SUITE_ADD_TEST(suite, cropElemKeySmallBoolSmallJsonT);
  57927   SUITE_ADD_TEST(suite, cropElemKeySmallBytesSmallJsonT);
  57928   SUITE_ADD_TEST(suite, cropElemKeySmallDoubleSmallJsonT);
  57929   SUITE_ADD_TEST(suite, cropElemKeySmallIntSmallJsonT);
  57930   SUITE_ADD_TEST(suite, cropElemKeySmallJsonSmallJsonT);
  57931   SUITE_ADD_TEST(suite, cropElemKeySmallStringSmallJsonT);
  57932   SUITE_ADD_TEST(suite, cropElemKeyVoidSmallJsonT);
  57933   SUITE_ADD_TEST(suite, cropElemKeySmallContainerSmallJsonT);
  57934   SUITE_ADD_TEST(suite, copySmallJsonT);
  57935   SUITE_ADD_TEST(suite, insertSmallJsonT);
  57936   SUITE_ADD_TEST(suite, insertNSmashSmallJsonT);
  57937   SUITE_ADD_TEST(suite, insertSmallJsonSmallJsonT);
  57938   SUITE_ADD_TEST(suite, insertNSmashSmallJsonSmallJsonT);
  57939   SUITE_ADD_TEST(suite, insertStringSmallJsonT);
  57940   SUITE_ADD_TEST(suite, insertSSmallJsonT);
  57941   SUITE_ADD_TEST(suite, insertNFreeStringSmallJsonT);
  57942   SUITE_ADD_TEST(suite, insertSNFreeSmallJsonT);
  57943   SUITE_ADD_TEST(suite, injectSmallJsonT);
  57944   SUITE_ADD_TEST(suite, injectUndefinedSmallJsonT);
  57945   SUITE_ADD_TEST(suite, injectBoolSmallJsonT);
  57946   SUITE_ADD_TEST(suite, injectDoubleSmallJsonT);
  57947   SUITE_ADD_TEST(suite, injectIntSmallJsonT);
  57948   SUITE_ADD_TEST(suite, injectSSmallJsonT);
  57949   SUITE_ADD_TEST(suite, injectCharSmallJsonT);
  57950   SUITE_ADD_TEST(suite, injectDictSmallJsonT);
  57951   SUITE_ADD_TEST(suite, injectArraySmallJsonT);
  57952   SUITE_ADD_TEST(suite, injectArraycSmallJsonT);
  57953   SUITE_ADD_TEST(suite, injectSmallBoolSmallJsonT);
  57954   SUITE_ADD_TEST(suite, injectSmallBytesSmallJsonT);
  57955   SUITE_ADD_TEST(suite, injectSmallDoubleSmallJsonT);
  57956   SUITE_ADD_TEST(suite, injectSmallIntSmallJsonT);
  57957   SUITE_ADD_TEST(suite, injectSmallJsonSmallJsonT);
  57958   SUITE_ADD_TEST(suite, injectSmallStringSmallJsonT);
  57959   SUITE_ADD_TEST(suite, injectSmallContainerSmallJsonT);
  57960   SUITE_ADD_TEST(suite, injectNFreeSmallJsonT);
  57961   SUITE_ADD_TEST(suite, injectNFreeUndefinedSmallJsonT);
  57962   SUITE_ADD_TEST(suite, injectNFreeSSmallJsonT);
  57963   SUITE_ADD_TEST(suite, injectNFreeDictSmallJsonT);
  57964   SUITE_ADD_TEST(suite, injectNFreeArraySmallJsonT);
  57965   SUITE_ADD_TEST(suite, injectNFreeArraycSmallJsonT);
  57966   SUITE_ADD_TEST(suite, injectNFreeSmallBoolSmallJsonT);
  57967   SUITE_ADD_TEST(suite, injectNFreeSmallBytesSmallJsonT);
  57968   SUITE_ADD_TEST(suite, injectNFreeSmallDoubleSmallJsonT);
  57969   SUITE_ADD_TEST(suite, injectNFreeSmallIntSmallJsonT);
  57970   SUITE_ADD_TEST(suite, injectNFreeSmallJsonSmallJsonT);
  57971   SUITE_ADD_TEST(suite, injectNFreeSmallStringSmallJsonT);
  57972   SUITE_ADD_TEST(suite, injectNFreeSmallContainerSmallJsonT);
  57973   SUITE_ADD_TEST(suite, uniqSmallJsonT);
  57974   SUITE_ADD_TEST(suite, sortSmallJsonT);
  57975   SUITE_ADD_TEST(suite, icSortSmallJsonT);
  57976   SUITE_ADD_TEST(suite, sortFSmallJsonT);
  57977   SUITE_ADD_TEST(suite, icUniqSmallJsonT);
  57978   SUITE_ADD_TEST(suite, uniqCharSmallJsonT);
  57979   SUITE_ADD_TEST(suite, icUniqCharSmallJsonT);
  57980   SUITE_ADD_TEST(suite, hasSmallJsonT);
  57981   SUITE_ADD_TEST(suite, hasUndefinedSmallJsonT);
  57982   SUITE_ADD_TEST(suite, hasBoolSmallJsonT);
  57983   SUITE_ADD_TEST(suite, hasDoubleSmallJsonT);
  57984   SUITE_ADD_TEST(suite, hasIntSmallJsonT);
  57985   SUITE_ADD_TEST(suite, hasSSmallJsonT);
  57986   SUITE_ADD_TEST(suite, hasCharSmallJsonT);
  57987   SUITE_ADD_TEST(suite, hasDictSmallJsonT);
  57988   SUITE_ADD_TEST(suite, hasArraySmallJsonT);
  57989   SUITE_ADD_TEST(suite, hasArraycSmallJsonT);
  57990   SUITE_ADD_TEST(suite, hasSmallBoolSmallJsonT);
  57991   SUITE_ADD_TEST(suite, hasSmallBytesSmallJsonT);
  57992   SUITE_ADD_TEST(suite, hasSmallDoubleSmallJsonT);
  57993   SUITE_ADD_TEST(suite, hasSmallIntSmallJsonT);
  57994   SUITE_ADD_TEST(suite, hasSmallJsonSmallJsonT);
  57995   SUITE_ADD_TEST(suite, hasSmallStringSmallJsonT);
  57996   SUITE_ADD_TEST(suite, hasSmallContainerSmallJsonT);
  57997   SUITE_ADD_TEST(suite, findSmallJsonT);
  57998   SUITE_ADD_TEST(suite, findCharSmallJsonT);
  57999   SUITE_ADD_TEST(suite, findSmallStringSmallJsonT);
  58000   SUITE_ADD_TEST(suite, findJsonSmallJsonT);
  58001   SUITE_ADD_TEST(suite, indexOfSmallJsonT);
  58002   SUITE_ADD_TEST(suite, indexOfUndefinedSmallJsonT);
  58003   SUITE_ADD_TEST(suite, indexOfBoolSmallJsonT);
  58004   SUITE_ADD_TEST(suite, indexOfDoubleSmallJsonT);
  58005   SUITE_ADD_TEST(suite, indexOfIntSmallJsonT);
  58006   SUITE_ADD_TEST(suite, indexOfSSmallJsonT);
  58007   SUITE_ADD_TEST(suite, indexOfCharSmallJsonT);
  58008   SUITE_ADD_TEST(suite, indexOfDictSmallJsonT);
  58009   SUITE_ADD_TEST(suite, indexOfArraySmallJsonT);
  58010   SUITE_ADD_TEST(suite, indexOfArraycSmallJsonT);
  58011   SUITE_ADD_TEST(suite, indexOfSmallBoolSmallJsonT);
  58012   SUITE_ADD_TEST(suite, indexOfSmallBytesSmallJsonT);
  58013   SUITE_ADD_TEST(suite, indexOfSmallDoubleSmallJsonT);
  58014   SUITE_ADD_TEST(suite, indexOfSmallIntSmallJsonT);
  58015   SUITE_ADD_TEST(suite, indexOfSmallJsonSmallJsonT);
  58016   SUITE_ADD_TEST(suite, indexOfSmallStringSmallJsonT);
  58017   SUITE_ADD_TEST(suite, indexOfSmallContainerSmallJsonT);
  58018   SUITE_ADD_TEST(suite, binarySearchSmallJsonT);
  58019   SUITE_ADD_TEST(suite, binarySearchUndefinedSmallJsonT);
  58020   SUITE_ADD_TEST(suite, binarySearchBoolSmallJsonT);
  58021   SUITE_ADD_TEST(suite, binarySearchDoubleSmallJsonT);
  58022   SUITE_ADD_TEST(suite, binarySearchIntSmallJsonT);
  58023   SUITE_ADD_TEST(suite, binarySearchSSmallJsonT);
  58024   SUITE_ADD_TEST(suite, binarySearchCharSmallJsonT);
  58025   SUITE_ADD_TEST(suite, binarySearchDictSmallJsonT);
  58026   SUITE_ADD_TEST(suite, binarySearchArraySmallJsonT);
  58027   SUITE_ADD_TEST(suite, binarySearchArraycSmallJsonT);
  58028   SUITE_ADD_TEST(suite, binarySearchSmallBoolSmallJsonT);
  58029   SUITE_ADD_TEST(suite, binarySearchSmallBytesSmallJsonT);
  58030   SUITE_ADD_TEST(suite, binarySearchSmallDoubleSmallJsonT);
  58031   SUITE_ADD_TEST(suite, binarySearchSmallIntSmallJsonT);
  58032   SUITE_ADD_TEST(suite, binarySearchSmallJsonSmallJsonT);
  58033   SUITE_ADD_TEST(suite, binarySearchSmallStringSmallJsonT);
  58034   SUITE_ADD_TEST(suite, binarySearchSmallContainerSmallJsonT);
  58035   SUITE_ADD_TEST(suite, icHasSmallJsonT);
  58036   SUITE_ADD_TEST(suite, icHasSSmallJsonT);
  58037   SUITE_ADD_TEST(suite, icHasCharSmallJsonT);
  58038   SUITE_ADD_TEST(suite, icHasDictSmallJsonT);
  58039   SUITE_ADD_TEST(suite, icHasArraySmallJsonT);
  58040   SUITE_ADD_TEST(suite, icHasArraycSmallJsonT);
  58041   SUITE_ADD_TEST(suite, icHasSmallStringSmallJsonT);
  58042   SUITE_ADD_TEST(suite, icFindSmallJsonT);
  58043   SUITE_ADD_TEST(suite, icFindCharSmallJsonT);
  58044   SUITE_ADD_TEST(suite, icFindSmallStringSmallJsonT);
  58045   SUITE_ADD_TEST(suite, icFindJsonSmallJsonT);
  58046   SUITE_ADD_TEST(suite, icIndexOfSmallJsonT);
  58047   SUITE_ADD_TEST(suite, icIndexOfSSmallJsonT);
  58048   SUITE_ADD_TEST(suite, icIndexOfCharSmallJsonT);
  58049   SUITE_ADD_TEST(suite, icIndexOfDictSmallJsonT);
  58050   SUITE_ADD_TEST(suite, icIndexOfArraySmallJsonT);
  58051   SUITE_ADD_TEST(suite, icIndexOfArraycSmallJsonT);
  58052   SUITE_ADD_TEST(suite, icIndexOfSmallStringSmallJsonT);
  58053   SUITE_ADD_TEST(suite, icBinarySearchSmallJsonT);
  58054   SUITE_ADD_TEST(suite, icBinarySearchSSmallJsonT);
  58055   SUITE_ADD_TEST(suite, icBinarySearchCharSmallJsonT);
  58056   SUITE_ADD_TEST(suite, icBinarySearchDictSmallJsonT);
  58057   SUITE_ADD_TEST(suite, icBinarySearchArraySmallJsonT);
  58058   SUITE_ADD_TEST(suite, icBinarySearchArraycSmallJsonT);
  58059   SUITE_ADD_TEST(suite, icBinarySearchSmallStringSmallJsonT);
  58060   SUITE_ADD_TEST(suite, keyBySmallJsonT);
  58061   SUITE_ADD_TEST(suite, keyByUndefinedSmallJsonT);
  58062   SUITE_ADD_TEST(suite, keyByBoolSmallJsonT);
  58063   SUITE_ADD_TEST(suite, keyByDoubleSmallJsonT);
  58064   SUITE_ADD_TEST(suite, keyByIntSmallJsonT);
  58065   SUITE_ADD_TEST(suite, keyBySSmallJsonT);
  58066   SUITE_ADD_TEST(suite, keyByCharSmallJsonT);
  58067   SUITE_ADD_TEST(suite, keyByDictSmallJsonT);
  58068   SUITE_ADD_TEST(suite, keyByArraySmallJsonT);
  58069   SUITE_ADD_TEST(suite, keyByArraycSmallJsonT);
  58070   SUITE_ADD_TEST(suite, keyBySmallBoolSmallJsonT);
  58071   SUITE_ADD_TEST(suite, keyBySmallBytesSmallJsonT);
  58072   SUITE_ADD_TEST(suite, keyBySmallDoubleSmallJsonT);
  58073   SUITE_ADD_TEST(suite, keyBySmallIntSmallJsonT);
  58074   SUITE_ADD_TEST(suite, keyBySmallJsonSmallJsonT);
  58075   SUITE_ADD_TEST(suite, keyBySmallStringSmallJsonT);
  58076   SUITE_ADD_TEST(suite, keyBySmallContainerSmallJsonT);
  58077   SUITE_ADD_TEST(suite, icKeyBySmallJsonT);
  58078   SUITE_ADD_TEST(suite, icKeyBySSmallJsonT);
  58079   SUITE_ADD_TEST(suite, icKeyByCharSmallJsonT);
  58080   SUITE_ADD_TEST(suite, icKeyByDictSmallJsonT);
  58081   SUITE_ADD_TEST(suite, icKeyByArraySmallJsonT);
  58082   SUITE_ADD_TEST(suite, icKeyByArraycSmallJsonT);
  58083   SUITE_ADD_TEST(suite, icKeyBySmallStringSmallJsonT);
  58084   SUITE_ADD_TEST(suite, replaceSmallJsonT);
  58085   SUITE_ADD_TEST(suite, replaceCharSSmallJsonT);
  58086   SUITE_ADD_TEST(suite, replaceSCharSmallJsonT);
  58087   SUITE_ADD_TEST(suite, replaceCharCharSmallJsonT);
  58088   SUITE_ADD_TEST(suite, replaceSmallStringSmallStringSmallJsonT);
  58089   SUITE_ADD_TEST(suite, replaceSmallStringSSmallJsonT);
  58090   SUITE_ADD_TEST(suite, replaceSmallStringCharSmallJsonT);
  58091   SUITE_ADD_TEST(suite, replaceSSmallStringSmallJsonT);
  58092   SUITE_ADD_TEST(suite, replaceCharSmallStringSmallJsonT);
  58093   SUITE_ADD_TEST(suite, replaceJsonJsonSmallJsonT);
  58094   SUITE_ADD_TEST(suite, replaceJsonSmallStringSmallJsonT);
  58095   SUITE_ADD_TEST(suite, replaceJsonSSmallJsonT);
  58096   SUITE_ADD_TEST(suite, replaceJsonCharSmallJsonT);
  58097   SUITE_ADD_TEST(suite, replaceSmallStringJsonSmallJsonT);
  58098   SUITE_ADD_TEST(suite, replaceSJsonSmallJsonT);
  58099   SUITE_ADD_TEST(suite, replaceCharJsonSmallJsonT);
  58100   SUITE_ADD_TEST(suite, replaceManySmallJsonT);
  58101   SUITE_ADD_TEST(suite, icReplaceSmallJsonT);
  58102   SUITE_ADD_TEST(suite, icReplaceCharSSmallJsonT);
  58103   SUITE_ADD_TEST(suite, icReplaceSCharSmallJsonT);
  58104   SUITE_ADD_TEST(suite, icReplaceCharCharSmallJsonT);
  58105   SUITE_ADD_TEST(suite, icReplaceSmallStringSmallStringSmallJsonT);
  58106   SUITE_ADD_TEST(suite, icReplaceSmallStringSSmallJsonT);
  58107   SUITE_ADD_TEST(suite, icReplaceSmallStringCharSmallJsonT);
  58108   SUITE_ADD_TEST(suite, icReplaceSSmallStringSmallJsonT);
  58109   SUITE_ADD_TEST(suite, icReplaceCharSmallStringSmallJsonT);
  58110   SUITE_ADD_TEST(suite, icReplaceJsonJsonSmallJsonT);
  58111   SUITE_ADD_TEST(suite, icReplaceJsonSmallStringSmallJsonT);
  58112   SUITE_ADD_TEST(suite, icReplaceJsonSSmallJsonT);
  58113   SUITE_ADD_TEST(suite, icReplaceJsonCharSmallJsonT);
  58114   SUITE_ADD_TEST(suite, icReplaceSmallStringJsonSmallJsonT);
  58115   SUITE_ADD_TEST(suite, icReplaceSJsonSmallJsonT);
  58116   SUITE_ADD_TEST(suite, icReplaceCharJsonSmallJsonT);
  58117   SUITE_ADD_TEST(suite, icReplaceManySmallJsonT);
  58118   SUITE_ADD_TEST(suite, equalSmallJsonSmallArrayT);
  58119   SUITE_ADD_TEST(suite, equalSmallJsonArrayT);
  58120   SUITE_ADD_TEST(suite, equalSmallJsonBaseT);
  58121   SUITE_ADD_TEST(suite, equalSmallJsonChaT);
  58122   SUITE_ADD_TEST(suite, equalSmallJsonCharT);
  58123   SUITE_ADD_TEST(suite, equalSmallJsonBoolT);
  58124   SUITE_ADD_TEST(suite, equalSmallJsonDoubleT);
  58125   SUITE_ADD_TEST(suite, equalSmallJsonInt64T);
  58126   SUITE_ADD_TEST(suite, equalSmallJsonInt32T);
  58127   SUITE_ADD_TEST(suite, equalSmallJsonUint32T);
  58128   SUITE_ADD_TEST(suite, equalSmallJsonUint64T);
  58129   SUITE_ADD_TEST(suite, equalSmallJsonSmallBoolT);
  58130   SUITE_ADD_TEST(suite, equalSmallJsonSmallBytesT);
  58131   SUITE_ADD_TEST(suite, equalSmallJsonSmallDoubleT);
  58132   SUITE_ADD_TEST(suite, equalSmallJsonSmallIntT);
  58133   SUITE_ADD_TEST(suite, equalSmallJsonSmallJsonT);
  58134   SUITE_ADD_TEST(suite, equalSmallJsonSmallStringT);
  58135   SUITE_ADD_TEST(suite, equalSmallJsonSmallDictT);
  58136   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallArrayT);
  58137   SUITE_ADD_TEST(suite, icEqualSmallJsonArrayT);
  58138   SUITE_ADD_TEST(suite, icEqualSmallJsonBaseT);
  58139   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallDictT);
  58140   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallJsonT);
  58141   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallStringT);
  58142   SUITE_ADD_TEST(suite, icEqualSSmallJsonT);
  58143   SUITE_ADD_TEST(suite, icEqualCharSmallJsonT);
  58144   SUITE_ADD_TEST(suite, equalISSmallJsonT);
  58145   SUITE_ADD_TEST(suite, equalICharSmallJsonT);
  58146   SUITE_ADD_TEST(suite, equalIJsonSmallJsonT);
  58147   SUITE_ADD_TEST(suite, equalISmallStringSmallJsonT);
  58148   SUITE_ADD_TEST(suite, startsWithSSmallJsonT);
  58149   SUITE_ADD_TEST(suite, startsWithCharSmallJsonT);
  58150   SUITE_ADD_TEST(suite, startsWithSmallStringSmallJsonT);
  58151   SUITE_ADD_TEST(suite, startsWithJsonSmallJsonT);
  58152   SUITE_ADD_TEST(suite, endsWithSSmallJsonT);
  58153   SUITE_ADD_TEST(suite, endsWithCharSmallJsonT);
  58154   SUITE_ADD_TEST(suite, endsWithSmallStringSmallJsonT);
  58155   SUITE_ADD_TEST(suite, endsWithJsonSmallJsonT);
  58156   SUITE_ADD_TEST(suite, countSSmallJsonT);
  58157   SUITE_ADD_TEST(suite, countCharSmallJsonT);
  58158   SUITE_ADD_TEST(suite, countSmallStringSmallJsonT);
  58159   SUITE_ADD_TEST(suite, countJsonSmallJsonT);
  58160   SUITE_ADD_TEST(suite, icStartsWithSSmallJsonT);
  58161   SUITE_ADD_TEST(suite, icStartsWithCharSmallJsonT);
  58162   SUITE_ADD_TEST(suite, icStartsWithSmallStringSmallJsonT);
  58163   SUITE_ADD_TEST(suite, icStartsWithJsonSmallJsonT);
  58164   SUITE_ADD_TEST(suite, icEndsWithSSmallJsonT);
  58165   SUITE_ADD_TEST(suite, icEndsWithCharSmallJsonT);
  58166   SUITE_ADD_TEST(suite, icEndsWithSmallStringSmallJsonT);
  58167   SUITE_ADD_TEST(suite, icEndsWithJsonSmallJsonT);
  58168   SUITE_ADD_TEST(suite, icCountSSmallJsonT);
  58169   SUITE_ADD_TEST(suite, icCountCharSmallJsonT);
  58170   SUITE_ADD_TEST(suite, icCountSmallStringSmallJsonT);
  58171   SUITE_ADD_TEST(suite, icCountJsonSmallJsonT);
  58172   SUITE_ADD_TEST(suite, isNumberSmallJsonT);
  58173   SUITE_ADD_TEST(suite, isIntSmallJsonT);
  58174   SUITE_ADD_TEST(suite, parseIntSmallJsonT);
  58175   SUITE_ADD_TEST(suite, parseDoubleSmallJsonT);
  58176   SUITE_ADD_TEST(suite, intToSmallJsonT);
  58177   SUITE_ADD_TEST(suite, doubleToSmallJsonT);
  58178   SUITE_ADD_TEST(suite, upperSmallJsonT);
  58179   SUITE_ADD_TEST(suite, lowerSmallJsonT);
  58180   SUITE_ADD_TEST(suite, trimSmallJsonT);
  58181   SUITE_ADD_TEST(suite, lTrimSmallJsonT);
  58182   SUITE_ADD_TEST(suite, rTrimSmallJsonT);
  58183   SUITE_ADD_TEST(suite, keysSmallJsonT);
  58184   SUITE_ADD_TEST(suite, keysSmallStringSmallJsonT);
  58185   SUITE_ADD_TEST(suite, valuesSmallJsonT);
  58186   SUITE_ADD_TEST(suite, compactSmallJsonT);
  58187   SUITE_ADD_TEST(suite, isEmptySmallJsonT);
  58188   SUITE_ADD_TEST(suite, isBlankSmallJsonT);
  58189   SUITE_ADD_TEST(suite, forEachSmallJsonFT);
  58190   SUITE_ADD_TEST(suite, enumerateSmallJsonFT);
  58191   SUITE_ADD_TEST(suite, enumerateDictSmallJsonT);
  58192   SUITE_ADD_TEST(suite, joinSmallJsonT);
  58193   SUITE_ADD_TEST(suite, joinCharSmallJsonT);
  58194   SUITE_ADD_TEST(suite, joinSmallJsonSmallJsonT);
  58195   SUITE_ADD_TEST(suite, joinSmallStringSmallJsonT);
  58196   SUITE_ADD_TEST(suite, joinSSmallJsonT);
  58197   SUITE_ADD_TEST(suite, joinCharSSmallJsonT);
  58198   SUITE_ADD_TEST(suite, joinSmallJsonSSmallJsonT);
  58199   SUITE_ADD_TEST(suite, joinSmallStringSSmallJsonT);
  58200   SUITE_ADD_TEST(suite, splitSmallJsonT);
  58201   SUITE_ADD_TEST(suite, splitCharSmallJsonT);
  58202   SUITE_ADD_TEST(suite, splitSmallJsonSmallJsonT);
  58203   SUITE_ADD_TEST(suite, splitSmallStringSmallJsonT);
  58204   SUITE_ADD_TEST(suite, splitSSmallJsonT);
  58205   SUITE_ADD_TEST(suite, splitCharSSmallJsonT);
  58206   SUITE_ADD_TEST(suite, splitSmallJsonSSmallJsonT);
  58207   SUITE_ADD_TEST(suite, splitSmallStringSSmallJsonT);
  58208   SUITE_ADD_TEST(suite, extractSmallJsonT);
  58209   SUITE_ADD_TEST(suite, extractCharSSmallJsonT);
  58210   SUITE_ADD_TEST(suite, extractSCharSmallJsonT);
  58211   SUITE_ADD_TEST(suite, extractCharCharSmallJsonT);
  58212   SUITE_ADD_TEST(suite, extractSmallJsonSmallJsonSmallJsonT);
  58213   SUITE_ADD_TEST(suite, extractSmallJsonSmallStringSmallJsonT);
  58214   SUITE_ADD_TEST(suite, extractSmallJsonSSmallJsonT);
  58215   SUITE_ADD_TEST(suite, extractSmallJsonCharSmallJsonT);
  58216   SUITE_ADD_TEST(suite, extractSmallStringSmallJsonSmallJsonT);
  58217   SUITE_ADD_TEST(suite, extractSmallStringSmallStringSmallJsonT);
  58218   SUITE_ADD_TEST(suite, extractSmallStringSSmallJsonT);
  58219   SUITE_ADD_TEST(suite, extractSmallStringCharSmallJsonT);
  58220   SUITE_ADD_TEST(suite, extractSSmallJsonSmallJsonT);
  58221   SUITE_ADD_TEST(suite, extractSSmallStringSmallJsonT);
  58222   SUITE_ADD_TEST(suite, extractCharSmallJsonSmallJsonT);
  58223   SUITE_ADD_TEST(suite, extractCharSmallStringSmallJsonT);
  58224   SUITE_ADD_TEST(suite, icSplitSmallJsonT);
  58225   SUITE_ADD_TEST(suite, icSplitCharSmallJsonT);
  58226   SUITE_ADD_TEST(suite, icSplitSmallJsonSmallJsonT);
  58227   SUITE_ADD_TEST(suite, icSplitSmallStringSmallJsonT);
  58228   SUITE_ADD_TEST(suite, icSplitSSmallJsonT);
  58229   SUITE_ADD_TEST(suite, icSplitCharSSmallJsonT);
  58230   SUITE_ADD_TEST(suite, icSplitSmallJsonSSmallJsonT);
  58231   SUITE_ADD_TEST(suite, icSplitSmallStringSSmallJsonT);
  58232   SUITE_ADD_TEST(suite, icExtractSmallJsonT);
  58233   SUITE_ADD_TEST(suite, icExtractCharSSmallJsonT);
  58234   SUITE_ADD_TEST(suite, icExtractSCharSmallJsonT);
  58235   SUITE_ADD_TEST(suite, icExtractCharCharSmallJsonT);
  58236   SUITE_ADD_TEST(suite, icExtractSmallJsonSmallJsonSmallJsonT);
  58237   SUITE_ADD_TEST(suite, icExtractSmallJsonSmallStringSmallJsonT);
  58238   SUITE_ADD_TEST(suite, icExtractSmallJsonSSmallJsonT);
  58239   SUITE_ADD_TEST(suite, icExtractSmallJsonCharSmallJsonT);
  58240   SUITE_ADD_TEST(suite, icExtractSmallStringSmallJsonSmallJsonT);
  58241   SUITE_ADD_TEST(suite, icExtractSmallStringSmallStringSmallJsonT);
  58242   SUITE_ADD_TEST(suite, icExtractSmallStringSSmallJsonT);
  58243   SUITE_ADD_TEST(suite, icExtractSmallStringCharSmallJsonT);
  58244   SUITE_ADD_TEST(suite, icExtractSSmallJsonSmallJsonT);
  58245   SUITE_ADD_TEST(suite, icExtractSSmallStringSmallJsonT);
  58246   SUITE_ADD_TEST(suite, icExtractCharSmallJsonSmallJsonT);
  58247   SUITE_ADD_TEST(suite, icExtractCharSmallStringSmallJsonT);
  58248   SUITE_ADD_TEST(suite, colorSmallJsonT);
  58249   SUITE_ADD_TEST(suite, colordSmallJsonT);
  58250   SUITE_ADD_TEST(suite, zipSmallJsonT);
  58251   SUITE_ADD_TEST(suite, zipArraySmallJsonT);
  58252   SUITE_ADD_TEST(suite, zipCArraySmallJsonT);
  58253   SUITE_ADD_TEST(suite, zipCharSmallJsonT);
  58254   SUITE_ADD_TEST(suite, zipCCharSmallJsonT);
  58255   SUITE_ADD_TEST(suite, zipArrayCharSmallJsonT);
  58256   SUITE_ADD_TEST(suite, zipCArrayCharSmallJsonT);
  58257   SUITE_ADD_TEST(suite, zipArrayCCharSmallJsonT);
  58258   SUITE_ADD_TEST(suite, zipCArrayCCharSmallJsonT);
  58259   SUITE_ADD_TEST(suite, zipJsonSmallJsonT);
  58260   SUITE_ADD_TEST(suite, zipJsonSmallArraySmallJsonT);
  58261   SUITE_ADD_TEST(suite, zipJsonArraySmallJsonT);
  58262   SUITE_ADD_TEST(suite, zipJsonCArraySmallJsonT);
  58263   SUITE_ADD_TEST(suite, zipSmallArrayJsonSmallJsonT);
  58264   SUITE_ADD_TEST(suite, zipArrayJsonSmallJsonT);
  58265   SUITE_ADD_TEST(suite, zipCArrayJsonSmallJsonT);
  58266   SUITE_ADD_TEST(suite, iterStartSmallJsonT);
  58267   SUITE_ADD_TEST(suite, iterStartKeySmallJsonT);
  58268   SUITE_ADD_TEST(suite, iterStartLastSmallJsonT);
  58269   SUITE_ADD_TEST(suite, iterStartFromSmallJsonT);
  58270   SUITE_ADD_TEST(suite, iterStartFromStepSmallJsonT);
  58271   SUITE_ADD_TEST(suite, iterNextSmallJsonT);
  58272   SUITE_ADD_TEST(suite, iterNextKeySmallJsonT);
  58273   SUITE_ADD_TEST(suite, iterElementSmallJsonT);
  58274   SUITE_ADD_TEST(suite, iterKeySmallJsonT);
  58275   SUITE_ADD_TEST(suite, iterIndexSmallJsonT);
  58276   SUITE_ADD_TEST(suite, iterStepSmallJsonT);
  58277   SUITE_ADD_TEST(suite, getUndefinedSmallJsonT);
  58278   SUITE_ADD_TEST(suite, getBoolSmallJsonT);
  58279   SUITE_ADD_TEST(suite, getBoolPSmallJsonT);
  58280   SUITE_ADD_TEST(suite, getDoubleSmallJsonT);
  58281   SUITE_ADD_TEST(suite, getDoublePSmallJsonT);
  58282   SUITE_ADD_TEST(suite, getIntSmallJsonT);
  58283   SUITE_ADD_TEST(suite, getIntPSmallJsonT);
  58284   SUITE_ADD_TEST(suite, getInt32SmallJsonT);
  58285   SUITE_ADD_TEST(suite, getInt32PSmallJsonT);
  58286   SUITE_ADD_TEST(suite, getUintSmallJsonT);
  58287   SUITE_ADD_TEST(suite, getUintPSmallJsonT);
  58288   SUITE_ADD_TEST(suite, getUint32SmallJsonT);
  58289   SUITE_ADD_TEST(suite, getUint32PSmallJsonT);
  58290   SUITE_ADD_TEST(suite, getSSmallJsonT);
  58291   SUITE_ADD_TEST(suite, getDictSmallJsonT);
  58292   SUITE_ADD_TEST(suite, getArraySmallJsonT);
  58293   SUITE_ADD_TEST(suite, getSmallBoolSmallJsonT);
  58294   SUITE_ADD_TEST(suite, getSmallBytesSmallJsonT);
  58295   SUITE_ADD_TEST(suite, getSmallDoubleSmallJsonT);
  58296   SUITE_ADD_TEST(suite, getSmallIntSmallJsonT);
  58297   SUITE_ADD_TEST(suite, getSmallJsonSmallJsonT);
  58298   SUITE_ADD_TEST(suite, getSmallStringSmallJsonT);
  58299   SUITE_ADD_TEST(suite, getVoidSmallJsonT);
  58300   SUITE_ADD_TEST(suite, getSmallContainerSmallJsonT);
  58301   SUITE_ADD_TEST(suite, getNDupSmallJsonT);
  58302   SUITE_ADD_TEST(suite, getNDupUndefinedSmallJsonT);
  58303   SUITE_ADD_TEST(suite, getNDupBoolSmallJsonT);
  58304   SUITE_ADD_TEST(suite, getNDupDoubleSmallJsonT);
  58305   SUITE_ADD_TEST(suite, getNDupIntSmallJsonT);
  58306   SUITE_ADD_TEST(suite, getNDupInt32SmallJsonT);
  58307   SUITE_ADD_TEST(suite, getNDupUintSmallJsonT);
  58308   SUITE_ADD_TEST(suite, getNDupUint32SmallJsonT);
  58309   SUITE_ADD_TEST(suite, getNDupSSmallJsonT);
  58310   SUITE_ADD_TEST(suite, getNDupDictSmallJsonT);
  58311   SUITE_ADD_TEST(suite, getNDupArraySmallJsonT);
  58312   SUITE_ADD_TEST(suite, getNDupSmallBoolSmallJsonT);
  58313   SUITE_ADD_TEST(suite, getNDupSmallBytesSmallJsonT);
  58314   SUITE_ADD_TEST(suite, getNDupSmallDoubleSmallJsonT);
  58315   SUITE_ADD_TEST(suite, getNDupSmallIntSmallJsonT);
  58316   SUITE_ADD_TEST(suite, getNDupSmallJsonSmallJsonT);
  58317   SUITE_ADD_TEST(suite, getNDupSmallStringSmallJsonT);
  58318   SUITE_ADD_TEST(suite, getNDupVoidSmallJsonT);
  58319   SUITE_ADD_TEST(suite, getNDupSmallContainerSmallJsonT);
  58320   SUITE_ADD_TEST(suite, getAtSmallJsonT);
  58321   SUITE_ADD_TEST(suite, getAtUndefinedSmallJsonT);
  58322   SUITE_ADD_TEST(suite, getAtBoolSmallJsonT);
  58323   SUITE_ADD_TEST(suite, getAtBoolPSmallJsonT);
  58324   SUITE_ADD_TEST(suite, getAtDoubleSmallJsonT);
  58325   SUITE_ADD_TEST(suite, getAtDoublePSmallJsonT);
  58326   SUITE_ADD_TEST(suite, getAtIntSmallJsonT);
  58327   SUITE_ADD_TEST(suite, getAtIntPSmallJsonT);
  58328   SUITE_ADD_TEST(suite, getAtInt32SmallJsonT);
  58329   SUITE_ADD_TEST(suite, getAtInt32PSmallJsonT);
  58330   SUITE_ADD_TEST(suite, getAtUintSmallJsonT);
  58331   SUITE_ADD_TEST(suite, getAtUintPSmallJsonT);
  58332   SUITE_ADD_TEST(suite, getAtUint32SmallJsonT);
  58333   SUITE_ADD_TEST(suite, getAtUint32PSmallJsonT);
  58334   SUITE_ADD_TEST(suite, getAtSSmallJsonT);
  58335   SUITE_ADD_TEST(suite, getAtDictSmallJsonT);
  58336   SUITE_ADD_TEST(suite, getAtArraySmallJsonT);
  58337   SUITE_ADD_TEST(suite, getAtSmallBoolSmallJsonT);
  58338   SUITE_ADD_TEST(suite, getAtSmallBytesSmallJsonT);
  58339   SUITE_ADD_TEST(suite, getAtSmallDoubleSmallJsonT);
  58340   SUITE_ADD_TEST(suite, getAtSmallIntSmallJsonT);
  58341   SUITE_ADD_TEST(suite, getAtSmallJsonSmallJsonT);
  58342   SUITE_ADD_TEST(suite, getAtSmallStringSmallJsonT);
  58343   SUITE_ADD_TEST(suite, getAtVoidSmallJsonT);
  58344   SUITE_ADD_TEST(suite, getAtSmallContainerSmallJsonT);
  58345   SUITE_ADD_TEST(suite, getAtNDupSmallJsonT);
  58346   SUITE_ADD_TEST(suite, getAtNDupUndefinedSmallJsonT);
  58347   SUITE_ADD_TEST(suite, getAtNDupBoolSmallJsonT);
  58348   SUITE_ADD_TEST(suite, getAtNDupDoubleSmallJsonT);
  58349   SUITE_ADD_TEST(suite, getAtNDupIntSmallJsonT);
  58350   SUITE_ADD_TEST(suite, getAtNDupInt32SmallJsonT);
  58351   SUITE_ADD_TEST(suite, getAtNDupUintSmallJsonT);
  58352   SUITE_ADD_TEST(suite, getAtNDupUint32SmallJsonT);
  58353   SUITE_ADD_TEST(suite, getAtNDupSSmallJsonT);
  58354   SUITE_ADD_TEST(suite, getAtNDupDictSmallJsonT);
  58355   SUITE_ADD_TEST(suite, getAtNDupArraySmallJsonT);
  58356   SUITE_ADD_TEST(suite, getAtNDupSmallBoolSmallJsonT);
  58357   SUITE_ADD_TEST(suite, getAtNDupSmallBytesSmallJsonT);
  58358   SUITE_ADD_TEST(suite, getAtNDupSmallDoubleSmallJsonT);
  58359   SUITE_ADD_TEST(suite, getAtNDupSmallIntSmallJsonT);
  58360   SUITE_ADD_TEST(suite, getAtNDupSmallJsonSmallJsonT);
  58361   SUITE_ADD_TEST(suite, getAtNDupSmallStringSmallJsonT);
  58362   SUITE_ADD_TEST(suite, getAtNDupVoidSmallJsonT);
  58363   SUITE_ADD_TEST(suite, getAtNDupSmallContainerSmallJsonT);
  58364   SUITE_ADD_TEST(suite, getNumSmallJsonT);
  58365   SUITE_ADD_TEST(suite, getNumAtSmallJsonT);
  58366   SUITE_ADD_TEST(suite, delElemSmallJsonT);
  58367   SUITE_ADD_TEST(suite, delSmallJsonT);
  58368   SUITE_ADD_TEST(suite, delElemIndexSmallJsonT);
  58369   SUITE_ADD_TEST(suite, removeElemSmallJsonT);
  58370   SUITE_ADD_TEST(suite, removeSmallJsonT);
  58371   SUITE_ADD_TEST(suite, removeElemIndexSmallJsonT);
  58372   SUITE_ADD_TEST(suite, stringifySmallStringSmallJsonT);
  58373   SUITE_ADD_TEST(suite, toYMLSmallStringSmallJsonT);
  58374   SUITE_ADD_TEST(suite, parseSmallJsonSmallJsonT);
  58375   SUITE_ADD_TEST(suite, parseSmallStringSmallJsonT);
  58376   SUITE_ADD_TEST(suite, parseYMLSmallJsonSmallJsonT);
  58377   SUITE_ADD_TEST(suite, parseYMLSmallStringSmallJsonT);
  58378   SUITE_ADD_TEST(suite, logSmallJsonT);
  58379   SUITE_ADD_TEST(suite, readFileSmallJsonT);
  58380   SUITE_ADD_TEST(suite, readFileSmallStringSmallJsonT);
  58381   SUITE_ADD_TEST(suite, readFileJsonSmallJsonT);
  58382   SUITE_ADD_TEST(suite, readStreamSmallJsonT);
  58383   SUITE_ADD_TEST(suite, writeFileSmallJsonT);
  58384   SUITE_ADD_TEST(suite, writeFileSmallStringSmallJsonT);
  58385   SUITE_ADD_TEST(suite, writeFileJsonSmallJsonT);
  58386   SUITE_ADD_TEST(suite, writeStreamSmallJsonT);
  58387   SUITE_ADD_TEST(suite, appendFileSmallJsonT);
  58388   SUITE_ADD_TEST(suite, appendFileSmallStringSmallJsonT);
  58389   SUITE_ADD_TEST(suite, appendFileJsonSmallJsonT);
  58390   SUITE_ADD_TEST(suite, readTextSmallJsonT);
  58391   SUITE_ADD_TEST(suite, readTextSmallStringSmallJsonT);
  58392   SUITE_ADD_TEST(suite, readTextJsonSmallJsonT);
  58393   SUITE_ADD_TEST(suite, readTextStreamSmallJsonT);
  58394   SUITE_ADD_TEST(suite, writeTextSmallJsonT);
  58395   SUITE_ADD_TEST(suite, writeTextSmallStringSmallJsonT);
  58396   SUITE_ADD_TEST(suite, writeTextJsonSmallJsonT);
  58397   SUITE_ADD_TEST(suite, writeTextStreamSmallJsonT);
  58398   SUITE_ADD_TEST(suite, appendTextSmallJsonT);
  58399   SUITE_ADD_TEST(suite, appendTextSmallStringSmallJsonT);
  58400   SUITE_ADD_TEST(suite, appendTextJsonSmallJsonT);
  58401   SUITE_ADD_TEST(suite, typeStringSmallJsonT);
  58402   SUITE_ADD_TEST(suite, typeSmallStringSmallJsonT);
  58403   SUITE_ADD_TEST(suite, typeAtStringSmallJsonT);
  58404   SUITE_ADD_TEST(suite, typeAtSmallStringSmallJsonT);
  58405   SUITE_ADD_TEST(suite, typeStringKCharSmallJsonT);
  58406   SUITE_ADD_TEST(suite, typeSmallStringKCharSmallJsonT);
  58407   SUITE_ADD_TEST(suite, typeSmallJsonT);
  58408   SUITE_ADD_TEST(suite, typeKCharSmallJsonT);
  58409   SUITE_ADD_TEST(suite, typeAtSmallJsonT);
  58410   SUITE_ADD_TEST(suite, typeStringsSmallJsonT);
  58411   SUITE_ADD_TEST(suite, typesSmallJsonT);
  58412   SUITE_ADD_TEST(suite, isETypeAtSmallJsonT);
  58413   SUITE_ADD_TEST(suite, isEUndefinedAtSmallJsonT);
  58414   SUITE_ADD_TEST(suite, isEBoolAtSmallJsonT);
  58415   SUITE_ADD_TEST(suite, isEContainerAtSmallJsonT);
  58416   SUITE_ADD_TEST(suite, isEDictAtSmallJsonT);
  58417   SUITE_ADD_TEST(suite, isEDoubleAtSmallJsonT);
  58418   SUITE_ADD_TEST(suite, isEIntAtSmallJsonT);
  58419   SUITE_ADD_TEST(suite, isEStringAtSmallJsonT);
  58420   SUITE_ADD_TEST(suite, isEFaststringAtSmallJsonT);
  58421   SUITE_ADD_TEST(suite, isEArrayAtSmallJsonT);
  58422   SUITE_ADD_TEST(suite, isEBytesAtSmallJsonT);
  58423   SUITE_ADD_TEST(suite, isETypeSmallJsonT);
  58424   SUITE_ADD_TEST(suite, isEUndefinedSmallJsonT);
  58425   SUITE_ADD_TEST(suite, isEBoolSmallJsonT);
  58426   SUITE_ADD_TEST(suite, isEContainerSmallJsonT);
  58427   SUITE_ADD_TEST(suite, isEDictSmallJsonT);
  58428   SUITE_ADD_TEST(suite, isEDoubleSmallJsonT);
  58429   SUITE_ADD_TEST(suite, isEIntSmallJsonT);
  58430   SUITE_ADD_TEST(suite, isEStringSmallJsonT);
  58431   SUITE_ADD_TEST(suite, isEFaststringSmallJsonT);
  58432   SUITE_ADD_TEST(suite, isEArraySmallJsonT);
  58433   SUITE_ADD_TEST(suite, isEBytesSmallJsonT);
  58434   SUITE_ADD_TEST(suite, areAllETypeSmallJsonT);
  58435   SUITE_ADD_TEST(suite, areAllEUndefinedSmallJsonT);
  58436   SUITE_ADD_TEST(suite, areAllEBoolSmallJsonT);
  58437   SUITE_ADD_TEST(suite, areAllEContainerSmallJsonT);
  58438   SUITE_ADD_TEST(suite, areAllEDictSmallJsonT);
  58439   SUITE_ADD_TEST(suite, areAllEDoubleSmallJsonT);
  58440   SUITE_ADD_TEST(suite, areAllEIntSmallJsonT);
  58441   SUITE_ADD_TEST(suite, areAllEStringSmallJsonT);
  58442   SUITE_ADD_TEST(suite, areAllEFaststringSmallJsonT);
  58443   SUITE_ADD_TEST(suite, areAllEArraySmallJsonT);
  58444   SUITE_ADD_TEST(suite, areAllEBytesSmallJsonT);
  58445   SUITE_ADD_TEST(suite, duplicateSmallJsonGT);
  58446   SUITE_ADD_TEST(suite, freeSmallJsonGT);
  58447   SUITE_ADD_TEST(suite, setTopSmallJsonGT);
  58448   SUITE_ADD_TEST(suite, setTopBoolSmallJsonGT);
  58449   SUITE_ADD_TEST(suite, setTopDoubleSmallJsonGT);
  58450   SUITE_ADD_TEST(suite, setTopIntSmallJsonGT);
  58451   SUITE_ADD_TEST(suite, setTopStringSmallJsonGT);
  58452   SUITE_ADD_TEST(suite, setTopCharSmallJsonGT);
  58453   SUITE_ADD_TEST(suite, setTopDictSmallJsonGT);
  58454   SUITE_ADD_TEST(suite, setTopArraySmallJsonGT);
  58455   SUITE_ADD_TEST(suite, setTopArraycSmallJsonGT);
  58456   SUITE_ADD_TEST(suite, setTopCArraycSmallJsonGT);
  58457   SUITE_ADD_TEST(suite, setTopSmallBoolSmallJsonGT);
  58458   SUITE_ADD_TEST(suite, setTopSmallDoubleSmallJsonGT);
  58459   SUITE_ADD_TEST(suite, setTopSmallIntSmallJsonGT);
  58460   SUITE_ADD_TEST(suite, setTopSmallJsonSmallJsonGT);
  58461   SUITE_ADD_TEST(suite, setTopSmallStringSmallJsonGT);
  58462   SUITE_ADD_TEST(suite, setTopNFreeSmallJsonGT);
  58463   SUITE_ADD_TEST(suite, setTopNFreeBoolSmallJsonGT);
  58464   SUITE_ADD_TEST(suite, setTopNFreeDoubleSmallJsonGT);
  58465   SUITE_ADD_TEST(suite, setTopNFreeIntSmallJsonGT);
  58466   SUITE_ADD_TEST(suite, setTopNFreeStringSmallJsonGT);
  58467   SUITE_ADD_TEST(suite, setTopNFreeDictSmallJsonGT);
  58468   SUITE_ADD_TEST(suite, setTopNFreeArraySmallJsonGT);
  58469   SUITE_ADD_TEST(suite, setTopNFreeArraycSmallJsonGT);
  58470   SUITE_ADD_TEST(suite, setTopNFreeSmallBoolSmallJsonGT);
  58471   SUITE_ADD_TEST(suite, setTopNFreeSmallDoubleSmallJsonGT);
  58472   SUITE_ADD_TEST(suite, setTopNFreeSmallIntSmallJsonGT);
  58473   SUITE_ADD_TEST(suite, setTopNFreeSmallJsonSmallJsonGT);
  58474   SUITE_ADD_TEST(suite, setTopNFreeSmallStringSmallJsonGT);
  58475   SUITE_ADD_TEST(suite, fromArraySmallJsonGT);
  58476   SUITE_ADD_TEST(suite, fromCArraySmallJsonGT);
  58477   SUITE_ADD_TEST(suite, getTopSmallJsonGT);
  58478   SUITE_ADD_TEST(suite, getTopUndefinedSmallJsonGT);
  58479   SUITE_ADD_TEST(suite, getTopBoolSmallJsonGT);
  58480   SUITE_ADD_TEST(suite, getTopBoolPSmallJsonGT);
  58481   SUITE_ADD_TEST(suite, getTopDoubleSmallJsonGT);
  58482   SUITE_ADD_TEST(suite, getTopDoublePSmallJsonGT);
  58483   SUITE_ADD_TEST(suite, getTopIntSmallJsonGT);
  58484   SUITE_ADD_TEST(suite, getTopIntPSmallJsonGT);
  58485   SUITE_ADD_TEST(suite, getTopInt32SmallJsonGT);
  58486   SUITE_ADD_TEST(suite, getTopInt32PSmallJsonGT);
  58487   SUITE_ADD_TEST(suite, getTopUintSmallJsonGT);
  58488   SUITE_ADD_TEST(suite, getTopUintPSmallJsonGT);
  58489   SUITE_ADD_TEST(suite, getTopUint32SmallJsonGT);
  58490   SUITE_ADD_TEST(suite, getTopUint32PSmallJsonGT);
  58491   SUITE_ADD_TEST(suite, getTopSSmallJsonGT);
  58492   SUITE_ADD_TEST(suite, getTopDictSmallJsonGT);
  58493   SUITE_ADD_TEST(suite, getTopArraySmallJsonGT);
  58494   SUITE_ADD_TEST(suite, getTopSmallBoolSmallJsonGT);
  58495   SUITE_ADD_TEST(suite, getTopSmallDoubleSmallJsonGT);
  58496   SUITE_ADD_TEST(suite, getTopSmallIntSmallJsonGT);
  58497   SUITE_ADD_TEST(suite, getTopSmallStringSmallJsonGT);
  58498   SUITE_ADD_TEST(suite, pushSmallJsonGT);
  58499   SUITE_ADD_TEST(suite, pushUndefinedSmallJsonGT);
  58500   SUITE_ADD_TEST(suite, pushBoolSmallJsonGT);
  58501   SUITE_ADD_TEST(suite, pushDoubleSmallJsonGT);
  58502   SUITE_ADD_TEST(suite, pushIntSmallJsonGT);
  58503   SUITE_ADD_TEST(suite, pushSSmallJsonGT);
  58504   SUITE_ADD_TEST(suite, pushCharSmallJsonGT);
  58505   SUITE_ADD_TEST(suite, pushDictSmallJsonGT);
  58506   SUITE_ADD_TEST(suite, pushArraySmallJsonGT);
  58507   SUITE_ADD_TEST(suite, pushArraycSmallJsonGT);
  58508   SUITE_ADD_TEST(suite, pushCArraycSmallJsonGT);
  58509   SUITE_ADD_TEST(suite, pushVoidSmallJsonGT);
  58510   SUITE_ADD_TEST(suite, pushSmallBoolSmallJsonGT);
  58511   SUITE_ADD_TEST(suite, pushSmallBytesSmallJsonGT);
  58512   SUITE_ADD_TEST(suite, pushSmallDoubleSmallJsonGT);
  58513   SUITE_ADD_TEST(suite, pushSmallIntSmallJsonGT);
  58514   SUITE_ADD_TEST(suite, pushSmallJsonSmallJsonGT);
  58515   SUITE_ADD_TEST(suite, pushSmallStringSmallJsonGT);
  58516   SUITE_ADD_TEST(suite, pushSmallContainerSmallJsonGT);
  58517   SUITE_ADD_TEST(suite, pushNFreeSmallJsonGT);
  58518   SUITE_ADD_TEST(suite, pushNFreeUndefinedSmallJsonGT);
  58519   SUITE_ADD_TEST(suite, pushNFreeSSmallJsonGT);
  58520   SUITE_ADD_TEST(suite, pushNFreeDictSmallJsonGT);
  58521   SUITE_ADD_TEST(suite, pushNFreeArraySmallJsonGT);
  58522   SUITE_ADD_TEST(suite, pushNFreeArraycSmallJsonGT);
  58523   SUITE_ADD_TEST(suite, pushNFreeSmallBoolSmallJsonGT);
  58524   SUITE_ADD_TEST(suite, pushNFreeSmallBytesSmallJsonGT);
  58525   SUITE_ADD_TEST(suite, pushNFreeSmallDoubleSmallJsonGT);
  58526   SUITE_ADD_TEST(suite, pushNFreeSmallIntSmallJsonGT);
  58527   SUITE_ADD_TEST(suite, pushNFreeSmallJsonSmallJsonGT);
  58528   SUITE_ADD_TEST(suite, pushNFreeSmallStringSmallJsonGT);
  58529   SUITE_ADD_TEST(suite, pushNFreeSmallContainerSmallJsonGT);
  58530   SUITE_ADD_TEST(suite, popSmallJsonGT);
  58531   SUITE_ADD_TEST(suite, popUndefinedSmallJsonGT);
  58532   SUITE_ADD_TEST(suite, popBoolSmallJsonGT);
  58533   SUITE_ADD_TEST(suite, popDoubleSmallJsonGT);
  58534   SUITE_ADD_TEST(suite, popIntSmallJsonGT);
  58535   SUITE_ADD_TEST(suite, popInt32SmallJsonGT);
  58536   SUITE_ADD_TEST(suite, popUintSmallJsonGT);
  58537   SUITE_ADD_TEST(suite, popUint32SmallJsonGT);
  58538   SUITE_ADD_TEST(suite, popSSmallJsonGT);
  58539   SUITE_ADD_TEST(suite, popDictSmallJsonGT);
  58540   SUITE_ADD_TEST(suite, popArraySmallJsonGT);
  58541   SUITE_ADD_TEST(suite, popSmallBoolSmallJsonGT);
  58542   SUITE_ADD_TEST(suite, popSmallBytesSmallJsonGT);
  58543   SUITE_ADD_TEST(suite, popSmallDoubleSmallJsonGT);
  58544   SUITE_ADD_TEST(suite, popSmallIntSmallJsonGT);
  58545   SUITE_ADD_TEST(suite, popSmallJsonSmallJsonGT);
  58546   SUITE_ADD_TEST(suite, popSmallStringSmallJsonGT);
  58547   SUITE_ADD_TEST(suite, popVoidSmallJsonGT);
  58548   SUITE_ADD_TEST(suite, popSmallContainerSmallJsonGT);
  58549   SUITE_ADD_TEST(suite, setSmallJsonGT);
  58550   SUITE_ADD_TEST(suite, setUndefinedSmallJsonGT);
  58551   SUITE_ADD_TEST(suite, setBoolSmallJsonGT);
  58552   SUITE_ADD_TEST(suite, setDoubleSmallJsonGT);
  58553   SUITE_ADD_TEST(suite, setIntSmallJsonGT);
  58554   SUITE_ADD_TEST(suite, setSSmallJsonGT);
  58555   SUITE_ADD_TEST(suite, setCharSmallJsonGT);
  58556   SUITE_ADD_TEST(suite, setDictSmallJsonGT);
  58557   SUITE_ADD_TEST(suite, setArraySmallJsonGT);
  58558   SUITE_ADD_TEST(suite, setArraycSmallJsonGT);
  58559   SUITE_ADD_TEST(suite, setCArraycSmallJsonGT);
  58560   SUITE_ADD_TEST(suite, setVoidSmallJsonGT);
  58561   SUITE_ADD_TEST(suite, setSmallBoolSmallJsonGT);
  58562   SUITE_ADD_TEST(suite, setSmallBytesSmallJsonGT);
  58563   SUITE_ADD_TEST(suite, setSmallDoubleSmallJsonGT);
  58564   SUITE_ADD_TEST(suite, setSmallIntSmallJsonGT);
  58565   SUITE_ADD_TEST(suite, setSmallJsonSmallJsonGT);
  58566   SUITE_ADD_TEST(suite, setSmallStringSmallJsonGT);
  58567   SUITE_ADD_TEST(suite, setSmallContainerSmallJsonGT);
  58568   SUITE_ADD_TEST(suite, setNFreeSmallJsonGT);
  58569   SUITE_ADD_TEST(suite, setNFreeUndefinedSmallJsonGT);
  58570   SUITE_ADD_TEST(suite, setNFreeSSmallJsonGT);
  58571   SUITE_ADD_TEST(suite, setNFreeDictSmallJsonGT);
  58572   SUITE_ADD_TEST(suite, setNFreeArraySmallJsonGT);
  58573   SUITE_ADD_TEST(suite, setNFreeArraycSmallJsonGT);
  58574   SUITE_ADD_TEST(suite, setNFreeSmallBoolSmallJsonGT);
  58575   SUITE_ADD_TEST(suite, setNFreeSmallBytesSmallJsonGT);
  58576   SUITE_ADD_TEST(suite, setNFreeSmallDoubleSmallJsonGT);
  58577   SUITE_ADD_TEST(suite, setNFreeSmallIntSmallJsonGT);
  58578   SUITE_ADD_TEST(suite, setNFreeSmallJsonSmallJsonGT);
  58579   SUITE_ADD_TEST(suite, setNFreeSmallStringSmallJsonGT);
  58580   SUITE_ADD_TEST(suite, setNFreeSmallContainerSmallJsonGT);
  58581   SUITE_ADD_TEST(suite, setPDictSmallJsonGT);
  58582   SUITE_ADD_TEST(suite, setPArraySmallJsonGT);
  58583   SUITE_ADD_TEST(suite, setPSmallJsonSmallJsonGT);
  58584   SUITE_ADD_TEST(suite, setPSmallStringSmallJsonGT);
  58585   SUITE_ADD_TEST(suite, setNFreePDictSmallJsonGT);
  58586   SUITE_ADD_TEST(suite, setNFreePArraySmallJsonGT);
  58587   SUITE_ADD_TEST(suite, setNFreePSmallJsonSmallJsonGT);
  58588   SUITE_ADD_TEST(suite, setNFreePSmallStringSmallJsonGT);
  58589   SUITE_ADD_TEST(suite, setAtSmallJsonGT);
  58590   SUITE_ADD_TEST(suite, setAtUndefinedSmallJsonGT);
  58591   SUITE_ADD_TEST(suite, setAtBoolSmallJsonGT);
  58592   SUITE_ADD_TEST(suite, setAtDoubleSmallJsonGT);
  58593   SUITE_ADD_TEST(suite, setAtIntSmallJsonGT);
  58594   SUITE_ADD_TEST(suite, setAtSSmallJsonGT);
  58595   SUITE_ADD_TEST(suite, setAtCharSmallJsonGT);
  58596   SUITE_ADD_TEST(suite, setAtDictSmallJsonGT);
  58597   SUITE_ADD_TEST(suite, setAtArraySmallJsonGT);
  58598   SUITE_ADD_TEST(suite, setAtArraycSmallJsonGT);
  58599   SUITE_ADD_TEST(suite, setAtCArraycSmallJsonGT);
  58600   SUITE_ADD_TEST(suite, setAtVoidSmallJsonGT);
  58601   SUITE_ADD_TEST(suite, setAtSmallBoolSmallJsonGT);
  58602   SUITE_ADD_TEST(suite, setAtSmallBytesSmallJsonGT);
  58603   SUITE_ADD_TEST(suite, setAtSmallDoubleSmallJsonGT);
  58604   SUITE_ADD_TEST(suite, setAtSmallIntSmallJsonGT);
  58605   SUITE_ADD_TEST(suite, setAtSmallJsonSmallJsonGT);
  58606   SUITE_ADD_TEST(suite, setAtSmallStringSmallJsonGT);
  58607   SUITE_ADD_TEST(suite, setAtSmallContainerSmallJsonGT);
  58608   SUITE_ADD_TEST(suite, setAtNFreeSmallJsonGT);
  58609   SUITE_ADD_TEST(suite, setAtNFreeUndefinedSmallJsonGT);
  58610   SUITE_ADD_TEST(suite, setAtNFreeSSmallJsonGT);
  58611   SUITE_ADD_TEST(suite, setAtNFreeDictSmallJsonGT);
  58612   SUITE_ADD_TEST(suite, setAtNFreeArraySmallJsonGT);
  58613   SUITE_ADD_TEST(suite, setAtNFreeArraycSmallJsonGT);
  58614   SUITE_ADD_TEST(suite, setAtNFreeSmallBoolSmallJsonGT);
  58615   SUITE_ADD_TEST(suite, setAtNFreeSmallBytesSmallJsonGT);
  58616   SUITE_ADD_TEST(suite, setAtNFreeSmallDoubleSmallJsonGT);
  58617   SUITE_ADD_TEST(suite, setAtNFreeSmallIntSmallJsonGT);
  58618   SUITE_ADD_TEST(suite, setAtNFreeSmallJsonSmallJsonGT);
  58619   SUITE_ADD_TEST(suite, setAtNFreeSmallStringSmallJsonGT);
  58620   SUITE_ADD_TEST(suite, setAtNFreeSmallContainerSmallJsonGT);
  58621   SUITE_ADD_TEST(suite, setPAtDictSmallJsonGT);
  58622   SUITE_ADD_TEST(suite, setPAtArraySmallJsonGT);
  58623   SUITE_ADD_TEST(suite, setPAtSmallJsonSmallJsonGT);
  58624   SUITE_ADD_TEST(suite, setPAtSmallStringSmallJsonGT);
  58625   SUITE_ADD_TEST(suite, setPAtNFreeDictSmallJsonGT);
  58626   SUITE_ADD_TEST(suite, setPAtNFreeArraySmallJsonGT);
  58627   SUITE_ADD_TEST(suite, setPAtNFreeSmallJsonSmallJsonGT);
  58628   SUITE_ADD_TEST(suite, setPAtNFreeSmallStringSmallJsonGT);
  58629   SUITE_ADD_TEST(suite, getSmallJsonGT);
  58630   SUITE_ADD_TEST(suite, getUndefinedSmallJsonGT);
  58631   SUITE_ADD_TEST(suite, getBoolSmallJsonGT);
  58632   SUITE_ADD_TEST(suite, getBoolPSmallJsonGT);
  58633   SUITE_ADD_TEST(suite, getDoubleSmallJsonGT);
  58634   SUITE_ADD_TEST(suite, getDoublePSmallJsonGT);
  58635   SUITE_ADD_TEST(suite, getIntSmallJsonGT);
  58636   SUITE_ADD_TEST(suite, getIntPSmallJsonGT);
  58637   SUITE_ADD_TEST(suite, getInt32SmallJsonGT);
  58638   SUITE_ADD_TEST(suite, getInt32PSmallJsonGT);
  58639   SUITE_ADD_TEST(suite, getUintSmallJsonGT);
  58640   SUITE_ADD_TEST(suite, getUintPSmallJsonGT);
  58641   SUITE_ADD_TEST(suite, getUint32SmallJsonGT);
  58642   SUITE_ADD_TEST(suite, getUint32PSmallJsonGT);
  58643   SUITE_ADD_TEST(suite, getSSmallJsonGT);
  58644   SUITE_ADD_TEST(suite, getDictSmallJsonGT);
  58645   SUITE_ADD_TEST(suite, getArraySmallJsonGT);
  58646   SUITE_ADD_TEST(suite, getSmallBoolSmallJsonGT);
  58647   SUITE_ADD_TEST(suite, getSmallBytesSmallJsonGT);
  58648   SUITE_ADD_TEST(suite, getSmallDoubleSmallJsonGT);
  58649   SUITE_ADD_TEST(suite, getSmallIntSmallJsonGT);
  58650   SUITE_ADD_TEST(suite, getSmallJsonSmallJsonGT);
  58651   SUITE_ADD_TEST(suite, getSmallStringSmallJsonGT);
  58652   SUITE_ADD_TEST(suite, getVoidSmallJsonGT);
  58653   SUITE_ADD_TEST(suite, getSmallContainerSmallJsonGT);
  58654   SUITE_ADD_TEST(suite, getNDupSmallJsonGT);
  58655   SUITE_ADD_TEST(suite, getNDupUndefinedSmallJsonGT);
  58656   SUITE_ADD_TEST(suite, getNDupBoolSmallJsonGT);
  58657   SUITE_ADD_TEST(suite, getNDupDoubleSmallJsonGT);
  58658   SUITE_ADD_TEST(suite, getNDupIntSmallJsonGT);
  58659   SUITE_ADD_TEST(suite, getNDupInt32SmallJsonGT);
  58660   SUITE_ADD_TEST(suite, getNDupUintSmallJsonGT);
  58661   SUITE_ADD_TEST(suite, getNDupUint32SmallJsonGT);
  58662   SUITE_ADD_TEST(suite, getNDupSSmallJsonGT);
  58663   SUITE_ADD_TEST(suite, getNDupDictSmallJsonGT);
  58664   SUITE_ADD_TEST(suite, getNDupArraySmallJsonGT);
  58665   SUITE_ADD_TEST(suite, getNDupSmallBoolSmallJsonGT);
  58666   SUITE_ADD_TEST(suite, getNDupSmallBytesSmallJsonGT);
  58667   SUITE_ADD_TEST(suite, getNDupSmallDoubleSmallJsonGT);
  58668   SUITE_ADD_TEST(suite, getNDupSmallIntSmallJsonGT);
  58669   SUITE_ADD_TEST(suite, getNDupSmallJsonSmallJsonGT);
  58670   SUITE_ADD_TEST(suite, getNDupSmallStringSmallJsonGT);
  58671   SUITE_ADD_TEST(suite, getNDupVoidSmallJsonGT);
  58672   SUITE_ADD_TEST(suite, getNDupSmallContainerSmallJsonGT);
  58673   SUITE_ADD_TEST(suite, getAtSmallJsonGT);
  58674   SUITE_ADD_TEST(suite, getAtUndefinedSmallJsonGT);
  58675   SUITE_ADD_TEST(suite, getAtBoolSmallJsonGT);
  58676   SUITE_ADD_TEST(suite, getAtBoolPSmallJsonGT);
  58677   SUITE_ADD_TEST(suite, getAtDoubleSmallJsonGT);
  58678   SUITE_ADD_TEST(suite, getAtDoublePSmallJsonGT);
  58679   SUITE_ADD_TEST(suite, getAtIntSmallJsonGT);
  58680   SUITE_ADD_TEST(suite, getAtIntPSmallJsonGT);
  58681   SUITE_ADD_TEST(suite, getAtInt32SmallJsonGT);
  58682   SUITE_ADD_TEST(suite, getAtInt32PSmallJsonGT);
  58683   SUITE_ADD_TEST(suite, getAtUintSmallJsonGT);
  58684   SUITE_ADD_TEST(suite, getAtUintPSmallJsonGT);
  58685   SUITE_ADD_TEST(suite, getAtUint32SmallJsonGT);
  58686   SUITE_ADD_TEST(suite, getAtUint32PSmallJsonGT);
  58687   SUITE_ADD_TEST(suite, getAtSSmallJsonGT);
  58688   SUITE_ADD_TEST(suite, getAtDictSmallJsonGT);
  58689   SUITE_ADD_TEST(suite, getAtArraySmallJsonGT);
  58690   SUITE_ADD_TEST(suite, getAtSmallBoolSmallJsonGT);
  58691   SUITE_ADD_TEST(suite, getAtSmallBytesSmallJsonGT);
  58692   SUITE_ADD_TEST(suite, getAtSmallDoubleSmallJsonGT);
  58693   SUITE_ADD_TEST(suite, getAtSmallIntSmallJsonGT);
  58694   SUITE_ADD_TEST(suite, getAtSmallJsonSmallJsonGT);
  58695   SUITE_ADD_TEST(suite, getAtSmallStringSmallJsonGT);
  58696   SUITE_ADD_TEST(suite, getAtVoidSmallJsonGT);
  58697   SUITE_ADD_TEST(suite, getAtSmallContainerSmallJsonGT);
  58698   SUITE_ADD_TEST(suite, getAtNDupSmallJsonGT);
  58699   SUITE_ADD_TEST(suite, getAtNDupUndefinedSmallJsonGT);
  58700   SUITE_ADD_TEST(suite, getAtNDupBoolSmallJsonGT);
  58701   SUITE_ADD_TEST(suite, getAtNDupDoubleSmallJsonGT);
  58702   SUITE_ADD_TEST(suite, getAtNDupIntSmallJsonGT);
  58703   SUITE_ADD_TEST(suite, getAtNDupInt32SmallJsonGT);
  58704   SUITE_ADD_TEST(suite, getAtNDupUintSmallJsonGT);
  58705   SUITE_ADD_TEST(suite, getAtNDupUint32SmallJsonGT);
  58706   SUITE_ADD_TEST(suite, getAtNDupSSmallJsonGT);
  58707   SUITE_ADD_TEST(suite, getAtNDupDictSmallJsonGT);
  58708   SUITE_ADD_TEST(suite, getAtNDupArraySmallJsonGT);
  58709   SUITE_ADD_TEST(suite, getAtNDupSmallBoolSmallJsonGT);
  58710   SUITE_ADD_TEST(suite, getAtNDupSmallBytesSmallJsonGT);
  58711   SUITE_ADD_TEST(suite, getAtNDupSmallDoubleSmallJsonGT);
  58712   SUITE_ADD_TEST(suite, getAtNDupSmallIntSmallJsonGT);
  58713   SUITE_ADD_TEST(suite, getAtNDupSmallJsonSmallJsonGT);
  58714   SUITE_ADD_TEST(suite, getAtNDupSmallStringSmallJsonGT);
  58715   SUITE_ADD_TEST(suite, getAtNDupVoidSmallJsonGT);
  58716   SUITE_ADD_TEST(suite, getAtNDupSmallContainerSmallJsonGT);
  58717   SUITE_ADD_TEST(suite, getNumSmallJsonGT);
  58718   SUITE_ADD_TEST(suite, getNumAtSmallJsonGT);
  58719   SUITE_ADD_TEST(suite, delKeySmallJsonGT);
  58720   SUITE_ADD_TEST(suite, delSmallJsonGT);
  58721   SUITE_ADD_TEST(suite, delElemSmallJsonGT);
  58722   SUITE_ADD_TEST(suite, delElemIndexSmallJsonGT);
  58723   SUITE_ADD_TEST(suite, prependSmallJsonGT);
  58724   SUITE_ADD_TEST(suite, prependUndefinedSmallJsonGT);
  58725   SUITE_ADD_TEST(suite, prependBoolSmallJsonGT);
  58726   SUITE_ADD_TEST(suite, prependDoubleSmallJsonGT);
  58727   SUITE_ADD_TEST(suite, prependIntSmallJsonGT);
  58728   SUITE_ADD_TEST(suite, prependSSmallJsonGT);
  58729   SUITE_ADD_TEST(suite, prependCharSmallJsonGT);
  58730   SUITE_ADD_TEST(suite, prependDictSmallJsonGT);
  58731   SUITE_ADD_TEST(suite, prependArraySmallJsonGT);
  58732   SUITE_ADD_TEST(suite, prependArraycSmallJsonGT);
  58733   SUITE_ADD_TEST(suite, prependCArraycSmallJsonGT);
  58734   SUITE_ADD_TEST(suite, prependVoidSmallJsonGT);
  58735   SUITE_ADD_TEST(suite, prependSmallBoolSmallJsonGT);
  58736   SUITE_ADD_TEST(suite, prependSmallBytesSmallJsonGT);
  58737   SUITE_ADD_TEST(suite, prependSmallDoubleSmallJsonGT);
  58738   SUITE_ADD_TEST(suite, prependSmallIntSmallJsonGT);
  58739   SUITE_ADD_TEST(suite, prependSmallJsonSmallJsonGT);
  58740   SUITE_ADD_TEST(suite, prependSmallStringSmallJsonGT);
  58741   SUITE_ADD_TEST(suite, prependSmallContainerSmallJsonGT);
  58742   SUITE_ADD_TEST(suite, prependNFreeSmallJsonGT);
  58743   SUITE_ADD_TEST(suite, prependNFreeUndefinedSmallJsonGT);
  58744   SUITE_ADD_TEST(suite, prependNFreeSSmallJsonGT);
  58745   SUITE_ADD_TEST(suite, prependNFreeDictSmallJsonGT);
  58746   SUITE_ADD_TEST(suite, prependNFreeArraySmallJsonGT);
  58747   SUITE_ADD_TEST(suite, prependNFreeArraycSmallJsonGT);
  58748   SUITE_ADD_TEST(suite, prependNFreeSmallBoolSmallJsonGT);
  58749   SUITE_ADD_TEST(suite, prependNFreeSmallBytesSmallJsonGT);
  58750   SUITE_ADD_TEST(suite, prependNFreeSmallDoubleSmallJsonGT);
  58751   SUITE_ADD_TEST(suite, prependNFreeSmallIntSmallJsonGT);
  58752   SUITE_ADD_TEST(suite, prependNFreeSmallJsonSmallJsonGT);
  58753   SUITE_ADD_TEST(suite, prependNFreeSmallStringSmallJsonGT);
  58754   SUITE_ADD_TEST(suite, prependNFreeSmallContainerSmallJsonGT);
  58755   SUITE_ADD_TEST(suite, dequeueSmallJsonGT);
  58756   SUITE_ADD_TEST(suite, dequeueUndefinedSmallJsonGT);
  58757   SUITE_ADD_TEST(suite, dequeueBoolSmallJsonGT);
  58758   SUITE_ADD_TEST(suite, dequeueDoubleSmallJsonGT);
  58759   SUITE_ADD_TEST(suite, dequeueIntSmallJsonGT);
  58760   SUITE_ADD_TEST(suite, dequeueInt32SmallJsonGT);
  58761   SUITE_ADD_TEST(suite, dequeueUintSmallJsonGT);
  58762   SUITE_ADD_TEST(suite, dequeueUint32SmallJsonGT);
  58763   SUITE_ADD_TEST(suite, dequeueSSmallJsonGT);
  58764   SUITE_ADD_TEST(suite, dequeueDictSmallJsonGT);
  58765   SUITE_ADD_TEST(suite, dequeueArraySmallJsonGT);
  58766   SUITE_ADD_TEST(suite, dequeueSmallBoolSmallJsonGT);
  58767   SUITE_ADD_TEST(suite, dequeueSmallBytesSmallJsonGT);
  58768   SUITE_ADD_TEST(suite, dequeueSmallDoubleSmallJsonGT);
  58769   SUITE_ADD_TEST(suite, dequeueSmallIntSmallJsonGT);
  58770   SUITE_ADD_TEST(suite, dequeueSmallJsonSmallJsonGT);
  58771   SUITE_ADD_TEST(suite, dequeueSmallStringSmallJsonGT);
  58772   SUITE_ADD_TEST(suite, dequeueVoidSmallJsonGT);
  58773   SUITE_ADD_TEST(suite, dequeueSmallContainerSmallJsonGT);
  58774   SUITE_ADD_TEST(suite, reverseSmallJsonGT);
  58775   SUITE_ADD_TEST(suite, mergeDictSmallJsonGT);
  58776   SUITE_ADD_TEST(suite, mergeDictNSmashSmallJsonGT);
  58777   SUITE_ADD_TEST(suite, mergeSmallJsonGT);
  58778   SUITE_ADD_TEST(suite, mergeNSmashSmallJsonGT);
  58779   SUITE_ADD_TEST(suite, appendSmallJsonGT);
  58780   SUITE_ADD_TEST(suite, appendNSmashSmallJsonGT);
  58781   SUITE_ADD_TEST(suite, appendArraySmallJsonGT);
  58782   SUITE_ADD_TEST(suite, appendNSmashArraySmallJsonGT);
  58783   SUITE_ADD_TEST(suite, appendCArraySmallJsonGT);
  58784   SUITE_ADD_TEST(suite, shiftSmallJsonGT);
  58785   SUITE_ADD_TEST(suite, shiftNSmashSmallJsonGT);
  58786   SUITE_ADD_TEST(suite, shiftSmallJsonSmallJsonGT);
  58787   SUITE_ADD_TEST(suite, shiftNSmashSmallJsonSmallJsonGT);
  58788   SUITE_ADD_TEST(suite, addSmallJsonGT);
  58789   SUITE_ADD_TEST(suite, addJsonSmallJsonGT);
  58790   SUITE_ADD_TEST(suite, sliceSmallJsonGT);
  58791   SUITE_ADD_TEST(suite, cropSmallJsonGT);
  58792   SUITE_ADD_TEST(suite, cropSSmallJsonGT);
  58793   SUITE_ADD_TEST(suite, cropSmallStringSmallJsonGT);
  58794   SUITE_ADD_TEST(suite, cropElemAtSmallJsonGT);
  58795   SUITE_ADD_TEST(suite, cropElemAtUndefinedSmallJsonGT);
  58796   SUITE_ADD_TEST(suite, cropElemAtBoolSmallJsonGT);
  58797   SUITE_ADD_TEST(suite, cropElemAtDoubleSmallJsonGT);
  58798   SUITE_ADD_TEST(suite, cropElemAtIntSmallJsonGT);
  58799   SUITE_ADD_TEST(suite, cropElemAtInt32SmallJsonGT);
  58800   SUITE_ADD_TEST(suite, cropElemAtUintSmallJsonGT);
  58801   SUITE_ADD_TEST(suite, cropElemAtUint32SmallJsonGT);
  58802   SUITE_ADD_TEST(suite, cropElemAtSSmallJsonGT);
  58803   SUITE_ADD_TEST(suite, cropElemAtCharSmallJsonGT);
  58804   SUITE_ADD_TEST(suite, cropElemAtDictSmallJsonGT);
  58805   SUITE_ADD_TEST(suite, cropElemAtArraySmallJsonGT);
  58806   SUITE_ADD_TEST(suite, cropElemAtSmallBoolSmallJsonGT);
  58807   SUITE_ADD_TEST(suite, cropElemAtSmallBytesSmallJsonGT);
  58808   SUITE_ADD_TEST(suite, cropElemAtSmallDoubleSmallJsonGT);
  58809   SUITE_ADD_TEST(suite, cropElemAtSmallIntSmallJsonGT);
  58810   SUITE_ADD_TEST(suite, cropElemAtSmallJsonSmallJsonGT);
  58811   SUITE_ADD_TEST(suite, cropElemAtSmallStringSmallJsonGT);
  58812   SUITE_ADD_TEST(suite, cropElemAtVoidSmallJsonGT);
  58813   SUITE_ADD_TEST(suite, cropElemAtSmallContainerSmallJsonGT);
  58814   SUITE_ADD_TEST(suite, cropElemKeySmallJsonGT);
  58815   SUITE_ADD_TEST(suite, cropElemKeyUndefinedSmallJsonGT);
  58816   SUITE_ADD_TEST(suite, cropElemKeyBoolSmallJsonGT);
  58817   SUITE_ADD_TEST(suite, cropElemKeyDoubleSmallJsonGT);
  58818   SUITE_ADD_TEST(suite, cropElemKeyIntSmallJsonGT);
  58819   SUITE_ADD_TEST(suite, cropElemKeyInt32SmallJsonGT);
  58820   SUITE_ADD_TEST(suite, cropElemKeyUintSmallJsonGT);
  58821   SUITE_ADD_TEST(suite, cropElemKeyUint32SmallJsonGT);
  58822   SUITE_ADD_TEST(suite, cropElemKeySSmallJsonGT);
  58823   SUITE_ADD_TEST(suite, cropElemKeyDictSmallJsonGT);
  58824   SUITE_ADD_TEST(suite, cropElemKeyArraySmallJsonGT);
  58825   SUITE_ADD_TEST(suite, cropElemKeySmallBoolSmallJsonGT);
  58826   SUITE_ADD_TEST(suite, cropElemKeySmallBytesSmallJsonGT);
  58827   SUITE_ADD_TEST(suite, cropElemKeySmallDoubleSmallJsonGT);
  58828   SUITE_ADD_TEST(suite, cropElemKeySmallIntSmallJsonGT);
  58829   SUITE_ADD_TEST(suite, cropElemKeySmallJsonSmallJsonGT);
  58830   SUITE_ADD_TEST(suite, cropElemKeySmallStringSmallJsonGT);
  58831   SUITE_ADD_TEST(suite, cropElemKeyVoidSmallJsonGT);
  58832   SUITE_ADD_TEST(suite, cropElemKeySmallContainerSmallJsonGT);
  58833   SUITE_ADD_TEST(suite, copySmallJsonGT);
  58834   SUITE_ADD_TEST(suite, insertSmallJsonGT);
  58835   SUITE_ADD_TEST(suite, insertNSmashSmallJsonGT);
  58836   SUITE_ADD_TEST(suite, insertSmallJsonSmallJsonGT);
  58837   SUITE_ADD_TEST(suite, insertNSmashSmallJsonSmallJsonGT);
  58838   SUITE_ADD_TEST(suite, insertStringSmallJsonGT);
  58839   SUITE_ADD_TEST(suite, insertSSmallJsonGT);
  58840   SUITE_ADD_TEST(suite, insertNFreeSmallJsonGT);
  58841   SUITE_ADD_TEST(suite, insertSNFreeStringSmallJsonGT);
  58842   SUITE_ADD_TEST(suite, injectSmallJsonGT);
  58843   SUITE_ADD_TEST(suite, injectUndefinedSmallJsonGT);
  58844   SUITE_ADD_TEST(suite, injectBoolSmallJsonGT);
  58845   SUITE_ADD_TEST(suite, injectDoubleSmallJsonGT);
  58846   SUITE_ADD_TEST(suite, injectIntSmallJsonGT);
  58847   SUITE_ADD_TEST(suite, injectSSmallJsonGT);
  58848   SUITE_ADD_TEST(suite, injectCharSmallJsonGT);
  58849   SUITE_ADD_TEST(suite, injectDictSmallJsonGT);
  58850   SUITE_ADD_TEST(suite, injectArraySmallJsonGT);
  58851   SUITE_ADD_TEST(suite, injectArraycSmallJsonGT);
  58852   SUITE_ADD_TEST(suite, injectCArraycSmallJsonGT);
  58853   SUITE_ADD_TEST(suite, injectVoidSmallJsonGT);
  58854   SUITE_ADD_TEST(suite, injectSmallBoolSmallJsonGT);
  58855   SUITE_ADD_TEST(suite, injectSmallBytesSmallJsonGT);
  58856   SUITE_ADD_TEST(suite, injectSmallDoubleSmallJsonGT);
  58857   SUITE_ADD_TEST(suite, injectSmallIntSmallJsonGT);
  58858   SUITE_ADD_TEST(suite, injectSmallJsonSmallJsonGT);
  58859   SUITE_ADD_TEST(suite, injectSmallStringSmallJsonGT);
  58860   SUITE_ADD_TEST(suite, injectSmallContainerSmallJsonGT);
  58861   SUITE_ADD_TEST(suite, injectNFreeSmallJsonGT);
  58862   SUITE_ADD_TEST(suite, injectNFreeUndefinedSmallJsonGT);
  58863   SUITE_ADD_TEST(suite, injectNFreeSSmallJsonGT);
  58864   SUITE_ADD_TEST(suite, injectNFreeDictSmallJsonGT);
  58865   SUITE_ADD_TEST(suite, injectNFreeArraySmallJsonGT);
  58866   SUITE_ADD_TEST(suite, injectNFreeArraycSmallJsonGT);
  58867   SUITE_ADD_TEST(suite, injectNFreeSmallBoolSmallJsonGT);
  58868   SUITE_ADD_TEST(suite, injectNFreeSmallBytesSmallJsonGT);
  58869   SUITE_ADD_TEST(suite, injectNFreeSmallDoubleSmallJsonGT);
  58870   SUITE_ADD_TEST(suite, injectNFreeSmallIntSmallJsonGT);
  58871   SUITE_ADD_TEST(suite, injectNFreeSmallJsonSmallJsonGT);
  58872   SUITE_ADD_TEST(suite, injectNFreeSmallStringSmallJsonGT);
  58873   SUITE_ADD_TEST(suite, injectNFreeSmallContainerSmallJsonGT);
  58874   SUITE_ADD_TEST(suite, uniqSmallJsonGT);
  58875   SUITE_ADD_TEST(suite, sortSmallJsonGT);
  58876   SUITE_ADD_TEST(suite, sortFSmallJsonGT);
  58877   SUITE_ADD_TEST(suite, icSortSmallJsonGT);
  58878   SUITE_ADD_TEST(suite, icUniqSmallJsonGT);
  58879   SUITE_ADD_TEST(suite, hasSmallJsonGT);
  58880   SUITE_ADD_TEST(suite, hasUndefinedSmallJsonGT);
  58881   SUITE_ADD_TEST(suite, hasBoolSmallJsonGT);
  58882   SUITE_ADD_TEST(suite, hasDoubleSmallJsonGT);
  58883   SUITE_ADD_TEST(suite, hasIntSmallJsonGT);
  58884   SUITE_ADD_TEST(suite, hasSSmallJsonGT);
  58885   SUITE_ADD_TEST(suite, hasCharSmallJsonGT);
  58886   SUITE_ADD_TEST(suite, hasDictSmallJsonGT);
  58887   SUITE_ADD_TEST(suite, hasArraySmallJsonGT);
  58888   SUITE_ADD_TEST(suite, hasArraycSmallJsonGT);
  58889   SUITE_ADD_TEST(suite, hasCArraycSmallJsonGT);
  58890   SUITE_ADD_TEST(suite, hasSmallBoolSmallJsonGT);
  58891   SUITE_ADD_TEST(suite, hasSmallBytesSmallJsonGT);
  58892   SUITE_ADD_TEST(suite, hasSmallDoubleSmallJsonGT);
  58893   SUITE_ADD_TEST(suite, hasSmallIntSmallJsonGT);
  58894   SUITE_ADD_TEST(suite, hasSmallJsonSmallJsonGT);
  58895   SUITE_ADD_TEST(suite, hasSmallStringSmallJsonGT);
  58896   SUITE_ADD_TEST(suite, hasSmallContainerSmallJsonGT);
  58897   SUITE_ADD_TEST(suite, findSmallJsonGT);
  58898   SUITE_ADD_TEST(suite, findCharSmallJsonGT);
  58899   SUITE_ADD_TEST(suite, findSmallStringSmallJsonGT);
  58900   SUITE_ADD_TEST(suite, findJsonSmallJsonGT);
  58901   SUITE_ADD_TEST(suite, indexOfSmallJsonGT);
  58902   SUITE_ADD_TEST(suite, indexOfUndefinedSmallJsonGT);
  58903   SUITE_ADD_TEST(suite, indexOfBoolSmallJsonGT);
  58904   SUITE_ADD_TEST(suite, indexOfDoubleSmallJsonGT);
  58905   SUITE_ADD_TEST(suite, indexOfIntSmallJsonGT);
  58906   SUITE_ADD_TEST(suite, indexOfSSmallJsonGT);
  58907   SUITE_ADD_TEST(suite, indexOfCharSmallJsonGT);
  58908   SUITE_ADD_TEST(suite, indexOfDictSmallJsonGT);
  58909   SUITE_ADD_TEST(suite, indexOfArraySmallJsonGT);
  58910   SUITE_ADD_TEST(suite, indexOfArraycSmallJsonGT);
  58911   SUITE_ADD_TEST(suite, indexOfCArraycSmallJsonGT);
  58912   SUITE_ADD_TEST(suite, indexOfSmallBoolSmallJsonGT);
  58913   SUITE_ADD_TEST(suite, indexOfSmallBytesSmallJsonGT);
  58914   SUITE_ADD_TEST(suite, indexOfSmallDoubleSmallJsonGT);
  58915   SUITE_ADD_TEST(suite, indexOfSmallIntSmallJsonGT);
  58916   SUITE_ADD_TEST(suite, indexOfSmallJsonSmallJsonGT);
  58917   SUITE_ADD_TEST(suite, indexOfSmallStringSmallJsonGT);
  58918   SUITE_ADD_TEST(suite, indexOfSmallContainerSmallJsonGT);
  58919   SUITE_ADD_TEST(suite, binarySearchSmallJsonGT);
  58920   SUITE_ADD_TEST(suite, binarySearchUndefinedSmallJsonGT);
  58921   SUITE_ADD_TEST(suite, binarySearchBoolSmallJsonGT);
  58922   SUITE_ADD_TEST(suite, binarySearchDoubleSmallJsonGT);
  58923   SUITE_ADD_TEST(suite, binarySearchIntSmallJsonGT);
  58924   SUITE_ADD_TEST(suite, binarySearchSSmallJsonGT);
  58925   SUITE_ADD_TEST(suite, binarySearchCharSmallJsonGT);
  58926   SUITE_ADD_TEST(suite, binarySearchDictSmallJsonGT);
  58927   SUITE_ADD_TEST(suite, binarySearchArraySmallJsonGT);
  58928   SUITE_ADD_TEST(suite, binarySearchArraycSmallJsonGT);
  58929   SUITE_ADD_TEST(suite, binarySearchCArraycSmallJsonGT);
  58930   SUITE_ADD_TEST(suite, binarySearchSmallBoolSmallJsonGT);
  58931   SUITE_ADD_TEST(suite, binarySearchSmallBytesSmallJsonGT);
  58932   SUITE_ADD_TEST(suite, binarySearchSmallDoubleSmallJsonGT);
  58933   SUITE_ADD_TEST(suite, binarySearchSmallIntSmallJsonGT);
  58934   SUITE_ADD_TEST(suite, binarySearchSmallJsonSmallJsonGT);
  58935   SUITE_ADD_TEST(suite, binarySearchSmallStringSmallJsonGT);
  58936   SUITE_ADD_TEST(suite, binarySearchSmallContainerSmallJsonGT);
  58937   SUITE_ADD_TEST(suite, icHasSmallJsonGT);
  58938   SUITE_ADD_TEST(suite, icHasSSmallJsonGT);
  58939   SUITE_ADD_TEST(suite, icHasCharSmallJsonGT);
  58940   SUITE_ADD_TEST(suite, icHasDictSmallJsonGT);
  58941   SUITE_ADD_TEST(suite, icHasArraySmallJsonGT);
  58942   SUITE_ADD_TEST(suite, icHasArraycSmallJsonGT);
  58943   SUITE_ADD_TEST(suite, icHasCArraycSmallJsonGT);
  58944   SUITE_ADD_TEST(suite, icHasSmallStringSmallJsonGT);
  58945   SUITE_ADD_TEST(suite, icFindSmallJsonGT);
  58946   SUITE_ADD_TEST(suite, icFindCharSmallJsonGT);
  58947   SUITE_ADD_TEST(suite, icFindSmallStringSmallJsonGT);
  58948   SUITE_ADD_TEST(suite, icFindJsonSmallJsonGT);
  58949   SUITE_ADD_TEST(suite, icIndexOfSmallJsonGT);
  58950   SUITE_ADD_TEST(suite, icIndexOfSSmallJsonGT);
  58951   SUITE_ADD_TEST(suite, icIndexOfCharSmallJsonGT);
  58952   SUITE_ADD_TEST(suite, icIndexOfDictSmallJsonGT);
  58953   SUITE_ADD_TEST(suite, icIndexOfArraySmallJsonGT);
  58954   SUITE_ADD_TEST(suite, icIndexOfArraycSmallJsonGT);
  58955   SUITE_ADD_TEST(suite, icIndexOfCArraycSmallJsonGT);
  58956   SUITE_ADD_TEST(suite, icIndexOfSmallStringSmallJsonGT);
  58957   SUITE_ADD_TEST(suite, icBinarySearchSmallJsonGT);
  58958   SUITE_ADD_TEST(suite, icBinarySearchSSmallJsonGT);
  58959   SUITE_ADD_TEST(suite, icBinarySearchCharSmallJsonGT);
  58960   SUITE_ADD_TEST(suite, icBinarySearchDictSmallJsonGT);
  58961   SUITE_ADD_TEST(suite, icBinarySearchArraySmallJsonGT);
  58962   SUITE_ADD_TEST(suite, icBinarySearchArraycSmallJsonGT);
  58963   SUITE_ADD_TEST(suite, icBinarySearchCArraycSmallJsonGT);
  58964   SUITE_ADD_TEST(suite, icBinarySearchSmallStringSmallJsonGT);
  58965   SUITE_ADD_TEST(suite, keyBySmallJsonGT);
  58966   SUITE_ADD_TEST(suite, keyByUndefinedSmallJsonGT);
  58967   SUITE_ADD_TEST(suite, keyByBoolSmallJsonGT);
  58968   SUITE_ADD_TEST(suite, keyByDoubleSmallJsonGT);
  58969   SUITE_ADD_TEST(suite, keyByIntSmallJsonGT);
  58970   SUITE_ADD_TEST(suite, keyBySSmallJsonGT);
  58971   SUITE_ADD_TEST(suite, keyByCharSmallJsonGT);
  58972   SUITE_ADD_TEST(suite, keyByDictSmallJsonGT);
  58973   SUITE_ADD_TEST(suite, keyByArraySmallJsonGT);
  58974   SUITE_ADD_TEST(suite, keyByArraycSmallJsonGT);
  58975   SUITE_ADD_TEST(suite, keyByCArraycSmallJsonGT);
  58976   SUITE_ADD_TEST(suite, keyBySmallBoolSmallJsonGT);
  58977   SUITE_ADD_TEST(suite, keyBySmallBytesSmallJsonGT);
  58978   SUITE_ADD_TEST(suite, keyBySmallDoubleSmallJsonGT);
  58979   SUITE_ADD_TEST(suite, keyBySmallIntSmallJsonGT);
  58980   SUITE_ADD_TEST(suite, keyBySmallJsonSmallJsonGT);
  58981   SUITE_ADD_TEST(suite, keyBySmallStringSmallJsonGT);
  58982   SUITE_ADD_TEST(suite, keyBySmallContainerSmallJsonGT);
  58983   SUITE_ADD_TEST(suite, icKeyBySmallJsonGT);
  58984   SUITE_ADD_TEST(suite, icKeyBySSmallJsonGT);
  58985   SUITE_ADD_TEST(suite, icKeyByCharSmallJsonGT);
  58986   SUITE_ADD_TEST(suite, icKeyByDictSmallJsonGT);
  58987   SUITE_ADD_TEST(suite, icKeyByArraySmallJsonGT);
  58988   SUITE_ADD_TEST(suite, icKeyByArraycSmallJsonGT);
  58989   SUITE_ADD_TEST(suite, icKeyByCArraycSmallJsonGT);
  58990   SUITE_ADD_TEST(suite, icKeyBySmallStringSmallJsonGT);
  58991   SUITE_ADD_TEST(suite, replaceSmallJsonGT);
  58992   SUITE_ADD_TEST(suite, replaceCharSSmallJsonGT);
  58993   SUITE_ADD_TEST(suite, replaceSCharSmallJsonGT);
  58994   SUITE_ADD_TEST(suite, replaceCharCharSmallJsonGT);
  58995   SUITE_ADD_TEST(suite, replaceSmallStringSmallStringSmallJsonGT);
  58996   SUITE_ADD_TEST(suite, replaceSmallStringSSmallJsonGT);
  58997   SUITE_ADD_TEST(suite, replaceSmallStringCharSmallJsonGT);
  58998   SUITE_ADD_TEST(suite, replaceSSmallStringSmallJsonGT);
  58999   SUITE_ADD_TEST(suite, replaceCharSmallStringSmallJsonGT);
  59000   SUITE_ADD_TEST(suite, replaceJsonJsonSmallJsonGT);
  59001   SUITE_ADD_TEST(suite, replaceJsonSmallStringSmallJsonGT);
  59002   SUITE_ADD_TEST(suite, replaceJsonSSmallJsonGT);
  59003   SUITE_ADD_TEST(suite, replaceJsonCharSmallJsonGT);
  59004   SUITE_ADD_TEST(suite, replaceSmallStringJsonSmallJsonGT);
  59005   SUITE_ADD_TEST(suite, replaceSJsonSmallJsonGT);
  59006   SUITE_ADD_TEST(suite, replaceCharJsonSmallJsonGT);
  59007   SUITE_ADD_TEST(suite, icReplaceSmallJsonGT);
  59008   SUITE_ADD_TEST(suite, icReplaceCharSSmallJsonGT);
  59009   SUITE_ADD_TEST(suite, icReplaceSCharSmallJsonGT);
  59010   SUITE_ADD_TEST(suite, icReplaceCharCharSmallJsonGT);
  59011   SUITE_ADD_TEST(suite, icReplaceSmallStringSmallStringSmallJsonGT);
  59012   SUITE_ADD_TEST(suite, icReplaceSmallStringSSmallJsonGT);
  59013   SUITE_ADD_TEST(suite, icReplaceSmallStringCharSmallJsonGT);
  59014   SUITE_ADD_TEST(suite, icReplaceSSmallStringSmallJsonGT);
  59015   SUITE_ADD_TEST(suite, icReplaceCharSmallStringSmallJsonGT);
  59016   SUITE_ADD_TEST(suite, icReplaceJsonJsonSmallJsonGT);
  59017   SUITE_ADD_TEST(suite, icReplaceJsonSmallStringSmallJsonGT);
  59018   SUITE_ADD_TEST(suite, icReplaceJsonSSmallJsonGT);
  59019   SUITE_ADD_TEST(suite, icReplaceJsonCharSmallJsonGT);
  59020   SUITE_ADD_TEST(suite, icReplaceSmallStringJsonSmallJsonGT);
  59021   SUITE_ADD_TEST(suite, icReplaceSJsonSmallJsonGT);
  59022   SUITE_ADD_TEST(suite, icReplaceCharJsonSmallJsonGT);
  59023   SUITE_ADD_TEST(suite, equalSmallJsonSmallArrayGT);
  59024   SUITE_ADD_TEST(suite, equalSmallJsonArrayGT);
  59025   SUITE_ADD_TEST(suite, equalSmallJsonCArrayGT);
  59026   SUITE_ADD_TEST(suite, equalSmallJsonBaseGT);
  59027   SUITE_ADD_TEST(suite, equalSmallJsonChaGT);
  59028   SUITE_ADD_TEST(suite, equalSmallJsonCharGT);
  59029   SUITE_ADD_TEST(suite, equalSmallJsonBoolGT);
  59030   SUITE_ADD_TEST(suite, equalSmallJsonDoubleGT);
  59031   SUITE_ADD_TEST(suite, equalSmallJsonInt64GT);
  59032   SUITE_ADD_TEST(suite, equalSmallJsonInt32GT);
  59033   SUITE_ADD_TEST(suite, equalSmallJsonUint32GT);
  59034   SUITE_ADD_TEST(suite, equalSmallJsonUint64GT);
  59035   SUITE_ADD_TEST(suite, equalSmallJsonSmallBoolGT);
  59036   SUITE_ADD_TEST(suite, equalSmallJsonSmallBytesGT);
  59037   SUITE_ADD_TEST(suite, equalSmallJsonSmallDoubleGT);
  59038   SUITE_ADD_TEST(suite, equalSmallJsonSmallIntGT);
  59039   SUITE_ADD_TEST(suite, equalSmallJsonSmallJsonGT);
  59040   SUITE_ADD_TEST(suite, equalSmallJsonSmallStringGT);
  59041   SUITE_ADD_TEST(suite, equalSmallJsonSmallDictGT);
  59042   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallArrayGT);
  59043   SUITE_ADD_TEST(suite, icEqualSmallJsonArrayGT);
  59044   SUITE_ADD_TEST(suite, icEqualSmallJsonCArrayGT);
  59045   SUITE_ADD_TEST(suite, icEqualSmallJsonBaseGT);
  59046   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallDictGT);
  59047   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallJsonGT);
  59048   SUITE_ADD_TEST(suite, icEqualSmallJsonSmallStringGT);
  59049   SUITE_ADD_TEST(suite, icEqualCharSmallJsonGT);
  59050   SUITE_ADD_TEST(suite, icEqualSSmallJsonGT);
  59051   SUITE_ADD_TEST(suite, equalISSmallJsonGT);
  59052   SUITE_ADD_TEST(suite, equalICharSmallJsonGT);
  59053   SUITE_ADD_TEST(suite, equalIJsonSmallJsonGT);
  59054   SUITE_ADD_TEST(suite, equalISmallStringSmallJsonGT);
  59055   SUITE_ADD_TEST(suite, startsWithSSmallJsonGT);
  59056   SUITE_ADD_TEST(suite, startsWithCharSmallJsonGT);
  59057   SUITE_ADD_TEST(suite, startsWithSmallStringSmallJsonGT);
  59058   SUITE_ADD_TEST(suite, startsWithJsonSmallJsonGT);
  59059   SUITE_ADD_TEST(suite, endsWithSSmallJsonGT);
  59060   SUITE_ADD_TEST(suite, endsWithCharSmallJsonGT);
  59061   SUITE_ADD_TEST(suite, endsWithSmallStringSmallJsonGT);
  59062   SUITE_ADD_TEST(suite, endsWithJsonSmallJsonGT);
  59063   SUITE_ADD_TEST(suite, countSSmallJsonGT);
  59064   SUITE_ADD_TEST(suite, countCharSmallJsonGT);
  59065   SUITE_ADD_TEST(suite, countSmallStringSmallJsonGT);
  59066   SUITE_ADD_TEST(suite, countJsonSmallJsonGT);
  59067   SUITE_ADD_TEST(suite, icStartsWithSSmallJsonGT);
  59068   SUITE_ADD_TEST(suite, icStartsWithCharSmallJsonGT);
  59069   SUITE_ADD_TEST(suite, icStartsWithSmallStringSmallJsonGT);
  59070   SUITE_ADD_TEST(suite, icStartsWithJsonSmallJsonGT);
  59071   SUITE_ADD_TEST(suite, icEndsWithSSmallJsonGT);
  59072   SUITE_ADD_TEST(suite, icEndsWithCharSmallJsonGT);
  59073   SUITE_ADD_TEST(suite, icEndsWithSmallStringSmallJsonGT);
  59074   SUITE_ADD_TEST(suite, icEndsWithJsonSmallJsonGT);
  59075   SUITE_ADD_TEST(suite, icCountSSmallJsonGT);
  59076   SUITE_ADD_TEST(suite, icCountCharSmallJsonGT);
  59077   SUITE_ADD_TEST(suite, icCountSmallStringSmallJsonGT);
  59078   SUITE_ADD_TEST(suite, icCountJsonSmallJsonGT);
  59079   SUITE_ADD_TEST(suite, isNumberSmallJsonGT);
  59080   SUITE_ADD_TEST(suite, isIntSmallJsonGT);
  59081   SUITE_ADD_TEST(suite, parseIntSmallJsonGT);
  59082   SUITE_ADD_TEST(suite, parseDoubleSmallJsonGT);
  59083   SUITE_ADD_TEST(suite, intToSmallJsonGT);
  59084   SUITE_ADD_TEST(suite, doubleToSmallJsonGT);
  59085   SUITE_ADD_TEST(suite, lenSmallJsonGT);
  59086   SUITE_ADD_TEST(suite, upperSmallJsonGT);
  59087   SUITE_ADD_TEST(suite, lowerSmallJsonGT);
  59088   SUITE_ADD_TEST(suite, trimSmallJsonGT);
  59089   SUITE_ADD_TEST(suite, lTrimSmallJsonGT);
  59090   SUITE_ADD_TEST(suite, rTrimSmallJsonGT);
  59091   SUITE_ADD_TEST(suite, compactSmallJsonGT);
  59092   SUITE_ADD_TEST(suite, emptySmallJsonGT);
  59093   SUITE_ADD_TEST(suite, isEmptySmallJsonGT);
  59094   SUITE_ADD_TEST(suite, isBlankSmallJsonGT);
  59095   SUITE_ADD_TEST(suite, joinSmallJsonGT);
  59096   SUITE_ADD_TEST(suite, joinCharSmallJsonGT);
  59097   SUITE_ADD_TEST(suite, joinSmallJsonSmallJsonGT);
  59098   SUITE_ADD_TEST(suite, joinSmallStringSmallJsonGT);
  59099   SUITE_ADD_TEST(suite, joinSSmallJsonGT);
  59100   SUITE_ADD_TEST(suite, joinCharSSmallJsonGT);
  59101   SUITE_ADD_TEST(suite, joinSmallJsonSSmallJsonGT);
  59102   SUITE_ADD_TEST(suite, joinSmallStringSSmallJsonGT);
  59103   SUITE_ADD_TEST(suite, splitSmallJsonGT);
  59104   SUITE_ADD_TEST(suite, splitCharSmallJsonGT);
  59105   SUITE_ADD_TEST(suite, splitSmallJsonSmallJsonGT);
  59106   SUITE_ADD_TEST(suite, splitSmallStringSmallJsonGT);
  59107   SUITE_ADD_TEST(suite, splitSSmallJsonGT);
  59108   SUITE_ADD_TEST(suite, splitCharSSmallJsonGT);
  59109   SUITE_ADD_TEST(suite, splitSmallJsonSSmallJsonGT);
  59110   SUITE_ADD_TEST(suite, splitSmallStringSSmallJsonGT);
  59111   SUITE_ADD_TEST(suite, extractSmallJsonGT);
  59112   SUITE_ADD_TEST(suite, extractCharSSmallJsonGT);
  59113   SUITE_ADD_TEST(suite, extractSCharSmallJsonGT);
  59114   SUITE_ADD_TEST(suite, extractCharCharSmallJsonGT);
  59115   SUITE_ADD_TEST(suite, extractSmallJsonSmallJsonSmallJsonGT);
  59116   SUITE_ADD_TEST(suite, extractSmallJsonSmallStringSmallJsonGT);
  59117   SUITE_ADD_TEST(suite, extractSmallJsonSSmallJsonGT);
  59118   SUITE_ADD_TEST(suite, extractSmallJsonCharSmallJsonGT);
  59119   SUITE_ADD_TEST(suite, extractSmallStringSmallJsonSmallJsonGT);
  59120   SUITE_ADD_TEST(suite, extractSmallStringSmallStringSmallJsonGT);
  59121   SUITE_ADD_TEST(suite, extractSmallStringSSmallJsonGT);
  59122   SUITE_ADD_TEST(suite, extractSmallStringCharSmallJsonGT);
  59123   SUITE_ADD_TEST(suite, extractSSmallJsonSmallJsonGT);
  59124   SUITE_ADD_TEST(suite, extractSSmallStringSmallJsonGT);
  59125   SUITE_ADD_TEST(suite, extractCharSmallJsonSmallJsonGT);
  59126   SUITE_ADD_TEST(suite, extractCharSmallStringSmallJsonGT);
  59127   SUITE_ADD_TEST(suite, icSplitSmallJsonGT);
  59128   SUITE_ADD_TEST(suite, icSplitCharSmallJsonGT);
  59129   SUITE_ADD_TEST(suite, icSplitSmallJsonSmallJsonGT);
  59130   SUITE_ADD_TEST(suite, icSplitSmallStringSmallJsonGT);
  59131   SUITE_ADD_TEST(suite, icSplitSSmallJsonGT);
  59132   SUITE_ADD_TEST(suite, icSplitCharSSmallJsonGT);
  59133   SUITE_ADD_TEST(suite, icSplitSmallJsonSSmallJsonGT);
  59134   SUITE_ADD_TEST(suite, icSplitSmallStringSSmallJsonGT);
  59135   SUITE_ADD_TEST(suite, icExtractSmallJsonGT);
  59136   SUITE_ADD_TEST(suite, icExtractCharSSmallJsonGT);
  59137   SUITE_ADD_TEST(suite, icExtractSCharSmallJsonGT);
  59138   SUITE_ADD_TEST(suite, icExtractCharCharSmallJsonGT);
  59139   SUITE_ADD_TEST(suite, icExtractSmallJsonSmallJsonSmallJsonGT);
  59140   SUITE_ADD_TEST(suite, icExtractSmallJsonSmallStringSmallJsonGT);
  59141   SUITE_ADD_TEST(suite, icExtractSmallJsonSSmallJsonGT);
  59142   SUITE_ADD_TEST(suite, icExtractSmallJsonCharSmallJsonGT);
  59143   SUITE_ADD_TEST(suite, icExtractSmallStringSmallJsonSmallJsonGT);
  59144   SUITE_ADD_TEST(suite, icExtractSmallStringSmallStringSmallJsonGT);
  59145   SUITE_ADD_TEST(suite, icExtractSmallStringSSmallJsonGT);
  59146   SUITE_ADD_TEST(suite, icExtractSmallStringCharSmallJsonGT);
  59147   SUITE_ADD_TEST(suite, icExtractSSmallJsonSmallJsonGT);
  59148   SUITE_ADD_TEST(suite, icExtractSSmallStringSmallJsonGT);
  59149   SUITE_ADD_TEST(suite, icExtractCharSmallJsonSmallJsonGT);
  59150   SUITE_ADD_TEST(suite, icExtractCharSmallStringSmallJsonGT);
  59151   SUITE_ADD_TEST(suite, zipSmallJsonGT);
  59152   SUITE_ADD_TEST(suite, zipArraySmallJsonGT);
  59153   SUITE_ADD_TEST(suite, zipCArraySmallJsonGT);
  59154   SUITE_ADD_TEST(suite, zipCharSmallJsonGT);
  59155   SUITE_ADD_TEST(suite, zipCCharSmallJsonGT);
  59156   SUITE_ADD_TEST(suite, zipArrayCharSmallJsonGT);
  59157   SUITE_ADD_TEST(suite, zipArrayCCharSmallJsonGT);
  59158   SUITE_ADD_TEST(suite, zipCArrayCharSmallJsonGT);
  59159   SUITE_ADD_TEST(suite, zipCArrayCCharSmallJsonGT);
  59160   SUITE_ADD_TEST(suite, zipJsonSmallJsonGT);
  59161   SUITE_ADD_TEST(suite, zipJsonSmallArraySmallJsonGT);
  59162   SUITE_ADD_TEST(suite, zipJsonArraySmallJsonGT);
  59163   SUITE_ADD_TEST(suite, zipJsonCArraySmallJsonGT);
  59164   SUITE_ADD_TEST(suite, zipSmallArrayJsonSmallJsonGT);
  59165   SUITE_ADD_TEST(suite, zipArrayJsonSmallJsonGT);
  59166   SUITE_ADD_TEST(suite, zipCArrayJsonSmallJsonGT);
  59167   SUITE_ADD_TEST(suite, stringifySmallStringSmallJsonGT);
  59168   SUITE_ADD_TEST(suite, toYMLSmallStringSmallJsonGT);
  59169   SUITE_ADD_TEST(suite, parseSmallJsonGT);
  59170   SUITE_ADD_TEST(suite, parseSmallJsonSmallJsonGT);
  59171   SUITE_ADD_TEST(suite, parseSmallStringSmallJsonGT);
  59172   SUITE_ADD_TEST(suite, parseYMLSmallJsonGT);
  59173   SUITE_ADD_TEST(suite, parseYMLSmallJsonSmallJsonGT);
  59174   SUITE_ADD_TEST(suite, parseYMLSmallStringSmallJsonGT);
  59175   SUITE_ADD_TEST(suite, logSmallJsonGT);
  59176   SUITE_ADD_TEST(suite, readFileSmallJsonGT);
  59177   SUITE_ADD_TEST(suite, readFileSmallStringSmallJsonGT);
  59178   SUITE_ADD_TEST(suite, readFileJsonSmallJsonGT);
  59179   SUITE_ADD_TEST(suite, readStreamSmallJsonGT);
  59180   SUITE_ADD_TEST(suite, writeFileSmallJsonGT);
  59181   SUITE_ADD_TEST(suite, writeFileSmallStringSmallJsonGT);
  59182   SUITE_ADD_TEST(suite, writeFileJsonSmallJsonGT);
  59183   SUITE_ADD_TEST(suite, writeStreamSmallJsonGT);
  59184   SUITE_ADD_TEST(suite, appendFileSmallJsonGT);
  59185   SUITE_ADD_TEST(suite, appendFileSmallStringSmallJsonGT);
  59186   SUITE_ADD_TEST(suite, appendFileJsonSmallJsonGT);
  59187   SUITE_ADD_TEST(suite, readTextSmallJsonGT);
  59188   SUITE_ADD_TEST(suite, readTextSmallStringSmallJsonGT);
  59189   SUITE_ADD_TEST(suite, readTextJsonSmallJsonGT);
  59190   SUITE_ADD_TEST(suite, readTextStreamSmallJsonGT);
  59191   SUITE_ADD_TEST(suite, writeTextSmallJsonGT);
  59192   SUITE_ADD_TEST(suite, writeTextSmallStringSmallJsonGT);
  59193   SUITE_ADD_TEST(suite, writeTextJsonSmallJsonGT);
  59194   SUITE_ADD_TEST(suite, writeTextStreamSmallJsonGT);
  59195   SUITE_ADD_TEST(suite, appendTextSmallStringSmallJsonGT);
  59196   SUITE_ADD_TEST(suite, appendTextJsonSmallJsonGT);
  59197   SUITE_ADD_TEST(suite, cSmallJsonT);
  59198 
  59199 
  59200   CuSuiteRun(suite);
  59201   CuSuiteDetails(suite, output);
  59202   printf ("%s\n", output->buffer);
  59203   return suite->failCount;
  59204 }