OpenMS
ClassTest.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Marc Sturm, Clemens Groepl $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // Avoid OpenMS includes here at all costs
12 // When the included headers are changed, *all* tests have to be recompiled!
13 // Use the ClassTest class if you need add high-level functionality.
14 // Includes in the C-file are ok...
16 #include <OpenMS/CONCEPT/Types.h>
19 #include <OpenMS/OpenMSConfig.h>
20 #include <OpenMS/config.h>
21 
22 #include <cstring>
23 #include <iostream>
24 #include <string>
25 #include <vector>
26 
27 // Empty declaration to avoid problems in case the namespace is not
28 // yet defined (e.g. TEST/ClassTest_test.cpp)
29 
31 #ifndef stdcout
32 #define stdcout std::cout
33 #endif
34 
35 namespace OpenMS
36 {
37  namespace Internal
38  {
40  namespace ClassTest
41  {
42 
47  bool OPENMS_DLLAPI
48  validate(const std::vector<std::string>& file_names);
49 
51  std::string OPENMS_DLLAPI
52  createTmpFileName(const std::string& file, int line, const std::string& extension = "");
53 
55  inline bool OPENMS_DLLAPI
56  isRealType(float)
57  {
58  return true;
59  }
60 
62  inline bool OPENMS_DLLAPI
63  isRealType(double)
64  {
65  return true;
66  }
67 
69  inline bool OPENMS_DLLAPI
70  isRealType(long double)
71  {
72  return true;
73  }
74 
76  inline bool OPENMS_DLLAPI
78  {
79  return true;
80  }
81 
83  inline bool OPENMS_DLLAPI
85  {
86  return true;
87  }
88 
90  template <typename T>
91  inline bool
92  isRealType(const T&)
93  {
94  return false;
95  }
96 
102  void OPENMS_DLLAPI
103  testRealSimilar(const char* file, int line, long double number_1,
104  const char* number_1_stringified,
105  bool number_1_is_realtype, Int number_1_written_digits,
106  long double number_2, const char* number_2_stringified,
107  bool /* number_2_is_realtype */, Int number_2_written_digits);
108 
110  bool OPENMS_DLLAPI
111  isRealSimilar(long double number_1, long double number_2);
112 
120  void OPENMS_DLLAPI
121  testStringSimilar(const char* file, int line,
122  const std::string& string_1,
123  const char* string_1_stringified,
124  const std::string& string_2,
125  const char* string_2_stringified);
126 
128  void OPENMS_DLLAPI
129  testStringEqual(const char* file, int line,
130  const std::string& string_1,
131  const char* string_1_stringified,
132  const std::string& string_2,
133  const char* string_2_stringified);
134 
140  bool OPENMS_DLLAPI
141  isFileSimilar(const std::string& filename_1,
142  const std::string& filename_2);
143 
145  void OPENMS_DLLAPI
147 
149  void OPENMS_DLLAPI
150  printWithPrefix(const std::string& text, const int marked = -1);
151 
161  void OPENMS_DLLAPI mainInit(const char* version, const char* class_name, int argc, const char* argv0);
162 
172  void OPENMS_DLLAPI filesEqual(int line, const char* filename, const char* templatename, const char* filename_stringified, const char* templatename_stringified);
173 
175  void OPENMS_DLLAPI removeTempFiles();
176 
178  void OPENMS_DLLAPI
179  setWhitelist(const char* const /* file */, const int line,
180  const std::string& whitelist);
181 
183  extern OPENMS_DLLAPI double ratio_max_allowed;
184 
186  extern OPENMS_DLLAPI double ratio_max;
187 
189  extern OPENMS_DLLAPI double ratio;
190 
192  extern OPENMS_DLLAPI double absdiff_max_allowed;
193 
195  extern OPENMS_DLLAPI double absdiff_max;
196 
198  extern OPENMS_DLLAPI double absdiff;
199 
200  extern OPENMS_DLLAPI int line_num_1_max;
201  extern OPENMS_DLLAPI int line_num_2_max;
202 
204  extern OPENMS_DLLAPI int verbose;
205 
207  extern OPENMS_DLLAPI bool all_tests;
208 
210  extern OPENMS_DLLAPI bool test;
211 
213  extern OPENMS_DLLAPI bool this_test;
214 
216  extern OPENMS_DLLAPI int exception;
217 
219  extern OPENMS_DLLAPI std::string exception_name;
220 
222  extern OPENMS_DLLAPI std::string exception_message;
223 
225  extern OPENMS_DLLAPI std::string test_name;
226 
228  extern OPENMS_DLLAPI int start_section_line;
229 
231  extern OPENMS_DLLAPI int test_line;
232 
234  extern OPENMS_DLLAPI const char* version_string;
235 
237  extern OPENMS_DLLAPI std::vector<std::string> tmp_file_list;
238 
240  extern OPENMS_DLLAPI std::vector<UInt> failed_lines_list;
241 
243  extern OPENMS_DLLAPI std::ifstream infile;
244 
246  extern OPENMS_DLLAPI std::ifstream templatefile;
247 
249  extern OPENMS_DLLAPI bool equal_files;
250 
252  extern OPENMS_DLLAPI char line_buffer[65536];
253 
255  extern OPENMS_DLLAPI int test_count;
256 
258  extern OPENMS_DLLAPI std::string add_message;
259 
264  extern OPENMS_DLLAPI std::string fuzzy_message;
265 
267  extern OPENMS_DLLAPI bool newline;
268 
269  template <typename T1, typename T2>
270  void
271  testEqual(const char* /*file*/, int line, const T1& expression_1,
272  const char* expression_1_stringified,
273  const T2& expression_2,
274  const char* expression_2_stringified)
275  {
276  ++test_count;
277  test_line = line;
278  this_test = bool(expression_1 == T1(expression_2));
279  test = test && this_test;
280  {
281  initialNewline();
282  if (this_test)
283  {
284  if (verbose > 1)
285  {
286  stdcout << " + line " << line << ": TEST_EQUAL("
287  << expression_1_stringified << ','
288  << expression_2_stringified << "): got '" << expression_1
289  << "', expected '" << expression_2 << "'\n";
290  }
291  }
292  else
293  {
294  stdcout << " - line " << line << ": TEST_EQUAL("
295  << expression_1_stringified << ','
296  << expression_2_stringified << "): got '" << expression_1
297  << "', expected '" << expression_2 << "'\n";
298  failed_lines_list.push_back(line);
299  }
300  }
301  }
302 
303  void testTrue(const char* /*file*/, int line, const bool expression_1, const char* expression_1_stringified)
304  {
305  ++test_count;
306  test_line = line;
307  this_test = expression_1;
308  test = test && this_test;
309  {
310  initialNewline();
311  if (this_test)
312  {
313  if (verbose > 1)
314  {
315  stdcout << " + line " << line << ": TEST_TRUE(" << expression_1_stringified << "): ok\n";
316  }
317  }
318  else
319  {
320  stdcout << " - line " << line << ": TEST_TRUE(" << expression_1_stringified << "): failed\n";
321  failed_lines_list.push_back(line);
322  }
323  }
324  }
325 
326  void testFalse(const char* /*file*/, int line, const bool expression_1, const char* expression_1_stringified)
327  {
328  ++test_count;
329  test_line = line;
330  this_test = !expression_1;
331  test = test && this_test;
332  {
333  initialNewline();
334  if (this_test)
335  {
336  if (verbose > 1)
337  {
338  stdcout << " + line " << line << ": TEST_FALSE(" << expression_1_stringified << "): ok\n";
339  }
340  }
341  else
342  {
343  stdcout << " - line " << line << ": TEST_FALSE(" << expression_1_stringified << "): failed\n";
344  failed_lines_list.push_back(line);
345  }
346  }
347  }
348 
349  template <typename T1, typename T2>
350  void
351  testNotEqual(const char* /*file*/, int line, const T1& expression_1,
352  const char* expression_1_stringified,
353  const T2& expression_2,
354  const char* expression_2_stringified)
355  {
356  ++test_count;
357  test_line = line;
358  this_test = !(expression_1 == T1(expression_2));
359  test = test && this_test;
360  {
361  initialNewline();
362  if (this_test)
363  {
364  if (verbose > 1)
365  {
366  stdcout << " + line " << line << ": TEST_NOT_EQUAL("
367  << expression_1_stringified << ','
368  << expression_2_stringified << "): got '" << expression_1
369  << "', forbidden is '" << expression_2 << "'\n";
370  }
371  }
372  else
373  {
374  stdcout << " - line " << line << ": TEST_NOT_EQUAL("
375  << expression_1_stringified << ','
376  << expression_2_stringified << "): got '" << expression_1
377  << "', forbidden is '" << expression_2 << "'\n";
378  failed_lines_list.push_back(line);
379  }
380  }
381  }
382 
383 
384  void OPENMS_DLLAPI printLastException(std::ostream& out);
385 
386  int OPENMS_DLLAPI endTestPostProcess(std::ostream& out);
387 
388  void OPENMS_DLLAPI endSectionPostProcess(std::ostream& out, const int line);
389  }
390  }
391 }
392 
393 // A namespace alias - apparently these cannot be documented using doxygen (?)
395 
420 
421 //@name test and subtest
423 
448 #define START_TEST(class_name, version) \
449  int main(int argc, char** argv) \
450  { \
451  TEST::mainInit(version, #class_name, argc, argv[0]); \
452  try {
453 
465 #define END_TEST \
466  /* global try block */ \
467  } \
468  catch (...) \
469  { \
470  TEST::printLastException(stdcout); \
471  } \
472  return TEST::endTestPostProcess(stdcout); \
473  }
474 
497 #define START_SECTION(name_of_test) \
498  TEST::test = true; \
499  TEST::newline = false; \
500  TEST::test_name = # name_of_test; \
501  TEST::test_count = 0; \
502  TEST::start_section_line = __LINE__; \
503  stdcout << "checking " << TEST::test_name << " ... " << std::flush; \
504  try \
505  { \
506  while (true) \
507  {
508 
534 #define END_SECTION \
535  break; \
536  } \
537  } \
538  catch (...) \
539  { \
540  TEST::printLastException(stdcout);\
541  } \
542  TEST::endSectionPostProcess(stdcout, __LINE__);
543 
544 
546 
566 #define TEST_EQUAL(a, b) TEST::testEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
567 
577 #define TEST_TRUE(a) TEST::testTrue(__FILE__, __LINE__, (a), (#a));
578 
588 #define TEST_FALSE(a) TEST::testFalse(__FILE__, __LINE__, (a), (#a));
589 
590 
602 #define TEST_NOT_EQUAL(a, b) TEST::testNotEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
603 
616 #define TEST_STRING_EQUAL(a, b) TEST::testStringEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
617 
632 #define TEST_FILE_EQUAL(filename, templatename) \
633  { \
634  TEST::filesEqual(__LINE__, filename, templatename, #filename, #templatename); \
635  }
636 
652 #define TEST_REAL_SIMILAR(a, b) TEST::testRealSimilar(__FILE__, __LINE__, (a), (# a), TEST::isRealType(a), writtenDigits(a), (b), (# b), TEST::isRealType(b), writtenDigits(b));
653 
669 #define TEST_STRING_SIMILAR(a, b) TEST::testStringSimilar(__FILE__, __LINE__, (a), (# a), (b), (# b));
670 
685 #define TEST_FILE_SIMILAR(a, b) \
686  { \
687  ++TEST::test_count; \
688  TEST::test_line = __LINE__; \
689  TEST::this_test = TEST::isFileSimilar((a), (b)); \
690  TEST::test = TEST::test && TEST::this_test; \
691  { \
692  TEST::initialNewline(); \
693  if (TEST::this_test) \
694  { \
695  if (TEST::verbose > 1) \
696  { \
697  stdcout << " + line " << __LINE__ \
698  << ": TEST_FILE_SIMILAR(" # a "," # b "): absolute: " \
699  << precisionWrapper(TEST::absdiff) \
700  << " (" \
701  << precisionWrapper(TEST::absdiff_max_allowed) \
702  << "), relative: " \
703  << precisionWrapper(TEST::ratio) \
704  << " (" \
705  << precisionWrapper(TEST::ratio_max_allowed) \
706  << ")\n"; \
707  stdcout << "message: \n"; \
708  stdcout << TEST::fuzzy_message; \
709  } \
710  } \
711  else \
712  { \
713  stdcout << " - line " << TEST::test_line << \
714  ": TEST_FILE_SIMILAR(" # a "," # b ") ... -\n"; \
715  stdcout << "message: \n"; \
716  stdcout << TEST::fuzzy_message; \
717  TEST::failed_lines_list.push_back(TEST::test_line); \
718  } \
719  } \
720  }
721 
734 #define TOLERANCE_RELATIVE(a) \
735  TEST::ratio_max_allowed = (a); \
736  { \
737  TEST::initialNewline(); \
738  if (TEST::verbose > 1) \
739  { \
740  stdcout << " + line " << __LINE__ << \
741  ": TOLERANCE_RELATIVE(" << TEST::ratio_max_allowed << \
742  ") (\"" # a "\")\n"; \
743  } \
744  }
745 
757 #define TOLERANCE_ABSOLUTE(a) \
758  TEST::absdiff_max_allowed = (a); \
759  { \
760  TEST::initialNewline(); \
761  if (TEST::verbose > 1) \
762  { \
763  stdcout << " + line " << __LINE__ << \
764  ": TOLERANCE_ABSOLUTE(" << TEST::absdiff_max_allowed << \
765  ") (\"" # a "\")\n"; \
766  } \
767  }
768 
774 #define WHITELIST(a) TEST::setWhitelist(__FILE__, __LINE__, (a));
775 
788 #define TEST_EXCEPTION(exception_type, command) \
789  { \
790  ++TEST::test_count; \
791  TEST::test_line = __LINE__; \
792  TEST::exception = 0; \
793  try \
794  { \
795  command; \
796  } \
797  catch (exception_type&) \
798  { \
799  TEST::exception = 1; \
800  } \
801  catch (::OpenMS::Exception::BaseException& e) \
802  { \
803  TEST::exception = 2; \
804  TEST::exception_name = e.getName(); \
805  } \
806  catch (const std::exception& e) \
807  { \
808  TEST::exception = 3; \
809  TEST::exception_name = e.what(); \
810  } \
811  catch (...) \
812  { \
813  TEST::exception = 4; \
814  } \
815  TEST::this_test = (TEST::exception == 1); \
816  TEST::test = TEST::test && TEST::this_test; \
817  { \
818  TEST::initialNewline(); \
819  switch (TEST::exception) \
820  { \
821  case 0: \
822  stdcout << " - line " << TEST::test_line << \
823  ": TEST_EXCEPTION(" # exception_type "," # command \
824  "): no exception thrown!\n"; \
825  TEST::failed_lines_list.push_back(TEST::test_line); \
826  break; \
827  case 1: \
828  if (TEST::verbose > 1) \
829  { \
830  stdcout << " + line " << TEST::test_line << \
831  ": TEST_EXCEPTION(" # exception_type "," # command \
832  "): OK\n"; \
833  } \
834  break; \
835  case 2: \
836  stdcout << " - line " << TEST::test_line << \
837  ": TEST_EXCEPTION(" # exception_type "," # command \
838  "): wrong exception thrown! \"" \
839  << TEST::exception_name << "\"\n"; \
840  TEST::failed_lines_list.push_back(TEST::test_line); \
841  break; \
842  case 3: \
843  stdcout << " - line " << TEST::test_line << \
844  ": TEST_EXCEPTION(" # exception_type "," # command \
845  "): wrong exception thrown! \"" \
846  << TEST::exception_name << "\"\n"; \
847  TEST::failed_lines_list.push_back(TEST::test_line); \
848  break; \
849  case 4: \
850  stdcout << " - line " << TEST::test_line << \
851  ": TEST_EXCEPTION(" # exception_type "," # command \
852  "): wrong exception thrown!\n"; \
853  TEST::failed_lines_list.push_back(TEST::test_line); \
854  break; \
855  } \
856  } \
857  }
858 
870 #ifdef OPENMS_ASSERTIONS
871 #define TEST_PRECONDITION_VIOLATED(command) TEST_EXCEPTION(Exception::Precondition, command);
872 #else
873 #define TEST_PRECONDITION_VIOLATED(command) STATUS("TEST_PRECONDITION_VIOLATED(" # command ") - skipped");
874 #endif
875 
887 #ifdef OPENMS_ASSERTIONS
888 #define TEST_POSTCONDITION_VIOLATED(command) TEST_EXCEPTION(Exception::Postcondition, command);
889 #else
890 #define TEST_POSTCONDITION_VIOLATED(command) STATUS("TEST_POSTCONDITION_VIOLATED(" # command ") - skipped");
891 #endif
892 
893 
910 #define TEST_EXCEPTION_WITH_MESSAGE(exception_type, command, message) \
911  { \
912  ++TEST::test_count; \
913  TEST::test_line = __LINE__; \
914  TEST::exception = 0; \
915  try \
916  { \
917  command; \
918  } \
919  catch (exception_type& et) \
920  { \
921  if (std::string(et.what()) != std::string(message)) \
922  { \
923  TEST::exception = 4; \
924  TEST::exception_message = et.what(); \
925  } \
926  else TEST::exception = 1; \
927  } \
928  catch (::OpenMS::Exception::BaseException& e) \
929  { \
930  TEST::exception = 2; \
931  TEST::exception_name = e.getName(); \
932  } \
933  catch (...) \
934  { \
935  TEST::exception = 3; \
936  } \
937  TEST::this_test = (TEST::exception == 1); \
938  TEST::test = TEST::test && TEST::this_test; \
939  \
940  { \
941  TEST::initialNewline(); \
942  switch (TEST::exception) \
943  { \
944  case 0: \
945  stdcout << " - line " << TEST::test_line << \
946  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
947  "): no exception thrown!\n"; \
948  TEST::failed_lines_list.push_back(TEST::test_line); \
949  break; \
950  case 1: \
951  if (TEST::verbose > 1) \
952  { \
953  /* this is actually what we want to get: */ \
954  stdcout << " + line " << TEST::test_line << \
955  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
956  "): OK\n"; \
957  } \
958  break; \
959  case 2: \
960  stdcout << " - line " << TEST::test_line << \
961  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
962  "): wrong exception thrown! \"" << \
963  TEST::exception_name << "\"\n"; \
964  TEST::failed_lines_list.push_back(TEST::test_line); \
965  break; \
966  case 3: \
967  stdcout << " - line " << TEST::test_line << \
968  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
969  "): wrong exception thrown!\n"; \
970  TEST::failed_lines_list.push_back(TEST::test_line); \
971  break; \
972  case 4: \
973  stdcout << " - line " << TEST::test_line << \
974  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
975  "): exception has wrong message: got '" << \
976  TEST::exception_message << \
977  "', expected '" << \
978  (message) << "'\n"; \
979  TEST::failed_lines_list.push_back(TEST::test_line); \
980  break; \
981  } \
982  } \
983  }
984 
998 #define NEW_TMP_FILE_EXT(filename, extension) filename = TEST::createTmpFileName(__FILE__, __LINE__, extension);
999 
1000 
1001 #define NEW_TMP_FILE(filename) filename = TEST::createTmpFileName(__FILE__, __LINE__);
1002 
1003 
1011 #define ABORT_IF(condition) \
1012  if (condition) \
1013  { \
1014  { \
1015  TEST::test_line = __LINE__; \
1016  TEST::this_test = false; \
1017  TEST::test = TEST::test && TEST::this_test; \
1018  TEST::failed_lines_list.push_back(TEST::test_line); \
1019  TEST::initialNewline(); \
1020  stdcout << " - line " << TEST::test_line << \
1021  ": ABORT_IF(" # condition "): TEST ABORTED\n"; \
1022  } \
1023  break; \
1024  }
1025 
1043 #define STATUS(message) \
1044  { \
1045  TEST::initialNewline(); \
1046  stdcout << " line " \
1047  << __LINE__ \
1048  << ": status: " \
1049  << message \
1050  << "\n"; \
1051  }
1052 
1062 #define ADD_MESSAGE(message) \
1063  TEST::add_message = message;
1064 
1074 #define NOT_TESTABLE \
1075  TEST::test_count = 1;
1076 
#define stdcout
Provide a point of redirection for testing the test macros, see ClassTest_test.cpp.
Definition: ClassTest.h:32
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
Class to hold strings, numeric values, vectors of strings and vectors of numeric values using the stl...
Definition: ParamValue.h:29
int Int
Signed integer type.
Definition: Types.h:72
Namespace for class tests.
Definition: ClassTest.h:41
double ratio_max
Maximum ratio of numbers observed so far, see TOLERANCE_RELATIVE.
int verbose
Verbosity level ( "-v" is 1 and "-V" is 2 )
int test_count
Counter for the number of elementary tests within the current subsection.
int endTestPostProcess(std::ostream &out)
void initialNewline()
make sure we have a newline before results from first subtest
void testStringSimilar(const char *file, int line, const std::string &string_1, const char *string_1_stringified, const std::string &string_2, const char *string_2_stringified)
Compare strings using absdiff_max_allowed and ratio_max_allowed.
void endSectionPostProcess(std::ostream &out, const int line)
void testEqual(const char *, int line, const T1 &expression_1, const char *expression_1_stringified, const T2 &expression_2, const char *expression_2_stringified)
Definition: ClassTest.h:271
int test_line
Line of current elementary test.
void testRealSimilar(const char *file, int line, long double number_1, const char *number_1_stringified, bool number_1_is_realtype, Int number_1_written_digits, long double number_2, const char *number_2_stringified, bool, Int number_2_written_digits)
Compare floating point numbers using absdiff_max_allowed and ratio_max_allowed.
double absdiff
Recent absolute difference of numbers, see TOLERANCE_ABSOLUTE.
char line_buffer[65536]
(A buffer for one line from a file. Used by TEST_FILE_EQUAL.)
std::string add_message
See ADD_MESSAGE.
bool validate(const std::vector< std::string > &file_names)
Validates the given files against the XML schema (if available)
std::string fuzzy_message
Last message from a fuzzy comparison. Written by isRealSimilar(), testStringSimilar(),...
void mainInit(const char *version, const char *class_name, int argc, const char *argv0)
Set up some classtest variables as obtained from the 'START_TEST' macro and check that no additional ...
bool all_tests
Status of the whole test.
std::string exception_message
(Used by various macros. Stores the "message" of the exception, if applicable.)
std::string test_name
Name of current subsection.
void testStringEqual(const char *file, int line, const std::string &string_1, const char *string_1_stringified, const std::string &string_2, const char *string_2_stringified)
used by TEST_STRING_EQUAL
double absdiff_max
Maximum difference of numbers observed so far, see TOLERANCE_ABSOLUTE.
void printWithPrefix(const std::string &text, const int marked=-1)
print the text, each line gets a prefix, the marked line number gets a special prefix
bool newline
(Flags whether a new line is in place, depending on context and verbosity setting....
bool test
Status of the current subsection.
double absdiff_max_allowed
Maximum absolute difference of numbers allowed, see TOLERANCE_ABSOLUTE.
const char * version_string
Version string supplied with START_TEST.
std::ifstream infile
Questionable file tested by TEST_FILE_EQUAL.
void testTrue(const char *, int line, const bool expression_1, const char *expression_1_stringified)
Definition: ClassTest.h:303
std::string createTmpFileName(const std::string &file, int line, const std::string &extension="")
Creates a temporary file name from the test name and the line with the specified extension.
void testFalse(const char *, int line, const bool expression_1, const char *expression_1_stringified)
Definition: ClassTest.h:326
std::string exception_name
(Used by various macros. Stores the "name" of the exception, if applicable.)
std::vector< UInt > failed_lines_list
List of all failed lines for summary at the end of the test.
void removeTempFiles()
removed all temporary files created with the NEW_TMP_FILE macro
double ratio
Recent ratio of numbers, see TOLERANCE_RELATIVE.
std::vector< std::string > tmp_file_list
List of tmp file names (these will be cleaned up, see NEW_TMP_FILE)
bool isFileSimilar(const std::string &filename_1, const std::string &filename_2)
Compare files using absdiff_max_allowed and ratio_max_allowed.
void testNotEqual(const char *, int line, const T1 &expression_1, const char *expression_1_stringified, const T2 &expression_2, const char *expression_2_stringified)
Definition: ClassTest.h:351
bool this_test
Status of last elementary test.
std::ifstream templatefile
Template (correct) file used by TEST_FILE_EQUAL.
double ratio_max_allowed
Maximum ratio of numbers allowed, see TOLERANCE_RELATIVE.
void setWhitelist(const char *const, const int line, const std::string &whitelist)
set the whitelist_
bool isRealType(float)
This overload returns true; float is a floating point type.
Definition: ClassTest.h:56
bool equal_files
(A variable used by TEST_FILE_EQUAL)
int start_section_line
Line where current subsection started.
void filesEqual(int line, const char *filename, const char *templatename, const char *filename_stringified, const char *templatename_stringified)
Test if two files are exactly equal (used in TEST_FILE_EQUAL macro)
void printLastException(std::ostream &out)
int exception
(Used by various macros. Indicates a rough category of the exception being caught....
bool isRealSimilar(long double number_1, long double number_2)
used by testRealSimilar()
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19