63 verifyPatternSyntax();
64 verifyPatternNormalisation();
66 verifyPreparedMatch();
74 #define _PARSE_AND_SHOW(_STR_) \ 75 cout << _STR_ << "\t--->" << Binding(_STR_) << endl; 78 _PARSE_AND_SHOW (
"aSymbol");
79 _PARSE_AND_SHOW (
"a.compound_Symbol-with-various.parts");
80 _PARSE_AND_SHOW (
"trailing Garbage allowed. ☢☢ eat ☠☠☠ atomic ☠☠☠ waste ☢☢");
81 _PARSE_AND_SHOW (
"a, list , of ,symbols.");
82 _PARSE_AND_SHOW (
"nullary().");
83 _PARSE_AND_SHOW (
"nullary( )");
84 _PARSE_AND_SHOW (
"nullary .");
85 _PARSE_AND_SHOW (
"predicate( with-argument )");
92 testBinding.addTypeGuard<DummyAdvice>();
95 cout << testBinding << endl;
100 verifyPatternNormalisation()
103 Binding b1 (
"cat1(), cat2().");
104 Binding b2 (
" cat2 cat1 ....");
106 cout <<
"b0==" << b0 << endl;
107 cout <<
"b1==" << b1 << endl;
108 cout <<
"b2==" << b2 << endl;
111 CHECK (b0 == b00); CHECK (b00 == b0);
112 CHECK (b1 == b2); CHECK (b2 == b1);
114 CHECK (b0 != b1); CHECK (b1 != b0);
115 CHECK (b0 != b2); CHECK (b2 != b0);
123 b1.addTypeGuard<
Time>();
127 b2.addTypeGuard<
Time>();
130 cout <<
"b2==" << b2 << endl;
144 CHECK ( matches (
Binding(
"pred(x), pred(y)"),
Binding(
"pred(y), pred(x)")));
145 CHECK (!matches (
Binding(
"pred(x), pred(y)"),
Binding(
"pred(y), pred(y)")));
150 verifyPreparedMatch()
155 Binding b4 (
"pred( x ) , pred().");
156 CHECK ( matches (b1,b2));
157 CHECK ( matches (b3,b4));
164 CHECK (hash_value(b1) == hash_value(bm1));
165 CHECK (hash_value(b2) == hash_value(bm2));
166 CHECK (hash_value(b3) == hash_value(bm3));
167 CHECK (hash_value(b4) == hash_value(bm4));
169 CHECK (hash_value(b1) != hash_value(b3));
171 CHECK ( matches (bm1,bm2));
172 CHECK ( matches (bm3,bm4));
173 CHECK (!matches (bm1,bm3));
174 CHECK (!matches (bm2,bm4));
188 CHECK ( matches (Binding("pred(u)"), Binding("pred(X)"))); 190 CHECK ( matches (
Binding(
"pred(f(u,Y))"),
Binding(
"pred(f(X,v))")));
191 CHECK ( matches (
Binding(
"pred(f(u,X))"),
Binding(
"pred(f(X,v))")));
196 CHECK (!matches (
Binding(
"pred(f(u,v))"),
Binding(
"pred(f(X,X))")));
Conjunction of predicates to be matched against a collaboration partner for establishing an Advice co...
Functor object for matching against another Binding.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Lumiera's internal time value datatype.
Expecting Advice and giving Advice: a cross-cutting collaboration of loosely coupled participants...
Simplistic test class runner.
A collection of frequently used helper functions to support unit testing.
void addPredicate(Literal spec)
extend the definition of this binding by adding a predicate according to the given textual definition...
Lumiera public interface.
a family of time value like entities and their relationships.
void verifyDynamicMatch()