extracttests: minor updates
This commit is contained in:
parent
1fe94d74b8
commit
45c3ba3c28
|
@ -28,27 +28,116 @@ int main(const int argc, const char * const * const argv)
|
|||
std::string line;
|
||||
while (std::getline(f, line))
|
||||
{
|
||||
if (line.compare(0, 9, " void ") == 0)
|
||||
{
|
||||
testname = line.substr(9, line.size() - 11);
|
||||
std::cout << "\"" << testname << "\"" << std::endl;
|
||||
std::string::size_type pos = line.find_first_not_of(" ");
|
||||
if (pos > 0 && pos != std::string::npos)
|
||||
line.erase(0,pos);
|
||||
}
|
||||
|
||||
if (line.compare(0, 5, "void ") == 0)
|
||||
{
|
||||
testname = line.substr(5, line.size() - 7);
|
||||
subcount = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line.find("}") != std::string::npos)
|
||||
if (line =="}")
|
||||
{
|
||||
testname = "";
|
||||
subcount = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!testname.empty() && line.find(" check") != std::string::npos && line.find("(\"") != std::string::npos)
|
||||
if (!testname.empty() && line.compare(0, 5, "check") == 0 && line.find("(\"") != std::string::npos)
|
||||
{
|
||||
std::ofstream fout((testname + str(++subcount) + ext).c_str());
|
||||
fout << "#include <string.h>" << std::endl;
|
||||
fout << "#include <stdio.h>" << std::endl;
|
||||
fout << "#include <stdlib.h>" << std::endl;
|
||||
|
||||
if (testname == "nullpointer1")
|
||||
{
|
||||
if (subcount < 6)
|
||||
{
|
||||
fout << "class Token\n"
|
||||
<< "{\n"
|
||||
<< "public:\n"
|
||||
<< " const char *str() const;\n"
|
||||
<< " const Token *next() const;\n"
|
||||
<< " unsigned int size() const;\n"
|
||||
<< " char read () const;\n"
|
||||
<< " operator bool() const;\n"
|
||||
<< "};\n"
|
||||
<< "static Token *tokens;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fout << "struct A\n"
|
||||
"{\n"
|
||||
" char b();\n"
|
||||
" A *next;\n"
|
||||
"};\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (testname == "nullpointer2")
|
||||
{
|
||||
fout << "class Fred\n"
|
||||
<< "{\n"
|
||||
<< "public:\n"
|
||||
<< " void hello() const;\n"
|
||||
<< " operator bool() const;\n"
|
||||
<< "};\n";
|
||||
}
|
||||
|
||||
if (testname == "nullpointer3")
|
||||
{
|
||||
fout << "struct DEF { };\n"
|
||||
<< "struct ABC : public DEF\n"
|
||||
<< "{\n"
|
||||
<< " int a,b,c;\n"
|
||||
<< " struct ABC *next;\n"
|
||||
<< "};\n"
|
||||
<< "void bar(int); void f(struct ABC **);\n";
|
||||
}
|
||||
|
||||
if (testname == "nullpointer4")
|
||||
{
|
||||
fout << "void bar(int);\n"
|
||||
<< "int** f(int **p = 0);\n"
|
||||
<< "extern int x;\n"
|
||||
<< "struct P {\n"
|
||||
<< " bool check() const;\n"
|
||||
<< " P* next() const;\n"
|
||||
<< "};\n";
|
||||
}
|
||||
|
||||
if (testname == "nullpointer5")
|
||||
{
|
||||
fout << "struct A {\n"
|
||||
<< " char c() const;\n"
|
||||
<< " operator bool() const;\n"
|
||||
<< "};\n";
|
||||
}
|
||||
|
||||
if (testname == "nullpointer6")
|
||||
{
|
||||
fout << "struct Foo {\n"
|
||||
<< " void abcd() const;\n"
|
||||
<< "};\n"
|
||||
<< "struct FooBar : public Foo { };\n"
|
||||
<< "struct FooCar : public Foo { };\n"
|
||||
<< "extern int a;\n";
|
||||
}
|
||||
|
||||
if (testname == "nullpointer7")
|
||||
{
|
||||
fout << "struct wxLongLong {\n"
|
||||
<< " wxLongLong(int) { }\n"
|
||||
<< " long GetValue() const;\n"
|
||||
<< "};\n";
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
std::string::size_type pos = line.find("\"");
|
||||
|
|
Loading…
Reference in New Issue