39 #include <boost/lexical_cast.hpp> 41 using boost::lexical_cast;
42 using lib::test::showSizeof;
47 using std::numeric_limits;
57 uint NUM_CLUSTERS = 5;
58 uint NUM_OBJECTS = 500;
59 uint NUM_FAMILIES = 5;
62 bool randomFailures =
false;
75 Dummy (
char i1,
char i2,
char i3=0)
77 char id = i1 + i2 + i3;
80 if (randomFailures && 0 == (rand() % 20))
86 checksum -= content[0];
89 char getID() {
return content[0]; }
93 typedef vector<PCluster> ClusterList;
98 return x % numeric_limits<char>::max();
110 Invoker* invoke[20] = { &place_object<1>
133 fillIt (PCluster& clu)
140 for (uint i=0; i<NUM_OBJECTS; ++i)
142 char id = truncChar(i);
143 (*(invoke[rand() % NUM_FAMILIES])) (*clu,id);
161 if (0 < arg.size()) NUM_CLUSTERS = lexical_cast<uint> (arg[0]);
162 if (1 < arg.size()) NUM_OBJECTS = lexical_cast<uint> (arg[1]);
163 if (2 < arg.size()) NUM_FAMILIES = lexical_cast<uint> (arg[2]);
167 checkErrorHandling();
176 char c1(123), c2(56), c3(3), c4(4), c5(5);
188 CHECK (123==ref2.getID());
189 CHECK (3+4+5==rX.getID());
195 CHECK (4 == clu.
size());
207 ClusterList clusters (NUM_CLUSTERS);
208 for_each (clusters, fillIt);
220 randomFailures =
true;
223 for (uint i=0; i<NUM_OBJECTS; ++i)
226 char i1 = truncChar(i);
227 char i2 = truncChar(rand() % 5);
235 randomFailures =
false;
size_t count() const
helper for diagnostics
Some wrappers for coping with ownership problems.
Memory management for the low-level model (render nodes network).
string showSizeof(size_t siz, string name)
for printing sizeof().
Implementation namespace for support and library code.
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Inline buffer holding and owning an object similar to unique_ptr.
void for_each(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
A collection of frequently used helper functions to support unit testing.
A Dummy object for tests.
A pile of objects sharing common allocation and lifecycle.
Perform operations "for each element" of a collection.