72 verifyPatternSyntax();
73 verifyPatternNormalisation();
75 verifyPreparedMatch();
83 #define _PARSE_AND_SHOW(_STR_) \ 84 cout << _STR_ << "\t--->" << Binding(_STR_) << endl; 87 _PARSE_AND_SHOW (
"aSymbol");
88 _PARSE_AND_SHOW (
"a.compound_Symbol-with-various.parts");
89 _PARSE_AND_SHOW (
"trailing Garbage allowed. ☢☢ eat ☠☠☠ atomic ☠☠☠ waste ☢☢");
90 _PARSE_AND_SHOW (
"a, list , of ,symbols.");
91 _PARSE_AND_SHOW (
"nullary().");
92 _PARSE_AND_SHOW (
"nullary( )");
93 _PARSE_AND_SHOW (
"nullary .");
94 _PARSE_AND_SHOW (
"predicate( with-argument )");
101 testBinding.addTypeGuard<DummyAdvice>();
104 cout << testBinding << endl;
109 verifyPatternNormalisation()
112 Binding b1 (
"cat1(), cat2().");
113 Binding b2 (
" cat2 cat1 ....");
115 cout <<
"b0==" << b0 << endl;
116 cout <<
"b1==" << b1 << endl;
117 cout <<
"b2==" << b2 << endl;
120 CHECK (b0 == b00); CHECK (b00 == b0);
121 CHECK (b1 == b2); CHECK (b2 == b1);
123 CHECK (b0 != b1); CHECK (b1 != b0);
124 CHECK (b0 != b2); CHECK (b2 != b0);
132 b1.addTypeGuard<
Time>();
136 b2.addTypeGuard<
Time>();
139 cout <<
"b2==" << b2 << endl;
153 CHECK ( matches (
Binding(
"pred(x), pred(y)"),
Binding(
"pred(y), pred(x)")));
154 CHECK (!matches (
Binding(
"pred(x), pred(y)"),
Binding(
"pred(y), pred(y)")));
159 verifyPreparedMatch()
164 Binding b4 (
"pred( x ) , pred().");
165 CHECK ( matches (b1,b2));
166 CHECK ( matches (b3,b4));
173 CHECK (hash_value(b1) == hash_value(bm1));
174 CHECK (hash_value(b2) == hash_value(bm2));
175 CHECK (hash_value(b3) == hash_value(bm3));
176 CHECK (hash_value(b4) == hash_value(bm4));
178 CHECK (hash_value(b1) != hash_value(b3));
180 CHECK ( matches (bm1,bm2));
181 CHECK ( matches (bm3,bm4));
182 CHECK (!matches (bm1,bm3));
183 CHECK (!matches (bm2,bm4));
197 CHECK ( matches (Binding("pred(u)"), Binding("pred(X)"))); 199 CHECK ( matches (
Binding(
"pred(f(u,Y))"),
Binding(
"pred(f(X,v))")));
200 CHECK ( matches (
Binding(
"pred(f(u,X))"),
Binding(
"pred(f(X,v))")));
205 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...
Simple 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()