mirror of https://github.com/x64dbg/btparser
ready for testing automation
This commit is contained in:
parent
d211bf56a5
commit
2206f556c3
|
@ -494,8 +494,7 @@ bool TestLexer(const string & filename)
|
||||||
actual += line;
|
actual += line;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
printf("lex error in \"%s\": %s\n", filename.c_str(), lexer.Error.c_str());
|
actual += StringUtils::sprintf("lex error in \"%s\": %s\n", filename.c_str(), lexer.Error.c_str());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
actual = StringUtils::Trim(actual);
|
actual = StringUtils::Trim(actual);
|
||||||
string expected;
|
string expected;
|
||||||
|
@ -522,7 +521,6 @@ void RunLexerTests()
|
||||||
|
|
||||||
bool DebugLexer(const string & filename)
|
bool DebugLexer(const string & filename)
|
||||||
{
|
{
|
||||||
printf("Debugging \"%s\"\n", filename.c_str());
|
|
||||||
Lexer lexer;
|
Lexer lexer;
|
||||||
if (!lexer.ReadInputFile("tests\\" + filename))
|
if (!lexer.ReadInputFile("tests\\" + filename))
|
||||||
{
|
{
|
||||||
|
@ -537,9 +535,27 @@ bool DebugLexer(const string & filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenerateExpected(const string & filename)
|
||||||
|
{
|
||||||
|
Lexer lexer;
|
||||||
|
if (!lexer.ReadInputFile("tests\\" + filename))
|
||||||
|
{
|
||||||
|
printf("failed to read \"%s\"\n", filename.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string actual;
|
||||||
|
if (!lexer.TestLex([&](const string & line)
|
||||||
|
{
|
||||||
|
actual += line;
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
actual += StringUtils::sprintf("lex error in \"%s\": %s\n", filename.c_str(), lexer.Error.c_str());
|
||||||
|
}
|
||||||
|
FileHelper::WriteAllText("tests\\expected\\" + filename + ".lextest", actual);
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
DebugLexer(testFiles[82]);
|
|
||||||
RunLexerTests();
|
RunLexerTests();
|
||||||
system("pause");
|
system("pause");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
string test = "this is a test
|
Loading…
Reference in New Issue