8 #include <itksys/SystemTools.hxx>
11 const size_t NUMTESTS=2;
14 const char mhd_files[NUMTESTS][128] = {
15 CLITK_DATA_PATH"/4d/mhd/00.mhd",
16 CLITK_DATA_PATH"/4d/mhd/bh.mhd"
19 // pre-written validation files. the idea
20 // is that the output generated from the test
21 // files match the verification files
22 const char validation_files[NUMTESTS][128] = {
23 CLITK_DATA_PATH"/tools/clitkImageInfoTestValidate3D.out",
24 CLITK_DATA_PATH"/tools/clitkImageInfoTestValidate4D.out"
27 int main(int argc, char** argv)
32 for (size_t i = 0; i < NUMTESTS; i++) {
33 std::ostringstream cmd_line;
34 cmd_line << "clitkImageInfo " << mhd_files[i] << " > clitkImageInfoTest.out";
36 std::cout << "Executing " << cmd_line.str() << std::endl;
37 system(cmd_line.str().c_str());
39 // compare output with validation file
40 std::cout << "Validating output against " << validation_files[i] << std::endl;
41 bool differ = itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", validation_files[i]);
45 std::cout << "FAILED: Program output and reference do not match." << std::endl;
49 itksys::SystemTools::RemoveFile("clitkImageInfoTest.out");
50 std::cout << "PASSED" << std::endl;
53 return failed ? -1 : 0;