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

libsheepySmallCuTest.c (43680B)


      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 "libsheepySmall.h"
     19 
     20 void isSTypeFT(CuTest *tc UNUSED) {
     21 
     22   sBoolt *b;
     23   b = allocSBool(false);
     24   ck_assert(isSTypeF((smallt *)b, BOOL));
     25   free(b);
     26   // NULL
     27   ck_assert(!isSTypeF(NULL, UNDEFINED));
     28 
     29 }
     30 
     31 void sSizeT(CuTest *tc UNUSED) {
     32 
     33   sBoolt *b;
     34   b = allocSBool(false);
     35   ck_assert_uint_eq(sSizeTiny((smallt *)b), sizeof(sBoolt));
     36   free(b);
     37 
     38   sContainert *c;
     39   c = allocSContainer(strdup("sheepy"));
     40   ck_assert_uint_eq(sSizeTiny((smallt *)c), sizeof(sContainert));
     41   free(c->data);
     42   free(c);
     43 
     44   sDictt *d;
     45   d = allocSDict();
     46   ck_assert_uint_eq(sSizeTiny((smallt *)d), sizeof(sDictt));
     47     // with elements
     48   b = allocSBool(false);
     49   sDictPushTiny(&d, "a", (smallt *) b);
     50   ck_assert_uint_eq(sSizeTiny((smallt *)d), sizeof(sDictt) + sizeof(sDictElemt *)*(d->count-1));
     51   sDictFreeTiny(d);
     52 
     53   sDoublet *D;
     54   D = allocSDouble(10);
     55   ck_assert_uint_eq(sSizeTiny((smallt *)D), sizeof(sDoublet));
     56   free(D);
     57 
     58   sIntt *i;
     59   i = allocSInt(10);
     60   ck_assert_uint_eq(sSizeTiny((smallt *)i), sizeof(sIntt));
     61   free(i);
     62 
     63   sStringt *s;
     64   s = allocSStringTiny("");
     65   ck_assert_uint_eq(sSizeTiny((smallt *)s), sizeof(sStringt));
     66   free(s);
     67     // string
     68   s = allocSStringTiny("sheepy");
     69   ck_assert_uint_eq(sSizeTiny((smallt *)s), sizeof(sStringt) + strlen("sheepy"));
     70   free(s);
     71 
     72   sArrayt *a;
     73   a = allocSArray();
     74   ck_assert_uint_eq(sSizeTiny((smallt *)a), sizeof(sArrayt));
     75   b = allocSBool(false);
     76   sArrayPushTiny(&a, (smallt *) b);
     77   D = allocSDouble(10);
     78   sArrayPushTiny(&a, (smallt *) D);
     79   s = allocSStringTiny("sheepy");
     80   sArrayPushTiny(&a, (smallt *) s);
     81   ck_assert_uint_eq(sSizeTiny((smallt *)a), sizeof(sArrayt) + sizeof(smallt *)*(a->count-1));
     82   sArrayFreeTiny(a);
     83 
     84   sUndefinedt *u;
     85   u = allocSUndefined();
     86   ck_assert_uint_eq(sSizeTiny((smallt *)u), sizeof(sUndefinedt));
     87   free(u);
     88 
     89   sBytest *B;
     90   B = allocSBytes();
     91   ck_assert_uint_eq(sSizeTiny((smallt *)B), sizeof(sBytest));
     92   sBytesPush(&B, 1);
     93   sBytesPush(&B, 2);
     94   sBytesPush(&B, 3);
     95   ck_assert_uint_eq(sSizeTiny((smallt *)B), sizeof(sBytest) + sizeof(char) * (B->count-1));
     96   free(B);
     97 
     98   // non existing object type - size 0
     99   sUndefinedt *NIL;
    100   NIL = allocSUndefined();
    101   NIL->type += 100;
    102   ck_assert_uint_eq(sSizeTiny((smallt *)NIL), 0);
    103   free(NIL);
    104 
    105 }
    106 
    107 
    108 
    109 void allocSBoolT(CuTest *tc UNUSED) {
    110 
    111   sBoolt *o;
    112   o = allocSBool(false);
    113   ck_assert_uint_eq(o->type, BOOL);
    114   ck_assert(!o->value);
    115   free(o);
    116 
    117 }
    118 
    119 
    120 void allocSContainerT(CuTest *tc UNUSED) {
    121 
    122   sContainert *o;
    123   o = allocSContainer(strdup("sheepy"));
    124   ck_assert_uint_eq(o->type, CONTAINER);
    125   ck_assert_str_eq(o->data, "sheepy");
    126   free(o->data);
    127   free(o);
    128 
    129 }
    130 
    131 
    132 void allocSDictT(CuTest *tc UNUSED) {
    133 
    134   sDictt *o;
    135   o = allocSDict();
    136   ck_assert_uint_eq(o->type, DICT);
    137   ck_assert_uint_eq(o->count, 0);
    138   free(o);
    139 
    140 }
    141 
    142 
    143 void allocSDoubleT(CuTest *tc UNUSED) {
    144 
    145   sDoublet *o;
    146   o = allocSDouble(1.5);
    147   ck_assert_uint_eq(o->type, DOUBLE);
    148   // TODO use ck_assert_float_eq when available
    149   ck_assert_uint_eq(o->value*2, 3);
    150   free(o);
    151 
    152 }
    153 
    154 
    155 void allocSIntT(CuTest *tc UNUSED) {
    156 
    157   sIntt *o;
    158   o = allocSInt(1);
    159   ck_assert_uint_eq(o->type, INT);
    160   ck_assert_uint_eq(o->value, 1);
    161   free(o);
    162 
    163 }
    164 
    165 
    166 void allocSStringT(CuTest *tc UNUSED) {
    167 
    168   sStringt *o;
    169   o = allocSStringTiny("sheepy");
    170   ck_assert_uint_eq(o->type, STRING);
    171   ck_assert_uint_ne(o->data, 0);
    172   free(o);
    173 
    174 }
    175 
    176 
    177 void allocSArrayT(CuTest *tc UNUSED) {
    178 
    179   sArrayt *o;
    180   o = allocSArray();
    181   ck_assert_uint_eq(o->type, ARRAY);
    182   ck_assert_uint_eq(o->count, 0);
    183   free(o);
    184 
    185 }
    186 
    187 
    188 void allocSUndefinedT(CuTest *tc UNUSED) {
    189 
    190   sUndefinedt *o;
    191   o = allocSUndefined();
    192   ck_assert_uint_eq(o->type, UNDEFINED);
    193   free(o);
    194 
    195 }
    196 
    197 
    198 void allocSBytesT(CuTest *tc UNUSED) {
    199 
    200   sBytest *o;
    201   o = allocSBytes();
    202   ck_assert_uint_eq(o->type, BYTES);
    203   ck_assert_uint_eq(o->count, 0);
    204   free(o);
    205 
    206 }
    207 
    208 
    209 void sFreeT(CuTest *tc UNUSED) {
    210 
    211   // dict
    212   sDictt *o = allocSDict();
    213   sFree((smallt *) o);
    214   // array
    215   sArrayt *a = allocSArray();
    216   sFree((smallt *) a);
    217   // other objects
    218   sUndefinedt *u = allocSUndefined();
    219   sFree((smallt *) u);
    220   // non existing object type - size 0
    221   sUndefinedt *NIL;
    222   NIL = allocSUndefined();
    223   NIL->type += 100;
    224   sFree((smallt *) NIL);
    225   // NULL
    226   sFree(NULL);
    227 
    228 }
    229 
    230 
    231 void sDictFreeT(CuTest *tc UNUSED) {
    232 
    233   sDictt *o = allocSDict();
    234   sDictt *d = allocSDict();
    235   sDictPushTiny(&o, "d" , (smallt *)d);
    236   sArrayt *a = allocSArray();
    237   sDictPushTiny(&o, "a" , (smallt *)a);
    238   sDictFreeTiny(o);
    239 
    240 }
    241 
    242 
    243 void sArrayFreeT(CuTest *tc UNUSED) {
    244 
    245   sArrayt *o = allocSArray();
    246   sDictt  *d = allocSDict();
    247   sArrayPushTiny(&o, (smallt *)d);
    248   sArrayt *a = allocSArray();
    249   sArrayPushTiny(&o, (smallt *)a);
    250   sArrayFreeTiny(o);
    251 
    252 }
    253 
    254 
    255 void sBoolToStringT(CuTest *tc UNUSED) {
    256 
    257   sBoolt *o;
    258   o = allocSBool(false);
    259   char *S = sBoolToStringTiny(o);
    260   ck_assert_str_eq(S, "false");
    261   free(S);
    262   o->value = true;
    263   S = sBoolToStringTiny(o);
    264   ck_assert_str_eq(S, "true");
    265   free(S);
    266   free(o);
    267 
    268 }
    269 
    270 
    271 void sContainerToStringT(CuTest *tc UNUSED) {
    272 
    273   sContainert *o;
    274   o = allocSContainer(strdup("sheepy"));
    275   char *S = sContainerToStringTiny(o);
    276   ck_assert_str_eq(S, "<data container>");
    277   free(S);
    278   free(o->data);
    279   free(o);
    280 
    281 }
    282 
    283 
    284 void sDictToStringT(CuTest *tc UNUSED) {
    285 
    286   sDictt *o;
    287   o = allocSDict();
    288   char *S = sDictToStringTiny(o);
    289   ck_assert_str_eq(S, "{}");
    290   free(S);
    291     // elements
    292   sBoolt *b = allocSBool(false);
    293   sDictPushTiny(&o, "a", (smallt *) b);
    294   sContainert *c = allocSContainer(strdup("sheepy"));
    295   sDictPushTiny(&o, "c", (smallt *) c);
    296   sStringt *s = allocSStringTiny("");
    297   sDictPushTiny(&o, "s", (smallt *) s);
    298   S = sDictToStringTiny(o);
    299   ck_assert_str_eq(S, "{\"a\":false,\"c\":\"<data container>\",\"s\":\"\"}");
    300   free(S);
    301   free(c->data);
    302   sDictFreeTiny(o);
    303 
    304 }
    305 
    306 
    307 void sDoubleToStringT(CuTest *tc UNUSED) {
    308 
    309   sDoublet *o;
    310   o = allocSDouble(1.5);
    311   char *S = sDoubleToStringTiny(o);
    312   ck_assert_str_eq(S, "1.500000e+00");
    313   free(S);
    314   free(o);
    315 
    316 }
    317 
    318 
    319 void sIntToStringT(CuTest *tc UNUSED) {
    320 
    321   sIntt *o;
    322   o = allocSInt(1);
    323   char *S = sIntToStringTiny(o);
    324   ck_assert_str_eq(S, "1");
    325   free(S);
    326   free(o);
    327 
    328 }
    329 
    330 
    331 void sStringToStringT(CuTest *tc UNUSED) {
    332 
    333   sStringt *o;
    334   o = allocSStringTiny("sheepy");
    335   char *S = sStringToStringTiny(o);
    336   ck_assert_str_eq(S, "sheepy");
    337   free(S);
    338   free(o);
    339 
    340 }
    341 
    342 
    343 void sArrayToStringT(CuTest *tc UNUSED) {
    344 
    345   sArrayt *o;
    346   o = allocSArray();
    347   char *S = sArrayToStringTiny(o);
    348   ck_assert_str_eq(S, "[]");
    349   free(S);
    350     // elements
    351   sBoolt *b = allocSBool(false);
    352   sArrayPushTiny(&o, (smallt *) b);
    353   sContainert *c = allocSContainer(strdup("sheepy"));
    354   sArrayPushTiny(&o, (smallt *) c);
    355   sStringt *s = allocSStringTiny("");
    356   sArrayPushTiny(&o, (smallt *) s);
    357   sUndefinedt *u = allocSUndefined();
    358   sArrayPushTiny(&o, (smallt *) u);
    359   sArraySetTiny(o, 3, NULL);
    360   S = sArrayToStringTiny(o);
    361   ck_assert_str_eq(S, "[false,\"<data container>\",\"\"]");
    362   free(S);
    363   free(c->data);
    364   sArrayFreeTiny(o);
    365   // array with 1 NULL element
    366   o = allocSArray();
    367   sArrayPushTiny(&o, NULL);
    368   S = sArrayToStringTiny(o);
    369   ck_assert_str_eq(S, "[]");
    370   free(S);
    371   sArrayFreeTiny(o);
    372 
    373 }
    374 
    375 
    376 void sUndefinedToStringT(CuTest *tc UNUSED) {
    377 
    378   sUndefinedt *o;
    379   o = allocSUndefined();
    380   char *S = sUndefinedToStringTiny(o);
    381   ck_assert_str_eq(S, "null");
    382   free(S);
    383   free(o);
    384 
    385 }
    386 
    387 
    388 void sBytesToStringT(CuTest *tc UNUSED) {
    389 
    390   sBytest *o;
    391   o = allocSBytes();
    392   char *S = sBytesToStringTiny(o);
    393   ck_assert_str_eq(S, "[]");
    394   free(S);
    395   sBytesPush(&o, 1);
    396   sBytesPush(&o, 2);
    397   sBytesPush(&o, 3);
    398   S = sBytesToStringTiny(o);
    399   ck_assert_str_eq(S, "[0x01,0x02,0x03]");
    400   free(S);
    401   free(o);
    402 
    403 }
    404 
    405 
    406 void sToStringT(CuTest *tc UNUSED) {
    407 
    408   sBoolt *b;
    409   b = allocSBool(false);
    410   char *S = sToString((smallt *)b);
    411   ck_assert_str_eq(S, "false");
    412   free(S);
    413   free(b);
    414 
    415   sContainert *c;
    416   c = allocSContainer(strdup("sheepy"));
    417   S = sToString((smallt *)c);
    418   ck_assert_str_eq(S, "<data container>");
    419   free(S);
    420   free(c->data);
    421   free(c);
    422 
    423   sDictt *d;
    424   d = allocSDict();
    425   S = sToString((smallt *)d);
    426   ck_assert_str_eq(S, "{}");
    427   free(S);
    428   sDictFreeTiny(d);
    429 
    430   sDoublet *D;
    431   D = allocSDouble(10);
    432   S = sToString((smallt *)D);
    433   ck_assert_str_eq(S, "1.000000e+01");
    434   free(S);
    435   free(D);
    436 
    437   sIntt *i;
    438   i = allocSInt(10);
    439   S = sToString((smallt *)i);
    440   ck_assert_str_eq(S, "10");
    441   free(S);
    442   free(i);
    443 
    444   sStringt *s;
    445   s = allocSStringTiny("");
    446   S = sToString((smallt *)s);
    447   ck_assert_str_eq(S, "");
    448   free(S);
    449   free(s);
    450 
    451   sArrayt *a;
    452   a = allocSArray();
    453   S = sToString((smallt *)a);
    454   ck_assert_str_eq(S, "[]");
    455   free(S);
    456   sArrayFreeTiny(a);
    457 
    458   sUndefinedt *u;
    459   u = allocSUndefined();
    460   S = sToString((smallt *)u);
    461   ck_assert_str_eq(S, "null");
    462   free(S);
    463   free(u);
    464 
    465   sBytest *B;
    466   B = allocSBytes();
    467   S = sToString((smallt *)B);
    468   ck_assert_str_eq(S, "[]");
    469   free(S);
    470   free(B);
    471 
    472   // non existing object type - size 0
    473   sUndefinedt *NIL;
    474   NIL = allocSUndefined();
    475   NIL->type += 100;
    476   S = sToString((smallt *)NIL);
    477   ck_assert_ptr_eq(S, NULL);
    478   free(NIL);
    479 
    480   // NULL
    481   S = sToString(NULL);
    482   ck_assert_ptr_eq(S, NULL);
    483 
    484 }
    485 
    486 
    487 void sTypesT(CuTest *tc UNUSED) {
    488 
    489   sDictt *o;
    490   o = allocSDict();
    491     // elements
    492   sBoolt *b = allocSBool(false);
    493   sDictPushTiny(&o, "a", (smallt *) b);
    494   sContainert *c = allocSContainer(strdup("sheepy"));
    495   sDictPushTiny(&o, "c", (smallt *) c);
    496   sStringt *s = allocSStringTiny("");
    497   sDictPushTiny(&o, "s", (smallt *) s);
    498   char *S = sTypesTiny((smallt *)o);
    499   ck_assert_str_eq(S, "[\"bool\",\"container\",\"string\"]");
    500   free(S);
    501   free(c->data);
    502   sDictFreeTiny(o);
    503 
    504 }
    505 
    506 
    507 void sTypesToBytesT(CuTest *tc UNUSED) {
    508 
    509   // dict
    510   sDictt *o;
    511   o = allocSDict();
    512     // elements
    513   sBoolt *b = allocSBool(false);
    514   sDictPushTiny(&o, "a", (smallt *) b);
    515   sContainert *c = allocSContainer(strdup("sheepy"));
    516   sDictPushTiny(&o, "c", (smallt *) c);
    517   sStringt *s = allocSStringTiny("");
    518   sDictPushTiny(&o, "s", (smallt *) s);
    519   sBytest *t = sTypesToBytesTiny((smallt *)o);
    520   char *S = sBytesToStringTiny(t);
    521   ck_assert_str_eq(S, "[0x02,0x03,0x08]");
    522   free(S);
    523   free(t);
    524   free(c->data);
    525   sDictFreeTiny(o);
    526 
    527   // array
    528   sArrayt *a;
    529   a = allocSArray();
    530     // elements
    531   b = allocSBool(false);
    532   sArrayPushTiny(&a, (smallt *) b);
    533   c = allocSContainer(strdup("sheepy"));
    534   sArrayPushTiny(&a, (smallt *) c);
    535   s = allocSStringTiny("");
    536   sArrayPushTiny(&a, (smallt *) s);
    537   sUndefinedt *u = allocSUndefined();
    538   sArrayPushTiny(&a, (smallt *) u);
    539   sArraySetTiny(a, 3, NULL);
    540   t = sTypesToBytesTiny((smallt *)a);
    541   S = sBytesToStringTiny(t);
    542   ck_assert_str_eq(S, "[0x02,0x03,0x08]");
    543   free(S);
    544   free(t);
    545   free(c->data);
    546   sArrayFreeTiny(a);
    547 
    548   // non existing object type - size 0
    549   sUndefinedt *NIL;
    550   NIL = allocSUndefined();
    551   NIL->type += 100;
    552   t = sTypesToBytesTiny((smallt *)NIL);
    553   ck_assert_ptr_eq(t, NULL);
    554   free(NIL);
    555 
    556 }
    557 
    558 
    559 void sDictTypeStringsT(CuTest *tc UNUSED) {
    560 
    561   sDictt *o;
    562   o = allocSDict();
    563     // elements
    564   sBoolt *b = allocSBool(false);
    565   sDictPushTiny(&o, "a", (smallt *) b);
    566   sContainert *c = allocSContainer(strdup("sheepy"));
    567   sDictPushTiny(&o, "c", (smallt *) c);
    568   sStringt *s = allocSStringTiny("");
    569   sDictPushTiny(&o, "s", (smallt *) s);
    570   char **t = (char**)sDictTypeStrings(o);
    571   char *S = join(t, ",");
    572   ck_assert_str_eq(S, "bool,container,string");
    573   free(S);
    574   free(t);
    575   free(c->data);
    576   sDictFreeTiny(o);
    577 
    578 }
    579 
    580 
    581 void sDictTypesT(CuTest *tc UNUSED) {
    582 
    583   sDictt *o;
    584   o = allocSDict();
    585     // elements
    586   sBoolt *b = allocSBool(false);
    587   sDictPushTiny(&o, "a", (smallt *) b);
    588   sContainert *c = allocSContainer(strdup("sheepy"));
    589   sDictPushTiny(&o, "c", (smallt *) c);
    590   sStringt *s = allocSStringTiny("");
    591   sDictPushTiny(&o, "s", (smallt *) s);
    592   sBytest *t = sDictTypesTiny(o);
    593   char *S = sBytesToStringTiny(t);
    594   ck_assert_str_eq(S, "[0x02,0x03,0x08]");
    595   free(S);
    596   free(t);
    597   free(c->data);
    598   sDictFreeTiny(o);
    599 
    600 }
    601 
    602 
    603 void sArrayTypeStringsT(CuTest *tc UNUSED) {
    604 
    605   sArrayt *o;
    606   o = allocSArray();
    607     // elements
    608   sBoolt *b = allocSBool(false);
    609   sArrayPushTiny(&o, (smallt *) b);
    610   sContainert *c = allocSContainer(strdup("sheepy"));
    611   sArrayPushTiny(&o, (smallt *) c);
    612   sStringt *s = allocSStringTiny("");
    613   sArrayPushTiny(&o, (smallt *) s);
    614   sUndefinedt *u = allocSUndefined();
    615   sArrayPushTiny(&o, (smallt *) u);
    616   sArraySetTiny(o, 3, NULL);
    617   char **t = (char**)sArrayTypeStrings(o);
    618   char *S = join(t, ",");
    619   ck_assert_str_eq(S, "bool,container,string");
    620   free(S);
    621   free(t);
    622   free(c->data);
    623   sArrayFreeTiny(o);
    624 
    625 }
    626 
    627 
    628 void sArrayTypesT(CuTest *tc UNUSED) {
    629 
    630   sArrayt *o;
    631   o = allocSArray();
    632     // elements
    633   sBoolt *b = allocSBool(false);
    634   sArrayPushTiny(&o, (smallt *) b);
    635   sContainert *c = allocSContainer(strdup("sheepy"));
    636   sArrayPushTiny(&o, (smallt *) c);
    637   sStringt *s = allocSStringTiny("");
    638   sArrayPushTiny(&o, (smallt *) s);
    639   sUndefinedt *u = allocSUndefined();
    640   sArrayPushTiny(&o, (smallt *) u);
    641   sArraySetTiny(o, 3, NULL);
    642   sBytest *t = sArrayTypesTiny(o);
    643   char *S = sBytesToStringTiny(t);
    644   ck_assert_str_eq(S, "[0x02,0x03,0x08]");
    645   free(S);
    646   free(t);
    647   free(c->data);
    648   sArrayFreeTiny(o);
    649 
    650 }
    651 
    652 
    653 void sDuplicateT(CuTest *tc UNUSED) {
    654   char *S;
    655 
    656   sBoolt *b, *b2;
    657   b = allocSBool(true);
    658   b2 = (sBoolt *) sDuplicate((smallt *)b);
    659   ck_assert(b2->value);
    660   free(b2);
    661   free(b);
    662 
    663   sContainert *c, *c2;
    664   c = allocSContainer(strdup("sheepy"));
    665   c2 = (sContainert *) sDuplicate((smallt *)c);
    666   ck_assert_str_eq(c2->data, c->data);
    667   free(c2);
    668   free(c->data);
    669   free(c);
    670 
    671   sDictt *d, *d2;
    672   d = allocSDict();
    673   d2 = (sDictt *) sDuplicateTiny((smallt *)d);
    674   ck_assert_uint_eq(d2->count, 0);
    675   sDictFreeTiny(d2);
    676     // with elements
    677   b = allocSBool(false);
    678   sDictPushTiny(&d, "a", (smallt *) b);
    679   d2 = (sDictt *) sDuplicateTiny((smallt *)d);
    680   S = sDictToStringTiny(d2);
    681   ck_assert_str_eq(S, "{\"a\":false}");
    682   free(S);
    683   sDictFreeTiny(d2);
    684   sDictFreeTiny(d);
    685 
    686   sDoublet *D, *D2;
    687   D = allocSDouble(10);
    688   D2 = (sDoublet *) sDuplicate((smallt *)D);
    689   ck_assert_uint_eq((uint)D2->value, (uint)D->value);
    690   free(D2);
    691   free(D);
    692 
    693   sIntt *i, *i2;
    694   i = allocSInt(10);
    695   i2 = (sIntt *) sDuplicate((smallt *)i);
    696   ck_assert_uint_eq(i2->value, i->value);
    697   free(i2);
    698   free(i);
    699 
    700   sStringt *s, *s2;
    701   s = allocSStringTiny("");
    702   s2 = (sStringt *) sDuplicate((smallt *)s);
    703   ck_assert_str_eq((char*)s, (char*)s2);
    704   free(s2);
    705   free(s);
    706     // string
    707   s = allocSStringTiny("sheepy");
    708   s2 = (sStringt *) sDuplicate((smallt *)s);
    709   ck_assert_str_eq((char*)s, (char*)s2);
    710   free(s2);
    711   free(s);
    712 
    713   sArrayt *a, *a2;
    714   a  = allocSArray();
    715   a2 = (sArrayt *) sDuplicate((smallt *)a);
    716   ck_assert_uint_eq(a2->count, 0);
    717   sArrayFreeTiny(a2);
    718   b = allocSBool(false);
    719   sArrayPushTiny(&a, (smallt *) b);
    720   D = allocSDouble(10);
    721   sArrayPushTiny(&a, (smallt *) D);
    722   s = allocSStringTiny("sheepy");
    723   sArrayPushTiny(&a, (smallt *) s);
    724   a2 = (sArrayt *) sDuplicate((smallt *)a);
    725   S = sArrayToStringTiny(a2);
    726   ck_assert_str_eq(S, "[false,1.000000e+01,\"sheepy\"]");
    727   free(S);
    728   sArrayFreeTiny(a2);
    729   sArrayFreeTiny(a);
    730 
    731   sUndefinedt *u, *u2 = NULL;
    732   u = allocSUndefined();
    733   u2 = (sUndefinedt *) sDuplicate((smallt *)u);
    734   ck_assert_uint_eq(u2->type, UNDEFINED);
    735   free(u2);
    736   free(u);
    737 
    738   sBytest *B, *B2;
    739   B = allocSBytes();
    740   B2 = (sBytest *) sDuplicate((smallt *)B);
    741   sBytesPush(&B, 1);
    742   sBytesPush(&B, 2);
    743   sBytesPush(&B, 3);
    744   ck_assert_uint_eq(B2->count, 0);
    745   free(B2);
    746   B2 = (sBytest *) sDuplicate((smallt *)B);
    747   S  = sToStringTiny((smallt *)B);
    748   ck_assert_str_eq(S, "[0x01,0x02,0x03]");
    749   free(S);
    750   S  = sToStringTiny((smallt *)B2);
    751   ck_assert_str_eq(S, "[0x01,0x02,0x03]");
    752   free(S);
    753   free(B2);
    754   free(B);
    755 
    756   // NULL
    757   ck_assert_ptr_eq(sDuplicate(NULL), NULL);
    758 
    759 }
    760 
    761 
    762 void sDictDuplicateT(CuTest *tc UNUSED) {
    763 
    764   sDictt *o, *d;
    765   o = allocSDict();
    766     // elements
    767   sBoolt *b = allocSBool(true);
    768   sDictPushTiny(&o, "a", (smallt *) b);
    769   sContainert *c = allocSContainer(strdup("sheepy"));
    770   sDictPushTiny(&o, "c", (smallt *) c);
    771   sStringt *s = allocSStringTiny("");
    772   sDictPushTiny(&o, "s", (smallt *) s);
    773   d = sDictDuplicateTiny(o);
    774   char *S = sDictToStringTiny(d);
    775   ck_assert_str_eq(S, "{\"a\":true,\"c\":\"<data container>\",\"s\":\"\"}");
    776   free(S);
    777   free(c->data);
    778   sDictFreeTiny(d);
    779   sDictFreeTiny(o);
    780 
    781 }
    782 
    783 
    784 void sArrayDuplicateT(CuTest *tc UNUSED) {
    785 
    786   sArrayt *a = allocSArray();
    787   sBoolt *b = allocSBool(false);
    788   sArrayPushTiny(&a, (smallt *) b);
    789   sDoublet *D = allocSDouble(10);
    790   sArrayPushTiny(&a, (smallt *) D);
    791   sStringt *s = allocSStringTiny("sheepy");
    792   sArrayPushTiny(&a, (smallt *) s);
    793   sArrayPushTiny(&a, NULL);
    794   sArrayPushTiny(&a, NULL);
    795   sArrayt *a2 = sArrayDuplicateTiny(a);
    796   char *S = sArrayToStringTiny(a2);
    797   ck_assert_str_eq(S, "[false,1.000000e+01,\"sheepy\"]");
    798   free(S);
    799   sArrayFreeTiny(a2);
    800   sArrayFreeTiny(a);
    801 
    802 }
    803 
    804 
    805 void sDictGetT(CuTest *tc UNUSED) {
    806 
    807   sDictt *o;
    808   o = allocSDict();
    809     // elements
    810   sBoolt *b = allocSBool(false);
    811   sDictPushTiny(&o, "a", (smallt *) b);
    812   sContainert *c = allocSContainer(strdup("sheepy"));
    813   sDictPushTiny(&o, "c", (smallt *) c);
    814   sStringt *s = allocSStringTiny("");
    815   sDictPushTiny(&o, "s", (smallt *) s);
    816   b = (sBoolt *)sDictGet(o, "a");
    817   ck_assert_uint_eq(b->type, BOOL);
    818     // invalid key
    819   ck_assert_ptr_eq(sDictGet(o, "X"), NULL);
    820   free(c->data);
    821   sDictFreeTiny(o);
    822 
    823 }
    824 
    825 
    826 void sDictGetPT(CuTest *tc UNUSED) {
    827 
    828   sDictt *o;
    829   o = allocSDict();
    830     // elements
    831   sBoolt *b = allocSBool(false);
    832   sDictPushTiny(&o, "a", (smallt *) b);
    833   sContainert *c = allocSContainer(strdup("sheepy"));
    834   sDictPushTiny(&o, "c", (smallt *) c);
    835   sStringt *s = allocSStringTiny("");
    836   sDictPushTiny(&o, "s", (smallt *) s);
    837   sBoolt **bb = (sBoolt **)sDictGetP(o, "a");
    838   ck_assert_uint_eq((*bb)->type, BOOL);
    839     // invalid key
    840   ck_assert_ptr_eq(sDictGetP(o, "X"), NULL);
    841   free(c->data);
    842   sDictFreeTiny(o);
    843 
    844 }
    845 
    846 
    847 void sDictSetPT(CuTest *tc UNUSED) {
    848 
    849   sDictt *o = NULL;
    850   sBoolt *b1, *b2;
    851     // elements
    852   sBoolt *b = allocSBool(false);
    853   b1        = b;
    854   sDictSetP(&o, "a", (smallt *) b);
    855   b2 = allocSBool(true);
    856   sDictSetP(&o, "a2", (smallt *) b2);
    857   b  = allocSBool(true);
    858   sDictSetP(&o, "a", (smallt *) b);
    859   b = allocSBool(false);
    860   sDictSetP(&o, "a2", (smallt *) b);
    861     // b1 and b2 is not freed by sDictSetP
    862   ck_assert(!b1->value);
    863   ck_assert(b2->value);
    864   sFree((smallt *) b1);
    865   sFree((smallt *) b2);
    866     // set NULL (not changed)
    867   sDictSetP(&o, "a", NULL);
    868   b = (sBoolt *)sDictGet(o, "a");
    869   ck_assert(b->value);
    870   b = (sBoolt *)sDictGet(o, "a2");
    871   ck_assert(!b->value);
    872   sDictFreeTiny(o);
    873 
    874 }
    875 
    876 
    877 void sDictSetT(CuTest *tc UNUSED) {
    878 
    879   sDictt *o = NULL;
    880     // elements
    881   sBoolt *b = allocSBool(false);
    882   sDictSetTiny(&o, "a", (smallt *) b);
    883   b = allocSBool(true);
    884   sDictSetTiny(&o, "a2", (smallt *) b);
    885   b  = allocSBool(true);
    886   sDictSetTiny(&o, "a", (smallt *) b);
    887   b = allocSBool(false);
    888   sDictSetTiny(&o, "a2", (smallt *) b);
    889     // set NULL (not changed)
    890   sDictSetTiny(&o, "a", NULL);
    891   b = (sBoolt *)sDictGet(o, "a");
    892   ck_assert(b->value);
    893   b = (sBoolt *)sDictGet(o, "a2");
    894   ck_assert(!b->value);
    895   sDictFreeTiny(o);
    896 
    897 }
    898 
    899 
    900 void sDictPushT(CuTest *tc UNUSED) {
    901 
    902   sDictt *o = NULL;
    903     // elements
    904   sBoolt *b = allocSBool(false);
    905   sDictPushTiny(&o, "a", (smallt *) b);
    906   b = allocSBool(true);
    907   sDictPushTiny(&o, "a2", (smallt *) b);
    908   b = allocSBool(true);
    909   sDictPushTiny(&o, "a3", (smallt *) b);
    910   b = allocSBool(true);
    911   sDictPushTiny(&o, "a4", (smallt *) b);
    912   b = allocSBool(true);
    913   sDictPushTiny(&o, "aq", (smallt *) b);
    914   b = allocSBool(true);
    915   sDictPushTiny(&o, "aw", (smallt *) b);
    916   b = allocSBool(true);
    917   sDictPushTiny(&o, "ae", (smallt *) b);
    918   b = allocSBool(true);
    919   sDictPushTiny(&o, "ar", (smallt *) b);
    920   b = allocSBool(true);
    921   sDictPushTiny(&o, "at", (smallt *) b);
    922   b = allocSBool(true);
    923   sDictPushTiny(&o, "ay", (smallt *) b);
    924   b = allocSBool(true);
    925   sDictPushTiny(&o, "au", (smallt *) b);
    926   sContainert *c = allocSContainer(strdup("sheepy"));
    927   sDictPushTiny(&o, "c", (smallt *) c);
    928   sStringt *s = allocSStringTiny("");
    929   sDictPushTiny(&o, "s", (smallt *) s);
    930     // set NULL
    931   sDictPushTiny(&o, "a", NULL);
    932   b = (sBoolt *)sDictGet(o, "a");
    933   ck_assert_uint_eq(b->type, BOOL);
    934   b = (sBoolt *)sDictGet(o, "au");
    935   ck_assert(b->value);
    936   ck_assert_uint_eq(o->count, 13);
    937   // TODO 16 depends on defines SDICT_REALLOC_STEPS and SDICT_MIN_ELEMENTS
    938   ck_assert_uint_eq(o->maxCount, 16);
    939   free(c->data);
    940   sDictFreeTiny(o);
    941 
    942 }
    943 
    944 
    945 void sDictDelT(CuTest *tc UNUSED) {
    946 
    947   sDictt *o = NULL;
    948     // elements
    949   sBoolt *b = allocSBool(false);
    950   sDictPushTiny(&o, "a", (smallt *) b);
    951   sDictDelTiny(o, "a");
    952   b = (sBoolt *)sDictGet(o, "a");
    953   ck_assert_ptr_eq(b, NULL);
    954   sDictFreeTiny(o);
    955 
    956 }
    957 
    958 
    959 void sStringGetT(CuTest *tc UNUSED) {
    960 
    961   sStringt *s = allocSStringTiny("qweqwe");
    962   char *S = sStringGetTiny(s);
    963   ck_assert_str_eq(S, "qweqwe");
    964   free(s);
    965 
    966 }
    967 
    968 
    969 void sStringSetT(CuTest *tc UNUSED) {
    970 
    971   sStringt *s = allocSStringTiny("qweqwe");
    972   sStringSetTiny(&s, "sheepy");
    973   char *S = sStringGetTiny(s);
    974   ck_assert_str_eq(S, "sheepy");
    975   free(s);
    976 
    977 }
    978 
    979 
    980 void sArrayPushT(CuTest *tc UNUSED) {
    981 
    982   sArrayt *a = allocSArray();
    983   sBoolt *b = allocSBool(false);
    984   sArrayPushTiny(&a, (smallt *) b);
    985   sDoublet *D = allocSDouble(10);
    986   sArrayPushTiny(&a, (smallt *) D);
    987   sStringt *s = allocSStringTiny("sheepy");
    988   sArrayPushTiny(&a, (smallt *) s);
    989   sArrayPushTiny(&a, NULL);
    990   sArrayPushTiny(&a, NULL);
    991   ck_assert_uint_eq(a->count, 5);
    992   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
    993   ck_assert_uint_eq(a->maxCount, 8);
    994   sArrayFreeTiny(a);
    995   //NULL
    996   a = NULL;
    997   b = allocSBool(false);
    998   sArrayPushTiny(&a, (smallt *) b);
    999   sArrayFreeTiny(a);
   1000 
   1001 }
   1002 
   1003 
   1004 void sArrayPrependT(CuTest *tc UNUSED) {
   1005 
   1006   sArrayt *a = allocSArray();
   1007   sBoolt *b = allocSBool(false);
   1008   sArrayPrependTiny(&a, (smallt *) b);
   1009   sDoublet *D = allocSDouble(10);
   1010   sArrayPrependTiny(&a, (smallt *) D);
   1011   sStringt *s = allocSStringTiny("sheepy");
   1012   sArrayPrependTiny(&a, (smallt *) s);
   1013   sArrayPrependTiny(&a, NULL);
   1014   sArrayPrependTiny(&a, NULL);
   1015   ck_assert_uint_eq(a->count, 5);
   1016   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1017   ck_assert_uint_eq(a->maxCount, 8);
   1018   sArrayFreeTiny(a);
   1019   //NULL
   1020   a = NULL;
   1021   b = allocSBool(false);
   1022   sArrayPrependTiny(&a, (smallt *) b);
   1023   sArrayFreeTiny(a);
   1024 
   1025 }
   1026 
   1027 
   1028 void sArrayPopT(CuTest *tc UNUSED) {
   1029 
   1030   char *S;
   1031   sArrayt *a = allocSArray();
   1032   sBoolt *b = allocSBool(false);
   1033   sArrayPushTiny(&a, (smallt *) b);
   1034   sDoublet *D = allocSDouble(10);
   1035   sArrayPushTiny(&a, (smallt *) D);
   1036   sStringt *s = allocSStringTiny("sheepy");
   1037   sArrayPushTiny(&a, (smallt *) s);
   1038   sArrayPushTiny(&a, NULL);
   1039   sArrayPushTiny(&a, NULL);
   1040   s = (sStringt *) sArrayPopTiny(a);
   1041   ck_assert_ptr_eq(s, NULL);
   1042   ck_assert_uint_eq(a->count, 4);
   1043   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1044   ck_assert_uint_eq(a->maxCount, 8);
   1045   s = (sStringt *) sArrayPopTiny(a);
   1046   ck_assert_ptr_eq(s, NULL);
   1047   ck_assert_uint_eq(a->count, 3);
   1048   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1049   ck_assert_uint_eq(a->maxCount, 8);
   1050   s = (sStringt *) sArrayPopTiny(a);
   1051   S = sStringGetTiny(s);
   1052   ck_assert_str_eq(S, "sheepy");
   1053   free(s);
   1054   ck_assert_uint_eq(a->count, 2);
   1055   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1056   ck_assert_uint_eq(a->maxCount, 8);
   1057   D = (sDoublet *) sArrayPopTiny(a);
   1058   ck_assert_uint_eq((uint32_t)D->value, 10);
   1059   free(D);
   1060   ck_assert_uint_eq(a->count, 1);
   1061   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1062   ck_assert_uint_eq(a->maxCount, 8);
   1063   b = (sBoolt *) sArrayPopTiny(a);
   1064   ck_assert(!b->value);
   1065   free(b);
   1066   ck_assert_uint_eq(a->count, 0);
   1067   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1068   ck_assert_uint_eq(a->maxCount, 8);
   1069   sArrayFreeTiny(a);
   1070 
   1071 }
   1072 
   1073 
   1074 void sArrayDequeueT(CuTest *tc UNUSED) {
   1075 
   1076   char *S;
   1077   sArrayt *a = allocSArray();
   1078   sBoolt *b = allocSBool(false);
   1079   sArrayPrependTiny(&a, (smallt *) b);
   1080   sDoublet *D = allocSDouble(10);
   1081   sArrayPrependTiny(&a, (smallt *) D);
   1082   sStringt *s = allocSStringTiny("sheepy");
   1083   sArrayPrependTiny(&a, (smallt *) s);
   1084   sArrayPrependTiny(&a, NULL);
   1085   sArrayPrependTiny(&a, NULL);
   1086   s = (sStringt *) sArrayDequeueTiny(a);
   1087   ck_assert_ptr_eq(s, NULL);
   1088   ck_assert_uint_eq(a->count, 4);
   1089   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1090   ck_assert_uint_eq(a->maxCount, 8);
   1091   s = (sStringt *) sArrayDequeueTiny(a);
   1092   ck_assert_ptr_eq(s, NULL);
   1093   ck_assert_uint_eq(a->count, 3);
   1094   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1095   ck_assert_uint_eq(a->maxCount, 8);
   1096   s = (sStringt *) sArrayDequeueTiny(a);
   1097   S = sStringGetTiny(s);
   1098   ck_assert_str_eq(S, "sheepy");
   1099   free(s);
   1100   ck_assert_uint_eq(a->count, 2);
   1101   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1102   ck_assert_uint_eq(a->maxCount, 8);
   1103   D = (sDoublet *) sArrayDequeueTiny(a);
   1104   ck_assert_uint_eq((uint32_t)D->value, 10);
   1105   free(D);
   1106   ck_assert_uint_eq(a->count, 1);
   1107   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1108   ck_assert_uint_eq(a->maxCount, 8);
   1109   b = (sBoolt *) sArrayDequeueTiny(a);
   1110   ck_assert(!b->value);
   1111   free(b);
   1112   ck_assert_uint_eq(a->count, 0);
   1113   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1114   ck_assert_uint_eq(a->maxCount, 8);
   1115   sArrayFreeTiny(a);
   1116 
   1117 }
   1118 
   1119 
   1120 void sArrayGetT(CuTest *tc UNUSED) {
   1121 
   1122   sArrayt *a = allocSArray();
   1123   sBoolt *b = allocSBool(false);
   1124   sArrayPushTiny(&a, (smallt *) b);
   1125   sDoublet *D = allocSDouble(10);
   1126   sArrayPushTiny(&a, (smallt *) D);
   1127   sStringt *s = allocSStringTiny("sheepy");
   1128   sArrayPushTiny(&a, (smallt *) s);
   1129   sArrayPushTiny(&a, NULL);
   1130   sArrayPushTiny(&a, NULL);
   1131   b = (sBoolt *) sArrayGetTiny(a, 0);
   1132   ck_assert(!b->value);
   1133   ck_assert_uint_eq(a->count, 5);
   1134   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1135   ck_assert_uint_eq(a->maxCount, 8);
   1136   sArrayFreeTiny(a);
   1137 
   1138 }
   1139 
   1140 
   1141 void sArrayGetPT(CuTest *tc UNUSED) {
   1142 
   1143   sArrayt *a = allocSArray();
   1144   sBoolt *b = allocSBool(false);
   1145   sArrayPushTiny(&a, (smallt *) b);
   1146   sDoublet *D = allocSDouble(10);
   1147   sArrayPushTiny(&a, (smallt *) D);
   1148   sStringt *s = allocSStringTiny("sheepy");
   1149   sArrayPushTiny(&a, (smallt *) s);
   1150   sArrayPushTiny(&a, NULL);
   1151   sArrayPushTiny(&a, NULL);
   1152   b = (sBoolt *) sArrayGetP(a, 0);
   1153   ck_assert(!b->value);
   1154   ck_assert_uint_eq(a->count, 5);
   1155   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1156   ck_assert_uint_eq(a->maxCount, 8);
   1157   sArrayFreeTiny(a);
   1158 
   1159 }
   1160 
   1161 
   1162 void sArraySetPT(CuTest *tc UNUSED) {
   1163 
   1164   sArrayt *a = allocSArray();
   1165   sBoolt *b = allocSBool(false);
   1166   sArrayPushTiny(&a, (smallt *) b);
   1167   sDoublet *D = allocSDouble(10);
   1168   sArrayPushTiny(&a, (smallt *) D);
   1169   sStringt *s = allocSStringTiny("sheepy");
   1170   sArrayPushTiny(&a, (smallt *) s);
   1171   sArrayPushTiny(&a, NULL);
   1172   sArrayPushTiny(&a, NULL);
   1173   b = (sBoolt *) sArrayGetTiny(a, 0);
   1174   sBoolt *b2 = allocSBool(true);
   1175   sArraySetP(a, 0, (smallt *) b2);
   1176   b2 = (sBoolt *) sArrayGetTiny(a, 0);
   1177   ck_assert(!b->value);
   1178   ck_assert(b2->value);
   1179   sFree((smallt *) b);
   1180   ck_assert_uint_eq(a->count, 5);
   1181   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1182   ck_assert_uint_eq(a->maxCount, 8);
   1183   sArrayFreeTiny(a);
   1184 
   1185 }
   1186 
   1187 
   1188 void sArraySetT(CuTest *tc UNUSED) {
   1189 
   1190   sArrayt *a = allocSArray();
   1191   sBoolt *b = allocSBool(false);
   1192   sArrayPushTiny(&a, (smallt *) b);
   1193   sDoublet *D = allocSDouble(10);
   1194   sArrayPushTiny(&a, (smallt *) D);
   1195   sStringt *s = allocSStringTiny("sheepy");
   1196   sArrayPushTiny(&a, (smallt *) s);
   1197   sArrayPushTiny(&a, NULL);
   1198   sArrayPushTiny(&a, NULL);
   1199   b = (sBoolt *) sArrayGetTiny(a, 0);
   1200   b = allocSBool(true);
   1201   sArraySetTiny(a, 0, (smallt *) b);
   1202   b = (sBoolt *) sArrayGetTiny(a, 0);
   1203   ck_assert(b->value);
   1204   ck_assert_uint_eq(a->count, 5);
   1205   // TODO depends on defines SARRAY_REALLOC_STEPS and SARRAY_MIN_ELEMENTS
   1206   ck_assert_uint_eq(a->maxCount, 8);
   1207   sArrayFreeTiny(a);
   1208 
   1209 }
   1210 
   1211 
   1212 void sArrayReverseT(CuTest *tc UNUSED) {
   1213 
   1214   sArrayt *a = allocSArray();
   1215   sBoolt *b = allocSBool(false);
   1216   sArrayPushTiny(&a, (smallt *) b);
   1217   sDoublet *D = allocSDouble(10);
   1218   sArrayPushTiny(&a, (smallt *) D);
   1219   sStringt *s = allocSStringTiny("sheepy");
   1220   sArrayPushTiny(&a, (smallt *) s);
   1221   sArrayPushTiny(&a, NULL);
   1222   sArrayPushTiny(&a, NULL);
   1223   int r = sArrayReverseTiny(a);
   1224   ck_assert_int_ne(r,0);
   1225   b = (sBoolt *) sArrayGetTiny(a, 4);
   1226   ck_assert(!b->value);
   1227   ck_assert_uint_eq(a->count, 5);
   1228   sArrayFreeTiny(a);
   1229 
   1230 }
   1231 
   1232 
   1233 void sArrayDelT(CuTest *tc UNUSED) {
   1234 
   1235   sArrayt *a = allocSArray();
   1236   sBoolt *b = allocSBool(false);
   1237   sArrayPushTiny(&a, (smallt *) b);
   1238   sDoublet *D = allocSDouble(10);
   1239   sArrayPushTiny(&a, (smallt *) D);
   1240   sStringt *s = allocSStringTiny("sheepy");
   1241   sArrayPushTiny(&a, (smallt *) s);
   1242   sArrayDelTiny(a, 0);
   1243   b = (sBoolt *) sArrayGetTiny(a, 0);
   1244   ck_assert_ptr_eq(b, NULL);
   1245   sArrayFreeTiny(a);
   1246 
   1247 }
   1248 
   1249 void sArrayDelRangeT(CuTest *tc UNUSED) {
   1250 
   1251   sArrayt *a = allocSArray();
   1252   sBoolt *b = allocSBool(false);
   1253   sArrayPushTiny(&a, (smallt *) b);
   1254   sDoublet *D = allocSDouble(10);
   1255   sArrayPushTiny(&a, (smallt *) D);
   1256   sStringt *s = allocSStringTiny("sheepy");
   1257   sArrayPushTiny(&a, (smallt *) s);
   1258   sArrayDelRangeTiny(a, 0,1);
   1259   ck_assert_uint_eq(a->count, 2);
   1260   D = (sDoublet *) sArrayGetTiny(a, 0);
   1261   ck_assert_uint_eq((uint32_t)(D->value), 10);
   1262   sArrayFreeTiny(a);
   1263 
   1264 }
   1265 
   1266 
   1267 
   1268 void sBytesGetT(CuTest *tc UNUSED) {
   1269 
   1270   char *T = "sheepy";
   1271   sBytest *B = allocSBytes();
   1272   sBytesPushBuffer(&B, T, strlen(T)+1);
   1273   char *S = sBytesGet(B);
   1274   ck_assert_str_eq(S, "sheepy");
   1275   free(B);
   1276 
   1277 }
   1278 
   1279 
   1280 void sBytesPushT(CuTest *tc UNUSED) {
   1281 
   1282   sBytest *B = allocSBytes();
   1283   sBytesPush(&B, 1);
   1284   sBytesPush(&B, 2);
   1285   sBytesPush(&B, 3);
   1286   ck_assert_uint_eq(B->count, 3);
   1287   free(B);
   1288   //NULL
   1289   B = NULL;
   1290   sBytesPush(&B, 1);
   1291   sBytesPush(&B, 2);
   1292   sBytesPush(&B, 3);
   1293   ck_assert_uint_eq(B->count, 3);
   1294   free(B);
   1295 
   1296 }
   1297 
   1298 
   1299 void sBytesPushBufferT(CuTest *tc UNUSED) {
   1300 
   1301   char s[] = {1,2,3};
   1302   sBytest *B = NULL;
   1303   sBytesPushBuffer(&B, s, 3);
   1304   ck_assert_uint_eq(B->count, 3);
   1305   char *S = sBytesToStringTiny(B);
   1306   ck_assert_str_eq(S, "[0x01,0x02,0x03]");
   1307   free(S);
   1308     // push to existing
   1309   sBytesPushBuffer(&B, s, 3);
   1310   ck_assert_uint_eq(B->count, 6);
   1311   S = sBytesToStringTiny(B);
   1312   ck_assert_str_eq(S, "[0x01,0x02,0x03,0x01,0x02,0x03]");
   1313   free(S);
   1314   free(B);
   1315   // null
   1316   B = NULL;
   1317   sBytesPushBuffer(&B, NULL, 3);
   1318   ck_assert_uint_eq(B->count, 0);
   1319   free(B);
   1320   // size 0
   1321   B = NULL;
   1322   sBytesPushBuffer(&B, s, 0);
   1323   ck_assert_uint_eq(B->count, 0);
   1324   free(B);
   1325 
   1326 }
   1327 
   1328 
   1329 void sSerialT(CuTest *tc UNUSED) {
   1330 
   1331   char *S;
   1332 
   1333   // dict
   1334   sDictt  *d = allocSDict();
   1335   sBytest *r = sSerial((smallt *) d);
   1336   S = sBytesToStringTiny(r);
   1337   ck_assert_str_eq(S, "[0x04,0x00,0x00,0x00,0x00]");
   1338   free(S);
   1339   sDictFreeTiny(d);
   1340   free(r);
   1341 
   1342   // array
   1343   sArrayt *a = allocSArray();
   1344   r          = sSerial((smallt *) a);
   1345   S          = sBytesToStringTiny(r);
   1346   ck_assert_str_eq(S, "[0x0a,0x00,0x00,0x00,0x00]");
   1347   free(S);
   1348   sArrayFreeTiny(a);
   1349   free(r);
   1350 
   1351   // undefined
   1352   sUndefinedt *u = allocSUndefined();
   1353   r              = sSerial((smallt *) u);
   1354   S              = sBytesToStringTiny(r);
   1355   ck_assert_str_eq(S, "[0x01]");
   1356   free(S);
   1357   free(u);
   1358   free(r);
   1359   //NULL
   1360   ck_assert_ptr_eq(sSerial(NULL), NULL);
   1361 
   1362 }
   1363 
   1364 
   1365 void sDictSerialElementsT(CuTest *tc UNUSED) {
   1366 
   1367   sBytest *r = NULL;
   1368   sDictt  *o = NULL;
   1369   char    *S;
   1370 
   1371   // elements
   1372   // bool
   1373   sBoolt *b = allocSBool(true);
   1374   sDictPushTiny(&o, "a", (smallt *) b);
   1375   // undefined
   1376   sUndefinedt *u = allocSUndefined();
   1377   sDictPushTiny(&o, "u", (smallt *) u);
   1378   // container
   1379   sContainert *c = allocSContainer(strdup("sheepy"));
   1380   sDictPushTiny(&o, "c", (smallt *) c);
   1381   free(c->data);
   1382   // double
   1383   sDoublet *D = allocSDouble(10);
   1384   sDictPushTiny(&o, "d", (smallt *) D);
   1385   // int
   1386   sIntt *i = allocSInt(10);
   1387   sDictPushTiny(&o, "i", (smallt *) i);
   1388   // string
   1389   sStringt *s = allocSStringTiny("sheepy");
   1390   sDictPushTiny(&o, "s", (smallt *) s);
   1391   // bytes
   1392   sBytest *B = allocSBytes();
   1393   sBytesPush(&B, 1);
   1394   sBytesPush(&B, 2);
   1395   sDictPushTiny(&o, "B", (smallt *) B);
   1396   // dict
   1397   sDictt *d = allocSDict();
   1398   b = allocSBool(true);
   1399   sDictPushTiny(&d, "b", (smallt *) b);
   1400   sDictPushTiny(&o, "D", (smallt *) d);
   1401   // array
   1402   sArrayt *a = allocSArray();
   1403   b = allocSBool(true);
   1404   sArrayPushTiny(&a, (smallt *) b);
   1405   sDictPushTiny(&o, "A", (smallt *) a);
   1406 
   1407   sDictSerialElementsTiny(&r, o);
   1408   /* printf ("final count %d\n", r->count); */
   1409   /* S = sToStringTiny((smallt *) o); */
   1410   /* printf("%d %s\n", (int)strlen(S), S); */
   1411   /* free(S); */
   1412   S = sBytesToStringTiny(r);
   1413   /* // debug */
   1414   /* char *ref = "[4,9,0,0,0,97,0,2,1,117,0,1,99,0,3,100,0,6,0,0,0,0,0,0,36,64,105,0,7,10,0,0,0,0,0,0,0,115,0,8,115,104,101,101,112,121,0,66,0,11,2,0,0,0,1,2,68,0,4,1,0,0,0,98,0,2,1,65,0,10,1,0,0,0,2,1]"; */
   1415   /* printf("%d %d\n", (int)strlen(ref), (int)strlen(S)); */
   1416   /* puts(ref); */
   1417   /* puts(S); */
   1418   /* for (size_t i = 0; i < strlen(ref);i++) { */
   1419   /*   if (i < strlen(S)) { */
   1420   /*     if (ref[i] != S[i]) printf(">'%c' '%c' %d<", ref[i], S[i], (int)i); */
   1421   /*   } else { */
   1422   /*     printf(">%c X<", ref[i]); */
   1423   /*   } */
   1424   /* } */
   1425   /* puts(""); */
   1426   ck_assert_str_eq(S, "[0x04,0x09,0x00,0x00,0x00,0x61,0x00,0x02,0x01,0x75,0x00,0x01,0x63,0x00,0x03,0x64,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40,0x69,0x00,0x07,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x00,0x08,0x73,0x68,0x65,0x65,0x70,0x79,0x00,0x42,0x00,0x0b,0x02,0x00,0x00,0x00,0x01,0x02,0x44,0x00,0x04,0x01,0x00,0x00,0x00,0x62,0x00,0x02,0x01,0x41,0x00,0x0a,0x01,0x00,0x00,0x00,0x02,0x01]");
   1427   free(S);
   1428   sDictFreeTiny(o);
   1429   free(r);
   1430 
   1431 }
   1432 
   1433 
   1434 void sArraySerialElementsT(CuTest *tc UNUSED) {
   1435 
   1436   sBytest *r = NULL;
   1437   sArrayt *o = NULL;
   1438   char    *S;
   1439 
   1440   // elements
   1441   // bool
   1442   sBoolt *b = allocSBool(true);
   1443   sArrayPushTiny(&o, (smallt *) b);
   1444   // undefined
   1445   sUndefinedt *u = allocSUndefined();
   1446   sArrayPushTiny(&o, (smallt *) u);
   1447   // container
   1448   sContainert *c = allocSContainer(strdup("sheepy"));
   1449   sArrayPushTiny(&o, (smallt *) c);
   1450   // double
   1451   sDoublet *D = allocSDouble(10);
   1452   sArrayPushTiny(&o, (smallt *) D);
   1453   // int
   1454   sIntt *i = allocSInt(10);
   1455   sArrayPushTiny(&o, (smallt *) i);
   1456   // string
   1457   sStringt *s = allocSStringTiny("sheepy");
   1458   sArrayPushTiny(&o, (smallt *) s);
   1459   // bytes
   1460   sBytest *B = allocSBytes();
   1461   sBytesPush(&B, 1);
   1462   sBytesPush(&B, 2);
   1463   sArrayPushTiny(&o, (smallt *) B);
   1464   // dict
   1465   sDictt *d = allocSDict();
   1466   sArrayPushTiny(&o, (smallt *) d);
   1467   // array
   1468   sArrayt *a = allocSArray();
   1469   sArrayPushTiny(&o, (smallt *) a);
   1470 
   1471   sArraySerialElementsTiny(&r, o);
   1472   /* printf("final count %d\n", r->count); */
   1473   /* S = sToStringTiny((smallt *) o); */
   1474   /* printf("%d %s\n", (int)strlen(S), S); */
   1475   /* free(S); */
   1476   S = sBytesToStringTiny(r);
   1477   ck_assert_str_eq(S, "[0x0a,0x09,0x00,0x00,0x00,0x02,0x01,0x01,0x03,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40,0x07,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x73,0x68,0x65,0x65,0x70,0x79,0x00,0x0b,0x02,0x00,0x00,0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00]");
   1478   free(S);
   1479   free(c->data);
   1480   sArrayFreeTiny(o);
   1481   free(r);
   1482   // array with 1 NULL element
   1483   r = NULL;
   1484   o = allocSArray();
   1485   sArrayPushTiny(&o, NULL);
   1486   sArraySerialElementsTiny(&r, o);
   1487   S = sBytesToStringTiny(r);
   1488   ck_assert_str_eq(S, "[0x0a,0x01,0x00,0x00,0x00,0x01]");
   1489   free(S);
   1490   free(r);
   1491   sArrayFreeTiny(o);
   1492 
   1493 }
   1494 
   1495 
   1496 void sDeserialT(CuTest *tc UNUSED) {
   1497   sBytest *r = NULL;
   1498   char    *S;
   1499 
   1500   // undefined
   1501   sUndefinedt *u = allocSUndefined();
   1502   r = sSerialTiny((smallt *) u);
   1503   free(u);
   1504   u = (sUndefinedt *) sDeserial(r);
   1505   free(r);
   1506   S = sToStringTiny((smallt *) u);
   1507   //printf("%s\n", S);
   1508   ck_assert_str_eq(S, "null");
   1509   free(S);
   1510   free(u);
   1511 
   1512   // bool
   1513   sBoolt *b = allocSBool(true);
   1514   r = sSerialTiny((smallt *) b);
   1515   free(b);
   1516   b = (sBoolt *) sDeserial(r);
   1517   free(r);
   1518   S = sToStringTiny((smallt *) b);
   1519   //printf("%s\n", S);
   1520   ck_assert_str_eq(S, "true");
   1521   free(S);
   1522   free(b);
   1523   // container
   1524   sContainert *c = allocSContainer(strdup("sheepy"));
   1525   r = sSerialTiny((smallt *) c);
   1526   free(c->data);
   1527   free(c);
   1528   c = (sContainert *) sDeserial(r);
   1529   free(r);
   1530   S = sToStringTiny((smallt *) c);
   1531   //printf("%s\n", S);
   1532   ck_assert_str_eq(S, "<data container>");
   1533   free(S);
   1534   free(c);
   1535   // double
   1536   sDoublet *D = allocSDouble(10);
   1537   r = sSerialTiny((smallt *) D);
   1538   free(D);
   1539   D = (sDoublet *) sDeserial(r);
   1540   free(r);
   1541   S = sToStringTiny((smallt *) D);
   1542   //printf("%s\n", S);
   1543   ck_assert_str_eq(S, "1.000000e+01");
   1544   free(S);
   1545   free(D);
   1546   // int
   1547   sIntt *i = allocSInt(10);
   1548   r = sSerialTiny((smallt *) i);
   1549   free(i);
   1550   i = (sIntt *) sDeserial(r);
   1551   free(r);
   1552   S = sToStringTiny((smallt *) i);
   1553   //printf("%s\n", S);
   1554   ck_assert_str_eq(S, "10");
   1555   free(S);
   1556   free(i);
   1557   // string
   1558   sStringt *s = allocSStringTiny("sheepy");
   1559   r = sSerialTiny((smallt *) s);
   1560   free(s);
   1561   s = (sStringt *) sDeserial(r);
   1562   free(r);
   1563   S = sToStringTiny((smallt *) s);
   1564   //printf("%s\n", S);
   1565   ck_assert_str_eq(S, "sheepy");
   1566   free(S);
   1567   free(s);
   1568   // bytes
   1569   sBytest *B = allocSBytes();
   1570   sBytesPush(&B, 1);
   1571   sBytesPush(&B, 2);
   1572   r = sSerialTiny((smallt *) B);
   1573   free(B);
   1574   B = (sBytest *) sDeserial(r);
   1575   free(r);
   1576   S = sToStringTiny((smallt *) B);
   1577   //printf("%s\n", S);
   1578   ck_assert_str_eq(S, "[0x01,0x02]");
   1579   free(S);
   1580   free(B);
   1581   //empty sBytes
   1582   B = allocSBytes();
   1583   ck_assert_ptr_eq(sDeserial(B), NULL);
   1584   free(B);
   1585   //NULL
   1586   ck_assert_ptr_eq(sDeserial(NULL), NULL);
   1587 
   1588 
   1589 }
   1590 
   1591 
   1592 void sDictDeserialElementsT(CuTest *tc UNUSED) {
   1593   sBytest *r = NULL;
   1594   sDictt  *o = NULL;
   1595   char    *S;
   1596 
   1597   // elements
   1598   // bool
   1599   sBoolt *b = allocSBool(true);
   1600   sDictPushTiny(&o, "a", (smallt *) b);
   1601   // undefined
   1602   sUndefinedt *u = allocSUndefined();
   1603   sDictPushTiny(&o, "u", (smallt *) u);
   1604   // container
   1605   sContainert *c = allocSContainer(strdup("sheepy"));
   1606   sDictPushTiny(&o, "c", (smallt *) c);
   1607   free(c->data);
   1608   // double
   1609   sDoublet *D = allocSDouble(10);
   1610   sDictPushTiny(&o, "d", (smallt *) D);
   1611   // int
   1612   sIntt *i = allocSInt(10);
   1613   sDictPushTiny(&o, "i", (smallt *) i);
   1614   // string
   1615   sStringt *s = allocSStringTiny("sheepy");
   1616   sDictPushTiny(&o, "s", (smallt *) s);
   1617   // bytes
   1618   sBytest *B = allocSBytes();
   1619   sBytesPush(&B, 1);
   1620   sBytesPush(&B, 2);
   1621   sDictPushTiny(&o, "B", (smallt *) B);
   1622   // dict
   1623   sDictt *d = allocSDict();
   1624   b = allocSBool(true);
   1625   sDictPushTiny(&d, "b", (smallt *) b);
   1626   sDictPushTiny(&o, "D", (smallt *) d);
   1627   // array
   1628   sArrayt *a = allocSArray();
   1629   b = allocSBool(true);
   1630   sArrayPushTiny(&a, (smallt *) b);
   1631   sDictPushTiny(&o, "A", (smallt *) a);
   1632   sDictSerialElementsTiny(&r, o);
   1633   sDictFreeTiny(o);
   1634   /* S = sToStringTiny((smallt *) r); */
   1635   /* printf("%d %s\n", (int)strlen(S), S); */
   1636   /* free(S); */
   1637   o = (sDictt *) sDeserialTiny(r);
   1638   S = sToStringTiny((smallt *) o);
   1639   ck_assert_str_eq(S, "{\"a\":true,\"u\":null,\"c\":\"<data container>\",\"d\":1.000000e+01,\"i\":10,\"s\":\"sheepy\",\"B\":[0x01,0x02],\"D\":{\"b\":true},\"A\":[true]}");
   1640   free(S);
   1641   sDictFreeTiny(o);
   1642   free(r);
   1643 
   1644 }
   1645 
   1646 
   1647 void sArrayDeserialElementsT(CuTest *tc UNUSED) {
   1648 
   1649   sBytest     *src = NULL;
   1650   sArrayt     *r   = NULL;
   1651   sUndefinedt *u;
   1652   char *S;
   1653 
   1654   // empty array
   1655   r = allocSArray();
   1656   sArraySerialElementsTiny(&src, r);
   1657   sArrayFreeTiny(r);
   1658   r = (sArrayt *) sDeserialTiny(src);
   1659   S = sToStringTiny((smallt *) r);
   1660   ck_assert_str_eq(S, "[]");
   1661   free(S);
   1662   sArrayFreeTiny(r);
   1663   free(src);
   1664   // array
   1665   src = NULL;
   1666   r   = NULL;
   1667   // undefined
   1668   u = allocSUndefined();
   1669   sArrayPushTiny(&r, (smallt *) u);
   1670   // bool
   1671   sBoolt *b = allocSBool(true);
   1672   sArrayPushTiny(&r, (smallt *) b);
   1673   // container
   1674   sContainert *c = allocSContainer(strdup("sheepy"));
   1675   sArrayPushTiny(&r, (smallt *) c);
   1676   free(c->data);
   1677   // double
   1678   sDoublet *D = allocSDouble(10);
   1679   sArrayPushTiny(&r, (smallt *) D);
   1680   // int
   1681   sIntt *i = allocSInt(10);
   1682   sArrayPushTiny(&r, (smallt *) i);
   1683   // string
   1684   sStringt *s = allocSStringTiny("sheepy");
   1685   sArrayPushTiny(&r, (smallt *) s);
   1686   // bytes
   1687   sBytest *B = allocSBytes();
   1688   sBytesPush(&B, 1);
   1689   sBytesPush(&B, 2);
   1690   sArrayPushTiny(&r, (smallt *) B);
   1691   // dict
   1692   sDictt *d = allocSDict();
   1693   sArrayPushTiny(&r, (smallt *) d);
   1694   // array
   1695   sArrayt *a = allocSArray();
   1696   sArrayPushTiny(&r, (smallt *) a);
   1697 
   1698   sArraySerialElementsTiny(&src, r);
   1699   sArrayFreeTiny(r);
   1700   /* S = sToStringTiny((smallt *) src); */
   1701   /* printf("%d %s\n", (int)strlen(S), S); */
   1702   /* free(S); */
   1703   r = (sArrayt *) sDeserialTiny(src);
   1704   S = sToStringTiny((smallt *) r);
   1705   //printf("%s\n", S);
   1706   ck_assert_str_eq(S, "[null,true,\"<data container>\",1.000000e+01,10,\"sheepy\",[0x01,0x02],{},[]]");
   1707   free(S);
   1708   sArrayFreeTiny(r);
   1709   free(src);
   1710 
   1711 }
   1712 
   1713 
   1714 
   1715 
   1716 int main(int n UNUSED, char**v UNUSED) {
   1717   // disable btrace to make the test run faster
   1718   btraceDisable();
   1719   CuString *output = CuStringNew();
   1720   CuSuite *suite = CuSuiteNew();
   1721 
   1722   SUITE_ADD_TEST(suite, isSTypeFT);
   1723   SUITE_ADD_TEST(suite, sSizeT);
   1724   SUITE_ADD_TEST(suite, allocSBoolT);
   1725   SUITE_ADD_TEST(suite, allocSContainerT);
   1726   SUITE_ADD_TEST(suite, allocSDictT);
   1727   SUITE_ADD_TEST(suite, allocSDoubleT);
   1728   SUITE_ADD_TEST(suite, allocSIntT);
   1729   SUITE_ADD_TEST(suite, allocSStringT);
   1730   SUITE_ADD_TEST(suite, allocSArrayT);
   1731   SUITE_ADD_TEST(suite, allocSUndefinedT);
   1732   SUITE_ADD_TEST(suite, allocSBytesT);
   1733   SUITE_ADD_TEST(suite, sFreeT);
   1734   SUITE_ADD_TEST(suite, sDictFreeT);
   1735   SUITE_ADD_TEST(suite, sArrayFreeT);
   1736   SUITE_ADD_TEST(suite, sBoolToStringT);
   1737   SUITE_ADD_TEST(suite, sContainerToStringT);
   1738   SUITE_ADD_TEST(suite, sDictToStringT);
   1739   SUITE_ADD_TEST(suite, sDoubleToStringT);
   1740   SUITE_ADD_TEST(suite, sIntToStringT);
   1741   SUITE_ADD_TEST(suite, sStringToStringT);
   1742   SUITE_ADD_TEST(suite, sArrayToStringT);
   1743   SUITE_ADD_TEST(suite, sUndefinedToStringT);
   1744   SUITE_ADD_TEST(suite, sBytesToStringT);
   1745   SUITE_ADD_TEST(suite, sToStringT);
   1746   SUITE_ADD_TEST(suite, sTypesT);
   1747   SUITE_ADD_TEST(suite, sTypesToBytesT);
   1748   SUITE_ADD_TEST(suite, sDictTypeStringsT);
   1749   SUITE_ADD_TEST(suite, sDictTypesT);
   1750   SUITE_ADD_TEST(suite, sArrayTypeStringsT);
   1751   SUITE_ADD_TEST(suite, sArrayTypesT);
   1752   SUITE_ADD_TEST(suite, sDuplicateT);
   1753   SUITE_ADD_TEST(suite, sDictDuplicateT);
   1754   SUITE_ADD_TEST(suite, sArrayDuplicateT);
   1755   SUITE_ADD_TEST(suite, sDictGetT);
   1756   SUITE_ADD_TEST(suite, sDictGetPT);
   1757   SUITE_ADD_TEST(suite, sDictSetPT);
   1758   SUITE_ADD_TEST(suite, sDictSetT);
   1759   SUITE_ADD_TEST(suite, sDictPushT);
   1760   SUITE_ADD_TEST(suite, sDictDelT);
   1761   SUITE_ADD_TEST(suite, sStringGetT);
   1762   SUITE_ADD_TEST(suite, sStringSetT);
   1763   SUITE_ADD_TEST(suite, sArrayPushT);
   1764   SUITE_ADD_TEST(suite, sArrayPrependT);
   1765   SUITE_ADD_TEST(suite, sArrayPopT);
   1766   SUITE_ADD_TEST(suite, sArrayDequeueT);
   1767   SUITE_ADD_TEST(suite, sArrayGetT);
   1768   SUITE_ADD_TEST(suite, sArrayGetPT);
   1769   SUITE_ADD_TEST(suite, sArraySetPT);
   1770   SUITE_ADD_TEST(suite, sArraySetT);
   1771   SUITE_ADD_TEST(suite, sArrayReverseT);
   1772   SUITE_ADD_TEST(suite, sArrayDelT);
   1773   SUITE_ADD_TEST(suite, sArrayDelRangeT);
   1774   SUITE_ADD_TEST(suite, sBytesGetT);
   1775   SUITE_ADD_TEST(suite, sBytesPushT);
   1776   SUITE_ADD_TEST(suite, sBytesPushBufferT);
   1777   SUITE_ADD_TEST(suite, sSerialT);
   1778   SUITE_ADD_TEST(suite, sDictSerialElementsT);
   1779   SUITE_ADD_TEST(suite, sArraySerialElementsT);
   1780   SUITE_ADD_TEST(suite, sDeserialT);
   1781   SUITE_ADD_TEST(suite, sDictDeserialElementsT);
   1782   SUITE_ADD_TEST(suite, sArrayDeserialElementsT);
   1783 
   1784 
   1785   CuSuiteRun(suite);
   1786   CuSuiteDetails(suite, output);
   1787   printf ("%s\n", output->buffer);
   1788   return suite->failCount;
   1789 }