refactoring: fixed the teststl so it is runnable again

This commit is contained in:
Daniel Marjamäki 2009-03-19 19:35:08 +01:00
parent 16b6a7a605
commit 75171cae08
1 changed files with 49 additions and 88 deletions

View File

@ -35,7 +35,6 @@ public:
private:
void run()
{
/*
TEST_CASE(iterator1);
TEST_CASE(iterator2);
TEST_CASE(STLSize);
@ -48,10 +47,8 @@ private:
TEST_CASE(pushback1);
TEST_CASE(invalidcode);
*/
}
/*
void check(const char code[])
{
// Tokenize..
@ -62,10 +59,9 @@ private:
// Clear the error buffer..
errout.str("");
// Check char variable usage..
CheckStl checkStl(&tokenizer, this);
checkStl.iterators();
checkStl.stlOutOfBounds();
// Check..
CheckStl checkStl;
checkStl.runChecks(&tokenizer, (const Settings *)0, this);
}
@ -154,26 +150,9 @@ private:
void checkErase(const char code[])
{
// Tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
// Clear the error buffer..
errout.str("");
// Check char variable usage..
CheckStl checkStl(&tokenizer, this);
checkStl.erase();
}
void erase()
{
checkErase("void f()\n"
check("void f()\n"
"{\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
@ -185,7 +164,7 @@ private:
void eraseBreak()
{
checkErase("void f()\n"
check("void f()\n"
"{\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
@ -198,7 +177,7 @@ private:
void eraseReturn()
{
checkErase("void f()\n"
check("void f()\n"
"{\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
@ -211,7 +190,7 @@ private:
void eraseGoto()
{
checkErase("void f()\n"
check("void f()\n"
"{\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
@ -225,7 +204,7 @@ private:
void eraseAssign()
{
checkErase("void f()\n"
check("void f()\n"
"{\n"
" for (it = foo.begin(); it != foo.end(); ++it)\n"
" {\n"
@ -240,26 +219,9 @@ private:
void checkPushback(const char code[])
{
// Tokenize..
Tokenizer tokenizer;
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
// Clear the error buffer..
errout.str("");
// Check char variable usage..
CheckStl checkStl(&tokenizer, this);
checkStl.pushback();
}
void pushback1()
{
checkPushback("void f()\n"
check("void f()\n"
"{\n"
" std::vector<int>::const_iterator it = foo.begin();\n"
" foo.push_back(123);\n"
@ -276,7 +238,6 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
}
*/
};
REGISTER_TEST(TestStl)