62 for (uint i=0; i<siz; ++i)
63 checksum_ += (crap_[i] = rand() % 128);
69 for (uint i=0; i<siz; ++i)
70 checksum_ += (crap_[i] = o.crap_[i]);
75 for (uint i=0; i<siz; ++i)
76 checksum_ -= crap_[i];
104 CHECK (0 == checksum_);
106 TestAllocator allocator;
109 typedef DummyObj<1> * PD1;
110 typedef DummyObj<23> * PD23;
111 CHECK (
sizeof(DummyObj<1>) !=
sizeof(DummyObj<23>));
113 PD1 pD11 = allocator.create<DummyObj<1>>();
114 PD1 pD12 = allocator.create<DummyObj<1>>();
115 PD23 pD21 = allocator.create<DummyObj<23>>();
116 PD23 pD22 = allocator.create<DummyObj<23>>();
117 PS pS11 = allocator.create<
string> (
"Lumiera");
118 PS pS12 = allocator.create<
string> (
"the paradox");
126 CHECK (!isSameObject (*pD11, *pD12));
127 CHECK (!isSameObject (*pD11, *pD21));
128 CHECK (!isSameObject (*pD11, *pD22));
129 CHECK (!isSameObject (*pD11, *pS11));
130 CHECK (!isSameObject (*pD11, *pS12));
131 CHECK (!isSameObject (*pD12, *pD21));
132 CHECK (!isSameObject (*pD12, *pD22));
133 CHECK (!isSameObject (*pD12, *pS11));
134 CHECK (!isSameObject (*pD12, *pS12));
135 CHECK (!isSameObject (*pD21, *pD22));
136 CHECK (!isSameObject (*pD21, *pS11));
137 CHECK (!isSameObject (*pD21, *pS12));
138 CHECK (!isSameObject (*pD22, *pS11));
139 CHECK (!isSameObject (*pD22, *pS12));
140 CHECK (!isSameObject (*pS11, *pS12));
142 CHECK (*pS11 ==
"Lumiera");
143 CHECK (*pS12 ==
"the paradox");
145 PD23 pDxx = allocator.create<DummyObj<23>> (*pD21);
146 PS pSxx = allocator.create<
string> (*pS12);
148 CHECK (*pS12 == *pSxx);
149 CHECK (!isSameObject (*pS12, *pSxx));
151 allocator.destroy (pD11);
152 allocator.destroy (pD12);
153 allocator.destroy (pD21);
154 allocator.destroy (pD22);
155 allocator.destroy (pS11);
156 allocator.destroy (pS12);
157 allocator.destroy (pDxx);
158 allocator.destroy (pSxx);
160 CHECK (0 == allocator.numSlots<DummyObj<1>>());
161 CHECK (0 == allocator.numSlots<DummyObj<23>>());
162 CHECK (0 == allocator.numSlots<
string>());
163 CHECK (0 == checksum_);
Implementation namespace for support and library code.
Frontend and marker interface for allocating small objects explicitly.
Yet-another ctor/dtor-tracking test dummy object....
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Frontend for explicit allocations, using a custom allocator.
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.