Add unit test program
This commit is contained in:
1 parent
fc0340ac70
commit
bac93e6117
3 files changed
+156
-1
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// Program to parse output of vice monitor script tests
|
||||
// Outputs a list of tests and information from failing tests
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream file("output");
|
||||
std::string line;
|
||||
bool in_compare = false;
|
||||
bool failed = false;
|
||||
|
||||
while (getline(file, line)) {
|
||||
if (line.starts_with("ERROR -- Wrong syntax:")) {
|
||||
getline(file, line);
|
||||
if (line.starts_with(" print \"TEST: ")) {
|
||||
std::cout << line.substr(9, line.size() - 10) << std::endl;
|
||||
} else if (line.starts_with(" print \"COMPARE")) {
|
||||
getline(file, line);
|
||||
in_compare = true;
|
||||
} else if (line.starts_with(" print \"END")) {
|
||||
in_compare = false;
|
||||
}
|
||||
} else if (in_compare) {
|
||||
std::cout << "\033[31mFAIL:\033[0m " << line << std::endl;
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
std::cout << "Some tests \033[31mFAIL\033[0m " << std::endl;
|
||||
return 1;
|
||||
} else {
|
||||
std::cout << "All tests \033[32mPASS\033[0m " << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user