move unit tests into each file (compile with -DUNITTEST)

This commit is contained in:
leitner
2017-05-13 22:52:21 +00:00
parent 760598ec2f
commit b9eb81c58f
44 changed files with 636 additions and 0 deletions

View File

@@ -50,5 +50,6 @@ int main() {
memset(buf,0,10); assert(scan_base64("Zm5vcmQ=",buf,&l)==8 && l==5 && !memcmp(buf,"fnord",6));
memset(buf,0,10); assert(scan_base64("Zm5vcmQ",buf,&l)==7 && l==5 && !memcmp(buf,"fnord",6));
memset(buf,0,10); assert(scan_base64("//8=",buf,&l)==4 && l==2 && !memcmp(buf,"\xff\xff",3));
return 0;
}
#endif

View File

@@ -101,5 +101,6 @@ int main() {
assert(scan_jsonescape("a\\ud834\\udd1eb",buf,&l)==14 && l==6 && !memcmp(buf,"a\xf0\x9d\x84\x9e""b",6));
/* how about some incorrect UTF-8? */
assert(scan_jsonescape("a\xc0\xaf",buf,&l)==1 && l==1 && !memcmp(buf,"a",1));
return 0;
}
#endif

View File

@@ -36,6 +36,7 @@ int main() {
assert(scan_uuencoded("&9FYO<F0*",buf,&i)==9 && i==6 && !memcmp(buf,"fnord\n",7));
memset(buf,0,100);
assert(scan_uuencoded("%9FYO<F0`",buf,&i)==9 && i==5 && !memcmp(buf,"fnord",6));
return 0;
}
#endif