From 31413a216b8ee683a67b6c4bce2211773f385be4 Mon Sep 17 00:00:00 2001 From: Sebastien Barre Date: Fri, 29 Mar 2002 16:03:19 -0500 Subject: [PATCH] ENH: if -R or -E was used, displays also the name of the tests that passed. --- Source/ctest.cxx | 26 +++++++++++++++++++------- Source/ctest.h | 3 ++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Source/ctest.cxx b/Source/ctest.cxx index d010be82b5..1564b25f8c 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -117,7 +117,8 @@ std::string ctest::FindExecutable(const char *exe) } -void ctest::ProcessDirectory(int &passed, std::vector &failed) +void ctest::ProcessDirectory(std::vector &passed, + std::vector &failed) { // does the DartTestfile.txt exist ? if(!cmSystemTools::FileExists("DartTestfile.txt")) @@ -250,7 +251,7 @@ void ctest::ProcessDirectory(int &passed, std::vector &failed) std::cerr << output.c_str() << "\n"; } } - passed++; + passed.push_back(args[0]); } } } @@ -262,7 +263,7 @@ void ctest::ProcessDirectory(int &passed, std::vector &failed) // this is a test driver program for cmake. int main (int argc, char *argv[]) { - int passed = 0; + std::vector passed; std::vector failed; int total; @@ -299,7 +300,7 @@ int main (int argc, char *argv[]) // call process directory inst.ProcessDirectory(passed, failed); - total = passed + int(failed.size()); + total = int(passed.size()) + int(failed.size()); if (total == 0) { @@ -307,12 +308,23 @@ int main (int argc, char *argv[]) } else { - float percent = passed * 100.0f / total; - fprintf(stderr,"%.0f%% tests passed, %i tests failed out of %i\n", + if (passed.size() && (inst.m_UseIncludeRegExp || inst.m_UseExcludeRegExp)) + { + std::cerr << "\nThe following tests passed:\n"; + for(std::vector::iterator j = passed.begin(); + j != passed.end(); ++j) + { + std::cerr << "\t" << *j << "\n"; + } + } + + float percent = float(passed.size()) * 100.0f / total; + fprintf(stderr,"\n%.0f%% tests passed, %i tests failed out of %i\n", percent, failed.size(), total); + if (failed.size()) { - std::cerr << "The following tests failed:\n"; + std::cerr << "\nThe following tests FAILED:\n"; for(std::vector::iterator j = failed.begin(); j != failed.end(); ++j) { diff --git a/Source/ctest.h b/Source/ctest.h index 60065a1a97..033707fd8d 100644 --- a/Source/ctest.h +++ b/Source/ctest.h @@ -26,7 +26,8 @@ public: /** * Run the test for a directory and any subdirectories */ - void ProcessDirectory(int &passed, std::vector &failed); + void ProcessDirectory(std::vector &passed, + std::vector &failed); /** * Find the executable for a test