Initiating Hurricane Tests

This commit is contained in:
The Coriolis Project 2009-02-02 10:20:29 +00:00
parent 78140e5feb
commit 42dfa164c7
4 changed files with 52 additions and 2 deletions

View File

@ -29,6 +29,10 @@ FIND_PACKAGE(Doxygen)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(cmake_modules)
ADD_SUBDIRECTORY(tests)
IF(DOXYGEN_FOUND)
ADD_SUBDIRECTORY(doc)
ENDIF(DOXYGEN_FOUND)
ENABLE_TESTING()
ADD_TEST(HurricaneTest ${PROJECT_BINARY_DIR}/tests/htest)

View File

@ -160,5 +160,6 @@
install ( TARGETS hurricane DESTINATION /lib)
endif ( BUILD_STATIC )
install ( FILES ${includes} DESTINATION /include/hurricane)
install(FILES ${includes} DESTINATION /include/hurricane)
add_subdirectory(tests)

View File

@ -0,0 +1,5 @@
INCLUDE_DIRECTORIES(${HURRICANE_SOURCE_DIR}/src/hurricane)
ADD_EXECUTABLE(htest HTest.cpp)
TARGET_LINK_LIBRARIES(htest hurricane)

40
hurricane/tests/HTest.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <iostream>
using namespace std;
#include "hurricane/DataBase.h"
#include "hurricane/Library.h"
using namespace Hurricane;
int main() {
DataBase* db = DataBase::create();
cout << "Testing DataBase creation" << endl;
if (!db) {
cout << "Error in DataBase creation" << endl;
return 1;
}
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
if (!rootLibrary) {
cout << "Error in RootLibrary creation" << endl;
return 1;
}
Library* workLibrary = Library::create(rootLibrary, Name("WorkLibrary"));
if (!workLibrary) {
cout << "Error in WorkLibrary creation" << endl;
return 1;
}
workLibrary = rootLibrary->getLibrary(Name("WorkLibrary"));
if (!workLibrary) {
cout << "Error in Library->getLibrary(const Name& name)" << endl;
}
workLibrary->destroy();
workLibrary = rootLibrary->getLibrary(Name("WorkLibrary"));
if (workLibrary) {
cout << "Error in Library destruction" << endl;
}
return 0;
}