Merge pull request #418 from Dmitry-Me/moreTestsForPointerSign
More test cases for pointer sign detection
This commit is contained in:
commit
36e53369cb
|
@ -4474,6 +4474,34 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(int* x, int* y) {\n"
|
||||
" if (x - y < 0)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(int* x, int* y) {\n"
|
||||
" if (x - y <= 0)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(int* x, int* y) {\n"
|
||||
" if (x - y > 0)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(int* x, int* y) {\n"
|
||||
" if (x - y >= 0)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(Bar* x) {\n"
|
||||
" if (0 <= x)"
|
||||
|
@ -4495,6 +4523,20 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(Bar* x) {\n"
|
||||
" if (0 <= x->y)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(Bar* x, Bar* y) {\n"
|
||||
" if (0 <= x->y - y->y )"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(Bar* x) {\n"
|
||||
" if (0 > x)"
|
||||
|
@ -4516,6 +4558,13 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"bool foo(Bar* x) {\n"
|
||||
" if (0 > x->y)"
|
||||
" bar();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check_signOfUnsignedVariable(
|
||||
"void foo() {\n"
|
||||
" int (*t)(void *a, void *b);\n"
|
||||
|
|
Loading…
Reference in New Issue