From 33498d7c2d8761d82b7f1e318d2d0f81b89c35c8 Mon Sep 17 00:00:00 2001 From: leitner Date: Sun, 4 May 2003 16:20:08 +0000 Subject: [PATCH] add small scan test --- test/scan_long.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/scan_long.c diff --git a/test/scan_long.c b/test/scan_long.c new file mode 100644 index 0000000..5f598d5 --- /dev/null +++ b/test/scan_long.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +main() { + char buf[1024]; + unsigned long long int i; + if (sizeof(unsigned long) != 4) + return 0; + for (i=1; i<0xfffffffffull; i+=i+1) { + int k; + unsigned long test; + buf[k=fmt_ulonglong(buf,i)]=0; + buffer_puts(buffer_1,buf); buffer_putnlflush(buffer_1); + if (buf[scan_ulong(buf,&test)]) + /* scan did not like the whole number */ + assert(i>0xffffffffull); + else + assert(i<=0xffffffffull); + } +}