#include <SparseSetTest.h>
Public Member Functions | |
int | Test (const char *psLogFile, size_t nLoops) |
Executes all operations of psLogFile nLoops times. |
TSet
is the concrete BitSet implementation to test and TIterator
its iterator (you usually don't need to overwrite its default value). To run the tests only a call to Test() is needed.
Example:
SparseSetTest< sps::BitList > spstest; spstest.Test("logfile.txt", 3); // this will run the tests of logfile.txt 3 times
int sps::SparseSetTest< TSet, TIterator >::Test | ( | const char * | psLogFile, | |
size_t | nLoops | |||
) | [inline] |
Executes all operations of psLogFile
nLoops
times.
Each line of psLogFile
must match the Line
production (see below). The Id
at the beginning of each line identifies the object. Commands of an object are only allowed if the Id
of the object is valid. An Id
starts to be valid on a constructor call ('SparseSet
()' and 'Iterator
()') and ends to be valid on a destructor call ('~SparseSet
()' and '~Iterator
()'). An Id
constructed with the 'SparseSet
()' constructor is only valid for SPSCommands
and an Id
constructed with the 'Iterator
()' constructor only for ItCommands
.
An 'Iterator
()' constructor must directly follow each 'GetIterator
()' command. This iterator is the result of the 'GetIterator
()' call. Each command represents a call to the equal-named method in one of the SparseSet implementations or their Iterator implementation, respectivly. The iterator 'End
()' command represents sps::Iterator::HasMoreElements() and 'Dereference
()' sps::Iterator::operator*().
Line := Id ':' Command Id := [0-9a-fA-F]+ Command := SPSCommand | ItCommand SPSCommand := 'SparseSet::' ( SPSNoArgCmd | SPSValueCmd | SPSIdCmd ) SPSNoArgCmd := ( 'SparseSet()' | '~SparseSet()' | 'GetIterator()' | 'IsEmpty()' ) SPSValueCmd := ( 'Add(' | 'Contains(' | 'Remove(' ) Value ')' Value := [0-9]+ SPSIdCmd := ( 'Union(' | 'Intersect(' | 'Difference(' | 'Copy(' | 'IsEqual(' ) Id ')' ItCommand := 'Iterator::' ( 'Iterator()' | '~Iterator()' | 'Begin()' | 'Next()' | 'End()' | 'Dereference()' )