Browse Source

fix unit tests

master
Felix von Leitner 12 months ago
parent
commit
835476466a
  1. 2
      scan/scan_8longlong.c
  2. 2
      scan/scan_netstring.c
  3. 4
      scan/scan_utf8_sem.c

2
scan/scan_8longlong.c

@ -29,7 +29,7 @@ int main() {
assert(scan_8longlong("1234",&i)==4 && i==01234);
assert(scan_8longlong("12345678",&i)==7 && i==01234567);
assert(scan_8longlong("1777777777777777777777",&i)==22 && i==0xffffffffffffffffull);
assert(scan_8longlong("2000000000000000000000",&i)==21 && i==200000000000000000000ull);
assert(scan_8longlong("2000000000000000000000",&i)==21 && i==0200000000000000000000ull);
assert(scan_8longlong("-4",&i)==0 && i==0);
assert(scan_8longlong("01234",&i)==5 && i==01234);
return 0;

2
scan/scan_netstring.c

@ -26,6 +26,8 @@ size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) {
#ifdef UNITTEST
#include <assert.h>
#undef UNITTEST
#include "scan_ulongn.c"
int main() {

4
scan/scan_utf8_sem.c

@ -13,7 +13,11 @@ size_t scan_utf8_sem(const char* in,size_t len,uint32_t* num) {
#ifdef UNITTEST
#include <assert.h>
#undef UNITTEST
#include "scan/scan_utf8.c"
int main() {
uint32_t l;
/* rest of scan_utf8 tested in scan_utf8.c unit tests */
assert(scan_utf8_sem("\xed\xa0\x80",4,&l)==0);
return 0;

Loading…
Cancel
Save