42 _EXIT_INCORRECT_ARGS = 2,
43 _EXIT_FILE_NOT_FOUND = 3,
45 _EXIT_SUCCESS_NONE = 5
48int main(
int argc,
char* argv[])
53 return EXIT_CODE::_EXIT_INCORRECT_ARGS;
56 std::string fname1 = std::string(argv[1]);
57 std::string fname2 = std::string(argv[2]);
61 std::cout <<
"No such file \"" << fname1 <<
"\"" << std::endl;
62 return EXIT_CODE::_EXIT_BAD_FILE;
64 TFile* f1 =
new TFile(fname1.c_str());
67 std::cout <<
"error : could not open " << fname1 << std::endl;
68 return EXIT_CODE::_EXIT_FILE_NOT_FOUND;
73 std::cout <<
"No such file \"" << fname2 <<
"\"" << std::endl;
74 return EXIT_CODE::_EXIT_BAD_FILE;
76 TFile* f2 =
new TFile(fname2.c_str());
79 std::cout <<
"error : could not open " << fname2 << std::endl;
80 return EXIT_CODE::_EXIT_FILE_NOT_FOUND;
91 for (
auto r : results)
95 std::cout <<
"TESTS_FAILED" << std::endl;
96 return EXIT_CODE::_EXIT_FAILED;
102 std::cout <<
"No tests" << std::endl;
103 return EXIT_CODE::_EXIT_SUCCESS_NONE;
106 {
return EXIT_CODE::_EXIT_SUCCESS;}
112 std::cout <<
"Usage: comparator <rootfile1> <rootfile2>" << std::endl;
113 std::cout <<
"Compares <rootfile2> to <rootfile1> - ie <rootfile1> is the reference." << std::endl;
118 std::ifstream infile(fileName.c_str());
119 return infile.good();
G4bool FileExists(const G4String &filename)
Checks if filename exists.
std::vector< Result * > Files(TFile *f1, TFile *f2)
Compare two files.
bool Summarise(const std::vector< Result * > &results)
Loop over results and print any failed ones. Returns true if all passed.