#include <SBufFindTest.h>

Collaboration diagram for SBufFindTest:

Public Types

enum  Placement {
  placeBeginning ,
  placeMiddle ,
  placeEnd ,
  placeNowhere ,
  placeEof
}
 Supported algorithms for placing needle in the hay. More...
 

Public Member Functions

 SBufFindTest ()
 
void run ()
 generates and executes cases using configuration params More...
 

Public Attributes

int caseLimit
 approximate caseCount limit More...
 
int errorLimit
 
bool hushSimilar
 whether to report only one failed test case per "category" More...
 
SBuf::size_type maxHayLength
 approximate maximum generated hay string length More...
 

Protected Member Functions

void nextLen (SBuf::size_type &len, const SBuf::size_type max)
 
void placeNeedle (const SBuf &cleanHay)
 
void testAllMethods ()
 
void testFindDefs ()
 
void testFind ()
 
void testRFindDefs ()
 
void testRFind ()
 
void testFindCharDefs ()
 
void testFindChar ()
 
void testRFindCharDefs ()
 
void testRFindChar ()
 
void testFindFirstOf ()
 
std::string posKey () const
 
std::string placementKey () const
 
bool resultsMatch () const
 
void checkResults (const char *method)
 
void handleFailure (const char *method)
 

Static Protected Member Functions

static SBuf RandomSBuf (const int length)
 

Private Attributes

SBuf theSBufHay
 the string to be searched More...
 
SBuf theSBufNeedle
 the string to be found More...
 
SBuf::size_type thePos
 search position limit More...
 
Placement thePlacement
 where in the hay the needle is placed More...
 
std::string theStringHay
 theHay converted to std::string More...
 
std::string theStringNeedle
 theNeedle converted to std::string More...
 
std::string::size_type theBareNeedlePos
 needle pos w/o thePos restrictions; used for case categorization More...
 
std::string::size_type theFindString
 
SBuf::size_type theFindSBuf
 
std::string theReportFunc
 
std::string theReportNeedle
 
std::string theReportPos
 
char theReportQuote
 
int caseCount
 cases executed so far More...
 
int errorCount
 total number of failed test cases so far More...
 
int reportCount
 total number of test cases reported so far More...
 
std::set< std::string > failedCats
 reported failed categories More...
 

Detailed Description

Generates and executes a [configurable] large number of SBuf::*find() test cases using random strings. Reports detected failures.

Definition at line 19 of file SBufFindTest.h.

Member Enumeration Documentation

◆ Placement

Enumerator
placeBeginning 
placeMiddle 
placeEnd 
placeNowhere 
placeEof 

Definition at line 35 of file SBufFindTest.h.

Constructor & Destructor Documentation

◆ SBufFindTest()

SBufFindTest::SBufFindTest ( )

Member Function Documentation

◆ checkResults()

void SBufFindTest::checkResults ( const char *  method)
protected

◆ handleFailure()

void SBufFindTest::handleFailure ( const char *  method)
protected

◆ nextLen()

void SBufFindTest::nextLen ( SBuf::size_type len,
const SBuf::size_type  max 
)
protected

◆ placementKey()

std::string SBufFindTest::placementKey ( ) const
protected

◆ placeNeedle()

void SBufFindTest::placeNeedle ( const SBuf cleanHay)
protected

◆ posKey()

std::string SBufFindTest::posKey ( ) const
protected

◆ RandomSBuf()

static SBuf SBufFindTest::RandomSBuf ( const int  length)
staticprotected

◆ resultsMatch()

bool SBufFindTest::resultsMatch ( ) const
protected

◆ run()

void SBufFindTest::run ( )

Referenced by TestSBuf::testAutoFind().

◆ testAllMethods()

void SBufFindTest::testAllMethods ( )
protected

◆ testFind()

void SBufFindTest::testFind ( )
protected

◆ testFindChar()

void SBufFindTest::testFindChar ( )
protected

◆ testFindCharDefs()

void SBufFindTest::testFindCharDefs ( )
protected

◆ testFindDefs()

void SBufFindTest::testFindDefs ( )
protected

◆ testFindFirstOf()

void SBufFindTest::testFindFirstOf ( )
protected

◆ testRFind()

void SBufFindTest::testRFind ( )
protected

◆ testRFindChar()

void SBufFindTest::testRFindChar ( )
protected

◆ testRFindCharDefs()

void SBufFindTest::testRFindCharDefs ( )
protected

◆ testRFindDefs()

void SBufFindTest::testRFindDefs ( )
protected

Member Data Documentation

◆ caseCount

int SBufFindTest::caseCount
private

Definition at line 83 of file SBufFindTest.h.

◆ caseLimit

int SBufFindTest::caseLimit

Definition at line 27 of file SBufFindTest.h.

◆ errorCount

int SBufFindTest::errorCount
private

Definition at line 84 of file SBufFindTest.h.

◆ errorLimit

int SBufFindTest::errorLimit

errorCount limit

Definition at line 28 of file SBufFindTest.h.

◆ failedCats

std::set<std::string> SBufFindTest::failedCats
private

Definition at line 86 of file SBufFindTest.h.

◆ hushSimilar

bool SBufFindTest::hushSimilar

Definition at line 30 of file SBufFindTest.h.

◆ maxHayLength

SBuf::size_type SBufFindTest::maxHayLength

Definition at line 32 of file SBufFindTest.h.

◆ reportCount

int SBufFindTest::reportCount
private

Definition at line 85 of file SBufFindTest.h.

◆ theBareNeedlePos

std::string::size_type SBufFindTest::theBareNeedlePos
private

Definition at line 72 of file SBufFindTest.h.

◆ theFindSBuf

SBuf::size_type SBufFindTest::theFindSBuf
private

Definition at line 76 of file SBufFindTest.h.

◆ theFindString

std::string::size_type SBufFindTest::theFindString
private

Definition at line 75 of file SBufFindTest.h.

◆ thePlacement

Placement SBufFindTest::thePlacement
private

Definition at line 67 of file SBufFindTest.h.

◆ thePos

SBuf::size_type SBufFindTest::thePos
private

Definition at line 66 of file SBufFindTest.h.

◆ theReportFunc

std::string SBufFindTest::theReportFunc
private

Definition at line 77 of file SBufFindTest.h.

◆ theReportNeedle

std::string SBufFindTest::theReportNeedle
private

Definition at line 78 of file SBufFindTest.h.

◆ theReportPos

std::string SBufFindTest::theReportPos
private

Definition at line 79 of file SBufFindTest.h.

◆ theReportQuote

char SBufFindTest::theReportQuote
private

Definition at line 80 of file SBufFindTest.h.

◆ theSBufHay

SBuf SBufFindTest::theSBufHay
private

Definition at line 64 of file SBufFindTest.h.

◆ theSBufNeedle

SBuf SBufFindTest::theSBufNeedle
private

Definition at line 65 of file SBufFindTest.h.

◆ theStringHay

std::string SBufFindTest::theStringHay
private

Definition at line 68 of file SBufFindTest.h.

◆ theStringNeedle

std::string SBufFindTest::theStringNeedle
private

Definition at line 69 of file SBufFindTest.h.


The documentation for this class was generated from the following file:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors