MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / filesEqual

Function filesEqual

src/openms/source/CONCEPT/ClassTest.cpp:91–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90
91 void filesEqual(int line, const char* filename, const char* templatename, const char* filename_stringified, const char* templatename_stringified)
92 {
93 ++TEST::test_count;
94 TEST::test_line = line;
95
96 TEST::equal_files = true;
97 TEST::infile.open(filename, std::ios::in);
98 TEST::templatefile.open(templatename, std::ios::in);
99
100 if (TEST::infile.good() && TEST::templatefile.good())
101 {
102 std::string TEST_FILE__template_line;
103 std::string TEST_FILE__line;
104
105 while (TEST::infile.good() && TEST::templatefile.good())
106 {
107 TEST::templatefile.getline(TEST::line_buffer, 65535);
108 TEST_FILE__template_line = TEST::line_buffer;
109 TEST::infile.getline(TEST::line_buffer, 65535);
110 TEST_FILE__line = TEST::line_buffer;
111
112 TEST::equal_files &= (TEST_FILE__template_line == TEST_FILE__line);
113 if (TEST_FILE__template_line != TEST_FILE__line)
114 {
115 TEST::initialNewline();
116 stdcout << " TEST_FILE_EQUAL: line mismatch:\n got: '"
117 << TEST_FILE__line << "'\n expected: '"
118 << TEST_FILE__template_line << "'\n";
119 }
120 }
121 }
122 else
123 {
124 TEST::equal_files = false;
125 {
126 TEST::initialNewline();
127 stdcout << " + line "
128 << line
129 << ": TEST_FILE_EQUAL("
130 << filename_stringified
131 << ", "
132 << templatename_stringified;
133 stdcout << ") : "
134 << " cannot open file: \"";
135 if (!TEST::infile.good())
136 {
137 stdcout << filename << "\" (input file) ";
138 }
139 if (!TEST::templatefile.good())
140 {
141 stdcout << templatename << "\" (template file) ";
142 }
143 stdcout << "'\n";
144 }
145 }
146 TEST::infile.close();
147 TEST::templatefile.close();
148 TEST::infile.clear();

Callers

nothing calls this directly

Calls 5

initialNewlineFunction · 0.85
openMethod · 0.45
closeMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected