Private implementation class for TestReferenceChecker.
|
| Impl (bool bWrite) |
| Creates a checker that does nothing.
|
|
| Impl (const std::string &path, xmlNodePtr rootNode, bool bWrite, bool bSelfTestMode, const FloatingPointTolerance &defaultTolerance) |
| Creates a checker with a given root node.
|
|
std::string | traceString (const char *id) const |
| Returns a string for SCOPED_TRACE() for checking element id .
|
|
std::string | appendPath (const char *id) const |
| Returns the path of this checker with id appended.
|
|
xmlNodePtr | findNode (const xmlChar *name, const char *id) const |
| Finds a reference data node. More...
|
|
xmlNodePtr | findOrCreateNode (const xmlChar *name, const char *id, bool *bFound) |
| Finds/creates a reference data node to match against. More...
|
|
std::string | processItem (const xmlChar *name, const char *id, const char *value, bool *bFound) |
| Helper method for checking a reference data value. More...
|
|
std::string | processItem (const xmlChar *name, const char *id, const std::string &value, bool *bFound) |
| Convenience wrapper that takes a std::string.
|
|
bool | shouldIgnore () const |
| Whether the checker should ignore all validation calls. More...
|
|
|
static const xmlChar *const | cBooleanNodeName |
| String constant for naming XML elements for boolean values. More...
|
|
static const xmlChar *const | cStringNodeName |
| String constant for naming XML elements for string values. More...
|
|
static const xmlChar *const | cIntegerNodeName |
| String constant for naming XML elements for integer values. More...
|
|
static const xmlChar *const | cInt64NodeName |
| String constant for naming XML elements for int64 values. More...
|
|
static const xmlChar *const | cUInt64NodeName |
| String constant for naming XML elements for unsigned int64 values. More...
|
|
static const xmlChar *const | cRealNodeName |
| String constant for naming XML elements for floating-point values. More...
|
|
static const xmlChar *const | cIdAttrName |
| String constant for naming XML attribute for value identifiers. More...
|
|
static const char *const | cVectorType |
| String constant for naming compounds for vectors. More...
|
|
static const char *const | cSequenceType |
| String constant for naming compounds for sequences. More...
|
|
static const char *const | cSequenceLengthName |
| String constant for value identifier for sequence length. More...
|
|
xmlNodePtr gmx::test::TestReferenceChecker::Impl::findNode |
( |
const xmlChar * |
name, |
|
|
const char * |
id |
|
) |
| const |
Finds a reference data node.
- Parameters
-
[in] | name | Type of node to find (can be NULL, in which case any type is matched). |
[in] | id | Unique identifier of the node (can be NULL, in which case the next node without an id is matched). |
- Returns
- Matching node, or NULL if no matching node found.
Searches for a node in the reference data that matches the given name
and id
. Searching starts from the node that follows the previously matched node (relevant for performance, and if there are duplicate ids or nodes without ids). Note that the match pointer is not updated by this method.
xmlNodePtr gmx::test::TestReferenceChecker::Impl::findOrCreateNode |
( |
const xmlChar * |
name, |
|
|
const char * |
id, |
|
|
bool * |
bFound |
|
) |
| |
Finds/creates a reference data node to match against.
- Parameters
-
[in] | name | Type of node to find. |
[in] | id | Unique identifier of the node (can be NULL, in which case the next node without an id is matched). |
[out] | bFound | Whether the node was found (false if the node was created in write mode). |
- Returns
- Matching node, or NULL if no matching node found (NULL is never returned in write mode).
- Exceptions
-
Finds a node using findNode() and updates the match pointer is a match is found. If a match is not found, the method returns NULL in read mode and creates a new node in write mode. If the creation fails in write mode, throws.
std::string gmx::test::TestReferenceChecker::Impl::processItem |
( |
const xmlChar * |
name, |
|
|
const char * |
id, |
|
|
const char * |
value, |
|
|
bool * |
bFound |
|
) |
| |
Helper method for checking a reference data value.
- Parameters
-
[in] | name | Type of node to find. |
[in] | id | Unique identifier of the node (can be NULL, in which case the next node without an id is matched). |
[in] | value | String value of the value to be compared. |
[out] | bFound | true if a matchin value was found. |
- Returns
- String value for the reference value.
- Exceptions
-
Performs common tasks in checking a reference value: finding/creating the correct XML node and reading/writing its string value. Caller is responsible for converting the value to and from string where necessary and performing the actual comparison.
In read mode, if a value is not found, adds a Google Test failure and returns an empty string. If the reference value is found, returns it (value
is not used in this case).
In write mode, creates the node if it is not found, sets its value as value
and returns value
.
bool gmx::test::TestReferenceChecker::Impl::shouldIgnore |
( |
| ) |
const |
Whether the checker should ignore all validation calls.
This is used to ignore any calls within compounds for which reference data could not be found, such that only one error is issued for the missing compound, instead of every individual value.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cBooleanNodeName |
|
static |
Initial value:=
(const xmlChar *)"Bool"
String constant for naming XML elements for boolean values.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cIdAttrName |
|
static |
Initial value:=
(const xmlChar *)"Name"
String constant for naming XML attribute for value identifiers.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cInt64NodeName |
|
static |
Initial value:=
(const xmlChar *)"Int64"
String constant for naming XML elements for int64 values.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cIntegerNodeName |
|
static |
Initial value:
String constant for naming XML elements for integer values.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cRealNodeName |
|
static |
Initial value:=
(const xmlChar *)"Real"
String constant for naming XML elements for floating-point values.
const char *const gmx::test::TestReferenceChecker::Impl::cSequenceLengthName |
|
static |
Initial value:
String constant for value identifier for sequence length.
const char *const gmx::test::TestReferenceChecker::Impl::cSequenceType |
|
static |
Initial value:
String constant for naming compounds for sequences.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cStringNodeName |
|
static |
Initial value:=
(const xmlChar *)"String"
String constant for naming XML elements for string values.
const xmlChar *const gmx::test::TestReferenceChecker::Impl::cUInt64NodeName |
|
static |
Initial value:=
(const xmlChar *)"UInt64"
String constant for naming XML elements for unsigned int64 values.
xmlNodePtr gmx::test::TestReferenceChecker::Impl::currNode_ |
Current node under which reference data is searched.
Points to either the root of TestReferenceData::Impl::refDoc_, or to a compound node.
Can be NULL, in which case this checker does nothing (doesn't even report errors, see shouldIgnore()).
const char *const gmx::test::TestReferenceChecker::Impl::cVectorType |
|
static |
Initial value:
String constant for naming compounds for vectors.
std::string gmx::test::TestReferenceChecker::Impl::path_ |
Human-readable path to the root node of this checker.
For the root checker, this will be "/", and for each compound, the id of the compound is added. Used for reporting comparison mismatches.
xmlNodePtr gmx::test::TestReferenceChecker::Impl::prevFoundNode_ |
Points to a child of currNode_ that was last found.
On initialization, is initialized to NULL. After every check, is updated to point to the node that was used for the check. Subsequent checks start the search for the matching node on this node.
Is NULL if currNode_ contains no children or if no checks have yet been made. Otherwise, always points to a direct child of currNode_.
int gmx::test::TestReferenceChecker::Impl::seqIndex_ |
Current number of unnamed elements in a sequence.
It is the index of the next added unnamed element.
The documentation for this class was generated from the following file: