From: mpech Date: Wed, 29 Jun 2011 12:00:19 +0000 (+0200) Subject: testing with a simple executable X-Git-Tag: v1.3.0~300^2^2~6 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=933461dcb8724f908e5aee74f26fc572ef38ac5b;p=clitk.git testing with a simple executable --- diff --git a/tests/tools/clitkImageInfoTest_oldWay.cpp b/tests/tools/clitkImageInfoTest_oldWay.cpp new file mode 100644 index 0000000..fa60e44 --- /dev/null +++ b/tests/tools/clitkImageInfoTest_oldWay.cpp @@ -0,0 +1,63 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + 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 + + 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. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================*/ +#include +#include +#include +#include +#include +#include +#include +int main(int argc, char** argv){ + int fail = 1; + std::string mhd = std::string(CLITK_DATA_PATH); + std::string ref = std::string(CLITK_DATA_PATH); + + //We select which image we use to test clitkImageInfo + int idImg = atoi(argv[1]); + switch(idImg){ + case '0': + mhd += "Deformation4D.mhd"; + ref += "clitkImageInfoTestRef"; + break; + case '1': + mhd += "Lung3D.mhd"; + ref += "clitkImageInfoTestRef"; + break; + default: + return fail; + } + //end of selection + + //ensure mhd do exist + if(!itksys::SystemTools::FileExists(mhd.c_str(), true)){ + return fail; + } + //ensure ref do exist + if(!itksys::SystemTools::FileExists(ref.c_str(), true)){ + return fail; + } + + std::ostringstream cmd_line; + cmd_line << TOOLS_PATH <<"clitkImageInfo " << mhd << " > clitkImageInfoTest.out"; + system(cmd_line.str().c_str()); + + //files should be equal, so if this is the case return success=0 + fail = (itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", ref.c_str()))?0:1; + remove("clitkImageInfoTest.out"); + return fail; +}