From 6db4ab68efb1593001139c974c8443b137401105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 17 Apr 2010 15:01:18 +0200 Subject: [PATCH] Unit Testing: added assertions for todo testcases to detect changes --- test/testbufferoverrun.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 5efc7b887..0f9c82445 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -700,6 +700,7 @@ private: " i+=1;\n" " }\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // Catch changes TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Buffer overrun\n", errout.str()); } @@ -905,6 +906,7 @@ private: " char a[2][2];\n" " a[2][1] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); check("void f()\n" @@ -912,6 +914,7 @@ private: " char a[2][2];\n" " a[1][2] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); check("void f()\n" @@ -919,6 +922,7 @@ private: " char a[2][2][2];\n" " a[2][1][1] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); check("void f()\n" @@ -926,6 +930,7 @@ private: " char a[2][2][2];\n" " a[1][2][1] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); check("void f()\n" @@ -933,6 +938,7 @@ private: " char a[2][2][2];\n" " a[1][1][2] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); check("void f()\n" @@ -940,6 +946,7 @@ private: " char a[2][2][2];\n" " a[1][1][2] = 'a';\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes 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" " }\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()); } @@ -1129,6 +1137,7 @@ private: "char str[i];\n" "fread(str,sizeof(char),i+1,fd);\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str()); check("void f(FILE* fd)\n" @@ -1152,6 +1161,7 @@ private: "char str[i];\n" "fwrite(str,sizeof(char),i+1,fd);\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str()); check("void f(FILE* fd)\n" @@ -1456,6 +1466,7 @@ private: " char buf[3];\n" " sprintf(buf, \"%s\", condition ? \"11\" : \"222\");\n" "}\n"); + ASSERT_EQUALS("", errout.str()); // catch changes TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Buffer access out-of-bounds\n", errout.str()); }