diff --git a/test/testsuites/danmar-verify/divbyzero.cpp b/test/testsuites/danmar-verify/divbyzero.cpp index f7236ea7c..fa408b3ec 100644 --- a/test/testsuites/danmar-verify/divbyzero.cpp +++ b/test/testsuites/danmar-verify/divbyzero.cpp @@ -1,3 +1,6 @@ +// make USE_Z3=yes +// ./cppcheck --verify --inline-suppr --enable=information test/testsuites/danmar-verify/divbyzero.cpp + struct S { int x; }; @@ -10,7 +13,22 @@ void callfunc1() { return 100000 / x; } -void g1() { +void float1(float f) { + // cppcheck-suppress verificationDivByZero + return 100000 / (int)f; +} + +void float2(float f) { + // cppcheck-suppress verificationDivByZeroFloat + return 100000 / f; +} + +void functionCall() { + // cppcheck-suppress verificationDivByZero + return 100000 / unknown_function(); +} + +void globalVar1() { // cppcheck-suppress verificationDivByZero return 100000 / globalvar; } @@ -25,16 +43,6 @@ void pointer2(int *p) { return 100000 / p[32]; } -void float1(float f) { - // cppcheck-suppress verificationDivByZero - return 100000 / (int)f; -} - -void float2(float f) { - // cppcheck-suppress verificationDivByZeroFloat - return 100000 / f; -} - void stdmap(std::map &data) { // cppcheck-suppress verificationDivByZero return 100000 / data[43]; diff --git a/test/testsuites/danmar-verify/uninit.c b/test/testsuites/danmar-verify/uninit.c index ba9de4165..a7249b3cb 100644 --- a/test/testsuites/danmar-verify/uninit.c +++ b/test/testsuites/danmar-verify/uninit.c @@ -1,7 +1,23 @@ -int foo() { +// make USE_Z3=yes CPPFLAGS=-DVERIFY_UNININIT +// ./cppcheck --verify --inline-suppr --enable=information test/testsuites/danmar-verify/uninit.c + +int array1() { int a[10]; a[0] = 0; + // cppcheck-suppress verificationUninit return a[2]; } +int array2() { + int a[10][10]; + a[0][0] = 0; + // cppcheck-suppress verificationUninit + return a[2][3]; +} + +int pointer1(int *p) { + // cppcheck-suppress verificationUninit + return *p; +} +