]> Creatis software - clitk.git/blob - tests/tools/clitkImageInfoTest.cxx
0b3f30394a178b6cb08c7dffdfbeacc17091f312
[clitk.git] / tests / tools / clitkImageInfoTest.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================*/
18 #include <iostream>
19 #include <sstream>
20 #include <string>
21 #include <fstream>
22 #include "gtest/gtest.h"
23 #include "stdio.h"
24 #include <itksys/SystemTools.hxx>
25 static inline void compare(std::string mhd, std::string ref){
26   std::ostringstream cmd_line;
27   cmd_line << TOOLS_PATH<<"clitkImageInfo " << mhd << " > clitkImageInfoTest.out";
28   system(cmd_line.str().c_str());
29   
30   EXPECT_FALSE( itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", ref.c_str()) );
31   remove("clitkImageInfoTest.out");
32 }
33 TEST(clitkImageInfoTest, main){
34   std::string mhd1=std::string(CLITK_TEST_DATA_PATH)+"Deformation4D.mhd";
35   ASSERT_TRUE(itksys::SystemTools::FileExists(mhd1.c_str(), true));
36   
37   std::string mhd2=std::string(CLITK_TEST_DATA_PATH)+"Lung3D.mhd";
38   ASSERT_TRUE(itksys::SystemTools::FileExists(mhd2.c_str(), true));
39   
40   mhd1+=" "+mhd2;
41   std::string ref1=std::string(CLITK_TEST_DATA_PATH)+"clitkImageInfoTestRef.out";
42   ASSERT_TRUE(itksys::SystemTools::FileExists(ref1.c_str(), true));
43   compare(mhd1, ref1);
44 }