add man page and unit tests for scan_base64url

This commit is contained in:
leitner
2017-07-30 13:41:43 +00:00
parent 8d449d442b
commit c8156a9841
5 changed files with 103 additions and 35 deletions

View File

@@ -48,8 +48,10 @@ int main() {
char buf[100];
size_t i,l;
memset(buf,0,10); assert(scan_base64("Zm5vcmQ=",buf,&l)==8 && l==5 && !memcmp(buf,"fnord",6));
/* check that we don't insist on the padding */
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));
/* check the special non-isalnum chars :) */
memset(buf,0,10); assert(scan_base64("/+8=",buf,&l)==4 && l==2 && !memcmp(buf,"\xff\xef",3));
return 0;
}
#endif