From: mpech Date: Wed, 29 Jun 2011 11:31:10 +0000 (+0200) Subject: Modification for nightly builds X-Git-Tag: v1.3.0~300^2^2~10 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=12317efdc0a451f877e41a13c26d56931798af0b;p=clitk.git Modification for nightly builds --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fcacae0..04a0b0a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,21 @@ cmake_policy(SET CMP0005 NEW) #========================================================= + +#========================================================= +# Data tests path + +OPTION(CLITK_DATA_PATH ${CMAKE_CURRENT_BINARY_DIR}/data) +ADD_DEFINITIONS(-DCLITK_DATA_PATH=\"${CLITK_DATA_PATH}\") +#========================================================= +#========================================================= +# Get the data tests +IF(WIN32) + SET(scriptExt bat) +ELSE(UNIX) + SET(scriptExt sh) +ENDIF() +EXEC_PROGRAM(${CMAKE_CURRENT_SOURCE_DIR}/fetch_data_test.${scriptExt} ARGS ${CLITK_DATA_PATH}) +#========================================================= # Google test macro macro(ADD_GOOGLE_TESTS executable) message(exe : ${executable}) @@ -18,11 +34,6 @@ SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin) SET(BUILDNAME ${CMAKE_SYSTEM_NAME}${CMAKE_OSX_ARCHITECTURES} CACHE INTERNAL DOCSTRING) #========================================================= #========================================================= -# Data tests path -FIND_PATH(CLITK_DATA_PATH data) -ADD_DEFINITIONS(-DCLITK_DATA_PATH=\"${CLITK_DATA_PATH}\") -#========================================================= -#========================================================= # GoogleTest framemwork FIND_PATH(GTEST_DIR gtest) INCLUDE_DIRECTORIES(${GTEST_DIR}/include/) diff --git a/tests/tools/CMakeLists.txt b/tests/tools/CMakeLists.txt index 8c6c282..6f4bcbf 100644 --- a/tests/tools/CMakeLists.txt +++ b/tests/tools/CMakeLists.txt @@ -12,4 +12,9 @@ target_link_libraries(toolsTest vvLib ${vvExternalLibs} gtest) # Add all tests found in the source code, calling the executable to run them add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/toolsTest ${srcs}) -SET(BUILDNAME ${BUILDNAME}_tools CACHE INTERNAL DOCSTRING) \ No newline at end of file +SET(BUILDNAME ${BUILDNAME}_tools CACHE INTERNAL DOCSTRING) + +ADD_EXECUTABLE(clitkImageInfoTest_oldWay clitkImageInfoTest_oldWay.cpp) +target_link_libraries(clitkImageInfoTest_oldWay vvLib ${vvExternalLibs}) +ADD_TEST(clitkImageInfoTest_oldWay ${EXECUTABLE_OUTPUT_PATH}/clitkImageInfoTest_oldWay firstOne) +ADD_TEST(clitkImageInfoTest_oldWay ${EXECUTABLE_OUTPUT_PATH}/clitkImageInfoTest_oldWay secondOne) \ No newline at end of file diff --git a/tests/tools/clitkAffineTransformTest.cxx b/tests/tools/clitkAffineTransformTest.cxx index 1af7cc2..82d4df9 100644 --- a/tests/tools/clitkAffineTransformTest.cxx +++ b/tests/tools/clitkAffineTransformTest.cxx @@ -24,18 +24,34 @@ #include static inline void compare(std::string mhd, std::string refMhd, std::string refRaw){ std::ostringstream cmd_line; + + //Ensure the description file exists ASSERT_TRUE(itksys::SystemTools::FileExists(mhd.c_str(), true)); + + //Ensure the description reference file exists ASSERT_TRUE(itksys::SystemTools::FileExists(refMhd.c_str(), true)); + + //Ensure our reference raw exists ASSERT_TRUE(itksys::SystemTools::FileExists(refRaw.c_str(), true)); +//todo : test this on windows + //Generate the new mhd and the new raw cmd_line << TOOLS_PATH<<"clitkAffineTransform -i " << mhd << " -o "<<"out.mhd >/dev/null"; system(cmd_line.str().c_str()); + + //Check the new file has been created EXPECT_TRUE(itksys::SystemTools::FileExists("out.mhd", true)); + + //Check the mhd and the produced mhd are still equal EXPECT_FALSE( itksys::SystemTools::FilesDiffer("out.mhd", refMhd.c_str()) ); - EXPECT_FALSE( itksys::SystemTools::FilesDiffer("out.raw", refRaw.c_str()) ); + + //Check the raw and the produced raw are different + EXPECT_TRUE( itksys::SystemTools::FilesDiffer("out.raw", refRaw.c_str()) ); + + //clean the produced junk remove("out.mhd"); remove("out.raw"); } -TEST(clitkAffineTransformTest, main){ +TEST(identity, clitkAffineTransformTest){ std::string mhd1=std::string(CLITK_DATA_PATH)+"Deformation4D.mhd"; std::string refMhd1=std::string(CLITK_DATA_PATH)+"Deformation4DRef.mhd"; std::string refRaw1=std::string(CLITK_DATA_PATH)+"Deformation4DRef.raw";