X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tests%2Ftools%2FclitkAffineTransformTest.cxx;h=2a7fe92e8089977a61fbb9bae44a8d35d4fe6156;hb=bc6c780aea4d4b1b5736360ac8febd1ee550c463;hp=1af7cc2dc7fcb8d6567cd4a14923d07eb1cf7dbb;hpb=011e3dc6dfcc3261370e59140717f21466bd64da;p=clitk.git diff --git a/tests/tools/clitkAffineTransformTest.cxx b/tests/tools/clitkAffineTransformTest.cxx index 1af7cc2..2a7fe92 100644 --- a/tests/tools/clitkAffineTransformTest.cxx +++ b/tests/tools/clitkAffineTransformTest.cxx @@ -24,20 +24,36 @@ #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){ - 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"; +TEST(identity, clitkAffineTransformTest){ + std::string mhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4D.mhd"; + std::string refMhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4DRef.mhd"; + std::string refRaw1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4DRef.raw"; compare(mhd1, refMhd1, refRaw1); } \ No newline at end of file