From 0c05b2cb50330a3b5c97c765db62e961e3c2408f Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 21 Jun 2016 07:49:46 -0700 Subject: Comment cleanup and fuzzing improvements. --- selftest.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'selftest.cpp') diff --git a/selftest.cpp b/selftest.cpp index 0f777dfd..f712afd3 100644 --- a/selftest.cpp +++ b/selftest.cpp @@ -806,21 +806,22 @@ static int testOther() } int foo = 0; volatile int *volatile bar = &foo; // force compiler not to optimize out test.get() below - for(int k=0;k<100;++k) { + for(int k=0;k<200;++k) { int r = rand() % 8194; unsigned char tmp[8194]; for(int q=0;q test((const char *)tmp); for(unsigned int q=0;q<100;++q) { - char tmp[16]; - Utils::snprintf(tmp,16,"%.8lx",(unsigned long)rand()); - char value[128]; - *bar = test.get(tmp,value,sizeof(value)); + char tmp[128]; + for(unsigned int x=0;x<128;++x) + tmp[x] = (char)(rand() & 0xff); + char value[8194]; + *bar += test.get(tmp,value,sizeof(value)); } } - std::cout << "PASS" << std::endl; + std::cout << "PASS (junk value to prevent optimization-out of test: " << foo << ")" << std::endl; return 0; } -- cgit v1.2.3