Unit Testing: added assertions for todo testcases to detect changes
This commit is contained in:
parent
d851b4a3d4
commit
6db4ab68ef
|
@ -700,6 +700,7 @@ private:
|
||||||
" i+=1;\n"
|
" i+=1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // Catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Buffer overrun\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Buffer overrun\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,6 +906,7 @@ private:
|
||||||
" char a[2][2];\n"
|
" char a[2][2];\n"
|
||||||
" a[2][1] = 'a';\n"
|
" a[2][1] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
|
@ -912,6 +914,7 @@ private:
|
||||||
" char a[2][2];\n"
|
" char a[2][2];\n"
|
||||||
" a[1][2] = 'a';\n"
|
" a[1][2] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
|
@ -919,6 +922,7 @@ private:
|
||||||
" char a[2][2][2];\n"
|
" char a[2][2][2];\n"
|
||||||
" a[2][1][1] = 'a';\n"
|
" a[2][1][1] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
|
@ -926,6 +930,7 @@ private:
|
||||||
" char a[2][2][2];\n"
|
" char a[2][2][2];\n"
|
||||||
" a[1][2][1] = 'a';\n"
|
" a[1][2][1] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
|
@ -933,6 +938,7 @@ private:
|
||||||
" char a[2][2][2];\n"
|
" char a[2][2][2];\n"
|
||||||
" a[1][1][2] = 'a';\n"
|
" a[1][1][2] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
|
@ -940,6 +946,7 @@ private:
|
||||||
" char a[2][2][2];\n"
|
" char a[2][2][2];\n"
|
||||||
" a[1][1][2] = 'a';\n"
|
" a[1][1][2] = 'a';\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,6 +1042,7 @@ private:
|
||||||
" val[i+1] = val[i];\n"
|
" val[i+1] = val[i];\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array 'val[5]' index -1 out of bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Array 'val[5]' index -1 out of bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,6 +1137,7 @@ private:
|
||||||
"char str[i];\n"
|
"char str[i];\n"
|
||||||
"fread(str,sizeof(char),i+1,fd);\n"
|
"fread(str,sizeof(char),i+1,fd);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f(FILE* fd)\n"
|
check("void f(FILE* fd)\n"
|
||||||
|
@ -1152,6 +1161,7 @@ private:
|
||||||
"char str[i];\n"
|
"char str[i];\n"
|
||||||
"fwrite(str,sizeof(char),i+1,fd);\n"
|
"fwrite(str,sizeof(char),i+1,fd);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||||
|
|
||||||
check("void f(FILE* fd)\n"
|
check("void f(FILE* fd)\n"
|
||||||
|
@ -1456,6 +1466,7 @@ private:
|
||||||
" char buf[3];\n"
|
" char buf[3];\n"
|
||||||
" sprintf(buf, \"%s\", condition ? \"11\" : \"222\");\n"
|
" sprintf(buf, \"%s\", condition ? \"11\" : \"222\");\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str()); // catch changes
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue