Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Namespaces | Defines | Functions | Variables

ClassTest.h File Reference

#include <OpenMS/CONCEPT/Types.h>
#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/CONCEPT/UniqueIdGenerator.h>
#include <OpenMS/SYSTEM/File.h>
#include <vector>
#include <string>
#include <cstring>
#include <list>
#include <iostream>
#include <fstream>
#include <boost/lexical_cast.hpp>
#include <cstdio>
#include <cmath>
#include <cstdlib>

Go to the source code of this file.

Namespaces

namespace  OpenMS
 

Main OpenMS namespace.


namespace  OpenMS::Internal
 

Namespace used to hide implementation details from users.


namespace  OpenMS::Internal::ClassTest
 

Namespace for class tests.


Defines

#define std__cout   std::cout
 Provide a point of redirection for testing the test macros, see ClassTest_test.C.
#define START_TEST(class_name, version)
 Begin of the test program for a given class.
#define END_TEST
 End of the test program for a class.
#define START_SECTION(name_of_test)
 Begin of a subtest with a given name.
#define END_SECTION
 End of a subtest.
#define TEST_EQUAL(a, b)
 Generic equality macro.
#define TEST_NOT_EQUAL(a, b)
 Generic inequality macro.
#define TEST_STRING_EQUAL(a, b)
 String equality macro.
#define TEST_FILE_EQUAL(filename, templatename)
 File comparison macro.
#define TEST_REAL_SIMILAR(a, b)
 Floating point similarity macro.
#define TEST_STRING_SIMILAR(a, b)
 String similarity macro.
#define TEST_FILE_SIMILAR(a, b)
 File similarity macro.
#define TOLERANCE_RELATIVE(a)
 Define the relative tolerance for floating point comparisons.
#define TOLERANCE_ABSOLUTE(a)
 Define the absolute tolerance for floating point comparisons.
#define WHITELIST(a)   TEST::setWhitelist(__FILE__, __LINE__, (a));
 Define the whitelist_ used by TEST_STRING_SIMILAR and TEST_FILE_SIMILAR.
#define TEST_EXCEPTION(exception_type, command)
 Exception test macro.
#define TEST_PRECONDITION_VIOLATED(command)
 Precondition test macro.
#define TEST_POSTCONDITION_VIOLATED(command)
 Postcondition test macro.
#define TEST_EXCEPTION_WITH_MESSAGE(exception_type, command, message)
 Exception test macro (with test for exception message).
#define NEW_TMP_FILE(filename)
 Create a temporary filename.
#define ABORT_IF(condition)
 Skip the remainder of the current subtest.
#define STATUS(message)
 Print a status message.
#define ADD_MESSAGE(message)
 Sets an additional text that is displayed after final result of the test.
#define NOT_TESTABLE
 Macro that suppresses the warning issued when no subtests are performed.

Functions

bool validate (const std::vector< std::string > &file_names)
 Validates the given files against the XML schema (if available).
std::string tmpFileName (const std::string &file, int line)
 Creates a temporary file name from the test name and the line.
bool isRealType (float)
 This overload returns true; float is a floating point type.
bool isRealType (double)
 This overload returns true; double is a floating point type.
bool isRealType (long double)
 This overload returns true; long double is a floating point type.
bool isRealType (const DataValue &)
 This overload returns true; DataValue will be converted to DoubleReal by TEST_REAL_SIMILAR.
template<typename T >
bool isRealType (const T &)
 This catch-all template returns false; it will be instantiated for non-floating point types.
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.
bool isRealSimilar (long double number_1, long double number_2)
 used by testRealSimilar()
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 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
bool isFileSimilar (const std::string &filename_1, const std::string &filename_2)
 Compare files using absdiff_max_allowed and ratio_max_allowed.
void initialNewline ()
 make sure we have a newline before results from first subtest
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
void setWhitelist (const char *const , const int line, const std::string &whitelist)
 set the whitelist_
template<typename T1 , typename T2 >
void testEqual (const char *, int line, const T1 &expression_1, const char *expression_1_stringified, const T2 &expression_2, const char *expression_2_stringified)
template<typename T1 , typename T2 >
void testNotEqual (const char *, int line, const T1 &expression_1, const char *expression_1_stringified, const T2 &expression_2, const char *expression_2_stringified)

Variables

double ratio_max_allowed
 Maximum ratio of numbers allowed, see TOLERANCE_RELATIVE.
double ratio_max
 Maximum ratio of numbers observed so far, see TOLERANCE_RELATIVE.
double ratio
 Recent ratio of numbers, see TOLERANCE_RELATIVE.
double absdiff_max_allowed
 Maximum absolute difference of numbers allowed, see TOLERANCE_ABSOLUTE.
double absdiff_max
 Maximum difference of numbers observed so far, see TOLERANCE_ABSOLUTE.
double absdiff
 Recent absolute difference of numbers, see TOLERANCE_ABSOLUTE.
int line_num_1_max
int line_num_2_max
int verbose
 Verbosity level ( "-v" is 1 and "-V" is 2 ).
bool all_tests
 Status of the whole test.
bool test
 Status of the current subsection.
bool this_test
 Status of last elementary test.
int exception
 (Used by various macros. Indicates a rough category of the exception being caught.)
std::string exception_name
 (Used by various macros. Stores the "name" of the exception, if applicable.)
std::string exception_message
 (Used by various macros. Stores the "message" of the exception, if applicable.)
std::string test_name
 Name of current subsection.
int start_section_line
 Line where current subsection started.
int test_line
 Line of current elementary test.
const char * version_string
 Version string supplied with START_TEST.
std::vector< std::string > tmp_file_list
 List of tmp file names (these will be cleaned up, see NEW_TMP_FILE).
std::vector< UInt > failed_lines_list
 List of all failed lines for summary at the end of the test.
std::ifstream infile
 Questionable file tested by TEST_FILE_EQUAL.
std::ifstream templatefile
 Template (correct) file used by TEST_FILE_EQUAL.
bool equal_files
 (A variable used by TEST_FILE_EQUAL)
char line_buffer [65536]
 (A buffer for one line from a file. Used by TEST_FILE_EQUAL.)
int test_count
 Counter for the number of elementary tests within the current subsection.
std::string add_message
 See ADD_MESSAGE.
std::string fuzzy_message
 Last message from a fuzzy comparison. Written by isRealSimilar(), testStringSimilar(), isFileSimilar(). Read by TEST_REAL_SIMILAR, TEST_STRING_SIMILAR, TEST_FILE_SIMILAR;.
bool newline
 (Flags whether a new line is in place, depending on context and verbosity setting. Used by initialNewline() and some macros.)

Define Documentation

#define std__cout   std::cout

Provide a point of redirection for testing the test macros, see ClassTest_test.C.

Referenced by OpenMS::Internal::ClassTest::testEqual(), and OpenMS::Internal::ClassTest::testNotEqual().


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:46 using doxygen 1.7.1