commit 01b6650c672d7f85145cd7f9de6ad8d2ac187aa7
parent 61110c74afd3167eecb5384613047f90ec59654d
Author: Remy Noulin <loader2x@gmail.com>
Date: Tue, 28 May 2019 08:22:05 -0400
fix smallBytes support and tests
memcheckNetSerial.c | 312 +++++++++----
netSerial.c | 24 +-
netSerial.c.gcov | 1281 ++++++++++++++++++++++++++-------------------------
package.yml | 2 +-
test.c | 11 +
testNetSerial.c | 312 +++++++++----
testNetSerial.sh | 4 +-
7 files changed, 1140 insertions(+), 806 deletions(-)
Diffstat:
7 files changed, 1140 insertions(+), 806 deletions(-)
diff --git a/memcheckNetSerial.c b/memcheckNetSerial.c
@@ -56,7 +56,7 @@ void topT(void) {
setTopNFreeG(&n, (baset *)oU);
B = serialG(&n);
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[0]");
+ ck_assert_str_eq(s, "[0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -69,7 +69,7 @@ void topT(void) {
setTopG(&n, TRUE);
B = serialG(&n);
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[17]");
+ ck_assert_str_eq(s, "[0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -84,7 +84,7 @@ void topT(void) {
logI("len %u", lenG(B));
logSI("%s", toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[3,51,51,51,51,51,51,-13,63]");
+ ck_assert_str_eq(s, "[0x03,0x33,0x33,0x33,0x33,0x33,0x33,0xf3,0x3f]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -99,7 +99,7 @@ void topT(void) {
B = serialG(&n);
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,-12,-46,-11,-57,-73,-46,-69,-18,27]");
+ ck_assert_str_eq(s, "[0xf4,0x82,0xd2,0x8b,0xc7,0xb7,0xd2,0xbb,0xee,0x1b]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -114,7 +114,7 @@ void topT(void) {
B = serialG(&n);
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,-12,-68,-63,-10,11]");
+ ck_assert_str_eq(s, "[0x84,0x80,0xbc,0xc1,0x96,0x0b]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -130,7 +130,7 @@ void topT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,30]");
+ ck_assert_str_eq(s, "[0x84,0x1e]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -145,7 +145,7 @@ void topT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[5,115,116,114,105,110,103,0]");
+ ck_assert_str_eq(s, "[0x05,0x73,0x74,0x72,0x69,0x6e,0x67,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -161,7 +161,7 @@ void topT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[78,1,107,0,8]");
+ ck_assert_str_eq(s, "[0x4e,0x01,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -178,7 +178,7 @@ void topT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x26,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -222,7 +222,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[14,6,48,0,49,0,50,0,51,0,52,0,53,0]");
+ ck_assert_str_eq(s, "[0x0e,0x06,0x30,0x00,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -238,7 +238,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[14,0]");
+ ck_assert_str_eq(s, "[0x0e,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -258,7 +258,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[30,4,48,0,15,49,0,50,0,51,0]");
+ ck_assert_str_eq(s, "[0x1e,0x04,0x30,0x00,0x0f,0x31,0x00,0x32,0x00,0x33,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -283,7 +283,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[30,9,48,0,-1,49,0,50,0,51,0,52,0,53,0,54,0,55,0,56,0,1]");
+ ck_assert_str_eq(s, "[0x1e,0x09,0x30,0x00,0xff,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00,0x36,0x00,0x37,0x00,0x38,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -303,7 +303,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[62,3,48,0,-10,-10,-10,-10,-10,-10,-15,63,49,0,-10,-10,-10,-10,-10,-10,1,64,50,0,102,102,102,102,102,102,10,64]");
+ ck_assert_str_eq(s, "[0x3e,0x03,0x30,0x00,0x9a,0x99,0x99,0x99,0x99,0x99,0xf1,0x3f,0x31,0x00,0x9a,0x99,0x99,0x99,0x99,0x99,0x01,0x40,0x32,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x0a,0x40]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -321,7 +321,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[78,2,48,0,2,49,0,4]");
+ ck_assert_str_eq(s, "[0x4e,0x02,0x30,0x00,0x02,0x31,0x00,0x04]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -340,7 +340,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[94,3,48,0,97,0,49,0,65,0,50,0,122,0]");
+ ck_assert_str_eq(s, "[0x5e,0x03,0x30,0x00,0x61,0x00,0x31,0x00,0x41,0x00,0x32,0x00,0x7a,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -364,7 +364,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[46,2,48,0,2,57,0,69,122,0,49,0,2,49,0,2,90,0,69,45,0,65,0,-44,3]");
+ ck_assert_str_eq(s, "[0x2e,0x02,0x30,0x00,0x02,0x39,0x00,0x45,0x7a,0x00,0x31,0x00,0x02,0x31,0x00,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -389,7 +389,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-18,2,48,0,36,57,0,2,49,0,4,49,0,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0xee,0x02,0x30,0x00,0x24,0x39,0x00,0x02,0x31,0x00,0x04,0x31,0x00,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -408,7 +408,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[110,1,48,0,2,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x6e,0x01,0x30,0x00,0x02,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -430,7 +430,7 @@ void uniformDictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-2,1,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0xfe,0x01,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -439,6 +439,33 @@ void uniformDictT(void) {
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ initiateG(&d);
+ createSmallBytes(b);
+ createSmallBytes(b1);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b1, 5);
+ pushG(&b1, 6);
+ pushG(&b1, 7);
+ setG(&d, "0", &b);
+ setG(&d, "1", &b1);
+ setTopG(&n, &d);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x7e,0x02,0x30,0x00,0x04,0x01,0x02,0x03,0x04,0x31,0x00,0x03,0x05,0x06,0x07]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":[0x01,0x02,0x03,0x04],"_"1"_":[0x05,0x06,0x07]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
}
@@ -474,7 +501,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[15,6]");
+ ck_assert_str_eq(s, "[0x0f,0x06]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -490,7 +517,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[15,0]");
+ ck_assert_str_eq(s, "[0x0f,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -510,7 +537,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[31,4,15]");
+ ck_assert_str_eq(s, "[0x1f,0x04,0x0f]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -529,7 +556,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[63,3,-10,-10,-10,-10,-10,-10,-15,63,-10,-10,-10,-10,-10,-10,1,64,102,102,102,102,102,102,10,64]");
+ ck_assert_str_eq(s, "[0x3f,0x03,0x9a,0x99,0x99,0x99,0x99,0x99,0xf1,0x3f,0x9a,0x99,0x99,0x99,0x99,0x99,0x01,0x40,0x66,0x66,0x66,0x66,0x66,0x66,0x0a,0x40]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -547,7 +574,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[79,2,2,4]");
+ ck_assert_str_eq(s, "[0x4f,0x02,0x02,0x04]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -566,7 +593,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[95,3,97,0,65,0,122,0]");
+ ck_assert_str_eq(s, "[0x5f,0x03,0x61,0x00,0x41,0x00,0x7a,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -590,7 +617,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[47,2,2,57,0,69,122,0,49,0,2,2,90,0,69,45,0,65,0,-44,3]");
+ ck_assert_str_eq(s, "[0x2f,0x02,0x02,0x39,0x00,0x45,0x7a,0x00,0x31,0x00,0x02,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -615,7 +642,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-17,2,36,57,0,2,49,0,4,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0xef,0x02,0x24,0x39,0x00,0x02,0x31,0x00,0x04,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -634,7 +661,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[111,1,2,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x6f,0x01,0x02,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -655,7 +682,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-1,1,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0xff,0x01,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -671,7 +698,7 @@ void uniformArrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[31,10,-1,2]");
+ ck_assert_str_eq(s, "[0x1f,0x0a,0xff,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -680,6 +707,39 @@ void uniformArrayT(void) {
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ initiateG(&A);
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&A, &b);
+ initiateG(&b);
+ pushG(&b, 7);
+ pushG(&b, 8);
+ pushG(&b, 9);
+ pushG(&b, 10);
+ pushG(&b, 11);
+ pushG(&b, 12);
+ pushG(&A, &b);
+ setTopG(&n, &A);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x7f,0x02,0x06,0x01,0x02,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[[0x01,0x02,0x03,0x04,0x05,0x06],[0x07,0x08,0x09,0x0a,0x0b,0x0c]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
}
@@ -715,7 +775,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,-32,49,0,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0xe0,0x31,0x00,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -737,7 +797,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,32,49,0,2,90,0,69,45,0,65,0,2]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0x20,0x31,0x00,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -759,7 +819,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,17,49,0,94,2,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0x11,0x31,0x00,0x5e,0x02,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -783,7 +843,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,-16,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0xf0,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -807,7 +867,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,17,48,0,79,4,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0x11,0x30,0x00,0x4f,0x04,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -831,7 +891,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,-11,49,0,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0xf5,0x31,0x00,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -847,7 +907,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,0,49,0,50,0,36]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x00,0x31,0x00,0x32,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -863,7 +923,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-14,1,122,0,16,48,0,-1,49,0,17,50,0,51,0,17,52,0,53,0,17,54,0,55,0,17,56,0,63,57,0,17,97,0,98,0,17,99,0,100,0,1]");
+ ck_assert_str_eq(s, "[0xf2,0x01,0x7a,0x00,0x10,0x30,0x00,0xff,0x31,0x00,0x11,0x32,0x00,0x33,0x00,0x11,0x34,0x00,0x35,0x00,0x11,0x36,0x00,0x37,0x00,0x11,0x38,0x00,0x3f,0x39,0x00,0x11,0x61,0x00,0x62,0x00,0x11,0x63,0x00,0x64,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -879,7 +939,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,2,122,0,16,48,0,-1,49,0,17,50,0,51,0,17,52,0,53,0,17,54,0,55,0,1,90,0,56,0,-15,57,0,17,97,0,98,0,17,99,0,3,100,0,1]");
+ ck_assert_str_eq(s, "[0x82,0x02,0x7a,0x00,0x10,0x30,0x00,0xff,0x31,0x00,0x11,0x32,0x00,0x33,0x00,0x11,0x34,0x00,0x35,0x00,0x11,0x36,0x00,0x37,0x00,0x01,0x5a,0x00,0x38,0x00,0xf1,0x39,0x00,0x11,0x61,0x00,0x62,0x00,0x11,0x63,0x00,0x03,0x64,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -895,7 +955,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,30,1,48,0,1,50,0,30,1,48,0,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x1e,0x01,0x30,0x00,0x01,0x32,0x00,0x1e,0x01,0x30,0x00,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -912,7 +972,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,51,0,0,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,64,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -928,7 +988,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,80,50,0,50,46,48,0,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x50,0x32,0x00,0x32,0x2e,0x30,0x00,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -944,7 +1004,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,-16,50,0,36,2,4,122,0,38,17,100]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0xf0,0x32,0x00,0x24,0x02,0x04,0x7a,0x00,0x26,0x11,0x64]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -962,7 +1022,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,88,0,49,0,0,50,0,0,51,0,0,52,0,0,53,0,36]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x58,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x33,0x00,0x00,0x34,0x00,0x00,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -977,7 +1037,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,88,2,48,0,64,49,0,2,49,0,2,48,0,69,48,0,49,0,2,50,0,2,48,0,69,48,0,49,0,2,51,0,2,48,0,69,48,0,49,0,2,52,0,2,48,0,69,48,0,49,0,2,53,0,36]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x58,0x02,0x30,0x00,0x40,0x31,0x00,0x02,0x31,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x32,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x33,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x34,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -993,7 +1053,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[114,97,0,-12,48,0,5,0,49,0,0,50,0,0,51,0,0,52,0,0,53,0,36]");
+ ck_assert_str_eq(s, "[0x72,0x61,0x00,0x80,0x30,0x00,0x05,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x33,0x00,0x00,0x34,0x00,0x00,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1010,7 +1070,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,89,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,-16,63,50,0,0,0,0,0,0,0,0,64,51,0,0,0,0,0,0,0,8,64,52,0,0,0,0,0,0,0,16,64,53,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x35,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1026,7 +1086,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[114,97,0,-11,48,0,5,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,-16,63,50,0,0,0,0,0,0,0,0,64,51,0,0,0,0,0,0,0,8,64,52,0,0,0,0,0,0,0,16,64,53,0,0]");
+ ck_assert_str_eq(s, "[0x72,0x61,0x00,0x90,0x30,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x35,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1043,7 +1103,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,74,2,50,0,4,51,0,6,52,0,8,90,0,5,108,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4a,0x02,0x32,0x00,0x04,0x33,0x00,0x06,0x34,0x00,0x08,0x5a,0x00,0x05,0x6c,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1059,7 +1119,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-96,49,0,4,2,50,0,4,51,0,6,52,0,8,90,0,5,108,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xa0,0x31,0x00,0x04,0x02,0x32,0x00,0x04,0x33,0x00,0x06,0x34,0x00,0x08,0x5a,0x00,0x05,0x6c,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1076,7 +1136,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,75,49,0,50,0,50,0,51,0,51,0,52,0,52,0,90,0,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4b,0x31,0x00,0x32,0x00,0x32,0x00,0x33,0x00,0x33,0x00,0x34,0x00,0x34,0x00,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1092,7 +1152,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-80,49,0,4,49,0,50,0,50,0,51,0,51,0,52,0,52,0,90,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xb0,0x31,0x00,0x04,0x31,0x00,0x32,0x00,0x32,0x00,0x33,0x00,0x33,0x00,0x34,0x00,0x34,0x00,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1108,7 +1168,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,76,0,50,0,1,36,51,0,1,21,51,114,0,52,0,1,1,90,0,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4c,0x00,0x32,0x00,0x01,0x24,0x33,0x00,0x01,0x15,0x33,0x72,0x00,0x34,0x00,0x01,0x01,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1124,7 +1184,7 @@ void dictT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-64,49,0,4,0,50,0,1,36,51,0,1,21,51,114,0,52,0,1,1,90,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xc0,0x31,0x00,0x04,0x00,0x32,0x00,0x01,0x24,0x33,0x00,0x01,0x15,0x33,0x72,0x00,0x34,0x00,0x01,0x01,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1133,6 +1193,53 @@ void dictT(void) {
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ parseG(&n, "{"_"0"_":null,"_"z"_":[true,3]}");
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ setG(&n, "bytes", &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x60,0x7a,0x00,0x02,0x11,0x64,0x62,0x79,0x74,0x65,0x73,0x00,0x67,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":null,"_"z"_":[true,3],"_"bytes"_":[0x01,0x02,0x03,0x04,0x05,0x06]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
+ parseG(&n, "{"_"0"_":null,"_"z"_":[true,3],"_"1"_":null}");
+ initiateG(&b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ setG(&n, "bytes", &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x42,0x30,0x00,0x60,0x7a,0x00,0x02,0x11,0x64,0x31,0x00,0x70,0x62,0x79,0x74,0x65,0x73,0x00,0x06,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":null,"_"z"_":[true,3],"_"1"_":null,"_"bytes"_":[0x01,0x02,0x03,0x04,0x05,0x06]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
}
@@ -1169,7 +1276,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,-16,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0xf0,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1194,7 +1301,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,1,79,4,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0x01,0x4f,0x04,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1219,7 +1326,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,-11,49,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0xf5,0x31,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1235,7 +1342,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,96,2,36,0]");
+ ck_assert_str_eq(s, "[0x26,0x60,0x02,0x24,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1251,7 +1358,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,0,36]");
+ ck_assert_str_eq(s, "[0x36,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1267,7 +1374,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-26,1,16,89,17,17,17,17,31,17,17]");
+ ck_assert_str_eq(s, "[0xe6,0x01,0x10,0x59,0x11,0x11,0x11,0x11,0x1f,0x11,0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1283,7 +1390,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-26,1,-11,17,1,81,17,17,31,17,17]");
+ ck_assert_str_eq(s, "[0xe6,0x01,0x91,0x11,0x01,0x51,0x11,0x11,0x1f,0x11,0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1300,7 +1407,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[70,34,48,0,64,49,0,2,78,1,50,0,4,78,1,51,0,6,0]");
+ ck_assert_str_eq(s, "[0x46,0x22,0x30,0x00,0x40,0x31,0x00,0x02,0x4e,0x01,0x32,0x00,0x04,0x4e,0x01,0x33,0x00,0x06,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1316,7 +1423,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,51,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0]");
+ ck_assert_str_eq(s, "[0x36,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1332,7 +1439,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,36,68,0]");
+ ck_assert_str_eq(s, "[0x36,0x24,0x44,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1348,7 +1455,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,85,49,0,50,0,0]");
+ ck_assert_str_eq(s, "[0x36,0x55,0x31,0x00,0x32,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1364,7 +1471,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,15,0,79,2,2,4,0]");
+ ck_assert_str_eq(s, "[0x36,0x0f,0x00,0x4f,0x02,0x02,0x04,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1381,7 +1488,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,72,1,49,0,36,1,50,0,68,1,51,0,100,1,52,0,-12,1,0]");
+ ck_assert_str_eq(s, "[0x56,0x48,0x01,0x31,0x00,0x24,0x01,0x32,0x00,0x44,0x01,0x33,0x00,0x64,0x01,0x34,0x00,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1397,7 +1504,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-12,4,1,49,0,36,1,50,0,68,1,51,0,100,1,52,0,-12,1,0]");
+ ck_assert_str_eq(s, "[0x66,0x80,0x04,0x01,0x31,0x00,0x24,0x01,0x32,0x00,0x44,0x01,0x33,0x00,0x64,0x01,0x34,0x00,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1413,7 +1520,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,73,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0,0,0,0,0,0,8,64,0,0,0,0,0,0,16,64,0]");
+ ck_assert_str_eq(s, "[0x56,0x49,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1429,7 +1536,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-11,4,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0,0,0,0,0,0,8,64,0,0,0,0,0,0,16,64,0]");
+ ck_assert_str_eq(s, "[0x66,0x90,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1445,7 +1552,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,74,2,4,6,8,0]");
+ ck_assert_str_eq(s, "[0x56,0x4a,0x02,0x04,0x06,0x08,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1461,7 +1568,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-96,4,2,4,6,8,0]");
+ ck_assert_str_eq(s, "[0x66,0xa0,0x04,0x02,0x04,0x06,0x08,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1477,7 +1584,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,75,49,0,50,0,51,0,52,0,0]");
+ ck_assert_str_eq(s, "[0x56,0x4b,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1493,7 +1600,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-80,4,49,0,50,0,51,0,52,0,0]");
+ ck_assert_str_eq(s, "[0x66,0xb0,0x04,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1509,7 +1616,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,76,1,36,1,68,1,100,1,-12,1,0]");
+ ck_assert_str_eq(s, "[0x56,0x4c,0x01,0x24,0x01,0x44,0x01,0x64,0x01,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1525,7 +1632,7 @@ void arrayT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-64,4,1,36,1,68,1,100,1,-12,1,0]");
+ ck_assert_str_eq(s, "[0x66,0xc0,0x04,0x01,0x24,0x01,0x44,0x01,0x64,0x01,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1534,6 +1641,53 @@ void arrayT(void) {
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ parseG(&n, "[1,2,null]");
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&n, &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x46,0x24,0x44,0x70,0x06,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[1,2,null,[0x01,0x02,0x03,0x04,0x05,0x06]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
+ parseG(&n, "[1,2]");
+ initiateG(&b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&n, &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x36,0x24,0x44,0x67,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[1,2,[0x01,0x02,0x03,0x04,0x05,0x06]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
}
@@ -1552,7 +1706,7 @@ void variousT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[70,4,37,97,115,100,0,3,114,112,99,0,69,100,115,0,105,100,0,2,112,0,-79,54,81,117,115,101,114,0,111,3,3,81,110,97,109,101,0,36,3,81,110,97,109,101,50,0,-12,-11,24,3,1,69,122,120,99,0,-44,3]");
+ ck_assert_str_eq(s, "[0x46,0x04,0x25,0x61,0x73,0x64,0x00,0x03,0x72,0x70,0x63,0x00,0x45,0x64,0x73,0x00,0x69,0x64,0x00,0x02,0x70,0x00,0xb1,0x36,0x51,0x75,0x73,0x65,0x72,0x00,0x6f,0x03,0x03,0x51,0x6e,0x61,0x6d,0x65,0x00,0x24,0x03,0x51,0x6e,0x61,0x6d,0x65,0x32,0x00,0x84,0x8d,0x18,0x03,0x01,0x45,0x7a,0x78,0x63,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1567,7 +1721,7 @@ void variousT(void) {
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[111,1,4,78,1,97,0,2,-32,20,97,0,2,78,1,97,0,2]");
+ ck_assert_str_eq(s, "[0x6f,0x01,0x04,0x4e,0x01,0x61,0x00,0x02,0xe0,0x14,0x61,0x00,0x02,0x4e,0x01,0x61,0x00,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
diff --git a/netSerial.c b/netSerial.c
@@ -2919,7 +2919,7 @@ internal void dictNetDeserialLevel0(sDictt **dict, char **data) {
case S_BYTES:
B = allocSBytes();
count = netTypeVarintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
break;
@@ -3006,7 +3006,7 @@ internal void arrayNetDeserialLevel0(sArrayt **array, char **data) {
case S_BYTES:
B = allocSBytes();
count = netTypeVarintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
break;
@@ -3273,7 +3273,7 @@ internal void dictNetDeserialLevel1(sDictt **dict, u8 **data, contextt *ctx) {
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
break;
@@ -3441,7 +3441,7 @@ internal void arrayNetDeserialLevel1(sArrayt **array, u8 **data, contextt *ctx)
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
break;
@@ -3723,7 +3723,7 @@ internal void dictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *ctx, boo
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
break;
@@ -3872,7 +3872,7 @@ internal void uniformDictNetDeserialLevel2(sDictt **dict, u8 **data, contextt *c
*data += strlen(key)+1;
B = allocSBytes();
count = varintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
}
@@ -4063,7 +4063,7 @@ internal void arrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt *ctx,
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
break;
@@ -4183,7 +4183,7 @@ internal void uniformArrayNetDeserialLevel2(sArrayt **array, u8 **data, contextt
loop(arrayCount) {
B = allocSBytes();
count = varintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
}
@@ -4488,7 +4488,7 @@ internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool pack
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
break;
@@ -4768,7 +4768,7 @@ internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bo
*data += strlen(key)+1;
B = allocSBytes();
count = varintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sDictPushTiny(dict, key, (smallt *) B);
}
@@ -4967,7 +4967,7 @@ internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool p
readTypeInHighNbl;
count = varintToUint((u8**)data);
}
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
break;
@@ -5218,7 +5218,7 @@ internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx,
loop(arrayCount) {
B = allocSBytes();
count = varintToUint((u8**)data);
- sBytesPushBuffer(&B, data, count);
+ sBytesPushBuffer(&B, *data, count);
*data += count;
sArrayPushTiny(array, (smallt *) B);
}
diff --git a/netSerial.c.gcov b/netSerial.c.gcov
@@ -1,4 +1,4 @@
- -: 0:Source:/home/rlp/git/sw/sheepyPackagesGitHub/netSerial/netSerial.c
+ -: 0:Source:/home/rlp/git/sw/publicGits/netSerial/netSerial.c
-: 0:Graph:netSerial.gcno
-: 0:Data:netSerial.gcda
-: 0:Runs:7
@@ -99,16 +99,18 @@ call 0 never executed
call 0 never executed
branch 1 never executed
branch 2 never executed
-call 3 never executed
+branch 3 never executed
branch 4 never executed
-branch 5 never executed
-call 6 never executed
+call 5 never executed
+branch 6 never executed
branch 7 never executed
-branch 8 never executed
-call 9 never executed
-call 10 never executed
+call 8 never executed
+branch 9 never executed
+branch 10 never executed
call 11 never executed
call 12 never executed
+call 13 never executed
+call 14 never executed
-: 89: }
#####: 90: self->f = netSerialF;
#####: 91:}
@@ -130,16 +132,18 @@ call 0 never executed
call 0 never executed
branch 1 never executed
branch 2 never executed
-call 3 never executed
+branch 3 never executed
branch 4 never executed
-branch 5 never executed
-call 6 never executed
+call 5 never executed
+branch 6 never executed
branch 7 never executed
-branch 8 never executed
-call 9 never executed
-call 10 never executed
+call 8 never executed
+branch 9 never executed
+branch 10 never executed
call 11 never executed
call 12 never executed
+call 13 never executed
+call 14 never executed
-: 102: }
#####: 103: self->f = netSerialF;
#####: 104:}
@@ -161,21 +165,23 @@ call 0 never executed
call 0 never executed
branch 1 never executed
branch 2 never executed
-call 3 never executed
+branch 3 never executed
branch 4 never executed
-branch 5 never executed
-call 6 never executed
+call 5 never executed
+branch 6 never executed
branch 7 never executed
-branch 8 never executed
-call 9 never executed
-call 10 never executed
+call 8 never executed
+branch 9 never executed
+branch 10 never executed
call 11 never executed
call 12 never executed
+call 13 never executed
+call 14 never executed
-: 115: }
#####: 116: self->f = netSerialF;
#####: 117:}
-: 118:
-function initiateNetSerial called 12 returned 100% blocks executed 43%
+function initiateNetSerial called 12 returned 100% blocks executed 40%
12: 119:void initiateNetSerial(smallJsont *self) {
-: 120:
12: 121: initiateSmallJson(self);
@@ -192,16 +198,18 @@ call 0 returned 100%
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
-call 3 never executed
+branch 3 never executed
branch 4 never executed
-branch 5 never executed
-call 6 never executed
+call 5 never executed
+branch 6 never executed
branch 7 never executed
-branch 8 never executed
-call 9 never executed
-call 10 never executed
+call 8 never executed
+branch 9 never executed
+branch 10 never executed
call 11 never executed
call 12 never executed
+call 13 never executed
+call 14 never executed
-: 128: }
12: 129: self->f = netSerialF;
12: 130:}
@@ -366,14 +374,14 @@ function helpNetSerial called 0 returned 0% blocks executed 0%
-: 245:/**
-: 246: * encode type in lower nibble, uint value in high nibble and next bytes as varuint
-: 247: */
-function uintToNetTypeVarint called 108 returned 100% blocks executed 100%
- 108: 248:internal void uintToNetTypeVarint(sBytest **buf, u8 type, u64 value) {
- 108: 249: u64 c = value;
+function uintToNetTypeVarint called 120 returned 100% blocks executed 100%
+ 120: 248:internal void uintToNetTypeVarint(sBytest **buf, u8 type, u64 value) {
+ 120: 249: u64 c = value;
-: 250: /* encode b0..2 */
- 108: 251: u8 b = type + ((c & 0x7) << 4);
- 108: 252: if (c & 0xFFFFFFFFFFFFFFF8) {
-branch 0 taken 11% (fallthrough)
-branch 1 taken 89%
+ 120: 251: u8 b = type + ((c & 0x7) << 4);
+ 120: 252: if (c & 0xFFFFFFFFFFFFFFF8) {
+branch 0 taken 10% (fallthrough)
+branch 1 taken 90%
12: 253: b |= 0x80;
12: 254: sBytesPush(buf, b);
call 0 returned 100%
@@ -393,18 +401,18 @@ call 0 returned 100%
-: 263: }
-: 264: }
-: 265: else
- 96: 266: sBytesPush(buf, b);
+ 108: 266: sBytesPush(buf, b);
call 0 returned 100%
- 108: 267:}
+ 120: 267:}
-: 268:
-: 269:/**
-: 270: * encode uint as varuint
-: 271: */
-function uintToVarint called 180 returned 100% blocks executed 90%
- 180: 272:internal void uintToVarint(sBytest **buf, u64 value) {
- 180: 273: u64 c = value;
- 180: 274: u8 b = c & 0x7F;
- 180: 275: if (c & 0xFFFFFFFFFFFFFF80) {
+function uintToVarint called 190 returned 100% blocks executed 90%
+ 190: 272:internal void uintToVarint(sBytest **buf, u64 value) {
+ 190: 273: u64 c = value;
+ 190: 274: u8 b = c & 0x7F;
+ 190: 275: if (c & 0xFFFFFFFFFFFFFF80) {
branch 0 taken 2% (fallthrough)
branch 1 taken 98%
3: 276: b |= 0x80;
@@ -426,42 +434,42 @@ call 0 returned 100%
-: 286: }
-: 287: }
-: 288: else
- 177: 289: sBytesPush(buf, b);
+ 187: 289: sBytesPush(buf, b);
call 0 returned 100%
- 180: 290:}
+ 190: 290:}
-: 291:
-: 292:/**
-: 293: * decode type and varuint to uint
-: 294: */
-function netTypeVarintToUint called 108 returned 100% blocks executed 100%
- 108: 295:internal u64 netTypeVarintToUint(u8 **buf) {
- 108: 296: u64 r = 0;
+function netTypeVarintToUint called 120 returned 100% blocks executed 100%
+ 120: 295:internal u64 netTypeVarintToUint(u8 **buf) {
+ 120: 296: u64 r = 0;
-: 297:
- 108: 298: r = (**buf >> 4) & 0x7;
+ 120: 298: r = (**buf >> 4) & 0x7;
-: 299:
- 108: 300: u8 c = 0;
- 241: 301: while (**buf & 0x80) {
-branch 0 taken 19%
-branch 1 taken 81% (fallthrough)
+ 120: 300: u8 c = 0;
+ 265: 301: while (**buf & 0x80) {
+branch 0 taken 17%
+branch 1 taken 83% (fallthrough)
25: 302: (*buf)++;
-: 303: // note: keep 0x7FUL to use 64 bit shift operation, without UL a 32 bit shift operation is use and then casted to 64 bit
25: 304: r |= (**buf & 0x7FUL) << (7*c+3);
25: 305: c++;
-: 306: }
- 108: 307: (*buf)++;
- 108: 308: ret r;
+ 120: 307: (*buf)++;
+ 120: 308: ret r;
-: 309:}
-: 310:
-: 311:/**
-: 312: * decode varuint to uint
-: 313: */
-function varintToUint called 180 returned 100% blocks executed 100%
- 180: 314:internal u64 varintToUint(u8 **buf) {
- 180: 315: u64 r = 0;
+function varintToUint called 190 returned 100% blocks executed 100%
+ 190: 314:internal u64 varintToUint(u8 **buf) {
+ 190: 315: u64 r = 0;
-: 316:
- 180: 317: r = (**buf) & 0x7F;
- 180: 318: u8 c = 1;
- 363: 319: while (**buf & 0x80) {
+ 190: 317: r = (**buf) & 0x7F;
+ 190: 318: u8 c = 1;
+ 383: 319: while (**buf & 0x80) {
branch 0 taken 2%
branch 1 taken 98% (fallthrough)
3: 320: (*buf)++;
@@ -469,8 +477,8 @@ branch 1 taken 98% (fallthrough)
3: 322: r |= (**buf & 0x7FUL) << (7*c);
3: 323: c++;
-: 324: }
- 180: 325: (*buf)++;
- 180: 326: ret r;
+ 190: 325: (*buf)++;
+ 190: 326: ret r;
-: 327:}
-: 328:
-: 329:// -------------------------------------
@@ -1489,15 +1497,15 @@ branch 1 taken 33%
33: 1034: ret type;
-: 1035:}
-: 1036:
-function isArrayUniform called 28 returned 100% blocks executed 65%
- 28: 1037:internal u8 isArrayUniform(sArrayt *array) {
- 28: 1038: bool allElementsHaveSameType = true;
- 28: 1039: bool foundFirstType = false;
- 28: 1040: char type = 0;
- 79: 1041: forEachSArray(array, e) {
-branch 0 taken 73%
-branch 1 taken 27% (fallthrough)
- 58: 1042: if (!e) {
+function isArrayUniform called 30 returned 100% blocks executed 65%
+ 30: 1037:internal u8 isArrayUniform(sArrayt *array) {
+ 30: 1038: bool allElementsHaveSameType = true;
+ 30: 1039: bool foundFirstType = false;
+ 30: 1040: char type = 0;
+ 83: 1041: forEachSArray(array, e) {
+branch 0 taken 75%
+branch 1 taken 25% (fallthrough)
+ 62: 1042: if (!e) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 1043: if (foundFirstType) {
@@ -1516,11 +1524,11 @@ branch 1 never executed
-: 1052: }
-: 1053: }
-: 1054: else {
- 58: 1055: if (foundFirstType) {
-branch 0 taken 57% (fallthrough)
-branch 1 taken 43%
+ 62: 1055: if (foundFirstType) {
+branch 0 taken 56% (fallthrough)
+branch 1 taken 44%
-: 1056: u8 nextType;
- 33: 1057: switch(e->type) {
+ 35: 1057: switch(e->type) {
branch 0 taken 0%
branch 1 taken 0%
branch 2 taken 100%
@@ -1533,17 +1541,17 @@ call 0 never executed
call 0 never executed
#####: 1063: break;
-: 1064: default:
- 33: 1065: nextType = NET_SERIAL_TYPES[(u8)e->type];
+ 35: 1065: nextType = NET_SERIAL_TYPES[(u8)e->type];
-: 1066: }
- 33: 1067: if (nextType != type) {
-branch 0 taken 21% (fallthrough)
-branch 1 taken 79%
- 7: 1068: allElementsHaveSameType = false;
- 7: 1069: break;
+ 35: 1067: if (nextType != type) {
+branch 0 taken 26% (fallthrough)
+branch 1 taken 74%
+ 9: 1068: allElementsHaveSameType = false;
+ 9: 1069: break;
-: 1070: }
-: 1071: }
-: 1072: else {
- 25: 1073: switch(e->type) {
+ 27: 1073: switch(e->type) {
branch 0 taken 4%
branch 1 taken 0%
branch 2 taken 96%
@@ -1556,19 +1564,19 @@ call 0 returned 100%
call 0 never executed
#####: 1079: break;
-: 1080: default:
- 24: 1081: type = NET_SERIAL_TYPES[(u8)e->type];
+ 26: 1081: type = NET_SERIAL_TYPES[(u8)e->type];
-: 1082: }
- 25: 1083: foundFirstType = true;
+ 27: 1083: foundFirstType = true;
-: 1084: }
-: 1085: }
-: 1086: }
- 28: 1087: if (allElementsHaveSameType)
-branch 0 taken 75% (fallthrough)
-branch 1 taken 25%
+ 30: 1087: if (allElementsHaveSameType)
+branch 0 taken 70% (fallthrough)
+branch 1 taken 30%
21: 1088: type = UNIFORM_ARRAY;
-: 1089: else
- 7: 1090: type = S_ARRAY;
- 28: 1091: ret type;
+ 9: 1090: type = S_ARRAY;
+ 30: 1091: ret type;
-: 1092:}
-: 1093:
-: 1094:/**
@@ -2518,13 +2526,13 @@ call 0 never executed
-: 1717:/**
-: 1718: * serializer top function
-: 1719: */
-function netSerial called 79 returned 100% blocks executed 88%
- 79: 1720:internal sBytest* netSerial(smallt *o) {
- 79: 1721: sBytest *r = NULL;
- 79: 1722: sBytest *B = NULL;
- 79: 1723: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0};
+function netSerial called 85 returned 100% blocks executed 88%
+ 85: 1720:internal sBytest* netSerial(smallt *o) {
+ 85: 1721: sBytest *r = NULL;
+ 85: 1722: sBytest *B = NULL;
+ 85: 1723: contextt ctx = {.nibble=lowNbl, .nblOffset=0, .boolShift = 0, .boolOffset=0};
-: 1724:
- 79: 1725: switch(o->type) {
+ 85: 1725: switch(o->type) {
branch 0 taken 1%
branch 1 taken 1%
branch 2 taken 46%
@@ -2551,9 +2559,9 @@ call 0 returned 100%
-: 1736: }
1: 1737: break;
-: 1738: case DICT:
- 36: 1739: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING);
+ 39: 1739: dictNetSerial(&r, (sDictt *)&(o->type), &ctx, /*packing=*/NOPACKING);
call 0 returned 100%
- 36: 1740: break;
+ 39: 1740: break;
-: 1741: case DOUBLE:
1: 1742: sBytesPush(&r, NET_SERIAL_TYPES[(u8)o->type]);
call 0 returned 100%
@@ -2576,9 +2584,9 @@ call 0 returned 100%
call 0 returned 100%
1: 1756: break;
-: 1757: case ARRAY:
- 36: 1758: arrayNetSerial(&r, (sArrayt *)&(o->type), &ctx, /*packing=*/NOPACKING);
+ 39: 1758: arrayNetSerial(&r, (sArrayt *)&(o->type), &ctx, /*packing=*/NOPACKING);
call 0 returned 100%
- 36: 1759: break;
+ 39: 1759: break;
-: 1760: case BYTES:
#####: 1761: B = (sBytest *)&(o->type);
#####: 1762: uintToNetTypeVarint(&r, NET_SERIAL_TYPES[(u8)o->type], B->count);
@@ -2587,7 +2595,7 @@ call 0 never executed
call 0 never executed
#####: 1764: break;
-: 1765: }
- 79: 1766: ret r;
+ 85: 1766: ret r;
-: 1767:}
-: 1768:
-: 1769:/**
@@ -2602,56 +2610,56 @@ call 0 never executed
-: 1778: * r small bytes object
-: 1779: * dict dictionary to serialize
-: 1780: */
-function dictNetSerial called 79 returned 100% blocks executed 91%
- 79: 1781:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) {
- 79: 1782: sBytest *B = NULL;
- 79: 1783: char *data = NULL;
+function dictNetSerial called 82 returned 100% blocks executed 96%
+ 82: 1781:internal void dictNetSerial(sBytest **r, sDictt *dict, contextt *ctx, packingT packing) {
+ 82: 1782: sBytest *B = NULL;
+ 82: 1783: char *data = NULL;
-: 1784:
-: 1785: // check if all elements have same type
-: 1786: // then set dict type normal or uniform
-: 1787: // array and dict have to be checked recursively to know if they are normal or uniform
- 79: 1788: bool allElementsHaveSameType = true;
- 79: 1789: bool foundFirstType = false;
- 79: 1790: char type = 0;
+ 82: 1788: bool allElementsHaveSameType = true;
+ 82: 1789: bool foundFirstType = false;
+ 82: 1790: char type = 0;
-: 1791: // get first element type
-: 1792: // compare to other element type
- 200: 1793: {forEachSDict(dict, e) {
+ 207: 1793: {forEachSDict(dict, e) {
branch 0 taken 79%
-branch 1 taken 22% (fallthrough)
- 157: 1794: if (e->key) {
+branch 1 taken 21% (fallthrough)
+ 163: 1794: if (e->key) {
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
- 157: 1795: if (foundFirstType) {
-branch 0 taken 57% (fallthrough)
-branch 1 taken 43%
+ 163: 1795: if (foundFirstType) {
+branch 0 taken 56% (fallthrough)
+branch 1 taken 44%
-: 1796: u8 nextType;
- 89: 1797: switch(e->data->type) {
-branch 0 taken 17%
-branch 1 taken 9%
-branch 2 taken 74%
+ 92: 1797: switch(e->data->type) {
+branch 0 taken 16%
+branch 1 taken 11%
+branch 2 taken 73%
-: 1798: case DICT:
15: 1799: nextType = isDictUniform((sDictt*)e->data);
call 0 returned 100%
15: 1800: break;
-: 1801: case ARRAY:
- 8: 1802: nextType = isArrayUniform((sArrayt*)e->data);
+ 10: 1802: nextType = isArrayUniform((sArrayt*)e->data);
call 0 returned 100%
- 8: 1803: break;
+ 10: 1803: break;
-: 1804: default:
- 66: 1805: nextType = NET_SERIAL_TYPES[(u8)e->data->type];
+ 67: 1805: nextType = NET_SERIAL_TYPES[(u8)e->data->type];
-: 1806: }
- 89: 1807: if (nextType != type) {
-branch 0 taken 40% (fallthrough)
-branch 1 taken 60%
- 36: 1808: allElementsHaveSameType = false;
- 36: 1809: break;
+ 92: 1807: if (nextType != type) {
+branch 0 taken 41% (fallthrough)
+branch 1 taken 59%
+ 38: 1808: allElementsHaveSameType = false;
+ 38: 1809: break;
-: 1810: }
-: 1811: }
-: 1812: else {
- 68: 1813: switch(e->data->type) {
+ 71: 1813: switch(e->data->type) {
branch 0 taken 7%
branch 1 taken 4%
-branch 2 taken 88%
+branch 2 taken 89%
-: 1814: case DICT:
5: 1815: type = isDictUniform((sDictt*)e->data);
call 0 returned 100%
@@ -2661,41 +2669,41 @@ call 0 returned 100%
call 0 returned 100%
3: 1819: break;
-: 1820: default:
- 60: 1821: type = NET_SERIAL_TYPES[(u8)e->data->type];
+ 63: 1821: type = NET_SERIAL_TYPES[(u8)e->data->type];
-: 1822: }
- 68: 1823: foundFirstType = true;
+ 71: 1823: foundFirstType = true;
-: 1824: }
-: 1825: }
-: 1826: }}
-: 1827:
- 79: 1828: if (allElementsHaveSameType) {
+ 82: 1828: if (allElementsHaveSameType) {
branch 0 taken 54% (fallthrough)
branch 1 taken 46%
-: 1829: // uniform dict
-: 1830: // encode type and element count
-: 1831:
-: 1832: // in pack dictionary
- 43: 1833: if (packing == PACKED) {
-branch 0 taken 42% (fallthrough)
-branch 1 taken 58%
+ 44: 1833: if (packing == PACKED) {
+branch 0 taken 41% (fallthrough)
+branch 1 taken 59%
-: 1834: // uniform dict can't be packed
-: 1835: // because there is only one type of packed arrays
18: 1836: goto normalDict;
-: 1837: }
- 25: 1838: elif (packing == UNIFORM) {
-branch 0 taken 16% (fallthrough)
-branch 1 taken 84%
+ 26: 1838: elif (packing == UNIFORM) {
+branch 0 taken 15% (fallthrough)
+branch 1 taken 85%
-: 1839: // when the packing is uniform, there is no need to encode UNIFORM_DICT since all elements have this type
4: 1840: uintToNetTypeVarint(r, type, dict->count);
call 0 returned 100%
-: 1841: }
-: 1842: else {
- 21: 1843: if (ctx->nibble == lowNbl) {
-branch 0 taken 90% (fallthrough)
-branch 1 taken 10%
- 19: 1844: sBytesPush(r, (type << 4) + UNIFORM_DICT);
+ 22: 1843: if (ctx->nibble == lowNbl) {
+branch 0 taken 91% (fallthrough)
+branch 1 taken 9%
+ 20: 1844: sBytesPush(r, (type << 4) + UNIFORM_DICT);
call 0 returned 100%
- 19: 1845: uintToVarint(r, dict->count);
+ 20: 1845: uintToVarint(r, dict->count);
call 0 returned 100%
-: 1846: }
-: 1847: else {
@@ -2709,15 +2717,15 @@ call 0 returned 100%
-: 1854: }
-: 1855:
-: 1856: // encode all element keys and values
- 25: 1857: switch(type) {
+ 26: 1857: switch(type) {
branch 0 taken 8%
-branch 1 taken 16%
+branch 1 taken 15%
branch 2 taken 8%
branch 3 taken 4%
-branch 4 taken 36%
-branch 5 taken 20%
+branch 4 taken 35%
+branch 5 taken 19%
branch 6 taken 8%
-branch 7 taken 0%
+branch 7 taken 4%
branch 8 taken 0%
-: 1858: case S_UNDEFINED:
8: 1859: {forEachSDict(dict, e) {
@@ -2846,42 +2854,42 @@ call 0 returned 100%
-: 1930: }}
2: 1931: break;
-: 1932: case S_BYTES:
- #####: 1933: {forEachSDict(dict, e) {
-branch 0 never executed
-branch 1 never executed
- #####: 1934: if (e->key) {
-branch 0 never executed
-branch 1 never executed
- #####: 1935: sBytesPushBuffer(r, e->key, strlen(e->key) + 1);
-call 0 never executed
- #####: 1936: B = (sBytest *)(e->data);
- #####: 1937: uintToVarint(r, B->count);
-call 0 never executed
- #####: 1938: sBytesPushBuffer(r, &(B->data), B->count);
-call 0 never executed
+ 3: 1933: {forEachSDict(dict, e) {
+branch 0 taken 67%
+branch 1 taken 33% (fallthrough)
+ 2: 1934: if (e->key) {
+branch 0 taken 100% (fallthrough)
+branch 1 taken 0%
+ 2: 1935: sBytesPushBuffer(r, e->key, strlen(e->key) + 1);
+call 0 returned 100%
+ 2: 1936: B = (sBytest *)(e->data);
+ 2: 1937: uintToVarint(r, B->count);
+call 0 returned 100%
+ 2: 1938: sBytesPushBuffer(r, &(B->data), B->count);
+call 0 returned 100%
-: 1939: }
-: 1940: }}
- #####: 1941: break;
+ 1: 1941: break;
-: 1942: }
- 25: 1943: ret;
+ 26: 1943: ret;
-: 1944: }
-: 1945:
-: 1946: normalDict:
-: 1947: // encode type and element count
- 54: 1948: if (packing == PACKED or packing == UNIFORM) {
-branch 0 taken 57% (fallthrough)
-branch 1 taken 43%
-branch 2 taken 13% (fallthrough)
-branch 3 taken 87%
+ 56: 1948: if (packing == PACKED or packing == UNIFORM) {
+branch 0 taken 59% (fallthrough)
+branch 1 taken 41%
+branch 2 taken 12% (fallthrough)
+branch 3 taken 88%
-: 1949: // when the packing is packed or uniform, there is no need to encode DICT type since all elements have this type
27: 1950: uintToVarint(r, dict->count);
call 0 returned 100%
-: 1951: }
-: 1952: else {
- 27: 1953: if (ctx->nibble == lowNbl) {
+ 29: 1953: if (ctx->nibble == lowNbl) {
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
- 25: 1954: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count);
+ 27: 1954: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)dict->type], dict->count);
call 0 returned 100%
-: 1955: }
-: 1956: else {
@@ -2896,38 +2904,38 @@ call 0 returned 100%
-: 1964: }
-: 1965: }
-: 1966:
- 54: 1967: bool pack = false;
+ 56: 1967: bool pack = false;
-: 1968: size_t packCount;
- 210: 1969: enumerateSDict(dict, e, eIdx) {
+ 219: 1969: enumerateSDict(dict, e, eIdx) {
branch 0 taken 74%
branch 1 taken 26% (fallthrough)
- 156: 1970: if (e->key) {
+ 163: 1970: if (e->key) {
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
- 156: 1971: if (!pack) {
-branch 0 taken 76% (fallthrough)
-branch 1 taken 24%
+ 163: 1971: if (!pack) {
+branch 0 taken 77% (fallthrough)
+branch 1 taken 23%
-: 1972: // scan dict for packing
- 118: 1973: if ((dict->count - eIdx) > 3) {
-branch 0 taken 35% (fallthrough)
-branch 1 taken 65%
+ 125: 1973: if ((dict->count - eIdx) > 3) {
+branch 0 taken 34% (fallthrough)
+branch 1 taken 66%
-: 1974: // at least 4 elements, less than that is not worth it
- 41: 1975: if ( e->data->type == DICT
+ 42: 1975: if ( e->data->type == DICT
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
- 38: 1976: or e->data->type == DOUBLE
+ 39: 1976: or e->data->type == DOUBLE
branch 0 taken 95% (fallthrough)
branch 1 taken 5%
- 36: 1977: or e->data->type == INT
-branch 0 taken 94% (fallthrough)
-branch 1 taken 6%
- 34: 1978: or e->data->type == STRING
+ 37: 1977: or e->data->type == INT
+branch 0 taken 95% (fallthrough)
+branch 1 taken 5%
+ 35: 1978: or e->data->type == STRING
branch 0 taken 94% (fallthrough)
branch 1 taken 6%
- 32: 1979: or e->data->type == ARRAY
+ 33: 1979: or e->data->type == ARRAY
branch 0 taken 94% (fallthrough)
branch 1 taken 6%
- 30: 1980: or e->data->type == BYTES) {
+ 31: 1980: or e->data->type == BYTES) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
11: 1981: type = e->data->type;
@@ -2958,36 +2966,36 @@ branch 1 taken 0%
-: 1998: } // not already packing
-: 1999:
-: 2000: // encode key
- 156: 2001: sBytesPushBuffer(r, e->key, strlen(e->key) + 1);
+ 163: 2001: sBytesPushBuffer(r, e->key, strlen(e->key) + 1);
call 0 returned 100%
-: 2002:
-: 2003: // encode value
- 156: 2004: switch(e->data->type) {
-branch 0 taken 17%
-branch 1 taken 20%
-branch 2 taken 13%
-branch 3 taken 8%
-branch 4 taken 21%
-branch 5 taken 14%
-branch 6 taken 8%
-branch 7 taken 0%
+ 163: 2004: switch(e->data->type) {
+branch 0 taken 18%
+branch 1 taken 19%
+branch 2 taken 12%
+branch 3 taken 7%
+branch 4 taken 20%
+branch 5 taken 13%
+branch 6 taken 9%
+branch 7 taken 1%
branch 8 taken 0%
-: 2005: case UNDEFINED:
-: 2006: case CONTAINER:
- 26: 2007: if (ctx->nibble == lowNbl) {
-branch 0 taken 92% (fallthrough)
-branch 1 taken 8%
+ 29: 2007: if (ctx->nibble == lowNbl) {
+branch 0 taken 93% (fallthrough)
+branch 1 taken 7%
-: 2008: #define storeTypeOnly(o)\
-: 2009: sBytesPush(r, NET_SERIAL_TYPES[(u8)o->type]);\
-: 2010: ctx->nibble = highNbl;\
-: 2011: ctx->nblOffset = (*r)->count -1
- 24: 2012: storeTypeOnly(e->data);
+ 27: 2012: storeTypeOnly(e->data);
call 0 returned 100%
-: 2013: }
-: 2014: else {
2: 2015: storeTypeInHighNbl(e->data);
-: 2016: }
- 26: 2017: break;
+ 29: 2017: break;
-: 2018: case BOOL:
31: 2019: if (!ctx->boolOffset) {
branch 0 taken 16% (fallthrough)
@@ -3265,9 +3273,9 @@ call 0 returned 100%
-: 2208: }
22: 2209: break;
-: 2210: case ARRAY:
- 13: 2211: if (pack) {
-branch 0 taken 62% (fallthrough)
-branch 1 taken 38%
+ 15: 2211: if (pack) {
+branch 0 taken 53% (fallthrough)
+branch 1 taken 47%
8: 2212: if (type) {
branch 0 taken 25% (fallthrough)
branch 1 taken 75%
@@ -3299,13 +3307,13 @@ branch 0 taken 25% (fallthrough)
branch 1 taken 75%
-: 2232: } // if pack
-: 2233: else
- 5: 2234: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING);
+ 7: 2234: arrayNetSerial(r, (sArrayt *)(e->data), ctx, /*packing=*/NOPACKING);
call 0 returned 100%
- 13: 2235: break;
+ 15: 2235: break;
-: 2236: case BYTES:
- #####: 2237: if (pack) {
-branch 0 never executed
-branch 1 never executed
+ 2: 2237: if (pack) {
+branch 0 taken 0% (fallthrough)
+branch 1 taken 100%
#####: 2238: if (type) {
branch 0 never executed
branch 1 never executed
@@ -3340,27 +3348,27 @@ branch 0 never executed
branch 1 never executed
-: 2260: } // if pack
-: 2261: else {
- #####: 2262: B = (sBytest *)(e->data);
- #####: 2263: if (ctx->nibble == lowNbl) {
-branch 0 never executed
-branch 1 never executed
- #####: 2264: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count);
-call 0 never executed
+ 2: 2262: B = (sBytest *)(e->data);
+ 2: 2263: if (ctx->nibble == lowNbl) {
+branch 0 taken 50% (fallthrough)
+branch 1 taken 50%
+ 1: 2264: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->data->type], B->count);
+call 0 returned 100%
-: 2265: }
-: 2266: else {
-: 2267: // high nibble
- #####: 2268: storeTypeInHighNbl(e->data);
- #####: 2269: uintToVarint(r, B->count);
-call 0 never executed
+ 1: 2268: storeTypeInHighNbl(e->data);
+ 1: 2269: uintToVarint(r, B->count);
+call 0 returned 100%
-: 2270: }
- #####: 2271: sBytesPushBuffer(r, &(B->data), B->count);
-call 0 never executed
+ 2: 2271: sBytesPushBuffer(r, &(B->data), B->count);
+call 0 returned 100%
-: 2272: }
- #####: 2273: break;
+ 2: 2273: break;
-: 2274: }
-: 2275: }
-: 2276: }
- 54: 2277: ret;
+ 56: 2277: ret;
-: 2278:}
-: 2279:
-: 2280:/**
@@ -3375,25 +3383,25 @@ call 0 never executed
-: 2289: * r small bytes object
-: 2290: * array to serialize
-: 2291: */
-function arrayNetSerial called 73 returned 100% blocks executed 86%
- 73: 2292:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) {
- 73: 2293: sBytest *B = NULL;
- 73: 2294: char *data = NULL;
+function arrayNetSerial called 78 returned 100% blocks executed 91%
+ 78: 2292:internal void arrayNetSerial(sBytest **r, sArrayt *array, contextt *ctx, packingT packing) {
+ 78: 2293: sBytest *B = NULL;
+ 78: 2294: char *data = NULL;
-: 2295:
-: 2296: // check if all elements have same type
-: 2297: // then set array type normal or uniform
-: 2298: // array and dict have to be checked recursively to know if they are normal or uniform
- 73: 2299: bool allElementsHaveSameType = true;
- 73: 2300: bool foundFirstType = false;
- 73: 2301: char type = 0;
+ 78: 2299: bool allElementsHaveSameType = true;
+ 78: 2300: bool foundFirstType = false;
+ 78: 2301: char type = 0;
-: 2302:
-: 2303: // get first element type
-: 2304: // compare to other element type
-: 2305: // null element are interpreted as undefined
- 217: 2306: {forEachSArray(array, e) {
+ 230: 2306: {forEachSArray(array, e) {
branch 0 taken 82%
branch 1 taken 18% (fallthrough)
- 177: 2307: if (!e) {
+ 189: 2307: if (!e) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 2308: if (foundFirstType) {
@@ -3412,14 +3420,14 @@ branch 1 never executed
-: 2317: }
-: 2318: }
-: 2319: else {
- 177: 2320: if (foundFirstType) {
+ 189: 2320: if (foundFirstType) {
branch 0 taken 61% (fallthrough)
branch 1 taken 39%
-: 2321: u8 nextType;
- 108: 2322: switch(e->type) {
+ 115: 2322: switch(e->type) {
branch 0 taken 6%
branch 1 taken 10%
-branch 2 taken 83%
+branch 2 taken 84%
-: 2323: case DICT:
7: 2324: nextType = isDictUniform((sDictt*)e);
call 0 returned 100%
@@ -3429,20 +3437,20 @@ call 0 returned 100%
call 0 returned 100%
11: 2328: break;
-: 2329: default:
- 90: 2330: nextType = NET_SERIAL_TYPES[(u8)e->type];
+ 97: 2330: nextType = NET_SERIAL_TYPES[(u8)e->type];
-: 2331: }
- 108: 2332: if (nextType != type) {
-branch 0 taken 31% (fallthrough)
-branch 1 taken 69%
- 33: 2333: allElementsHaveSameType = false;
- 33: 2334: break;
+ 115: 2332: if (nextType != type) {
+branch 0 taken 32% (fallthrough)
+branch 1 taken 68%
+ 37: 2333: allElementsHaveSameType = false;
+ 37: 2334: break;
-: 2335: }
-: 2336: }
-: 2337: else {
- 69: 2338: switch(e->type) {
+ 74: 2338: switch(e->type) {
branch 0 taken 7%
-branch 1 taken 9%
-branch 2 taken 84%
+branch 1 taken 8%
+branch 2 taken 85%
-: 2339: case DICT:
5: 2340: type = isDictUniform((sDictt*)e);
call 0 returned 100%
@@ -3452,28 +3460,28 @@ call 0 returned 100%
call 0 returned 100%
6: 2344: break;
-: 2345: default:
- 58: 2346: type = NET_SERIAL_TYPES[(u8)e->type];
+ 63: 2346: type = NET_SERIAL_TYPES[(u8)e->type];
-: 2347: }
- 69: 2348: foundFirstType = true;
+ 74: 2348: foundFirstType = true;
-: 2349: }
-: 2350: }
-: 2351: }}
-: 2352:
- 73: 2353: if (allElementsHaveSameType) {
-branch 0 taken 55% (fallthrough)
-branch 1 taken 45%
+ 78: 2353: if (allElementsHaveSameType) {
+branch 0 taken 53% (fallthrough)
+branch 1 taken 47%
-: 2354: // uniform array
-: 2355: // encode type and element count
-: 2356:
-: 2357: // in pack array
- 40: 2358: if (packing == PACKED) {
-branch 0 taken 40% (fallthrough)
-branch 1 taken 60%
+ 41: 2358: if (packing == PACKED) {
+branch 0 taken 39% (fallthrough)
+branch 1 taken 61%
-: 2359: // uniform array can't be packed
-: 2360: // because there is only one type of packed arrays
16: 2361: goto normalArray;
-: 2362: }
- 24: 2363: elif (packing == UNIFORM) {
+ 25: 2363: elif (packing == UNIFORM) {
branch 0 taken 8% (fallthrough)
branch 1 taken 92%
-: 2364: // when the packing is uniform, there is no need to encode UNIFORM_ARRAY since all elements have this type
@@ -3481,12 +3489,12 @@ branch 1 taken 92%
call 0 returned 100%
-: 2366: }
-: 2367: else {
- 22: 2368: if (ctx->nibble == lowNbl) {
-branch 0 taken 77% (fallthrough)
-branch 1 taken 23%
- 17: 2369: sBytesPush(r, (type << 4) + UNIFORM_ARRAY);
+ 23: 2368: if (ctx->nibble == lowNbl) {
+branch 0 taken 78% (fallthrough)
+branch 1 taken 22%
+ 18: 2369: sBytesPush(r, (type << 4) + UNIFORM_ARRAY);
call 0 returned 100%
- 17: 2370: uintToVarint(r, array->count);
+ 18: 2370: uintToVarint(r, array->count);
call 0 returned 100%
-: 2371: }
-: 2372: else {
@@ -3500,15 +3508,15 @@ call 0 returned 100%
-: 2379: }
-: 2380:
-: 2381: // encode all element values
- 24: 2382: switch(type) {
+ 25: 2382: switch(type) {
branch 0 taken 8%
branch 1 taken 8%
branch 2 taken 4%
-branch 3 taken 46%
+branch 3 taken 44%
branch 4 taken 4%
-branch 5 taken 17%
-branch 6 taken 0%
-branch 7 taken 13%
+branch 5 taken 16%
+branch 6 taken 4%
+branch 7 taken 12%
-: 2383: case S_BOOL:
16: 2384: {forEachSArray(array, e) {
branch 0 taken 88%
@@ -3586,52 +3594,52 @@ call 0 returned 100%
-: 2428: }}
4: 2429: break;
-: 2430: case S_BYTES:
- #####: 2431: {forEachSArray(array, e) {
-branch 0 never executed
-branch 1 never executed
- #####: 2432: B = (sBytest *)e;
- #####: 2433: uintToVarint(r, B->count);
-call 0 never executed
- #####: 2434: sBytesPushBuffer(r, &(B->data), B->count);
-call 0 never executed
+ 3: 2431: {forEachSArray(array, e) {
+branch 0 taken 67%
+branch 1 taken 33% (fallthrough)
+ 2: 2432: B = (sBytest *)e;
+ 2: 2433: uintToVarint(r, B->count);
+call 0 returned 100%
+ 2: 2434: sBytesPushBuffer(r, &(B->data), B->count);
+call 0 returned 100%
-: 2435: }}
- #####: 2436: break;
+ 1: 2436: break;
-: 2437: }
- 24: 2438: ret;
+ 25: 2438: ret;
-: 2439: }
-: 2440:
-: 2441: normalArray:
-: 2442: // encode type and element count
- 49: 2443: if (packing == PACKED or packing == UNIFORM) {
-branch 0 taken 67% (fallthrough)
-branch 1 taken 33%
-branch 2 taken 18% (fallthrough)
-branch 3 taken 82%
+ 53: 2443: if (packing == PACKED or packing == UNIFORM) {
+branch 0 taken 70% (fallthrough)
+branch 1 taken 30%
+branch 2 taken 16% (fallthrough)
+branch 3 taken 84%
-: 2444: // when the packing is packed or uniform, there is no need to encode ARRAY type since all elements have this type
22: 2445: uintToVarint(r, array->count);
call 0 returned 100%
-: 2446: }
-: 2447: else {
- 27: 2448: if (ctx->nibble == lowNbl) {
-branch 0 taken 96% (fallthrough)
-branch 1 taken 4%
- 26: 2449: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count);
+ 31: 2448: if (ctx->nibble == lowNbl) {
+branch 0 taken 90% (fallthrough)
+branch 1 taken 10%
+ 28: 2449: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)array->type], array->count);
call 0 returned 100%
-: 2450: }
-: 2451: else {
-: 2452: // high nibble
- 1: 2453: storeTypeInHighNbl(array);
- 1: 2454: uintToVarint(r, array->count);
+ 3: 2453: storeTypeInHighNbl(array);
+ 3: 2454: uintToVarint(r, array->count);
call 0 returned 100%
-: 2455: }
-: 2456: }
-: 2457:
- 49: 2458: bool pack = false;
+ 53: 2458: bool pack = false;
-: 2459: size_t packCount;
- 203: 2460: enumerateSArray(array, e, eIdx) {
+ 218: 2460: enumerateSArray(array, e, eIdx) {
branch 0 taken 76%
branch 1 taken 24% (fallthrough)
- 154: 2461: if (!e) {
+ 165: 2461: if (!e) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 2462: // empty slots are represented as undefined elements
@@ -3651,23 +3659,23 @@ call 0 never executed
-: 2473: }
-: 2474: }
-: 2475: else {
- 154: 2476: if (!pack) {
-branch 0 taken 81% (fallthrough)
-branch 1 taken 19%
+ 165: 2476: if (!pack) {
+branch 0 taken 82% (fallthrough)
+branch 1 taken 18%
-: 2477: // scan array for packing
- 124: 2478: if ((array->count - eIdx) > 3) {
-branch 0 taken 32% (fallthrough)
-branch 1 taken 68%
+ 135: 2478: if ((array->count - eIdx) > 3) {
+branch 0 taken 30% (fallthrough)
+branch 1 taken 70%
-: 2479: // at least 4 elements, less than that is not worth it
- 40: 2480: if ( e->type == DICT
+ 41: 2480: if ( e->type == DICT
branch 0 taken 90% (fallthrough)
branch 1 taken 10%
- 36: 2481: or e->type == DOUBLE
-branch 0 taken 94% (fallthrough)
-branch 1 taken 6%
- 34: 2482: or e->type == INT
-branch 0 taken 91% (fallthrough)
-branch 1 taken 9%
+ 37: 2481: or e->type == DOUBLE
+branch 0 taken 95% (fallthrough)
+branch 1 taken 5%
+ 35: 2482: or e->type == INT
+branch 0 taken 89% (fallthrough)
+branch 1 taken 11%
31: 2483: or e->type == STRING
branch 0 taken 94% (fallthrough)
branch 1 taken 6%
@@ -3677,30 +3685,30 @@ branch 1 taken 7%
27: 2485: or e->type == BYTES) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
- 13: 2486: type = e->type;
- 13: 2487: packCount = 1;
- 13: 2488: smallt *element = ((smallt **) &((array)->data))[eIdx+1];
- 45: 2489: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) {
+ 14: 2486: type = e->type;
+ 14: 2487: packCount = 1;
+ 14: 2488: smallt *element = ((smallt **) &((array)->data))[eIdx+1];
+ 47: 2489: for (size_t i = eIdx+1; i < (array)->count ; i++, element = ((smallt **) &((array)->data))[i]) {
branch 0 taken 100%
branch 1 taken 0% (fallthrough)
- 45: 2490: if (!element) {
+ 47: 2490: if (!element) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 2491: // null element are undefined
#####: 2492: break;
-: 2493: }
-: 2494: else {
- 45: 2495: if (element->type != type) {
-branch 0 taken 29% (fallthrough)
-branch 1 taken 71%
- 13: 2496: break;
+ 47: 2495: if (element->type != type) {
+branch 0 taken 30% (fallthrough)
+branch 1 taken 70%
+ 14: 2496: break;
-: 2497: }
- 32: 2498: packCount++;
+ 33: 2498: packCount++;
-: 2499: } // if element
-: 2500: } // for
- 13: 2501: if (packCount > 3) {
-branch 0 taken 77% (fallthrough)
-branch 1 taken 23%
+ 14: 2501: if (packCount > 3) {
+branch 0 taken 71% (fallthrough)
+branch 1 taken 29%
10: 2502: type = PACKED_NET_SERIAL_TYPES[(u8)type];
10: 2503: pack = true;
-: 2504: }
@@ -3709,40 +3717,40 @@ branch 1 taken 23%
-: 2507: } // not already packing
-: 2508:
-: 2509: // encode element value
- 154: 2510: switch(e->type) {
+ 165: 2510: switch(e->type) {
branch 0 taken 18%
branch 1 taken 22%
-branch 2 taken 10%
+branch 2 taken 9%
branch 3 taken 6%
-branch 4 taken 19%
-branch 5 taken 14%
+branch 4 taken 22%
+branch 5 taken 13%
branch 6 taken 10%
-branch 7 taken 0%
+branch 7 taken 1%
branch 8 taken 0%
-: 2511: case UNDEFINED:
-: 2512: case CONTAINER:
- 28: 2513: if (ctx->nibble == lowNbl) {
+ 29: 2513: if (ctx->nibble == lowNbl) {
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
- 26: 2514: storeTypeOnly(e);
+ 27: 2514: storeTypeOnly(e);
call 0 returned 100%
-: 2515: }
-: 2516: else {
-: 2517: // high nibble
2: 2518: storeTypeInHighNbl(e);
-: 2519: }
- 28: 2520: break;
+ 29: 2520: break;
-: 2521: case BOOL:
- 34: 2522: if (!ctx->boolOffset) {
-branch 0 taken 18% (fallthrough)
-branch 1 taken 82%
+ 36: 2522: if (!ctx->boolOffset) {
+branch 0 taken 22% (fallthrough)
+branch 1 taken 78%
-: 2523: // new packed bools
- 6: 2524: if (ctx->nibble == lowNbl) {
-branch 0 taken 50% (fallthrough)
-branch 1 taken 50%
- 3: 2525: storeNew4bPackedBool(e);
-branch 0 taken 67% (fallthrough)
-branch 1 taken 33%
+ 8: 2524: if (ctx->nibble == lowNbl) {
+branch 0 taken 63% (fallthrough)
+branch 1 taken 38%
+ 5: 2525: storeNew4bPackedBool(e);
+branch 0 taken 80% (fallthrough)
+branch 1 taken 20%
call 2 returned 100%
-: 2526: }
-: 2527: else {
@@ -3797,7 +3805,7 @@ branch 1 taken 22%
-: 2556: }
-: 2557: }
-: 2558: }
- 34: 2559: break;
+ 36: 2559: break;
-: 2560: case DICT:
15: 2561: if (pack) {
branch 0 taken 53% (fallthrough)
@@ -3886,9 +3894,9 @@ call 0 returned 100%
-: 2618: }
10: 2619: break;
-: 2620: case INT:
- 30: 2621: if (pack) {
-branch 0 taken 27% (fallthrough)
-branch 1 taken 73%
+ 36: 2621: if (pack) {
+branch 0 taken 22% (fallthrough)
+branch 1 taken 78%
8: 2622: if (type) {
branch 0 taken 25% (fallthrough)
branch 1 taken 75%
@@ -3923,12 +3931,12 @@ branch 1 taken 75%
-: 2644: else {
-: 2645: // encode int to varint
-: 2646: // v is int64_t to convert to varint
- 22: 2647: i64 v = ((sIntt *)&(e->type))->value;
- 22: 2648: if (ctx->nibble == lowNbl) {
-branch 0 taken 82% (fallthrough)
-branch 1 taken 18%
+ 28: 2647: i64 v = ((sIntt *)&(e->type))->value;
+ 28: 2648: if (ctx->nibble == lowNbl) {
+branch 0 taken 86% (fallthrough)
+branch 1 taken 14%
-: 2649: // encode v with arithmetic shifts
- 18: 2650: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63));
+ 24: 2650: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], (v << 1) ^ (v >> 63));
call 0 returned 100%
-: 2651: }
-: 2652: else {
@@ -3938,7 +3946,7 @@ call 0 returned 100%
call 0 returned 100%
-: 2656: }
-: 2657: }
- 30: 2658: break;
+ 36: 2658: break;
-: 2659: case STRING:
21: 2660: if (pack) {
branch 0 taken 38% (fallthrough)
@@ -4027,9 +4035,9 @@ branch 1 taken 75%
call 0 returned 100%
16: 2718: break;
-: 2719: case BYTES:
- #####: 2720: if (pack) {
-branch 0 never executed
-branch 1 never executed
+ 2: 2720: if (pack) {
+branch 0 taken 0% (fallthrough)
+branch 1 taken 100%
#####: 2721: if (type) {
branch 0 never executed
branch 1 never executed
@@ -4064,53 +4072,53 @@ branch 0 never executed
branch 1 never executed
-: 2743: } // if pack
-: 2744: else {
- #####: 2745: B = (sBytest *)e;
- #####: 2746: if (ctx->nibble == lowNbl) {
-branch 0 never executed
-branch 1 never executed
- #####: 2747: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count);
-call 0 never executed
+ 2: 2745: B = (sBytest *)e;
+ 2: 2746: if (ctx->nibble == lowNbl) {
+branch 0 taken 50% (fallthrough)
+branch 1 taken 50%
+ 1: 2747: uintToNetTypeVarint(r, NET_SERIAL_TYPES[(u8)e->type], B->count);
+call 0 returned 100%
-: 2748: }
-: 2749: else {
-: 2750: // high nibble
- #####: 2751: storeTypeInHighNbl(e);
- #####: 2752: uintToVarint(r, B->count);
-call 0 never executed
+ 1: 2751: storeTypeInHighNbl(e);
+ 1: 2752: uintToVarint(r, B->count);
+call 0 returned 100%
-: 2753: }
- #####: 2754: sBytesPushBuffer(r, &(B->data), B->count);
-call 0 never executed
+ 2: 2754: sBytesPushBuffer(r, &(B->data), B->count);
+call 0 returned 100%
-: 2755: }
- #####: 2756: break;
+ 2: 2756: break;
-: 2757: }
-: 2758: }
-: 2759: }
- 49: 2760: ret;
+ 53: 2760: ret;
-: 2761:}
-: 2762:
-function serialNetSerial called 79 returned 100% blocks executed 80%
- 79: 2763:internal smallBytest* serialNetSerial(smallJsont *self) {
+function serialNetSerial called 85 returned 100% blocks executed 80%
+ 85: 2763:internal smallBytest* serialNetSerial(smallJsont *self) {
-: 2764:
- 79: 2765: smallt *o = getsoG(self);
+ 85: 2765: smallt *o = getsoG(self);
call 0 returned 100%
-: 2766:
- 79: 2767: if (o == NULL)
+ 85: 2767: if (o == NULL)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 2768: ret NULL;
-: 2769:
- 79: 2770: sBytest *B = netSerial(o);
+ 85: 2770: sBytest *B = netSerial(o);
call 0 returned 100%
-: 2771:
- 79: 2772: if (!B) {
+ 85: 2772: if (!B) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 2773: ret NULL;
-: 2774: }
-: 2775:
- 79: 2776: createAllocateSmallBytes(r);
+ 85: 2776: createAllocateSmallBytes(r);
call 0 returned 100%
- 79: 2777: r->B = B;
- 79: 2778: ret r;
+ 85: 2777: r->B = B;
+ 85: 2778: ret r;
-: 2779:}
-: 2780:
-: 2781:// -------------------------------------
@@ -4308,7 +4316,7 @@ call 0 never executed
call 0 never executed
#####: 2921: count = netTypeVarintToUint((u8**)data);
call 0 never executed
- #####: 2922: sBytesPushBuffer(&B, data, count);
+ #####: 2922: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 2923: *data += count;
#####: 2924: sDictPushTiny(dict, key, (smallt *) B);
@@ -4430,7 +4438,7 @@ call 0 never executed
call 0 never executed
#####: 3008: count = netTypeVarintToUint((u8**)data);
call 0 never executed
- #####: 3009: sBytesPushBuffer(&B, data, count);
+ #####: 3009: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 3010: *data += count;
#####: 3011: sArrayPushTiny(array, (smallt *) B);
@@ -4813,7 +4821,7 @@ branch 1 never executed
#####: 3274: count = varintToUint((u8**)data);
call 0 never executed
-: 3275: }
- #####: 3276: sBytesPushBuffer(&B, data, count);
+ #####: 3276: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 3277: *data += count;
#####: 3278: sDictPushTiny(dict, key, (smallt *) B);
@@ -5064,7 +5072,7 @@ branch 1 never executed
#####: 3442: count = varintToUint((u8**)data);
call 0 never executed
-: 3443: }
- #####: 3444: sBytesPushBuffer(&B, data, count);
+ #####: 3444: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 3445: *data += count;
#####: 3446: sArrayPushTiny(array, (smallt *) B);
@@ -5471,7 +5479,7 @@ branch 1 never executed
#####: 3724: count = varintToUint((u8**)data);
call 0 never executed
-: 3725: }
- #####: 3726: sBytesPushBuffer(&B, data, count);
+ #####: 3726: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 3727: *data += count;
#####: 3728: sDictPushTiny(dict, key, (smallt *) B);
@@ -5692,7 +5700,7 @@ branch 1 never executed
call 0 never executed
#####: 3874: count = varintToUint((u8**)data);
call 0 never executed
- #####: 3875: sBytesPushBuffer(&B, data, count);
+ #####: 3875: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 3876: *data += count;
#####: 3877: sDictPushTiny(dict, key, (smallt *) B);
@@ -5979,7 +5987,7 @@ branch 1 never executed
#####: 4064: count = varintToUint((u8**)data);
call 0 never executed
-: 4065: }
- #####: 4066: sBytesPushBuffer(&B, data, count);
+ #####: 4066: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 4067: *data += count;
#####: 4068: sArrayPushTiny(array, (smallt *) B);
@@ -6167,7 +6175,7 @@ branch 1 never executed
call 0 never executed
#####: 4185: count = varintToUint((u8**)data);
call 0 never executed
- #####: 4186: sBytesPushBuffer(&B, data, count);
+ #####: 4186: sBytesPushBuffer(&B, *data, count);
call 0 never executed
#####: 4187: *data += count;
#####: 4188: sArrayPushTiny(array, (smallt *) B);
@@ -6236,24 +6244,24 @@ call 0 never executed
-: 4230:/**
-: 4231: * deserializer top function
-: 4232: */
-function netDeserial called 79 returned 100% blocks executed 85%
- 79: 4233:internal smallt* netDeserial(sBytest *obj) {
- 79: 4234: smallt *r = NULL;
- 79: 4235: double *D = NULL;
- 79: 4236: char *s = NULL;
- 79: 4237: sBytest *B = NULL;
+function netDeserial called 85 returned 100% blocks executed 85%
+ 85: 4233:internal smallt* netDeserial(sBytest *obj) {
+ 85: 4234: smallt *r = NULL;
+ 85: 4235: double *D = NULL;
+ 85: 4236: char *s = NULL;
+ 85: 4237: sBytest *B = NULL;
-: 4238: uint32_t count;
- 79: 4239: char *data = NULL;
- 79: 4240: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL};
+ 85: 4239: char *data = NULL;
+ 85: 4240: contextt ctx = {.nibble=lowNbl, .nblAddr=NULL, .boolShift = 0, .boolAddr=NULL};
-: 4241:
- 79: 4242: switch(obj->data & 0xF) {
+ 85: 4242: switch(obj->data & 0xF) {
branch 0 taken 1%
branch 1 taken 1%
-branch 2 taken 30%
+branch 2 taken 31%
branch 3 taken 1%
branch 4 taken 4%
branch 5 taken 1%
-branch 6 taken 30%
+branch 6 taken 31%
branch 7 taken 0%
branch 8 taken 15%
branch 9 taken 15%
@@ -6267,11 +6275,11 @@ call 0 returned 100%
call 0 returned 100%
1: 4248: break;
-: 4249: case S_DICT:
- 24: 4250: data = (char *)&(obj->data);
+ 26: 4250: data = (char *)&(obj->data);
-: 4251: //debug - ctx.dbuf = (u8*) data;
- 24: 4252: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false);
+ 26: 4252: dictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false);
call 0 returned 100%
- 24: 4253: break;
+ 26: 4253: break;
-: 4254: case S_DOUBLE:
1: 4255: data = &(obj->data)+1;
1: 4256: D = (double *)data;
@@ -6292,11 +6300,11 @@ call 0 returned 100%
call 0 returned 100%
1: 4268: break;
-: 4269: case S_ARRAY:
- 24: 4270: data = (char *)&(obj->data);
+ 26: 4270: data = (char *)&(obj->data);
-: 4271: //debug - ctx.dbuf = (u8*) data;
- 24: 4272: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false);
+ 26: 4272: arrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false);
call 0 returned 100%
- 24: 4273: break;
+ 26: 4273: break;
-: 4274: case S_BYTES:
#####: 4275: B = allocSBytes();
call 0 never executed
@@ -6308,20 +6316,20 @@ call 0 never executed
#####: 4279: r = (smallt *)B;
#####: 4280: break;
-: 4281: case UNIFORM_DICT:
- 12: 4282: data = (char *)&(obj->data);
+ 13: 4282: data = (char *)&(obj->data);
-: 4283: //debug - ctx.dbuf = (u8*) data;
- 12: 4284: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false);
+ 13: 4284: uniformDictNetDeserial((sDictt **)&r, (u8**)&data, &ctx, /*packed=*/false);
call 0 returned 100%
- 12: 4285: break;
+ 13: 4285: break;
-: 4286: case UNIFORM_ARRAY:
- 12: 4287: data = (char *)&(obj->data);
+ 13: 4287: data = (char *)&(obj->data);
-: 4288: //debug - ctx.dbuf = (u8*) data;
- 12: 4289: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false);
+ 13: 4289: uniformArrayNetDeserial((sArrayt **)&r, (u8**)&data, &ctx, /*packed=*/false);
call 0 returned 100%
- 12: 4290: break;
+ 13: 4290: break;
-: 4291: }
-: 4292:
- 79: 4293: ret r;
+ 85: 4293: ret r;
-: 4294:}
-: 4295:
-: 4296:/**
@@ -6333,32 +6341,32 @@ call 0 returned 100%
-: 4302: * dict dictionary holding the elements
-: 4303: * data serialized dictionary
-: 4304: */
-function dictNetDeserial called 54 returned 100% blocks executed 78%
- 54: 4305:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) {
- 54: 4306: sUndefinedt *u = NULL;
- 54: 4307: sBoolt *bo = NULL;
- 54: 4308: double *D = NULL;
- 54: 4309: sDoublet *Do = NULL;
- 54: 4310: sDictt *d = NULL;
- 54: 4311: sIntt *io = NULL;
- 54: 4312: char *s = NULL;
- 54: 4313: sStringt *so = NULL;
- 54: 4314: sArrayt *a = NULL;
- 54: 4315: sBytest *B = NULL;
+function dictNetDeserial called 56 returned 100% blocks executed 84%
+ 56: 4305:internal void dictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) {
+ 56: 4306: sUndefinedt *u = NULL;
+ 56: 4307: sBoolt *bo = NULL;
+ 56: 4308: double *D = NULL;
+ 56: 4309: sDoublet *Do = NULL;
+ 56: 4310: sDictt *d = NULL;
+ 56: 4311: sIntt *io = NULL;
+ 56: 4312: char *s = NULL;
+ 56: 4313: sStringt *so = NULL;
+ 56: 4314: sArrayt *a = NULL;
+ 56: 4315: sBytest *B = NULL;
-: 4316: uint32_t count;
-: 4317: uint32_t dictCount;
-: 4318:
- 54: 4319: if (packed) {
-branch 0 taken 50% (fallthrough)
-branch 1 taken 50%
+ 56: 4319: if (packed) {
+branch 0 taken 48% (fallthrough)
+branch 1 taken 52%
27: 4320: dictCount = varintToUint(data);
call 0 returned 100%
-: 4321: }
-: 4322: else {
- 27: 4323: if (ctx->nibble == lowNbl) {
+ 29: 4323: if (ctx->nibble == lowNbl) {
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
- 25: 4324: dictCount = netTypeVarintToUint(data);
+ 27: 4324: dictCount = netTypeVarintToUint(data);
call 0 returned 100%
-: 4325: }
-: 4326: else {
@@ -6377,67 +6385,67 @@ call 0 returned 100%
-: 4336: }
-: 4337: }
-: 4338:
- 54: 4339: if (!dictCount) {
-branch 0 taken 19% (fallthrough)
-branch 1 taken 81%
+ 56: 4339: if (!dictCount) {
+branch 0 taken 18% (fallthrough)
+branch 1 taken 82%
10: 4340: *dict = allocSDict();
call 0 returned 100%
10: 4341: ret;
-: 4342: }
-: 4343:
- 44: 4344: bool inPack = false;
+ 46: 4344: bool inPack = false;
-: 4345: u8 packedType;
-: 4346: size_t packCount;
- 200: 4347: loop(dictCount) {
+ 209: 4347: loop(dictCount) {
branch 0 taken 78%
branch 1 taken 22% (fallthrough)
- 156: 4348: char *key = (char*)*data;
- 156: 4349: *data += strlen(key)+1;
+ 163: 4348: char *key = (char*)*data;
+ 163: 4349: *data += strlen(key)+1;
-: 4350: char type;
- 156: 4351: if (inPack) {
-branch 0 taken 24% (fallthrough)
-branch 1 taken 76%
+ 163: 4351: if (inPack) {
+branch 0 taken 23% (fallthrough)
+branch 1 taken 77%
38: 4352: type = packedType;
-: 4353: }
-: 4354: else {
- 118: 4355: if (ctx->nibble == lowNbl) {
-branch 0 taken 67% (fallthrough)
-branch 1 taken 33%
- 79: 4356: type = (**data) & 0xF;
+ 125: 4355: if (ctx->nibble == lowNbl) {
+branch 0 taken 66% (fallthrough)
+branch 1 taken 34%
+ 83: 4356: type = (**data) & 0xF;
-: 4357: }
-: 4358: else {
-: 4359: // high nibble
- 39: 4360: type = (*ctx->nblAddr) >> 4;
+ 42: 4360: type = (*ctx->nblAddr) >> 4;
-: 4361: }
-: 4362: }
-: 4363:
- 156: 4364: switch(type) {
-branch 0 taken 17%
-branch 1 taken 20%
+ 163: 4364: switch(type) {
+branch 0 taken 18%
+branch 1 taken 19%
branch 2 taken 1%
branch 3 taken 1%
branch 4 taken 15%
branch 5 taken 9%
-branch 6 taken 1%
-branch 7 taken 0%
-branch 8 taken 10%
+branch 6 taken 2%
+branch 7 taken 1%
+branch 8 taken 9%
branch 9 taken 6%
branch 10 taken 5%
branch 11 taken 5%
branch 12 taken 5%
branch 13 taken 0%
-branch 14 taken 3%
-branch 15 taken 3%
+branch 14 taken 2%
+branch 15 taken 2%
branch 16 taken 0%
-: 4365: case S_UNDEFINED:
- 26: 4366: if (ctx->nibble == lowNbl) {
-branch 0 taken 92% (fallthrough)
-branch 1 taken 8%
+ 29: 4366: if (ctx->nibble == lowNbl) {
+branch 0 taken 93% (fallthrough)
+branch 1 taken 7%
-: 4367: #define readTypeOnly\
-: 4368: ctx->nibble = highNbl;\
-: 4369: ctx->nblAddr = *data;\
-: 4370: (*data)++
- 24: 4371: readTypeOnly;
+ 27: 4371: readTypeOnly;
-: 4372: }
-: 4373: else {
-: 4374: // high nibble
@@ -6445,11 +6453,11 @@ branch 1 taken 8%
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 4376: }
- 26: 4377: u = allocSUndefined();
+ 29: 4377: u = allocSUndefined();
call 0 returned 100%
- 26: 4378: sDictPushTiny(dict, key, (smallt *) u);
+ 29: 4378: sDictPushTiny(dict, key, (smallt *) u);
call 0 returned 100%
- 26: 4379: break;
+ 29: 4379: break;
-: 4380: case S_BOOL:
31: 4381: if (!ctx->boolAddr) {
branch 0 taken 16% (fallthrough)
@@ -6592,35 +6600,35 @@ call 0 returned 100%
call 0 returned 100%
14: 4475: break;
-: 4476: case S_ARRAY:
- 1: 4477: a = NULL;
- 1: 4478: arrayNetDeserial(&a, data, ctx, /*packed=*/false);
+ 3: 4477: a = NULL;
+ 3: 4478: arrayNetDeserial(&a, data, ctx, /*packed=*/false);
call 0 returned 100%
- 1: 4479: sDictPushTiny(dict, key, (smallt *) a);
+ 3: 4479: sDictPushTiny(dict, key, (smallt *) a);
call 0 returned 100%
- 1: 4480: break;
+ 3: 4480: break;
-: 4481: case S_BYTES:
- #####: 4482: B = allocSBytes();
-call 0 never executed
- #####: 4483: if (ctx->nibble == lowNbl) {
-branch 0 never executed
-branch 1 never executed
- #####: 4484: count = netTypeVarintToUint((u8**)data);
-call 0 never executed
+ 2: 4482: B = allocSBytes();
+call 0 returned 100%
+ 2: 4483: if (ctx->nibble == lowNbl) {
+branch 0 taken 50% (fallthrough)
+branch 1 taken 50%
+ 1: 4484: count = netTypeVarintToUint((u8**)data);
+call 0 returned 100%
-: 4485: }
-: 4486: else {
-: 4487: // high nibble
- #####: 4488: readTypeInHighNbl;
-branch 0 never executed
-branch 1 never executed
- #####: 4489: count = varintToUint((u8**)data);
-call 0 never executed
+ 1: 4488: readTypeInHighNbl;
+branch 0 taken 0% (fallthrough)
+branch 1 taken 100%
+ 1: 4489: count = varintToUint((u8**)data);
+call 0 returned 100%
-: 4490: }
- #####: 4491: sBytesPushBuffer(&B, data, count);
-call 0 never executed
- #####: 4492: *data += count;
- #####: 4493: sDictPushTiny(dict, key, (smallt *) B);
-call 0 never executed
- #####: 4494: break;
+ 2: 4491: sBytesPushBuffer(&B, *data, count);
+call 0 returned 100%
+ 2: 4492: *data += count;
+ 2: 4493: sDictPushTiny(dict, key, (smallt *) B);
+call 0 returned 100%
+ 2: 4494: break;
-: 4495: case PK_DICT:
15: 4496: if (!inPack) {
branch 0 taken 20% (fallthrough)
@@ -6854,36 +6862,36 @@ call 0 returned 100%
-: 4646: * dict dictionary holding the elements
-: 4647: * data serialized dictionary
-: 4648: */
-function uniformDictNetDeserial called 25 returned 100% blocks executed 87%
- 25: 4649:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) {
- 25: 4650: sUndefinedt *u = NULL;
- 25: 4651: sBoolt *bo = NULL;
- 25: 4652: double *D = NULL;
- 25: 4653: sDoublet *Do = NULL;
- 25: 4654: sDictt *d = NULL;
- 25: 4655: sIntt *io = NULL;
- 25: 4656: char *s = NULL;
- 25: 4657: sStringt *so = NULL;
- 25: 4658: sArrayt *a = NULL;
- 25: 4659: sBytest *B = NULL;
+function uniformDictNetDeserial called 26 returned 100% blocks executed 97%
+ 26: 4649:internal void uniformDictNetDeserial(sDictt **dict, u8 **data, contextt *ctx, bool packed) {
+ 26: 4650: sUndefinedt *u = NULL;
+ 26: 4651: sBoolt *bo = NULL;
+ 26: 4652: double *D = NULL;
+ 26: 4653: sDoublet *Do = NULL;
+ 26: 4654: sDictt *d = NULL;
+ 26: 4655: sIntt *io = NULL;
+ 26: 4656: char *s = NULL;
+ 26: 4657: sStringt *so = NULL;
+ 26: 4658: sArrayt *a = NULL;
+ 26: 4659: sBytest *B = NULL;
-: 4660: uint32_t count;
-: 4661: uint32_t dictCount;
-: 4662: u8 type;
-: 4663:
- 25: 4664: if (packed) {
-branch 0 taken 16% (fallthrough)
-branch 1 taken 84%
+ 26: 4664: if (packed) {
+branch 0 taken 15% (fallthrough)
+branch 1 taken 85%
4: 4665: type = (**data) & 0xF;
4: 4666: dictCount = netTypeVarintToUint(data);
call 0 returned 100%
-: 4667: }
-: 4668: else {
- 21: 4669: if (ctx->nibble == lowNbl) {
-branch 0 taken 90% (fallthrough)
-branch 1 taken 10%
- 19: 4670: type = (**data) >> 4;
- 19: 4671: (*data)++;
- 19: 4672: dictCount = varintToUint(data);
+ 22: 4669: if (ctx->nibble == lowNbl) {
+branch 0 taken 91% (fallthrough)
+branch 1 taken 9%
+ 20: 4670: type = (**data) >> 4;
+ 20: 4671: (*data)++;
+ 20: 4672: dictCount = varintToUint(data);
call 0 returned 100%
-: 4673: }
-: 4674: else {
@@ -6896,7 +6904,7 @@ call 0 returned 100%
-: 4678: }
-: 4679: }
-: 4680:
- 25: 4681: if (!dictCount) {
+ 26: 4681: if (!dictCount) {
branch 0 taken 4% (fallthrough)
branch 1 taken 96%
1: 4682: *dict = allocSDict();
@@ -6905,15 +6913,15 @@ call 0 returned 100%
-: 4684: }
-: 4685:
-: 4686:
- 24: 4687: switch(type) {
+ 25: 4687: switch(type) {
branch 0 taken 4%
-branch 1 taken 17%
+branch 1 taken 16%
branch 2 taken 4%
branch 3 taken 4%
-branch 4 taken 38%
-branch 5 taken 21%
+branch 4 taken 36%
+branch 5 taken 20%
branch 6 taken 4%
-branch 7 taken 0%
+branch 7 taken 4%
branch 8 taken 4%
branch 9 taken 4%
branch 10 taken 0%
@@ -7033,22 +7041,22 @@ call 0 returned 100%
-: 4763: }
1: 4764: break;
-: 4765: case S_BYTES:
- #####: 4766: loop(dictCount) {
-branch 0 never executed
-branch 1 never executed
- #####: 4767: char *key = (char*)*data;
- #####: 4768: *data += strlen(key)+1;
- #####: 4769: B = allocSBytes();
-call 0 never executed
- #####: 4770: count = varintToUint((u8**)data);
-call 0 never executed
- #####: 4771: sBytesPushBuffer(&B, data, count);
-call 0 never executed
- #####: 4772: *data += count;
- #####: 4773: sDictPushTiny(dict, key, (smallt *) B);
-call 0 never executed
+ 3: 4766: loop(dictCount) {
+branch 0 taken 67%
+branch 1 taken 33% (fallthrough)
+ 2: 4767: char *key = (char*)*data;
+ 2: 4768: *data += strlen(key)+1;
+ 2: 4769: B = allocSBytes();
+call 0 returned 100%
+ 2: 4770: count = varintToUint((u8**)data);
+call 0 returned 100%
+ 2: 4771: sBytesPushBuffer(&B, *data, count);
+call 0 returned 100%
+ 2: 4772: *data += count;
+ 2: 4773: sDictPushTiny(dict, key, (smallt *) B);
+call 0 returned 100%
-: 4774: }
- #####: 4775: break;
+ 1: 4775: break;
-: 4776: case UNIFORM_DICT:
3: 4777: loop(dictCount) {
branch 0 taken 67%
@@ -7087,45 +7095,45 @@ call 0 returned 100%
-: 4803: * array holding the elements
-: 4804: * data serialized dictionary
-: 4805: */
-function arrayNetDeserial called 49 returned 100% blocks executed 78%
- 49: 4806:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) {
- 49: 4807: sUndefinedt *u = NULL;
- 49: 4808: sBoolt *bo = NULL;
- 49: 4809: double *D = NULL;
- 49: 4810: sDoublet *Do = NULL;
- 49: 4811: sDictt *d = NULL;
- 49: 4812: sIntt *io = NULL;
- 49: 4813: char *s = NULL;
- 49: 4814: sStringt *so = NULL;
- 49: 4815: sArrayt *a = NULL;
- 49: 4816: sBytest *B = NULL;
+function arrayNetDeserial called 53 returned 100% blocks executed 84%
+ 53: 4806:internal void arrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) {
+ 53: 4807: sUndefinedt *u = NULL;
+ 53: 4808: sBoolt *bo = NULL;
+ 53: 4809: double *D = NULL;
+ 53: 4810: sDoublet *Do = NULL;
+ 53: 4811: sDictt *d = NULL;
+ 53: 4812: sIntt *io = NULL;
+ 53: 4813: char *s = NULL;
+ 53: 4814: sStringt *so = NULL;
+ 53: 4815: sArrayt *a = NULL;
+ 53: 4816: sBytest *B = NULL;
-: 4817: uint32_t count;
-: 4818: uint32_t arrayCount;
-: 4819:
- 49: 4820: if (packed) {
-branch 0 taken 45% (fallthrough)
-branch 1 taken 55%
+ 53: 4820: if (packed) {
+branch 0 taken 42% (fallthrough)
+branch 1 taken 58%
22: 4821: arrayCount = varintToUint(data);
call 0 returned 100%
-: 4822: }
-: 4823: else {
- 27: 4824: if (ctx->nibble == lowNbl) {
-branch 0 taken 96% (fallthrough)
-branch 1 taken 4%
- 26: 4825: arrayCount = netTypeVarintToUint(data);
+ 31: 4824: if (ctx->nibble == lowNbl) {
+branch 0 taken 90% (fallthrough)
+branch 1 taken 10%
+ 28: 4825: arrayCount = netTypeVarintToUint(data);
call 0 returned 100%
-: 4826: }
-: 4827: else {
-: 4828: // high nibble
- 1: 4829: readTypeInHighNbl;
+ 3: 4829: readTypeInHighNbl;
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
- 1: 4830: arrayCount = varintToUint(data);
+ 3: 4830: arrayCount = varintToUint(data);
call 0 returned 100%
-: 4831: }
-: 4832: }
-: 4833:
- 49: 4834: if (!arrayCount) {
+ 53: 4834: if (!arrayCount) {
branch 0 taken 4% (fallthrough)
branch 1 taken 96%
2: 4835: *array = allocSArray();;
@@ -7133,39 +7141,39 @@ call 0 returned 100%
2: 4836: ret;
-: 4837: }
-: 4838:
- 47: 4839: bool inPack = false;
+ 51: 4839: bool inPack = false;
-: 4840: u8 packedType;
-: 4841: size_t packCount;
- 201: 4842: loop(arrayCount) {
-branch 0 taken 77%
-branch 1 taken 23% (fallthrough)
+ 216: 4842: loop(arrayCount) {
+branch 0 taken 76%
+branch 1 taken 24% (fallthrough)
-: 4843: char type;
- 154: 4844: if (inPack) {
-branch 0 taken 19% (fallthrough)
-branch 1 taken 81%
+ 165: 4844: if (inPack) {
+branch 0 taken 18% (fallthrough)
+branch 1 taken 82%
30: 4845: type = packedType;
-: 4846: }
-: 4847: else {
- 124: 4848: if (ctx->nibble == lowNbl) {
-branch 0 taken 72% (fallthrough)
-branch 1 taken 28%
- 89: 4849: type = (**data) & 0xF;
+ 135: 4848: if (ctx->nibble == lowNbl) {
+branch 0 taken 73% (fallthrough)
+branch 1 taken 27%
+ 99: 4849: type = (**data) & 0xF;
-: 4850: }
-: 4851: else {
-: 4852: // high nibble
- 35: 4853: type = (*ctx->nblAddr) >> 4;
+ 36: 4853: type = (*ctx->nblAddr) >> 4;
-: 4854: }
-: 4855: }
-: 4856:
- 154: 4857: switch(type) {
+ 165: 4857: switch(type) {
branch 0 taken 18%
branch 1 taken 22%
branch 2 taken 1%
branch 3 taken 1%
-branch 4 taken 14%
+branch 4 taken 17%
branch 5 taken 8%
branch 6 taken 1%
-branch 7 taken 0%
+branch 7 taken 1%
branch 8 taken 5%
branch 9 taken 5%
branch 10 taken 5%
@@ -7176,10 +7184,10 @@ branch 14 taken 3%
branch 15 taken 4%
branch 16 taken 0%
-: 4858: case S_UNDEFINED:
- 28: 4859: if (ctx->nibble == lowNbl) {
+ 29: 4859: if (ctx->nibble == lowNbl) {
branch 0 taken 93% (fallthrough)
branch 1 taken 7%
- 26: 4860: readTypeOnly;
+ 27: 4860: readTypeOnly;
-: 4861: }
-: 4862: else {
-: 4863: // high nibble
@@ -7187,21 +7195,21 @@ branch 1 taken 7%
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
-: 4865: }
- 28: 4866: u = allocSUndefined();
+ 29: 4866: u = allocSUndefined();
call 0 returned 100%
- 28: 4867: sArrayPushTiny(array, (smallt *) u);
+ 29: 4867: sArrayPushTiny(array, (smallt *) u);
call 0 returned 100%
- 28: 4868: break;
+ 29: 4868: break;
-: 4869: case S_BOOL:
- 34: 4870: if (!ctx->boolAddr) {
-branch 0 taken 18% (fallthrough)
-branch 1 taken 82%
+ 36: 4870: if (!ctx->boolAddr) {
+branch 0 taken 22% (fallthrough)
+branch 1 taken 78%
-: 4871: // new packed bools
- 6: 4872: if (ctx->nibble == lowNbl) {
-branch 0 taken 50% (fallthrough)
-branch 1 taken 50%
- 3: 4873: read4bPackedBool;
- 3: 4874: bo = allocSBool((*ctx->boolAddr) & 0x10);
+ 8: 4872: if (ctx->nibble == lowNbl) {
+branch 0 taken 63% (fallthrough)
+branch 1 taken 38%
+ 5: 4873: read4bPackedBool;
+ 5: 4874: bo = allocSBool((*ctx->boolAddr) & 0x10);
call 0 returned 100%
-: 4875: }
-: 4876: else {
@@ -7250,9 +7258,9 @@ call 0 returned 100%
-: 4904: }
-: 4905: }
-: 4906: }
- 34: 4907: sArrayPushTiny(array, (smallt *) bo);
+ 36: 4907: sArrayPushTiny(array, (smallt *) bo);
call 0 returned 100%
- 34: 4908: break;
+ 36: 4908: break;
-: 4909: case S_DICT:
2: 4910: d = NULL;
2: 4911: dictNetDeserial(&d, data, ctx, /*packed=*/false);
@@ -7281,10 +7289,10 @@ call 0 returned 100%
2: 4926: break;
-: 4927: case S_INT: {
-: 4928: u64 v;
- 22: 4929: if (ctx->nibble == lowNbl) {
-branch 0 taken 82% (fallthrough)
-branch 1 taken 18%
- 18: 4930: v = netTypeVarintToUint((u8**)data);
+ 28: 4929: if (ctx->nibble == lowNbl) {
+branch 0 taken 86% (fallthrough)
+branch 1 taken 14%
+ 24: 4930: v = netTypeVarintToUint((u8**)data);
call 0 returned 100%
-: 4931: }
-: 4932: else {
@@ -7295,13 +7303,13 @@ branch 1 taken 100%
4: 4935: v = varintToUint(data);
call 0 returned 100%
-: 4936: }
- 22: 4937: v = (v >> 1) ^ (~(v & 1) + 1);
- 22: 4938: io = allocSInt(v);
+ 28: 4937: v = (v >> 1) ^ (~(v & 1) + 1);
+ 28: 4938: io = allocSInt(v);
call 0 returned 100%
- 22: 4939: sArrayPushTiny(array, (smallt *) io);
+ 28: 4939: sArrayPushTiny(array, (smallt *) io);
call 0 returned 100%
-: 4940: }
- 22: 4941: break;
+ 28: 4941: break;
-: 4942: case S_STRING:
13: 4943: if (ctx->nibble == lowNbl) {
branch 0 taken 69% (fallthrough)
@@ -7329,28 +7337,28 @@ call 0 returned 100%
call 0 returned 100%
2: 4959: break;
-: 4960: case S_BYTES:
- #####: 4961: B = allocSBytes();
-call 0 never executed
- #####: 4962: if (ctx->nibble == lowNbl) {
-branch 0 never executed
-branch 1 never executed
- #####: 4963: count = netTypeVarintToUint((u8**)data);
-call 0 never executed
+ 2: 4961: B = allocSBytes();
+call 0 returned 100%
+ 2: 4962: if (ctx->nibble == lowNbl) {
+branch 0 taken 50% (fallthrough)
+branch 1 taken 50%
+ 1: 4963: count = netTypeVarintToUint((u8**)data);
+call 0 returned 100%
-: 4964: }
-: 4965: else {
-: 4966: // high nibble
- #####: 4967: readTypeInHighNbl;
-branch 0 never executed
-branch 1 never executed
- #####: 4968: count = varintToUint((u8**)data);
-call 0 never executed
+ 1: 4967: readTypeInHighNbl;
+branch 0 taken 0% (fallthrough)
+branch 1 taken 100%
+ 1: 4968: count = varintToUint((u8**)data);
+call 0 returned 100%
-: 4969: }
- #####: 4970: sBytesPushBuffer(&B, data, count);
-call 0 never executed
- #####: 4971: *data += count;
- #####: 4972: sArrayPushTiny(array, (smallt *) B);
-call 0 never executed
- #####: 4973: break;
+ 2: 4970: sBytesPushBuffer(&B, *data, count);
+call 0 returned 100%
+ 2: 4971: *data += count;
+ 2: 4972: sArrayPushTiny(array, (smallt *) B);
+call 0 returned 100%
+ 2: 4973: break;
-: 4974: case PK_DICT:
8: 4975: if (!inPack) {
branch 0 taken 25% (fallthrough)
@@ -7575,23 +7583,23 @@ call 0 returned 100%
-: 5116: }
-: 5117:}
-: 5118:
-function uniformArrayNetDeserial called 24 returned 100% blocks executed 89%
- 24: 5119:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) {
- 24: 5120: sUndefinedt *u = NULL;
- 24: 5121: sBoolt *bo = NULL;
- 24: 5122: double *D = NULL;
- 24: 5123: sDoublet *Do = NULL;
- 24: 5124: sDictt *d = NULL;
- 24: 5125: sIntt *io = NULL;
- 24: 5126: char *s = NULL;
- 24: 5127: sStringt *so = NULL;
- 24: 5128: sArrayt *a = NULL;
- 24: 5129: sBytest *B = NULL;
+function uniformArrayNetDeserial called 25 returned 100% blocks executed 99%
+ 25: 5119:internal void uniformArrayNetDeserial(sArrayt **array, u8 **data, contextt *ctx, bool packed) {
+ 25: 5120: sUndefinedt *u = NULL;
+ 25: 5121: sBoolt *bo = NULL;
+ 25: 5122: double *D = NULL;
+ 25: 5123: sDoublet *Do = NULL;
+ 25: 5124: sDictt *d = NULL;
+ 25: 5125: sIntt *io = NULL;
+ 25: 5126: char *s = NULL;
+ 25: 5127: sStringt *so = NULL;
+ 25: 5128: sArrayt *a = NULL;
+ 25: 5129: sBytest *B = NULL;
-: 5130: uint32_t count;
-: 5131: uint32_t arrayCount;
-: 5132: u8 type;
-: 5133:
- 24: 5134: if (packed) {
+ 25: 5134: if (packed) {
branch 0 taken 8% (fallthrough)
branch 1 taken 92%
2: 5135: type = (**data) & 0xF;
@@ -7599,12 +7607,12 @@ branch 1 taken 92%
call 0 returned 100%
-: 5137: }
-: 5138: else {
- 22: 5139: if (ctx->nibble == lowNbl) {
-branch 0 taken 77% (fallthrough)
-branch 1 taken 23%
- 17: 5140: type = (**data) >> 4;
- 17: 5141: (*data)++;
- 17: 5142: arrayCount = varintToUint(data);
+ 23: 5139: if (ctx->nibble == lowNbl) {
+branch 0 taken 78% (fallthrough)
+branch 1 taken 22%
+ 18: 5140: type = (**data) >> 4;
+ 18: 5141: (*data)++;
+ 18: 5142: arrayCount = varintToUint(data);
call 0 returned 100%
-: 5143: }
-: 5144: else {
@@ -7617,7 +7625,7 @@ call 0 returned 100%
-: 5148: }
-: 5149: }
-: 5150:
- 24: 5151: if (!arrayCount) {
+ 25: 5151: if (!arrayCount) {
branch 0 taken 8% (fallthrough)
branch 1 taken 92%
2: 5152: *array = allocSArray();;
@@ -7625,17 +7633,17 @@ call 0 returned 100%
2: 5153: ret;
-: 5154: }
-: 5155:
- 22: 5156: switch(type) {
-branch 0 taken 5%
+ 23: 5156: switch(type) {
+branch 0 taken 4%
branch 1 taken 9%
-branch 2 taken 5%
-branch 3 taken 5%
-branch 4 taken 50%
-branch 5 taken 5%
-branch 6 taken 14%
-branch 7 taken 0%
-branch 8 taken 5%
-branch 9 taken 5%
+branch 2 taken 4%
+branch 3 taken 4%
+branch 4 taken 48%
+branch 5 taken 4%
+branch 6 taken 13%
+branch 7 taken 4%
+branch 8 taken 4%
+branch 9 taken 4%
branch 10 taken 0%
-: 5157: case S_UNDEFINED:
7: 5158: loop(arrayCount) {
@@ -7732,20 +7740,20 @@ call 0 returned 100%
-: 5215: }
3: 5216: break;
-: 5217: case S_BYTES:
- #####: 5218: loop(arrayCount) {
-branch 0 never executed
-branch 1 never executed
- #####: 5219: B = allocSBytes();
-call 0 never executed
- #####: 5220: count = varintToUint((u8**)data);
-call 0 never executed
- #####: 5221: sBytesPushBuffer(&B, data, count);
-call 0 never executed
- #####: 5222: *data += count;
- #####: 5223: sArrayPushTiny(array, (smallt *) B);
-call 0 never executed
+ 3: 5218: loop(arrayCount) {
+branch 0 taken 67%
+branch 1 taken 33% (fallthrough)
+ 2: 5219: B = allocSBytes();
+call 0 returned 100%
+ 2: 5220: count = varintToUint((u8**)data);
+call 0 returned 100%
+ 2: 5221: sBytesPushBuffer(&B, *data, count);
+call 0 returned 100%
+ 2: 5222: *data += count;
+ 2: 5223: sArrayPushTiny(array, (smallt *) B);
+call 0 returned 100%
-: 5224: }
- #####: 5225: break;
+ 1: 5225: break;
-: 5226: case UNIFORM_DICT:
3: 5227: loop(arrayCount) {
branch 0 taken 67%
@@ -7771,10 +7779,10 @@ call 0 returned 100%
-: 5240: }
-: 5241:}
-: 5242:
-function deserialNetSerial called 80 returned 100% blocks executed 91%
- 80: 5243:internal smallJsont* deserialNetSerial(smallJsont *self, smallBytest *data) {
+function deserialNetSerial called 86 returned 100% blocks executed 91%
+ 86: 5243:internal smallJsont* deserialNetSerial(smallJsont *self, smallBytest *data) {
-: 5244:
- 80: 5245: if (!data or !data->B or !data->B->count) {
+ 86: 5245: if (!data or !data->B or !data->B->count) {
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
branch 2 taken 100% (fallthrough)
@@ -7784,22 +7792,29 @@ branch 5 taken 99%
1: 5246: ret self;
-: 5247: }
-: 5248:
- 79: 5249: smallt *o = netDeserial(data->B);
+ 85: 5249: smallt *o = netDeserial(data->B);
call 0 returned 100%
-: 5250:
- 79: 5251: if (!o) {
+ 85: 5251: if (!o) {
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
#####: 5252: ret self;
-: 5253: }
-: 5254:
- 79: 5255: freeG(self);
+ 85: 5255: freeG(self);
call 0 returned 100%
-: 5256:
- 79: 5257: setsoG(self, o);
+ 85: 5257: setsoG(self, o);
call 0 returned 100%
-: 5258:
- 79: 5259: ret self;
+ 85: 5259: ret self;
-: 5260:}
-: 5261:
-: 5262:// vim: set expandtab ts=2 sw=2:
+ -: 5263:
+function checkLibsheepyVersionNetSerial called 0 returned 0% blocks executed 0%
+ #####: 5264:bool checkLibsheepyVersionNetSerial(const char *currentLibsheepyVersion) {
+ #####: 5265: return eqG(currentLibsheepyVersion, LIBSHEEPY_VERSION);
+call 0 never executed
+ -: 5266:}
+ -: 5267:
diff --git a/package.yml b/package.yml
@@ -1,6 +1,6 @@
---
name: netSerial
- version: 0.0.7
+ version: 0.0.8
description: network serializer with binary format more compact than the default serializer in smallJson
bin: ./netSerial.c
repository:
diff --git a/test.c b/test.c
@@ -25,6 +25,7 @@ int main(int ARGC, char** ARGV) {
createSmallJson(j);
char *s;
+ goto bytes;
puts(helpO(&n));
// empty > null
@@ -91,5 +92,15 @@ int main(int ARGC, char** ARGV) {
parseG(&n, "[{\"dict\":\"hello \\\"wef\\\" qewe\",\"array\":[1,1],\"float\":3.434000e+01,\"asd\":true},\"asd \\\"qwe\\\"qwe\",234]");
show();
+
+ bytes:
+ createSmallBytes(b);
+ pushG(&b,'A');
+ pushG(&b,'B');
+ pushG(&b,'C');
+ createSmallArray(a);
+ pushG(&a, &b);
+ setTopG(&n, &a);
+ show();
}
// vim: set expandtab ts=2 sw=2:
diff --git a/testNetSerial.c b/testNetSerial.c
@@ -52,7 +52,7 @@ START_TEST(topT)
setTopNFreeG(&n, (baset *)oU);
B = serialG(&n);
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[0]");
+ ck_assert_str_eq(s, "[0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -65,7 +65,7 @@ START_TEST(topT)
setTopG(&n, TRUE);
B = serialG(&n);
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[17]");
+ ck_assert_str_eq(s, "[0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -80,7 +80,7 @@ START_TEST(topT)
logI("len %u", lenG(B));
logSI("%s", toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[3,51,51,51,51,51,51,-13,63]");
+ ck_assert_str_eq(s, "[0x03,0x33,0x33,0x33,0x33,0x33,0x33,0xf3,0x3f]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -95,7 +95,7 @@ START_TEST(topT)
B = serialG(&n);
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,-12,-46,-11,-57,-73,-46,-69,-18,27]");
+ ck_assert_str_eq(s, "[0xf4,0x82,0xd2,0x8b,0xc7,0xb7,0xd2,0xbb,0xee,0x1b]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -110,7 +110,7 @@ START_TEST(topT)
B = serialG(&n);
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,-12,-68,-63,-10,11]");
+ ck_assert_str_eq(s, "[0x84,0x80,0xbc,0xc1,0x96,0x0b]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -126,7 +126,7 @@ START_TEST(topT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,30]");
+ ck_assert_str_eq(s, "[0x84,0x1e]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -141,7 +141,7 @@ START_TEST(topT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[5,115,116,114,105,110,103,0]");
+ ck_assert_str_eq(s, "[0x05,0x73,0x74,0x72,0x69,0x6e,0x67,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -157,7 +157,7 @@ START_TEST(topT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[78,1,107,0,8]");
+ ck_assert_str_eq(s, "[0x4e,0x01,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -174,7 +174,7 @@ START_TEST(topT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x26,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -218,7 +218,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[14,6,48,0,49,0,50,0,51,0,52,0,53,0]");
+ ck_assert_str_eq(s, "[0x0e,0x06,0x30,0x00,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -234,7 +234,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[14,0]");
+ ck_assert_str_eq(s, "[0x0e,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -254,7 +254,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[30,4,48,0,15,49,0,50,0,51,0]");
+ ck_assert_str_eq(s, "[0x1e,0x04,0x30,0x00,0x0f,0x31,0x00,0x32,0x00,0x33,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -279,7 +279,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[30,9,48,0,-1,49,0,50,0,51,0,52,0,53,0,54,0,55,0,56,0,1]");
+ ck_assert_str_eq(s, "[0x1e,0x09,0x30,0x00,0xff,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00,0x36,0x00,0x37,0x00,0x38,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -299,7 +299,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[62,3,48,0,-10,-10,-10,-10,-10,-10,-15,63,49,0,-10,-10,-10,-10,-10,-10,1,64,50,0,102,102,102,102,102,102,10,64]");
+ ck_assert_str_eq(s, "[0x3e,0x03,0x30,0x00,0x9a,0x99,0x99,0x99,0x99,0x99,0xf1,0x3f,0x31,0x00,0x9a,0x99,0x99,0x99,0x99,0x99,0x01,0x40,0x32,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x0a,0x40]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -317,7 +317,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[78,2,48,0,2,49,0,4]");
+ ck_assert_str_eq(s, "[0x4e,0x02,0x30,0x00,0x02,0x31,0x00,0x04]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -336,7 +336,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[94,3,48,0,97,0,49,0,65,0,50,0,122,0]");
+ ck_assert_str_eq(s, "[0x5e,0x03,0x30,0x00,0x61,0x00,0x31,0x00,0x41,0x00,0x32,0x00,0x7a,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -360,7 +360,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[46,2,48,0,2,57,0,69,122,0,49,0,2,49,0,2,90,0,69,45,0,65,0,-44,3]");
+ ck_assert_str_eq(s, "[0x2e,0x02,0x30,0x00,0x02,0x39,0x00,0x45,0x7a,0x00,0x31,0x00,0x02,0x31,0x00,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -385,7 +385,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-18,2,48,0,36,57,0,2,49,0,4,49,0,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0xee,0x02,0x30,0x00,0x24,0x39,0x00,0x02,0x31,0x00,0x04,0x31,0x00,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -404,7 +404,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[110,1,48,0,2,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x6e,0x01,0x30,0x00,0x02,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -426,7 +426,7 @@ START_TEST(uniformDictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-2,1,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0xfe,0x01,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -435,6 +435,33 @@ START_TEST(uniformDictT)
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ initiateG(&d);
+ createSmallBytes(b);
+ createSmallBytes(b1);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b1, 5);
+ pushG(&b1, 6);
+ pushG(&b1, 7);
+ setG(&d, "0", &b);
+ setG(&d, "1", &b1);
+ setTopG(&n, &d);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x7e,0x02,0x30,0x00,0x04,0x01,0x02,0x03,0x04,0x31,0x00,0x03,0x05,0x06,0x07]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":[0x01,0x02,0x03,0x04],"_"1"_":[0x05,0x06,0x07]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
END_TEST
@@ -470,7 +497,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[15,6]");
+ ck_assert_str_eq(s, "[0x0f,0x06]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -486,7 +513,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[15,0]");
+ ck_assert_str_eq(s, "[0x0f,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -506,7 +533,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[31,4,15]");
+ ck_assert_str_eq(s, "[0x1f,0x04,0x0f]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -525,7 +552,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[63,3,-10,-10,-10,-10,-10,-10,-15,63,-10,-10,-10,-10,-10,-10,1,64,102,102,102,102,102,102,10,64]");
+ ck_assert_str_eq(s, "[0x3f,0x03,0x9a,0x99,0x99,0x99,0x99,0x99,0xf1,0x3f,0x9a,0x99,0x99,0x99,0x99,0x99,0x01,0x40,0x66,0x66,0x66,0x66,0x66,0x66,0x0a,0x40]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -543,7 +570,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[79,2,2,4]");
+ ck_assert_str_eq(s, "[0x4f,0x02,0x02,0x04]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -562,7 +589,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[95,3,97,0,65,0,122,0]");
+ ck_assert_str_eq(s, "[0x5f,0x03,0x61,0x00,0x41,0x00,0x7a,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -586,7 +613,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[47,2,2,57,0,69,122,0,49,0,2,2,90,0,69,45,0,65,0,-44,3]");
+ ck_assert_str_eq(s, "[0x2f,0x02,0x02,0x39,0x00,0x45,0x7a,0x00,0x31,0x00,0x02,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -611,7 +638,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-17,2,36,57,0,2,49,0,4,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0xef,0x02,0x24,0x39,0x00,0x02,0x31,0x00,0x04,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -630,7 +657,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[111,1,2,69,107,0,8]");
+ ck_assert_str_eq(s, "[0x6f,0x01,0x02,0x45,0x6b,0x00,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -651,7 +678,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-1,1,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0xff,0x01,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -667,7 +694,7 @@ START_TEST(uniformArrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[31,10,-1,2]");
+ ck_assert_str_eq(s, "[0x1f,0x0a,0xff,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -676,6 +703,39 @@ START_TEST(uniformArrayT)
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ initiateG(&A);
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&A, &b);
+ initiateG(&b);
+ pushG(&b, 7);
+ pushG(&b, 8);
+ pushG(&b, 9);
+ pushG(&b, 10);
+ pushG(&b, 11);
+ pushG(&b, 12);
+ pushG(&A, &b);
+ setTopG(&n, &A);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x7f,0x02,0x06,0x01,0x02,0x03,0x04,0x05,0x06,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[[0x01,0x02,0x03,0x04,0x05,0x06],[0x07,0x08,0x09,0x0a,0x0b,0x0c]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
END_TEST
@@ -711,7 +771,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,-32,49,0,37,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0xe0,0x31,0x00,0x25,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -733,7 +793,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,32,49,0,2,90,0,69,45,0,65,0,2]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0x20,0x31,0x00,0x02,0x5a,0x00,0x45,0x2d,0x00,0x41,0x00,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -755,7 +815,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,48,0,17,49,0,94,2,90,0,45,0,65,0,43,0]");
+ ck_assert_str_eq(s, "[0x22,0x30,0x00,0x11,0x31,0x00,0x5e,0x02,0x5a,0x00,0x2d,0x00,0x41,0x00,0x2b,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -779,7 +839,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,-16,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0xf0,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -803,7 +863,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,17,48,0,79,4,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0x11,0x30,0x00,0x4f,0x04,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -827,7 +887,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[34,49,0,-11,49,0,48,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x22,0x31,0x00,0xf5,0x31,0x00,0x30,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -843,7 +903,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,0,49,0,50,0,36]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x00,0x31,0x00,0x32,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -859,7 +919,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-14,1,122,0,16,48,0,-1,49,0,17,50,0,51,0,17,52,0,53,0,17,54,0,55,0,17,56,0,63,57,0,17,97,0,98,0,17,99,0,100,0,1]");
+ ck_assert_str_eq(s, "[0xf2,0x01,0x7a,0x00,0x10,0x30,0x00,0xff,0x31,0x00,0x11,0x32,0x00,0x33,0x00,0x11,0x34,0x00,0x35,0x00,0x11,0x36,0x00,0x37,0x00,0x11,0x38,0x00,0x3f,0x39,0x00,0x11,0x61,0x00,0x62,0x00,0x11,0x63,0x00,0x64,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -875,7 +935,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-12,2,122,0,16,48,0,-1,49,0,17,50,0,51,0,17,52,0,53,0,17,54,0,55,0,1,90,0,56,0,-15,57,0,17,97,0,98,0,17,99,0,3,100,0,1]");
+ ck_assert_str_eq(s, "[0x82,0x02,0x7a,0x00,0x10,0x30,0x00,0xff,0x31,0x00,0x11,0x32,0x00,0x33,0x00,0x11,0x34,0x00,0x35,0x00,0x11,0x36,0x00,0x37,0x00,0x01,0x5a,0x00,0x38,0x00,0xf1,0x39,0x00,0x11,0x61,0x00,0x62,0x00,0x11,0x63,0x00,0x03,0x64,0x00,0x01]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -891,7 +951,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,30,1,48,0,1,50,0,30,1,48,0,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x1e,0x01,0x30,0x00,0x01,0x32,0x00,0x1e,0x01,0x30,0x00,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -908,7 +968,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,51,0,0,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,64,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -924,7 +984,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,80,50,0,50,46,48,0,122,0,0]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x50,0x32,0x00,0x32,0x2e,0x30,0x00,0x7a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -940,7 +1000,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[50,48,0,-16,50,0,36,2,4,122,0,38,17,100]");
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0xf0,0x32,0x00,0x24,0x02,0x04,0x7a,0x00,0x26,0x11,0x64]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -958,7 +1018,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,88,0,49,0,0,50,0,0,51,0,0,52,0,0,53,0,36]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x58,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x33,0x00,0x00,0x34,0x00,0x00,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -973,7 +1033,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,88,2,48,0,64,49,0,2,49,0,2,48,0,69,48,0,49,0,2,50,0,2,48,0,69,48,0,49,0,2,51,0,2,48,0,69,48,0,49,0,2,52,0,2,48,0,69,48,0,49,0,2,53,0,36]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x58,0x02,0x30,0x00,0x40,0x31,0x00,0x02,0x31,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x32,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x33,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x34,0x00,0x02,0x30,0x00,0x45,0x30,0x00,0x31,0x00,0x02,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -989,7 +1049,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[114,97,0,-12,48,0,5,0,49,0,0,50,0,0,51,0,0,52,0,0,53,0,36]");
+ ck_assert_str_eq(s, "[0x72,0x61,0x00,0x80,0x30,0x00,0x05,0x00,0x31,0x00,0x00,0x32,0x00,0x00,0x33,0x00,0x00,0x34,0x00,0x00,0x35,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1006,7 +1066,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,89,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,-16,63,50,0,0,0,0,0,0,0,0,64,51,0,0,0,0,0,0,0,8,64,52,0,0,0,0,0,0,0,16,64,53,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0x59,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x35,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1022,7 +1082,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[114,97,0,-11,48,0,5,0,0,0,0,0,0,0,0,49,0,0,0,0,0,0,0,-16,63,50,0,0,0,0,0,0,0,0,64,51,0,0,0,0,0,0,0,8,64,52,0,0,0,0,0,0,0,16,64,53,0,0]");
+ ck_assert_str_eq(s, "[0x72,0x61,0x00,0x90,0x30,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x35,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1039,7 +1099,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,74,2,50,0,4,51,0,6,52,0,8,90,0,5,108,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4a,0x02,0x32,0x00,0x04,0x33,0x00,0x06,0x34,0x00,0x08,0x5a,0x00,0x05,0x6c,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1055,7 +1115,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-96,49,0,4,2,50,0,4,51,0,6,52,0,8,90,0,5,108,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xa0,0x31,0x00,0x04,0x02,0x32,0x00,0x04,0x33,0x00,0x06,0x34,0x00,0x08,0x5a,0x00,0x05,0x6c,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1072,7 +1132,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,75,49,0,50,0,50,0,51,0,51,0,52,0,52,0,90,0,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4b,0x31,0x00,0x32,0x00,0x32,0x00,0x33,0x00,0x33,0x00,0x34,0x00,0x34,0x00,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1088,7 +1148,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-80,49,0,4,49,0,50,0,50,0,51,0,51,0,52,0,52,0,90,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xb0,0x31,0x00,0x04,0x31,0x00,0x32,0x00,0x32,0x00,0x33,0x00,0x33,0x00,0x34,0x00,0x34,0x00,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1104,7 +1164,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[82,49,0,76,0,50,0,1,36,51,0,1,21,51,114,0,52,0,1,1,90,0,0]");
+ ck_assert_str_eq(s, "[0x52,0x31,0x00,0x4c,0x00,0x32,0x00,0x01,0x24,0x33,0x00,0x01,0x15,0x33,0x72,0x00,0x34,0x00,0x01,0x01,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1120,7 +1180,7 @@ START_TEST(dictT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[98,48,0,-64,49,0,4,0,50,0,1,36,51,0,1,21,51,114,0,52,0,1,1,90,0,0]");
+ ck_assert_str_eq(s, "[0x62,0x30,0x00,0xc0,0x31,0x00,0x04,0x00,0x32,0x00,0x01,0x24,0x33,0x00,0x01,0x15,0x33,0x72,0x00,0x34,0x00,0x01,0x01,0x5a,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1129,6 +1189,53 @@ START_TEST(dictT)
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ parseG(&n, "{"_"0"_":null,"_"z"_":[true,3]}");
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ setG(&n, "bytes", &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x32,0x30,0x00,0x60,0x7a,0x00,0x02,0x11,0x64,0x62,0x79,0x74,0x65,0x73,0x00,0x67,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":null,"_"z"_":[true,3],"_"bytes"_":[0x01,0x02,0x03,0x04,0x05,0x06]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
+ parseG(&n, "{"_"0"_":null,"_"z"_":[true,3],"_"1"_":null}");
+ initiateG(&b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ setG(&n, "bytes", &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x42,0x30,0x00,0x60,0x7a,0x00,0x02,0x11,0x64,0x31,0x00,0x70,0x62,0x79,0x74,0x65,0x73,0x00,0x06,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "{"_"0"_":null,"_"z"_":[true,3],"_"1"_":null,"_"bytes"_":[0x01,0x02,0x03,0x04,0x05,0x06]}");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
END_TEST
@@ -1165,7 +1272,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,-16,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0xf0,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1190,7 +1297,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,1,79,4,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0x01,0x4f,0x04,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1215,7 +1322,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,-11,49,0,68,2,4,6,8]");
+ ck_assert_str_eq(s, "[0x26,0xf5,0x31,0x00,0x44,0x02,0x04,0x06,0x08]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1231,7 +1338,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[38,96,2,36,0]");
+ ck_assert_str_eq(s, "[0x26,0x60,0x02,0x24,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1247,7 +1354,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,0,36]");
+ ck_assert_str_eq(s, "[0x36,0x00,0x24]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1263,7 +1370,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-26,1,16,89,17,17,17,17,31,17,17]");
+ ck_assert_str_eq(s, "[0xe6,0x01,0x10,0x59,0x11,0x11,0x11,0x11,0x1f,0x11,0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1279,7 +1386,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[-26,1,-11,17,1,81,17,17,31,17,17]");
+ ck_assert_str_eq(s, "[0xe6,0x01,0x91,0x11,0x01,0x51,0x11,0x11,0x1f,0x11,0x11]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1296,7 +1403,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[70,34,48,0,64,49,0,2,78,1,50,0,4,78,1,51,0,6,0]");
+ ck_assert_str_eq(s, "[0x46,0x22,0x30,0x00,0x40,0x31,0x00,0x02,0x4e,0x01,0x32,0x00,0x04,0x4e,0x01,0x33,0x00,0x06,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1312,7 +1419,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,51,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0]");
+ ck_assert_str_eq(s, "[0x36,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1328,7 +1435,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,36,68,0]");
+ ck_assert_str_eq(s, "[0x36,0x24,0x44,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1344,7 +1451,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,85,49,0,50,0,0]");
+ ck_assert_str_eq(s, "[0x36,0x55,0x31,0x00,0x32,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1360,7 +1467,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[54,15,0,79,2,2,4,0]");
+ ck_assert_str_eq(s, "[0x36,0x0f,0x00,0x4f,0x02,0x02,0x04,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1377,7 +1484,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,72,1,49,0,36,1,50,0,68,1,51,0,100,1,52,0,-12,1,0]");
+ ck_assert_str_eq(s, "[0x56,0x48,0x01,0x31,0x00,0x24,0x01,0x32,0x00,0x44,0x01,0x33,0x00,0x64,0x01,0x34,0x00,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1393,7 +1500,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-12,4,1,49,0,36,1,50,0,68,1,51,0,100,1,52,0,-12,1,0]");
+ ck_assert_str_eq(s, "[0x66,0x80,0x04,0x01,0x31,0x00,0x24,0x01,0x32,0x00,0x44,0x01,0x33,0x00,0x64,0x01,0x34,0x00,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1409,7 +1516,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,73,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0,0,0,0,0,0,8,64,0,0,0,0,0,0,16,64,0]");
+ ck_assert_str_eq(s, "[0x56,0x49,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1425,7 +1532,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-11,4,0,0,0,0,0,0,-16,63,0,0,0,0,0,0,0,64,0,0,0,0,0,0,8,64,0,0,0,0,0,0,16,64,0]");
+ ck_assert_str_eq(s, "[0x66,0x90,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1441,7 +1548,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,74,2,4,6,8,0]");
+ ck_assert_str_eq(s, "[0x56,0x4a,0x02,0x04,0x06,0x08,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1457,7 +1564,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-96,4,2,4,6,8,0]");
+ ck_assert_str_eq(s, "[0x66,0xa0,0x04,0x02,0x04,0x06,0x08,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1473,7 +1580,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,75,49,0,50,0,51,0,52,0,0]");
+ ck_assert_str_eq(s, "[0x56,0x4b,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1489,7 +1596,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-80,4,49,0,50,0,51,0,52,0,0]");
+ ck_assert_str_eq(s, "[0x66,0xb0,0x04,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1505,7 +1612,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[86,76,1,36,1,68,1,100,1,-12,1,0]");
+ ck_assert_str_eq(s, "[0x56,0x4c,0x01,0x24,0x01,0x44,0x01,0x64,0x01,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1521,7 +1628,7 @@ START_TEST(arrayT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[102,-64,4,1,36,1,68,1,100,1,-12,1,0]");
+ ck_assert_str_eq(s, "[0x66,0xc0,0x04,0x01,0x24,0x01,0x44,0x01,0x64,0x01,0x84,0x01,0x00]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1530,6 +1637,53 @@ START_TEST(arrayT)
terminateG(B);
freeManyG(&n, &ds);
+ // smallBytes
+ parseG(&n, "[1,2,null]");
+ createSmallBytes(b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&n, &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x46,0x24,0x44,0x70,0x06,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[1,2,null,[0x01,0x02,0x03,0x04,0x05,0x06]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
+ parseG(&n, "[1,2]");
+ initiateG(&b);
+ pushG(&b, 1);
+ pushG(&b, 2);
+ pushG(&b, 3);
+ pushG(&b, 4);
+ pushG(&b, 5);
+ pushG(&b, 6);
+ pushG(&n, &b);
+ logVarG(&n);
+ B = serialG(&n);
+ logI("len %u", lenG(B));
+ logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
+ s = sToString((smallt *) B->B);
+ ck_assert_str_eq(s, "[0x36,0x24,0x44,0x67,0x01,0x02,0x03,0x04,0x05,0x06]");
+ free(s);
+ deserialG(&ds, B);
+ s = toStringG(&ds);
+ ck_assert_str_eq(s, "[1,2,[0x01,0x02,0x03,0x04,0x05,0x06]]");
+ free(s);
+ terminateG(B);
+ freeManyG(&n, &ds);
+
END_TEST
@@ -1548,7 +1702,7 @@ START_TEST(variousT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[70,4,37,97,115,100,0,3,114,112,99,0,69,100,115,0,105,100,0,2,112,0,-79,54,81,117,115,101,114,0,111,3,3,81,110,97,109,101,0,36,3,81,110,97,109,101,50,0,-12,-11,24,3,1,69,122,120,99,0,-44,3]");
+ ck_assert_str_eq(s, "[0x46,0x04,0x25,0x61,0x73,0x64,0x00,0x03,0x72,0x70,0x63,0x00,0x45,0x64,0x73,0x00,0x69,0x64,0x00,0x02,0x70,0x00,0xb1,0x36,0x51,0x75,0x73,0x65,0x72,0x00,0x6f,0x03,0x03,0x51,0x6e,0x61,0x6d,0x65,0x00,0x24,0x03,0x51,0x6e,0x61,0x6d,0x65,0x32,0x00,0x84,0x8d,0x18,0x03,0x01,0x45,0x7a,0x78,0x63,0x00,0xd4,0x03]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
@@ -1563,7 +1717,7 @@ START_TEST(variousT)
logI("len %u", lenG(B));
logSI("%s",toHexSepS(getValG(B), lenG(B), " "));
s = sToString((smallt *) B->B);
- ck_assert_str_eq(s, "[111,1,4,78,1,97,0,2,-32,20,97,0,2,78,1,97,0,2]");
+ ck_assert_str_eq(s, "[0x6f,0x01,0x04,0x4e,0x01,0x61,0x00,0x02,0xe0,0x14,0x61,0x00,0x02,0x4e,0x01,0x61,0x00,0x02]");
free(s);
deserialG(&ds, B);
s = toStringG(&ds);
diff --git a/testNetSerial.sh b/testNetSerial.sh
@@ -1,5 +1,5 @@
spm test
-cd ~/.sheepy/build/home/$USER/git/sw/sheepyPackagesGitHub/netSerial/
+cd ~/.sheepy/build/home/$USER/git/sw/publicGits/netSerial/
gcov -b netSerial.c
cd -
-cp ~/.sheepy/build/home/$USER/git/sw/sheepyPackagesGitHub/netSerial/netSerial.c.gcov .
+cp ~/.sheepy/build/home/$USER/git/sw/publicGits/netSerial/netSerial.c.gcov .