Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
query-diagnostics.hpp
Go to the documentation of this file.
1/*
2 QUERY-DIAGNOSTICS.hpp - helpers for writing tests covering config queries
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
20#ifndef LIB_QUERY_DIAGNOSTICS_H
21#define LIB_QUERY_DIAGNOSTICS_H
22
23
24#include "lib/format-string.hpp"
25#include "lib/random.hpp"
26
27using util::_Fmt;
28using std::string;
29using std::rand;
30
31
32
33namespace lib {
34namespace query{
35namespace test {
36
37 namespace {// implementation constants
38
39 _Fmt predicatePattern{"%s_%02i( %s )"};
40 const string garbage {"asanisimasasmicksmaggtutti"};
41
43
44 }
45
46
47
48 inline string
50 {
51 return predicatePattern
52 % char ('a'+ rani(26))
53 % rani (100)
54 % garbage.substr (rani(23) , 3);
55 }
56
57 inline string
58 garbage_query (int degree=0)
59 {
60 string fake;
61 if (!degree)
62 degree = 1 + rani(MAX_DEGREE_RAND);
63 while (0 < --degree)
64 fake += garbage_term() + ", ";
65 fake += garbage_term() + ".";
66 return fake;
67 }
68
69
70
71
72}}} // namespace lib::query::test
73#endif
A front-end for using printf-style formatting.
Front-end for printf-style string template interpolation.
unsigned int uint
Definition integral.hpp:29
string garbage_query(int degree=0)
Implementation namespace for support and library code.
int rani(uint bound=_iBOUND())
Definition random.hpp:135
Test runner and basic definitions for tests.
Generating (pseudo) random numbers with controlled seed.