- //files should be equal, so if this is the case return success=0
- char* refFile = argv[argc-1];
- std::cout<<"comapring "<<outFile<<" to "<<refFile<<std::endl;
- bool fail = (itksys::SystemTools::FilesDiffer(outFile, refFile))?0:1;
- remove(outFile);
- return fail;
+
+ //compare source files
+ assertFalse((itksys::SystemTools::FilesDiffer(outFile.c_str(), refFile)), "Source Files are different");
+
+ //eventually raw files associated
+ //should be passed as a boolean to check also for raw or not
+
+ std::string refRawFile = std::string(refFile)+".raw";
+
+
+ int found=outFile.find_last_of(".");
+ std::string rawFile = outFile.substr(0, found)+".raw";
+ if((itksys::SystemTools::FileExists(refRawFile.c_str(), true))){
+ //compare the raw stuff
+ if((itksys::SystemTools::FileExists(rawFile.c_str(), true))){
+ std::cout<<"Checking raws"<<std::endl;
+ assertFalse(itksys::SystemTools::FilesDiffer(refRawFile.c_str(), rawFile.c_str()), "Raws are different");
+ }
+ //file is not removed if there is a fail
+ remove(rawFile.c_str());
+ }
+ //neither the mhd is
+ remove(outFile.c_str());
+
+ //success
+ return 0;