Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
query-text-test.cpp
Go to the documentation of this file.
1/*
2 QueryText(Test) - verify syntactical query representation
3
4 Copyright (C)
5 2012, 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
20#include "lib/test/run.hpp"
21#include "lib/query-util.hpp"
22#include "lib/query-text.hpp"
23#include "lib/util.hpp"
24
25#include <string>
26//#include <map>
27
28using util::contains;
29using util::isnil;
30using std::string;
31
32namespace lib {
33namespace test{
34
35 namespace { // test fixture...
36
37 } //(End) test fixture
38
39
40
41
42 /***************************************************************************/
49 class QueryText_test : public Test
50 {
51
52 virtual void run (Arg)
53 {
57 }
58
59
61 {
62 QueryText noText;
63
64 CHECK (isnil (noText));
65 CHECK (isnil (string(noText)));
66 }
67
68
70 {
71 QueryText eternal ("beats(lumiera, duke_nukem_forever).");
72 CHECK (contains (string(eternal), "lumiera"));
73 CHECK (contains (string(eternal), "beats"));
74 CHECK (contains (string(eternal), "duke_nukem_forever"));
75 CHECK (eternal.hasAtom ("lumiera"));
76 }
77
78
80 {
81 QueryText one("one");
82 QueryText two("two");
83
84 CHECK (0 < hash_value(one));
85 CHECK (0 < hash_value(two));
86 CHECK (hash_value(one) != hash_value(two));
87 }
88
89
90 };
91
92
93
95 LAUNCHER(QueryText_test, "unit common");
96
97}} // namespace lib::test
Syntactical query representation.
bool hasAtom(string const &predSymbol)
Implementation namespace for support and library code.
HashVal hash_value(QueryText const &entry)
support using queries in hashtables.
Test runner and basic definitions for tests.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition util.hpp:230
bool isnil(lib::time::Duration const &dur)
A generic syntactical representation for all kinds of queries.
Utilities to support working with predicate queries.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...