47 virtual string moo() =0;
48 virtual string meh() =0;
70 string woof() {
return "Woof-Woof!"; }
71 string honk() {
return "Honk-Honk!"; }
72 string moo() {
return "Moo-Moo!"; }
73 string meh() {
return "Meh!"; }
89 string resultExpression (fmt_ % verb_ % nextToken);
91 return resultExpression;
95 string woof() {
return buildResultTerm (VERB_woof); }
96 string honk() {
return buildResultTerm (VERB_honk); }
97 string moo() {
return buildResultTerm (VERB_moo); }
98 string meh() {
return buildResultTerm (VERB_meh); }
104 , fmt_(
"%s followed by %s")
158 VerboseRenderer receiver;
159 for (Verb verb : tokens)
160 cout <<
"consuming " << verb
162 << verb.applyTo(receiver)
173 RecollectingReceiver receiver;
174 string previous = BEGINNING;
175 for (Verb verb : tokens)
177 CHECK (previous+
" followed by "+
string(verb) == verb.applyTo(receiver));
178 previous = string(verb);
VerbSeq build_test_feed()
prepare a sequence of verbs for the actual tests to work on
void render_verbose(VerbSeq tokens)
void verify_dispatch(VerbSeq tokens)
the "visitor" interface to invoke
virtual ~Receiver()
this is an interface
Statefull receiver of verb-tokens.
string buildResultTerm(string nextToken)
a receiver of verb-tokens, which renders them verbosely
A front-end for using printf-style formatting.
VerbToken< Receiver, string(void)> Verb
const string BEGINNING("silence")
Implementation namespace for support and library code.
Action token implemented by double dispatch to a handler function, as defined in the "receiver" inter...
Test runner and basic definitions for tests.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Building blocks for a simple DSL using double dispatch to a handler function.
#define VERB(RECEIVER, FUN)