|
Utility
|
#include <Checker.hh>
Public Member Functions | |
| bool | check (bool passed) |
| Updates the check accounting. | |
| template<typename OBJECT > | |
| bool | check (const std::string &description, OBJECT &expected, OBJECT &obtained) |
| Checks two objects. | |
| bool | check (const std::string &description, long double expected, long double obtained) |
| Checks two long double values. | |
| bool | check (const std::string &description, double expected, double obtained) |
| Checks two double values. | |
| bool | check (const std::string &description, unsigned long long expected, unsigned long long obtained) |
| Checks two unsigned long long values. | |
| bool | check (const std::string &description, long long expected, long long obtained) |
| Checks two long long values. | |
| bool | check (const std::string &description, unsigned long expected, unsigned long obtained) |
| Checks two unsigned long values. | |
| bool | check (const std::string &description, long expected, long obtained) |
| Checks two long values. | |
| bool | check (const std::string &description, unsigned int expected, unsigned int obtained) |
| Checks two unsigned int values. | |
| bool | check (const std::string &description, int expected, int obtained) |
| Checks two int values. | |
| bool | check (const std::string &description, unsigned short expected, unsigned short obtained) |
| Checks two short unsigned short. | |
| bool | check (const std::string &description, short expected, short obtained) |
| Checks two short values. | |
| bool | check (const std::string &description, bool expected, bool obtained) |
| Checks two bool values. | |
| bool | check (const std::string &description, void *expected, void *obtained) |
| Checks two addresses. | |
| bool | check (const std::string &description, std::string &expected, std::string &obtained) |
| Checks two string objects. | |
| bool | check (const std::string &description, std::ostringstream &expected, std::ostringstream &obtained) |
| Checks the contents of two ostringstream objects. | |
| Checker () | |
Public Attributes | |
| int | Checks_Passed |
| Total number of Checks where expected matched obtained. | |
| int | Checks_Total |
| Total number of Checks performed. | |
| bool | Reset_Values |
| Set to true to reset (clear) the expected and obtained values when possible. | |
| bool | Verbose |
| Set to true to always show both the expected and obtained values. | |
Static Public Attributes | |
| static const char *const | ID |
| Class identification name with source code version and date. | |
Each check function compares (==) the expected against the obtained.
A message line is printed to cout of the form:
PASS|FAIL: <description<
where "PASS" is used if the comparison is true, "FAIL" otherwise.
If the comparison fails, or verbose is true, the expected and obtained values are printed on the following lines:
====> expected|obtained [<length<:<NL>]: <expected<|<obtained<
For strings, and the strings contained in ostringstreams, their length is listed and they are started on a new line.
N.B.: The contents of string and ostringstream arguments are cleared after use if Reset_Values is true (the default).
Each function returns the result of the comparison.
| Checker | ( | ) |
| bool check | ( | const std::string & | description, | |
| std::ostringstream & | expected, | |||
| std::ostringstream & | obtained | |||
| ) |
Checks the contents of two ostringstream objects.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
Referenced by Checker::check().
| bool check | ( | const std::string & | description, | |
| std::string & | expected, | |||
| std::string & | obtained | |||
| ) |
Checks two string objects.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| void * | expected, | |||
| void * | obtained | |||
| ) |
Checks two addresses.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| bool | expected, | |||
| bool | obtained | |||
| ) |
Checks two bool values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| short | expected, | |||
| short | obtained | |||
| ) |
Checks two short values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| unsigned short | expected, | |||
| unsigned short | obtained | |||
| ) |
Checks two short unsigned short.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| int | expected, | |||
| int | obtained | |||
| ) |
Checks two int values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| unsigned int | expected, | |||
| unsigned int | obtained | |||
| ) |
Checks two unsigned int values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| long | expected, | |||
| long | obtained | |||
| ) |
Checks two long values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| unsigned long | expected, | |||
| unsigned long | obtained | |||
| ) |
Checks two unsigned long values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| long long | expected, | |||
| long long | obtained | |||
| ) |
Checks two long long values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| unsigned long long | expected, | |||
| unsigned long long | obtained | |||
| ) |
Checks two unsigned long long values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| double | expected, | |||
| double | obtained | |||
| ) |
Checks two double values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| long double | expected, | |||
| long double | obtained | |||
| ) |
Checks two long double values.
| description | A brief description of what is being checked. | |
| expected | The expected result. | |
| obtained | The obtained result. |
| bool check | ( | const std::string & | description, | |
| OBJECT & | expected, | |||
| OBJECT & | obtained | |||
| ) | [inline] |
Checks two objects.
The objects being checked must provide operator== and operator<< methods. The results of operator== will determine if the check passes (true) or fails (false). If the test fails or Verbose is true operator<< will be used to list each OBJECT to cout (stdout).
| description | A brief description of what is being checked. | |
| expected | The expected OBJECT. | |
| obtained | The obtained OBJECT. |
References Checker::check(), and Checker::Verbose.
| bool check | ( | bool | passed | ) |
Updates the check accounting.
The Checks_Total accumulator is incremented. The Checks_Passed accumulator is incremented if passed is true.
| passed | true if the external test passed; false otherwise. |
The Checks_Total accumulator is incremented. The Checks_Passed accumulator is incremented if passed is true.
| passed | true if the external test passed; false otherwise. |
const char *const ID [static] |
Initial value:
"idaeim::Checker (1.14 2009/03/23 18:22:47)"
| int Checks_Total |
Total number of Checks performed.
| int Checks_Passed |
Total number of Checks where expected matched obtained.
| bool Verbose |
| bool Reset_Values |
Set to true to reset (clear) the expected and obtained values when possible.
1.5.8