41 _EXIT_INCORRECT_ARGS = 2,
42 _EXIT_FILE_NOT_FOUND = 3,
44 _EXIT_SUCCESS_NONE = 5
47int main(
int argc,
char* argv[])
52 return EXIT_CODE::_EXIT_INCORRECT_ARGS;
55 std::string fname1 = std::string(argv[1]);
56 std::string fname2 = std::string(argv[2]);
60 std::cout <<
"No such file \"" << fname1 <<
"\"" << std::endl;
61 return EXIT_CODE::_EXIT_BAD_FILE;
63 TFile* f1 =
new TFile(fname1.c_str());
66 std::cout <<
"error : could not open " << fname1 << std::endl;
67 return EXIT_CODE::_EXIT_FILE_NOT_FOUND;
72 std::cout <<
"No such file \"" << fname2 <<
"\"" << std::endl;
73 return EXIT_CODE::_EXIT_BAD_FILE;
75 TFile* f2 =
new TFile(fname2.c_str());
78 std::cout <<
"error : could not open " << fname2 << std::endl;
79 return EXIT_CODE::_EXIT_FILE_NOT_FOUND;
90 for (
auto r : results)
94 std::cout <<
"TESTS_FAILED" << std::endl;
95 return EXIT_CODE::_EXIT_FAILED;
101 std::cout <<
"No tests" << std::endl;
102 return EXIT_CODE::_EXIT_SUCCESS_NONE;
105 {
return EXIT_CODE::_EXIT_SUCCESS;}
111 std::cout <<
"Usage: comparator <rootfile1> <rootfile2>" << std::endl;
112 std::cout <<
"Compares <rootfile2> to <rootfile1> - ie <rootfile1> is the reference." << std::endl;
117 std::ifstream infile(fileName.c_str());
118 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.