FreeNOS
Public Member Functions | Private Attributes
TestChar< T > Class Template Reference

Generate test data for character strings. More...

#include <TestChar.h>

Inheritance diagram for TestChar< T >:
TestData< T >

Public Member Functions

 TestChar (Size min, Size max)
 Constructor. More...
 
virtual ~TestChar ()
 Destructor. More...
 
virtual T random (Size count=1)
 Get random test value(s). More...
 
virtual T unique (Size count=1)
 Get unique random test value(s). More...
 
virtual Size length (Size position)
 Get the length of the generated character string. More...
 
char * random (Size count)
 Get random test value(s). More...
 
char * unique (Size count)
 Get unique random test value(s). More...
 
- Public Member Functions inherited from TestData< T >
 TestData ()
 Constructor. More...
 
virtual ~TestData ()
 Destructor. More...
 
void seed ()
 Initialize the random number generator. More...
 
Size count () const
 The number of generated values. More...
 
T & get (Size index)
 Retrieve previously random generated test data by index. More...
 
T & operator[] (Size index)
 Retrieve previously random generated test data by index. More...
 

Private Attributes

Size m_max
 Maximum value. More...
 
Size m_min
 Minimum value. More...
 
Vector< Sizem_lengths
 String lengths. More...
 

Additional Inherited Members

- Protected Attributes inherited from TestData< T >
Vector< T > m_values
 Vector with generated values. More...
 

Detailed Description

template<class T>
class TestChar< T >

Generate test data for character strings.

Definition at line 35 of file TestChar.h.

Constructor & Destructor Documentation

◆ TestChar()

template<class T >
TestChar< T >::TestChar ( Size  min,
Size  max 
)
inline

Constructor.

Parameters
minMinimum length of the character strings.
maxMaximum length of the character strings.

Definition at line 45 of file TestChar.h.

References TestChar< T >::m_max, and TestChar< T >::m_min.

◆ ~TestChar()

template<class T >
virtual TestChar< T >::~TestChar ( )
inlinevirtual

Destructor.

Definition at line 54 of file TestChar.h.

References TestData< T >::m_values.

Member Function Documentation

◆ length()

template<class T >
virtual Size TestChar< T >::length ( Size  position)
inlinevirtual

Get the length of the generated character string.

Definition at line 81 of file TestChar.h.

References TestChar< T >::m_lengths.

◆ random() [1/2]

char * TestChar< char * >::random ( Size  count)
virtual

Get random test value(s).

Parameters
countNumber or values to generate.
Returns
The last generated T value.

Implements TestData< T >.

Definition at line 98 of file TestChar.h.

References TestInt< T >::random(), and ZERO.

◆ random() [2/2]

template<class T >
virtual T TestChar< T >::random ( Size  count = 1)
virtual

Get random test value(s).

Parameters
countNumber or values to generate.
Returns
The last generated T value.

Implements TestData< T >.

◆ unique() [1/2]

char * TestChar< char * >::unique ( Size  count)
virtual

Get unique random test value(s).

Parameters
countNumber of unique values to generate.
Returns
The last generated T value.

Implements TestData< T >.

Definition at line 122 of file TestChar.h.

References MemoryBlock::copy(), and MemoryBlock::set().

◆ unique() [2/2]

template<class T >
virtual T TestChar< T >::unique ( Size  count = 1)
virtual

Get unique random test value(s).

Parameters
countNumber of unique values to generate.
Returns
The last generated T value.

Implements TestData< T >.

Field Documentation

◆ m_lengths

template<class T >
Vector<Size> TestChar< T >::m_lengths
private

String lengths.

Definition at line 95 of file TestChar.h.

Referenced by TestChar< T >::length().

◆ m_max

template<class T >
Size TestChar< T >::m_max
private

Maximum value.

Definition at line 89 of file TestChar.h.

Referenced by TestChar< T >::TestChar().

◆ m_min

template<class T >
Size TestChar< T >::m_min
private

Minimum value.

Definition at line 92 of file TestChar.h.

Referenced by TestChar< T >::TestChar().


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