8 #include <itksys/SystemTools.hxx>
10 const size_t NUMTESTS=2;
13 const char mhd_files[NUMTESTS][128] = {
18 // pre-written validation files. the idea
19 // is that the output generated from the test
20 // files match the verification files
21 const char validation_files[NUMTESTS][128] = {
22 "data/tools/clitkImageInfoTestValidate3D.out",
23 "data/tools/clitkImageInfoTestValidate4D.out"
26 int main(int argc, char** argv)
29 for (size_t i = 0; i < NUMTESTS; i++) {
30 std::ostringstream cmd_line;
31 cmd_line << "clitkImageInfo " << mhd_files[i] << " > clitkImageInfoTest.out";
33 std::cout << "Executing " << cmd_line.str() << std::endl;
34 system(cmd_line.str().c_str());
36 // compare output with validation file
37 std::cout << "Validating output against " << validation_files[i] << std::endl;
38 bool differ = itksys::SystemTools::FilesDiffer("clitkImageInfoTest.out", validation_files[i]);
42 std::cout << "FAILED: Program output and reference do not match." << std::endl;
46 itksys::SystemTools::RemoveFile("clitkImageInfoTest.out");
47 std::cout << "PASSED" << std::endl;
50 return failed ? -1 : 0;