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, Chris Bielow, Timo Sachsenberg $
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 ClassTest.cpp 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 #include <type_traits>
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 &= this_test;
280  {
281  initialNewline();
282  if (!this_test || verbose > 1)
283  {
284  stdcout << ' ' << (this_test ? '+' : '-') << " line " << line << " : TEST_EQUAL(" << expression_1_stringified << ','
285  << expression_2_stringified << "): got '";
286  if constexpr (std::is_enum_v<T1> && std::is_enum_v<T2>)
287  {
288  stdcout << static_cast<int>(expression_1) << "', expected '" << static_cast<int>(expression_2) << "'\n";
289  }
290  else
291  {
292  stdcout << expression_1 << "', expected '" << expression_2 << "'\n";
293  }
294  }
295  if (!this_test)
296  {
297  failed_lines_list.push_back(line);
298  }
299  }
300  }
301 
302  void testTrue(const char* /*file*/, int line, const bool expression_1, const char* expression_1_stringified)
303  {
304  ++test_count;
305  test_line = line;
306  this_test = expression_1;
307  test &= this_test;
308  {
309  initialNewline();
310  if (this_test)
311  {
312  if (verbose > 1)
313  {
314  stdcout << " + line " << line << ": TEST_TRUE(" << expression_1_stringified << "): ok\n";
315  }
316  }
317  else
318  {
319  stdcout << " - line " << line << ": TEST_TRUE(" << expression_1_stringified << "): failed\n";
320  failed_lines_list.push_back(line);
321  }
322  }
323  }
324 
325  void testFalse(const char* /*file*/, int line, const bool expression_1, const char* expression_1_stringified)
326  {
327  ++test_count;
328  test_line = line;
329  this_test = !expression_1;
330  test &= this_test;
331  {
332  initialNewline();
333  if (this_test)
334  {
335  if (verbose > 1)
336  {
337  stdcout << " + line " << line << ": TEST_FALSE(" << expression_1_stringified << "): ok\n";
338  }
339  }
340  else
341  {
342  stdcout << " - line " << line << ": TEST_FALSE(" << expression_1_stringified << "): failed\n";
343  failed_lines_list.push_back(line);
344  }
345  }
346  }
347 
348  template <typename T1, typename T2>
349  void
350  testNotEqual(const char* /*file*/, int line, const T1& expression_1,
351  const char* expression_1_stringified,
352  const T2& expression_2,
353  const char* expression_2_stringified)
354  {
355  ++test_count;
356  test_line = line;
357  this_test = !(expression_1 == T1(expression_2));
358  test &= this_test;
359  {
360  initialNewline();
361  if (!this_test || verbose > 1)
362  {
363  stdcout << ' ' << (this_test ? '+' : '-') << " line " << line << " : TEST_NOT_EQUAL(" << expression_1_stringified << ','
364  << expression_2_stringified << "): got '";
365  if constexpr (std::is_enum_v<T1> && std::is_enum_v<T2>)
366  {
367  stdcout << static_cast<int>(expression_1) << "', forbidden is '" << static_cast<int>(expression_2) << "'\n";
368  }
369  else { stdcout << expression_1 << "', expected '" << expression_2 << "'\n"; }
370  }
371  if (!this_test)
372  {
373  failed_lines_list.push_back(line);
374  }
375  }
376  }
377 
378 
379  void OPENMS_DLLAPI printLastException(std::ostream& out);
380 
381  int OPENMS_DLLAPI endTestPostProcess(std::ostream& out);
382 
383  void OPENMS_DLLAPI endSectionPostProcess(std::ostream& out, const int line);
384  }
385  }
386 }
387 
388 // A namespace alias - apparently these cannot be documented using doxygen (?)
390 
415 
416 //@name test and subtest
418 
443 #define START_TEST(class_name, version) \
444  int main(int argc, char** argv) \
445  { \
446  TEST::mainInit(version, #class_name, argc, argv[0]); \
447  try {
448 
460 #define END_TEST \
461  /* global try block */ \
462  } \
463  catch (...) \
464  { \
465  TEST::printLastException(stdcout); \
466  } \
467  return TEST::endTestPostProcess(stdcout); \
468  }
469 
492 #define START_SECTION(name_of_test) \
493  TEST::test = true; \
494  TEST::newline = false; \
495  TEST::test_name = # name_of_test; \
496  TEST::test_count = 0; \
497  TEST::start_section_line = __LINE__; \
498  stdcout << "checking " << TEST::test_name << " ... " << std::flush; \
499  try \
500  { \
501  while (true) \
502  {
503 
529 #define END_SECTION \
530  break; \
531  } \
532  } \
533  catch (...) \
534  { \
535  TEST::printLastException(stdcout);\
536  } \
537  TEST::endSectionPostProcess(stdcout, __LINE__);
538 
539 
541 
561 #define TEST_EQUAL(a, b) TEST::testEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
562 
572 #define TEST_TRUE(a) TEST::testTrue(__FILE__, __LINE__, (a), (#a));
573 
583 #define TEST_FALSE(a) TEST::testFalse(__FILE__, __LINE__, (a), (#a));
584 
585 
597 #define TEST_NOT_EQUAL(a, b) TEST::testNotEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
598 
611 #define TEST_STRING_EQUAL(a, b) TEST::testStringEqual(__FILE__, __LINE__, (a), (# a), (b), (# b));
612 
627 #define TEST_FILE_EQUAL(filename, templatename) \
628  { \
629  TEST::filesEqual(__LINE__, filename, templatename, #filename, #templatename); \
630  }
631 
647 #define TEST_REAL_SIMILAR(a, b) TEST::testRealSimilar(__FILE__, __LINE__, (a), (# a), TEST::isRealType(a), writtenDigits(a), (b), (# b), TEST::isRealType(b), writtenDigits(b));
648 
664 #define TEST_STRING_SIMILAR(a, b) TEST::testStringSimilar(__FILE__, __LINE__, (a), (# a), (b), (# b));
665 
680 #define TEST_FILE_SIMILAR(a, b) \
681  { \
682  ++TEST::test_count; \
683  TEST::test_line = __LINE__; \
684  TEST::this_test = TEST::isFileSimilar((a), (b)); \
685  TEST::test = TEST::test && TEST::this_test; \
686  { \
687  TEST::initialNewline(); \
688  if (TEST::this_test) \
689  { \
690  if (TEST::verbose > 1) \
691  { \
692  stdcout << " + line " << __LINE__ \
693  << ": TEST_FILE_SIMILAR(" # a "," # b "): absolute: " \
694  << precisionWrapper(TEST::absdiff) \
695  << " (" \
696  << precisionWrapper(TEST::absdiff_max_allowed) \
697  << "), relative: " \
698  << precisionWrapper(TEST::ratio) \
699  << " (" \
700  << precisionWrapper(TEST::ratio_max_allowed) \
701  << ")\n"; \
702  stdcout << "message: \n"; \
703  stdcout << TEST::fuzzy_message; \
704  } \
705  } \
706  else \
707  { \
708  stdcout << " - line " << TEST::test_line << \
709  ": TEST_FILE_SIMILAR(" # a "," # b ") ... -\n"; \
710  stdcout << "message: \n"; \
711  stdcout << TEST::fuzzy_message; \
712  TEST::failed_lines_list.push_back(TEST::test_line); \
713  } \
714  } \
715  }
716 
729 #define TOLERANCE_RELATIVE(a) \
730  TEST::ratio_max_allowed = (a); \
731  { \
732  TEST::initialNewline(); \
733  if (TEST::verbose > 1) \
734  { \
735  stdcout << " + line " << __LINE__ << \
736  ": TOLERANCE_RELATIVE(" << TEST::ratio_max_allowed << \
737  ") (\"" # a "\")\n"; \
738  } \
739  }
740 
752 #define TOLERANCE_ABSOLUTE(a) \
753  TEST::absdiff_max_allowed = (a); \
754  { \
755  TEST::initialNewline(); \
756  if (TEST::verbose > 1) \
757  { \
758  stdcout << " + line " << __LINE__ << \
759  ": TOLERANCE_ABSOLUTE(" << TEST::absdiff_max_allowed << \
760  ") (\"" # a "\")\n"; \
761  } \
762  }
763 
769 #define WHITELIST(a) TEST::setWhitelist(__FILE__, __LINE__, (a));
770 
783 #define TEST_EXCEPTION(exception_type, command) \
784  { \
785  ++TEST::test_count; \
786  TEST::test_line = __LINE__; \
787  TEST::exception = 0; \
788  try \
789  { \
790  command; \
791  } \
792  catch (exception_type&) \
793  { \
794  TEST::exception = 1; \
795  } \
796  catch (::OpenMS::Exception::BaseException& e) \
797  { \
798  TEST::exception = 2; \
799  TEST::exception_name = e.getName(); \
800  } \
801  catch (const std::exception& e) \
802  { \
803  TEST::exception = 3; \
804  TEST::exception_name = e.what(); \
805  } \
806  catch (...) \
807  { \
808  TEST::exception = 4; \
809  } \
810  TEST::this_test = (TEST::exception == 1); \
811  TEST::test = TEST::test && TEST::this_test; \
812  { \
813  TEST::initialNewline(); \
814  switch (TEST::exception) \
815  { \
816  case 0: \
817  stdcout << " - line " << TEST::test_line << \
818  ": TEST_EXCEPTION(" # exception_type "," # command \
819  "): no exception thrown!\n"; \
820  TEST::failed_lines_list.push_back(TEST::test_line); \
821  break; \
822  case 1: \
823  if (TEST::verbose > 1) \
824  { \
825  stdcout << " + line " << TEST::test_line << \
826  ": TEST_EXCEPTION(" # exception_type "," # command \
827  "): OK\n"; \
828  } \
829  break; \
830  case 2: \
831  stdcout << " - line " << TEST::test_line << \
832  ": TEST_EXCEPTION(" # exception_type "," # command \
833  "): wrong exception thrown! \"" \
834  << TEST::exception_name << "\"\n"; \
835  TEST::failed_lines_list.push_back(TEST::test_line); \
836  break; \
837  case 3: \
838  stdcout << " - line " << TEST::test_line << \
839  ": TEST_EXCEPTION(" # exception_type "," # command \
840  "): wrong exception thrown! \"" \
841  << TEST::exception_name << "\"\n"; \
842  TEST::failed_lines_list.push_back(TEST::test_line); \
843  break; \
844  case 4: \
845  stdcout << " - line " << TEST::test_line << \
846  ": TEST_EXCEPTION(" # exception_type "," # command \
847  "): wrong exception thrown!\n"; \
848  TEST::failed_lines_list.push_back(TEST::test_line); \
849  break; \
850  } \
851  } \
852  }
853 
865 #ifdef OPENMS_ASSERTIONS
866 #define TEST_PRECONDITION_VIOLATED(command) TEST_EXCEPTION(Exception::Precondition, command);
867 #else
868 #define TEST_PRECONDITION_VIOLATED(command) STATUS("TEST_PRECONDITION_VIOLATED(" # command ") - skipped");
869 #endif
870 
882 #ifdef OPENMS_ASSERTIONS
883 #define TEST_POSTCONDITION_VIOLATED(command) TEST_EXCEPTION(Exception::Postcondition, command);
884 #else
885 #define TEST_POSTCONDITION_VIOLATED(command) STATUS("TEST_POSTCONDITION_VIOLATED(" # command ") - skipped");
886 #endif
887 
888 
905 #define TEST_EXCEPTION_WITH_MESSAGE(exception_type, command, message) \
906  { \
907  ++TEST::test_count; \
908  TEST::test_line = __LINE__; \
909  TEST::exception = 0; \
910  try \
911  { \
912  command; \
913  } \
914  catch (exception_type& et) \
915  { \
916  if (std::string(et.what()) != std::string(message)) \
917  { \
918  TEST::exception = 4; \
919  TEST::exception_message = et.what(); \
920  } \
921  else TEST::exception = 1; \
922  } \
923  catch (::OpenMS::Exception::BaseException& e) \
924  { \
925  TEST::exception = 2; \
926  TEST::exception_name = e.getName(); \
927  } \
928  catch (...) \
929  { \
930  TEST::exception = 3; \
931  } \
932  TEST::this_test = (TEST::exception == 1); \
933  TEST::test = TEST::test && TEST::this_test; \
934  \
935  { \
936  TEST::initialNewline(); \
937  switch (TEST::exception) \
938  { \
939  case 0: \
940  stdcout << " - line " << TEST::test_line << \
941  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
942  "): no exception thrown!\n"; \
943  TEST::failed_lines_list.push_back(TEST::test_line); \
944  break; \
945  case 1: \
946  if (TEST::verbose > 1) \
947  { \
948  /* this is actually what we want to get: */ \
949  stdcout << " + line " << TEST::test_line << \
950  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
951  "): OK\n"; \
952  } \
953  break; \
954  case 2: \
955  stdcout << " - line " << TEST::test_line << \
956  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
957  "): wrong exception thrown! \"" << \
958  TEST::exception_name << "\"\n"; \
959  TEST::failed_lines_list.push_back(TEST::test_line); \
960  break; \
961  case 3: \
962  stdcout << " - line " << TEST::test_line << \
963  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
964  "): wrong exception thrown!\n"; \
965  TEST::failed_lines_list.push_back(TEST::test_line); \
966  break; \
967  case 4: \
968  stdcout << " - line " << TEST::test_line << \
969  ": TEST_EXCEPTION_WITH_MESSAGE(" # exception_type "," # command ", " # message \
970  "): exception has wrong message: got '" << \
971  TEST::exception_message << \
972  "', expected '" << \
973  (message) << "'\n"; \
974  TEST::failed_lines_list.push_back(TEST::test_line); \
975  break; \
976  } \
977  } \
978  }
979 
993 #define NEW_TMP_FILE_EXT(filename, extension) filename = TEST::createTmpFileName(__FILE__, __LINE__, extension);
994 
995 
996 #define NEW_TMP_FILE(filename) filename = TEST::createTmpFileName(__FILE__, __LINE__);
997 
998 
1006 #define ABORT_IF(condition) \
1007  if (condition) \
1008  { \
1009  { \
1010  TEST::test_line = __LINE__; \
1011  TEST::this_test = false; \
1012  TEST::test = TEST::test && TEST::this_test; \
1013  TEST::failed_lines_list.push_back(TEST::test_line); \
1014  TEST::initialNewline(); \
1015  stdcout << " - line " << TEST::test_line << \
1016  ": ABORT_IF(" # condition "): TEST ABORTED\n"; \
1017  } \
1018  break; \
1019  }
1020 
1038 #define STATUS(message) \
1039  { \
1040  TEST::initialNewline(); \
1041  stdcout << " line " \
1042  << __LINE__ \
1043  << ": status: " \
1044  << message \
1045  << "\n"; \
1046  }
1047 
1057 #define ADD_MESSAGE(message) \
1058  TEST::add_message = message;
1059 
1069 #define NOT_TESTABLE \
1070  TEST::test_count = 1;
1071 
#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:302
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:325
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:350
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