Gromacs
2025.0-dev-20241011-013a99c
|
Private implementation class for TestReferenceChecker.
Public Member Functions | |
Impl (bool initialized) | |
Creates a checker that does nothing. | |
Impl (const std::string &path, ReferenceDataEntry *compareRootEntry, ReferenceDataEntry *outputRootEntry, bool updateMismatchingEntries, bool bSelfTestMode, const FloatingPointTolerance &defaultTolerance) | |
Creates a checker with a given root entry. | |
std::string | appendPath (const char *id) const |
Returns the path of this checker with id appended. | |
ReferenceDataEntry * | findEntry (const char *id) |
Finds an entry by id and updates the last found entry pointer. | |
ReferenceDataEntry * | findOrCreateEntry (const char *type, const char *id, const IReferenceDataEntryChecker &checker) |
Finds/creates a reference data entry to match against. More... | |
::testing::AssertionResult | processItem (const char *name, const char *id, const IReferenceDataEntryChecker &checker) |
Helper method for checking a reference data value. More... | |
bool | initialized () const |
Whether the checker is initialized. | |
bool | shouldIgnore () const |
Whether the checker should ignore all validation calls. More... | |
Static Public Member Functions | |
static ReferenceDataEntry::EntryPointer | createEntry (const char *type, const char *id, const IReferenceDataEntryChecker &checker) |
Creates an entry with given parameters and fills it with checker . | |
::testing::AssertionResult | checkEntry (const ReferenceDataEntry &entry, const std::string &fullId, const char *type, const IReferenceDataEntryChecker &checker) |
Checks an entry for correct type and using checker . | |
Public Attributes | |
bool | initialized_ |
Whether initialized with other means than the default constructor. | |
FloatingPointTolerance | defaultTolerance_ |
Default floating-point comparison tolerance. | |
std::string | path_ |
Human-readable path to the root node of this checker. More... | |
ReferenceDataEntry * | compareRootEntry_ |
Current entry under which reference data is searched for comparison. More... | |
ReferenceDataEntry * | outputRootEntry_ |
Current entry under which entries for writing are created. More... | |
ReferenceDataEntry::ChildIterator | lastFoundEntry_ |
Iterator to a child of compareRootEntry_ that was last found. More... | |
bool | updateMismatchingEntries_ |
Whether the reference data is being written (true) or compared (false). | |
bool | bSelfTestMode_ |
true if self-testing (enables extra failure messages). | |
int | seqIndex_ |
Current number of unnamed elements in a sequence. More... | |
Static Public Attributes | |
static const char *const | cBooleanNodeName = "Bool" |
String constant for naming XML elements for boolean values. | |
static const char *const | cStringNodeName = "String" |
String constant for naming XML elements for string values. | |
static const char *const | cCharNodeName = "Char" |
String constant for naming XML elements for single char values. | |
static const char *const | cUCharNodeName = "UChar" |
String constant for naming XML elements for unsigned char values. | |
static const char *const | cIntegerNodeName = "Int" |
String constant for naming XML elements for integer values. | |
static const char *const | cInt32NodeName = "Int32" |
String constant for naming XML elements for int32 values. | |
static const char *const | cUInt32NodeName = "UInt32" |
String constant for naming XML elements for unsigned int32 values. | |
static const char *const | cInt64NodeName = "Int64" |
String constant for naming XML elements for int32 values. | |
static const char *const | cUInt64NodeName = "UInt64" |
String constant for naming XML elements for unsigned int64 values. | |
static const char *const | cRealNodeName = "Real" |
String constant for naming XML elements for floating-point values. | |
static const char *const | cIdAttrName = "Name" |
String constant for naming XML attribute for value identifiers. | |
static const char *const | cVectorType = "Vector" |
String constant for naming compounds for vectors. | |
static const char *const | cObjectType = "Object" |
String constant for naming compounds for key-value tree objects. | |
static const char *const | cSequenceType = "Sequence" |
String constant for naming compounds for sequences. | |
static const char *const | cSequenceLengthName = "Length" |
String constant for value identifier for sequence length. | |
ReferenceDataEntry * gmx::test::TestReferenceChecker::Impl::findOrCreateEntry | ( | const char * | type, |
const char * | id, | ||
const IReferenceDataEntryChecker & | checker | ||
) |
Finds/creates a reference data entry to match against.
[in] | type | Type of entry to create. |
[in] | id | Unique identifier of the entry (can be NULL, in which case the next entry without an id is matched). |
[out] | checker | Checker to use for filling out created entries. |
testing::AssertionResult gmx::test::TestReferenceChecker::Impl::processItem | ( | const char * | name, |
const char * | id, | ||
const IReferenceDataEntryChecker & | checker | ||
) |
Helper method for checking a reference data value.
[in] | name | Type of entry to find. |
[in] | id | Unique identifier of the entry (can be NULL, in which case the next entry without an id is matched). |
[in] | checker | Checker that provides logic specific to the type of the entry. |
TestException | if there is a problem parsing the reference data. |
Performs common tasks in checking a reference value, such as finding or creating the correct entry. Caller needs to provide a checker object that provides the string value for a newly created entry and performs the actual comparison against a found entry.
|
inline |
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.
ReferenceDataEntry* gmx::test::TestReferenceChecker::Impl::compareRootEntry_ |
Current entry under which reference data is searched for comparison.
Points to either the TestReferenceDataImpl::compareRootEntry_, or to a compound entry in the tree rooted at that entry.
Can be NULL, in which case this checker does nothing (doesn't even report errors, see shouldIgnore()).
ReferenceDataEntry::ChildIterator gmx::test::TestReferenceChecker::Impl::lastFoundEntry_ |
Iterator to a child of compareRootEntry_ that was last found.
If compareRootEntry_->isValidChild()
returns false, no entry has been found yet. After every check, is updated to point to the entry that was used for the check. Subsequent checks start the search for the matching node on this node.
ReferenceDataEntry* gmx::test::TestReferenceChecker::Impl::outputRootEntry_ |
Current entry under which entries for writing are created.
Points to either the TestReferenceDataImpl::outputRootEntry_, or to a compound entry in the tree rooted at that entry. NULL if only comparing, or if shouldIgnore() returns false
.
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.
int gmx::test::TestReferenceChecker::Impl::seqIndex_ |
Current number of unnamed elements in a sequence.
It is the index of the current unnamed element.