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
28
using
util::contains
;
29
using
util::isnil
;
30
using
std::string;
31
32
namespace
lib
{
33
namespace
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
{
54
emptyRepresentation
();
55
build_from_string
();
56
useHashValue
();
57
}
58
59
60
void
emptyRepresentation
()
61
{
62
QueryText
noText;
63
64
CHECK (isnil (noText));
65
CHECK (isnil (
string
(noText)));
66
}
67
68
69
void
build_from_string
()
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
79
void
useHashValue
()
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
lib::QueryText
Syntactical query representation.
Definition
query-text.hpp:62
lib::QueryText::hasAtom
bool hasAtom(string const &predSymbol)
Definition
query-text.hpp:89
lib::test::QueryText_test
Definition
query-text-test.cpp:50
lib::test::QueryText_test::run
virtual void run(Arg)
Definition
query-text-test.cpp:52
lib::test::QueryText_test::emptyRepresentation
void emptyRepresentation()
Definition
query-text-test.cpp:60
lib::test::QueryText_test::useHashValue
void useHashValue()
Definition
query-text-test.cpp:79
lib::test::QueryText_test::build_from_string
void build_from_string()
Definition
query-text-test.cpp:69
lib
Implementation namespace for support and library code.
Definition
common-services.cpp:55
lib::hash_value
HashVal hash_value(QueryText const &entry)
support using queries in hashtables.
Definition
query-text.cpp:52
test
Test runner and basic definitions for tests.
util::contains
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition
util.hpp:230
util::isnil
bool isnil(lib::time::Duration const &dur)
Definition
timevalue.hpp:860
query-text.hpp
A generic syntactical representation for all kinds of queries.
query-util.hpp
Utilities to support working with predicate queries.
run.hpp
Simplistic test class runner.
LAUNCHER
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition
run.hpp:116
util.hpp
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
library
query-text-test.cpp
Generated on Thu Dec 11 2025 for Lumiera by
1.9.8