diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 19:59:51 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-04-24 19:59:51 (GMT) |
commit | d395b563ede173721c240df2daad23284f453c4a (patch) | |
tree | 84178ad0d725b16b92f84549bd106e05038c90d5 /Source/cmMakefile.cxx | |
parent | 3a8e7599b10806b43179e18c23218fe68a4d2eb5 (diff) | |
download | CMake-d395b563ede173721c240df2daad23284f453c4a.zip CMake-d395b563ede173721c240df2daad23284f453c4a.tar.gz CMake-d395b563ede173721c240df2daad23284f453c4a.tar.bz2 |
ENH: Improve internal test handling by creating a test class. Command cmEnableTesting now only sets CMAKE_TESTING_ENABLED and cmAddTest only adds a test to the list. The actual test files are written by local generator. This way we can at some point in the future replace DartTestfile with some XML file
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 43964d7..12c7c80 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -24,6 +24,7 @@ #include "cmCacheManager.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" +#include "cmTest.h" #ifdef CMAKE_BUILD_WITH_CMAKE # include "cmVariableWatch.h" #endif @@ -126,6 +127,11 @@ cmMakefile::~cmMakefile() { delete *i; } + for(std::vector<cmTest*>::iterator i = m_Tests.begin(); + i != m_Tests.end(); ++i) + { + delete *i; + } for(unsigned int i=0; i < m_UsedCommands.size(); i++) { delete m_UsedCommands[i]; @@ -2465,3 +2471,43 @@ cmTarget* cmMakefile::FindTarget(const char* name) } return 0; } + +cmTest* cmMakefile::CreateTest(const char* testName) +{ + if ( !testName ) + { + return 0; + } + cmTest* test = this->GetTest(testName); + if ( test ) + { + return test; + } + test = new cmTest; + test->SetName(testName); + m_Tests.push_back(test); + return test; +} + +cmTest* cmMakefile::GetTest(const char* testName) const +{ + if ( !testName ) + { + return 0; + } + std::vector<cmTest*>::const_iterator it; + for ( it = m_Tests.begin(); it != m_Tests.end(); ++ it ) + { + if ( strcmp((*it)->GetName(), testName) == 0 ) + { + return *it; + } + } + return 0; +} + +const std::vector<cmTest*> *cmMakefile::GetTests() const +{ + return &m_Tests; +} + |