nicer testcase runner

metadata
Wenzel Jakob 2010-09-02 18:05:49 +02:00
parent 1c60e7368d
commit 0b8863f2cb
1 changed files with 18 additions and 6 deletions

View File

@ -48,7 +48,10 @@ void help() {
cout << " -v Be more verbose" << endl << endl; cout << " -v Be more verbose" << endl << endl;
FileResolver *resolver = FileResolver::getInstance(); FileResolver *resolver = FileResolver::getInstance();
cout << "The following utilities are available:" << endl << endl; std::ostringstream utilities, testcases;
testcases << "The following testcases are available:" << endl << endl;
utilities << endl << "The following utilities are available:" << endl << endl;
std::vector<std::string> dirPaths = resolver->resolveAllAbsolute("plugins"); std::vector<std::string> dirPaths = resolver->resolveAllAbsolute("plugins");
std::set<std::string> seen; std::set<std::string> seen;
@ -86,10 +89,17 @@ void help() {
Plugin utility(shortName, fullName); Plugin utility(shortName, fullName);
if (!utility.isUtility()) if (!utility.isUtility())
continue; continue;
cout << "\t" << shortName; if (startsWith(shortName, "test_")) {
for (int i=0; i<22-(int) shortName.length(); ++i) testcases << "\t" << shortName;
cout << ' '; for (int i=0; i<22-(int) shortName.length(); ++i)
cout << utility.getDescription() << endl; testcases << ' ';
testcases << utility.getDescription() << endl;
} else {
utilities << "\t" << shortName;
for (int i=0; i<22-(int) shortName.length(); ++i)
utilities << ' ';
utilities << utility.getDescription() << endl;
}
#if !defined(WIN32) #if !defined(WIN32)
} }
#else #else
@ -97,6 +107,8 @@ void help() {
FindClose(hFind); FindClose(hFind);
#endif #endif
} }
cout << testcases.str() << utilities.str();
} }
@ -294,7 +306,7 @@ int ubi_main(int argc, char **argv) {
#endif #endif
} }
SLog(EError, "Ran %i tests, %i succeeded, %i failed.", executed, succeeded, executed-succeeded); SLog(EInfo, "Ran %i tests, %i succeeded, %i failed.", executed, succeeded, executed-succeeded);
} else { } else {
if (argc <= optind) { if (argc <= optind) {
std::cerr << "A utility name must be supplied!" << endl; std::cerr << "A utility name must be supplied!" << endl;