27 #ifndef GTESTSUITE_HPP
28 #define GTESTSUITE_HPP
69 virtual std::string
classname(
void)
const = 0;
70 virtual void set(
void) = 0;
77 const std::string&
name(
void)
const;
78 void name(
const std::string& name);
79 void cout(
const bool& flag);
81 const std::string& name,
82 const std::string& message =
"");
85 const std::string& name =
"",
86 const std::string& message =
"");
88 const double& expected,
89 const std::string& name =
"",
90 const std::string& message =
"");
92 const double& expected,
94 const std::string& name =
"",
95 const std::string& message =
"");
96 void test_value(
const std::complex<double>& value,
97 const std::complex<double>& expected,
98 const std::string& name =
"",
99 const std::string& message =
"");
100 void test_value(
const std::complex<double>& value,
101 const std::complex<double>& expected,
103 const std::string& name =
"",
104 const std::string& message =
"");
106 const std::string& expected,
107 const std::string& name =
"",
108 const std::string& message =
"");
109 void test_try(
const std::string& name);
112 const std::string& type =
"");
116 const int&
errors(
void)
const;
std::string print(const GChatter &chatter=NORMAL) const
Print test suite information.
void append(pfunction function, const std::string &name)
Append test functions to test suite.
void test_assert(const bool &result, const std::string &name, const std::string &message="")
Test an assert.
const int & errors(void) const
Return the number of errors.
int success(void) const
Return the number of successful tests.
int m_index
Index of actual test function.
void cout(const bool &flag)
Enables/disables logging into standard output stream.
double duration(void) const
Return the total duration of all tests.
void init_members(void)
Initialise class members.
void test_value(const int &value, const int &expected, const std::string &name="", const std::string &message="")
Test an integer value.
void cout(const bool &flag)
Set standard output stream (cout) flag.
virtual ~GTestSuite(void)
Destructor.
GException::test_error & exception_error(const std::string &message)
Return an error exception.
Information logger interface definition.
Test case class interface definition.
void test_try(const std::string &name)
Test an try block.
void test_try_success(void)
Notice when a try block succeeded.
std::vector< pfunction > m_functions
Test functions of this suite.
void free_members(void)
Delete class members.
int m_errors
Number of errors.
GTestSuite & operator=(const GTestSuite &testsuite)
Assignment operator.
std::string format_name(const std::string &name)
Format Name.
GTestCase & operator[](const int &index)
Returns reference to test case.
Interface class for all GammaLib classes.
virtual std::string classname(void) const =0
Return class name.
void copy_members(const GTestSuite &testsuite)
Copy class members.
std::vector< std::string > m_names
Names of test functions.
bool run(void)
Run all tests in test suite.
Abstract test suite class for unit testing on GammaLib fixtures.
time_t m_timestamp
Timestamp.
const std::string & name(void) const
Return test suite name.
int size(void) const
Return number of tests in test suite.
GException::test_failure & exception_failure(const std::string &message)
Return a failure exception.
int m_failures
Number of failures.
const time_t & timestamp(void) const
Return the timestamp.
void(GTestSuite::* pfunction)(void)
Information logger class definition.
GTestSuite(void)
Void constructor.
Definition of GammaLib typemaps.
const int & failures(void) const
Return the number of failures.
std::string m_name
Name of the test suite.
std::vector< GTestCase * > m_stack_try
Stack for nested try blocks.
Exception handler interface definition.
void clear(void)
Clear test suite.
std::vector< GTestCase * > m_tests
List of test results.
virtual GTestSuite * clone(void) const =0
Clones object.
void test_try_failure(const std::string &message="", const std::string &type="")
Notice when a try block failed.