Go to the documentation of this file.
18 #ifndef __LIBTEST_TESTCHAR_H
19 #define __LIBTEST_TESTCHAR_H
109 value =
new char[len + 1];
110 for (
Size i = 0; i < len; i++)
111 value[i] = (
char) chars.
random();
116 m_values.insert(value);
117 m_lengths.insert(len);
124 const Size charMin = 32, charMax = 126;
126 char value[m_max + 1];
132 for (
Size i = 0; i < count; i++)
134 const Size len = (i + 1) < m_max ? (i + 1) : m_max;
135 char *buf =
new char[
sizeof(value)];
138 const Size numToAdd = i < m_min ? m_min : 1;
140 for (
Size j = 0; j < numToAdd; j++)
142 const char c = (char) ((i / (
sizeof(value) - 1)) + charMin);
143 value[i % (
sizeof(value) - 1)] = c;
148 m_values.insert(buf);
149 m_lengths.insert(len);
virtual T unique(Size count=1)
Get unique random test value(s).
static Size copy(void *dest, const void *src, Size count)
Copy memory from one place to another.
virtual T random(Size count=1)
Get random test value(s).
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
virtual T random(Size count=1)
Get random test value(s).
Generate test data for a certain data type.
virtual ~TestChar()
Destructor.
virtual Size length(Size position)
Get the length of the generated character string.
Size count() const
The number of generated values.
Vector< T > m_values
Vector with generated values.
unsigned int Size
Any sane size indicator cannot go negative.
TestChar(Size min, Size max)
Constructor.
Generate test data for integers.
Vector< Size > m_lengths
String lengths.
Generate test data for character strings.