50 for (uint i=0; i<siz; ++i)
51 checksum_ += (crap_[i] =
rani(128));
57 for (uint i=0; i<siz; ++i)
58 checksum_ += (crap_[i] = o.crap_[i]);
63 for (uint i=0; i<siz; ++i)
64 checksum_ -= crap_[i];
92 CHECK (0 == checksum_);
95 TestAllocator allocator;
98 typedef DummyObj<1> * PD1;
99 typedef DummyObj<23> * PD23;
100 CHECK (
sizeof(DummyObj<1>) !=
sizeof(DummyObj<23>));
102 PD1 pD11 = allocator.create<DummyObj<1>>();
103 PD1 pD12 = allocator.create<DummyObj<1>>();
104 PD23 pD21 = allocator.create<DummyObj<23>>();
105 PD23 pD22 = allocator.create<DummyObj<23>>();
106 PS pS11 = allocator.create<
string> (
"Lumiera");
107 PS pS12 = allocator.create<
string> (
"the paradox");
115 CHECK (!isSameObject (*pD11, *pD12));
116 CHECK (!isSameObject (*pD11, *pD21));
117 CHECK (!isSameObject (*pD11, *pD22));
118 CHECK (!isSameObject (*pD11, *pS11));
119 CHECK (!isSameObject (*pD11, *pS12));
120 CHECK (!isSameObject (*pD12, *pD21));
121 CHECK (!isSameObject (*pD12, *pD22));
122 CHECK (!isSameObject (*pD12, *pS11));
123 CHECK (!isSameObject (*pD12, *pS12));
124 CHECK (!isSameObject (*pD21, *pD22));
125 CHECK (!isSameObject (*pD21, *pS11));
126 CHECK (!isSameObject (*pD21, *pS12));
127 CHECK (!isSameObject (*pD22, *pS11));
128 CHECK (!isSameObject (*pD22, *pS12));
129 CHECK (!isSameObject (*pS11, *pS12));
131 CHECK (*pS11 ==
"Lumiera");
132 CHECK (*pS12 ==
"the paradox");
134 PD23 pDxx = allocator.create<DummyObj<23>> (*pD21);
135 PS pSxx = allocator.create<
string> (*pS12);
137 CHECK (*pS12 == *pSxx);
138 CHECK (!isSameObject (*pS12, *pSxx));
140 allocator.destroy (pD11);
141 allocator.destroy (pD12);
142 allocator.destroy (pD21);
143 allocator.destroy (pD22);
144 allocator.destroy (pS11);
145 allocator.destroy (pS12);
146 allocator.destroy (pDxx);
147 allocator.destroy (pSxx);
149 CHECK (0 == allocator.numSlots<DummyObj<1>>());
150 CHECK (0 == allocator.numSlots<DummyObj<23>>());
151 CHECK (0 == allocator.numSlots<
string>());
152 CHECK (0 == checksum_);
int rani(uint bound=_iBOUND())
Implementation namespace for support and library code.
Frontend and marker interface for allocating small objects explicitly.
Yet-another ctor/dtor-tracking test dummy object....
Simplistic 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, based directly on the referee's memory identities. ...