45 using std::unique_ptr;
58 _Fmt instancePatt (
"obj_%s_%i");
65 return instancePatt % prefix % rand();
75 operator string ()
const {
return instanceID; }
76 bool operator== (
const Dummy& odu)
const {
return this == &odu; }
94 using lib::query::test::garbage_query;
109 unique_ptr<DefsRegistry> reg_;
123 Q13 q1, q2, q3, q4, q5;
124 map<QueryKey, Pra> ps;
128 : o1 (fabricate<13>())
129 , o2 (fabricate<13>())
130 , o3 (fabricate<13>())
131 , q1 (garbage_query (1))
132 , q2 (garbage_query (2))
133 , q3 (garbage_query (3))
134 , q4 (garbage_query (4))
135 , q5 (garbage_query (5))
157 CHECK ( ! *(reg_->candidates(Q13 (
"something"))) );
164 reg_->put (o1, Q13());
167 for (
int i=0; i<100; ++i)
169 Pra px (fabricate<23>());
170 Q23 qx (garbage_query());
174 px->instanceID =
QueryKey(qx).getQueryString();
183 Iter13 i (reg_->candidates(Q13 (
"irrelevant query")));
184 CHECK ( i.hasNext());
185 CHECK ( *i == o1); ++i;
186 CHECK ( *i == o2); ++i;
187 CHECK ( *i == o3); ++i;
188 CHECK ( *i == o2); ++i;
189 CHECK ( *i == o2); ++i;
191 CHECK (!i.hasNext());
194 i = reg_->candidates(q2);
195 CHECK ( *i == o3); ++i;
196 CHECK ( *i == o1); ++i;
197 CHECK ( *i == o2); ++i;
198 CHECK ( *i == o3); ++i;
199 CHECK ( *i == o2); ++i;
200 CHECK ( *i == o2); ++i;
201 CHECK ( *i == o1); ++i;
202 CHECK (!i.hasNext());
204 i = reg_->candidates(Q13());
205 CHECK ( *i == o1); ++i;
206 CHECK ( *i == o1); ++i;
207 CHECK ( *i == o2); ++i;
208 CHECK ( *i == o3); ++i;
209 CHECK ( *i == o2); ++i;
210 CHECK ( *i == o2); ++i;
211 CHECK ( *i == o1); ++i;
212 CHECK (!i.hasNext());
216 Iter23 j = reg_->candidates(Q23 (
"some crap"));
220 Q23 qx ((*j)->instanceID);
221 CHECK ( ps[qx] == (*j));
223 CHECK ( d_prev <= d );
226 CHECK (!j.hasNext());
230 Q23 someQuery(ps.begin()->first);
231 j = reg_->candidates(someQuery);
232 CHECK ( *j == ps.begin()->second);
242 Iter13 i (reg_->candidates(q4));
243 CHECK ( i.hasNext());
244 CHECK ( *i == o1); ++i;
246 CHECK ( *i == o3); ++i;
250 CHECK (!i.hasNext());
255 i = reg_->candidates(Q13 (
"something"));
256 CHECK ( i.hasNext());
257 CHECK ( *i == o1); ++i;
260 CHECK (!i.hasNext());
262 CHECK ( reg_->put (o1, q5));
264 i = reg_->candidates(q5);
265 CHECK ( *i == o1); ++i;
266 CHECK ( *i == o1); ++i;
267 CHECK ( *i == o1); ++i;
268 CHECK (!i.hasNext());
270 CHECK (!reg_->put (o2, q5));
272 i = reg_->candidates(q5);
273 CHECK ( *i == o1); ++i;
274 CHECK ( *i == o1); ++i;
275 CHECK ( *i == o1); ++i;
276 CHECK (!i.hasNext());
278 CHECK ( reg_->put (o2, q2));
279 i = reg_->candidates(q2);
280 CHECK ( *i == o2); ++i;
281 CHECK ( *i == o1); ++i;
282 CHECK ( *i == o2); ++i;
283 CHECK ( *i == o1); ++i;
284 CHECK (!i.hasNext());
286 CHECK ( reg_->forget (o1));
287 CHECK (!reg_->forget (o1));
288 CHECK ( reg_->forget (o2));
290 o3 = fabricate<13>();
292 i = reg_->candidates(q2);
used for enumerating solutions
template for generating some different test types
Basic and generic representation of an internal query.
string newID(string prefix)
create a random new ID
Customised refcounting smart pointer.
A front-end for using printf-style formatting.
A piece of implementation code factored out into a separate header (include).
Simple test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
diagnostic helpers to support test related to predicate queries
Wrapper for indexing and ordering.
Lumiera public interface.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Generic interface to express a query for specifically typed result elements exposing some capabilitie...