testing: new handling of todo test cases. If they use TODO_ASSERT_EQUALS instead we can detect when they are fixed

This commit is contained in:
Daniel Marjamäki 2009-03-25 18:31:40 +01:00
parent 0cfa241abb
commit 7afccc395a
3 changed files with 13 additions and 11 deletions

View File

@ -46,7 +46,7 @@ private:
TEST_CASE(uninitVarEnum);
TEST_CASE(uninitVarStream);
TEST_CASE(privateCtor1); // If constructor is private..
// TODO TEST_CASE(privateCtor2); // If constructor is private..
TEST_CASE(privateCtor2); // If constructor is private..
TEST_CASE(function); // Function is not variable
TEST_CASE(uninitVarHeader1); // Class is defined in header
TEST_CASE(uninitVarHeader2); // Class is defined in header
@ -230,7 +230,7 @@ private:
" Foo(int _i) { }\n"
"};\n");
ASSERT_EQUALS(std::string("[test.cpp:7] (style) Member variable not initialized in the constructor Foo::foo"), errout.str());
TODO_ASSERT_EQUALS(std::string("[test.cpp:7] (style) Member variable not initialized in the constructor Foo::foo"), errout.str());
}

View File

@ -95,7 +95,7 @@ private:
TEST_CASE(if6); // Bug 2432631
TEST_CASE(if7); // Bug 2401436
TEST_CASE(if8); // Bug 2458532
// TODO TEST_CASE( if9 ); // if (realloc)
TEST_CASE(if9); // if (realloc)
TEST_CASE(if10); // else if (realloc)
TEST_CASE(if11);
@ -135,7 +135,7 @@ private:
TEST_CASE(func4);
TEST_CASE(func5);
TEST_CASE(func6);
// TODO TEST_CASE( func7 );
TEST_CASE(func7);
TEST_CASE(func8); // Using callback
TEST_CASE(func9); // Embedding the function call in a if-condition
TEST_CASE(func10); // Bug 2458510 - Function pointer
@ -145,7 +145,7 @@ private:
TEST_CASE(class1);
TEST_CASE(class2);
// TODO TEST_CASE( class3 );
TEST_CASE(class3);
TEST_CASE(class4);
TEST_CASE(class5);
TEST_CASE(class6);
@ -168,14 +168,14 @@ private:
TEST_CASE(assign);
// TODO TEST_CASE( varid );
TEST_CASE(varid);
TEST_CASE(cast1);
TEST_CASE(cast2);
TEST_CASE(cast3);
// TODO TEST_CASE( structmember1 );
TEST_CASE(structmember1);
TEST_CASE(dealloc_use_1); // Deallocate and then use memory
TEST_CASE(dealloc_use_2); // Deallocate and then use memory. No error if "use" is &var
@ -1195,7 +1195,7 @@ private:
" foo(p);\n"
"}\n");
std::string err(errout.str());
ASSERT_EQUALS(std::string("[test.cpp:11]: (error) Memory leak: p\n"), err);
TODO_ASSERT_EQUALS(std::string("[test.cpp:11]: (error) Memory leak: p\n"), err);
}
@ -1402,7 +1402,7 @@ private:
" }\n"
"}\n", true);
ASSERT_EQUALS(std::string(""), errout.str());
TODO_ASSERT_EQUALS(std::string(""), errout.str());
}
void class4()
@ -1731,7 +1731,7 @@ private:
" }\n"
" free(p);\n"
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
TODO_ASSERT_EQUALS(std::string(""), errout.str());
}
void cast1()
@ -1779,7 +1779,7 @@ private:
" delete abc;\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Memory leak: abc.a\n"), errout.str());
TODO_ASSERT_EQUALS(std::string("[test.cpp:5]: (error) Memory leak: abc.a\n"), errout.str());
}

View File

@ -38,6 +38,7 @@ protected:
virtual void run() = 0;
bool runTest(const char testname[]);
void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
void assertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual);
@ -57,5 +58,6 @@ public:
#define TEST_CASE( NAME ) if ( runTest(#NAME) ) NAME ();
#define ASSERT_EQUALS( EXPECTED , ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)
#define TODO_ASSERT_EQUALS( EXPECTED , ACTUAL ) if (EXPECTED==ACTUAL) assertEquals(__FILE__, __LINE__, "TODO assertion", "The assertion succeeded")
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance; }