X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tests%2Ftools%2FclitkWriteDicomSeriesTest.cxx;h=bc63080a459b6c104046b75ae4aba47dab66c8d5;hb=6303ae6a7cad09a470d497d7c62ccf351fbf7981;hp=0d0059231abdc400f247b9e20749706668da97a6;hpb=39e22c039d0de25c4f1e1c60027e4351cb30e445;p=clitk.git diff --git a/tests/tools/clitkWriteDicomSeriesTest.cxx b/tests/tools/clitkWriteDicomSeriesTest.cxx old mode 100755 new mode 100644 index 0d00592..bc63080 --- a/tests/tools/clitkWriteDicomSeriesTest.cxx +++ b/tests/tools/clitkWriteDicomSeriesTest.cxx @@ -1,41 +1,34 @@ -#include -#include +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv -#include -#include -#include - -#include - -const size_t NUMTESTS=1; + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr -const char mhd_files[NUMTESTS][128] = { - "data/3d/mhd/CT_UNTAGGED2MM_0.mhd" -}; + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. -const char dcm_dirs[NUMTESTS][128] = { - "data/3d/dcm/1.2.840.113704.1.111.5556.1240990904.26" -}; + It is distributed under dual licence -int main(int argc, char** argv) -{ - bool failed = false; - for (size_t i = 0; i < NUMTESTS; i++) { - std::ostringstream cmd_line; - cmd_line << "clitkWriteDicomSeries -i " << mhd_files[i] << " -d " << dcm_dirs[i] << " -o dcm --verbose"; - - std::cout << "Executing " << cmd_line.str() << std::endl; - int err = system(cmd_line.str().c_str()); - if (err != 0) - { - failed = true; - std::cout << "FAILED (errno = " << err << ")" << std::endl; - } - else - { - itksys::SystemTools::RemoveADirectory("dcm"); - std::cout << "PASSED" << std::endl; - } - } - return failed ? -1 : 0; + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================*/ +#include +#include +#include "gtest/gtest.h" +#include +TEST(clitkWriteDicomSeriesTest, main){ + + std::string fIn=std::string(CLITK_DATA_PATH)+"/3d/mhd/00.mhd"; + std::string fOut=std::string(CLITK_DATA_PATH)+"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26"; + ASSERT_TRUE(itksys::SystemTools::FileExists(fIn.c_str(), true)); + std::ostringstream cmd_line; + cmd_line << TOOLS_PATH <<"clitkWriteDicomSeries -i " << fIn << " -d " << fOut << " -o dcm --verbose"; + EXPECT_TRUE(itksys::SystemTools::FileExists(fOut.c_str(), false)); + EXPECT_TRUE(itksys::SystemTools::FileExists("dcm", false)); + EXPECT_EQ(0, system(cmd_line.str().c_str())); + //does directory exists + itksys::SystemTools::RemoveADirectory("dcm"); } \ No newline at end of file