draft how "log joining" shall work
This commit is contained in:
parent
c9d113be87
commit
a95f9a6cac
2 changed files with 77 additions and 0 deletions
|
|
@ -345,6 +345,19 @@ namespace test{
|
|||
{
|
||||
UNIMPLEMENTED("start matching sequence");
|
||||
}
|
||||
|
||||
|
||||
/** equality comparison is based on the actual log contents */
|
||||
friend bool
|
||||
operator== (EventLog const& l1, EventLog const& l2)
|
||||
{
|
||||
return l1.log_ == l2.log_;
|
||||
}
|
||||
friend bool
|
||||
operator!= (EventLog const& l1, EventLog const& l2)
|
||||
{
|
||||
return not (l1 == l2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace test{
|
|||
{
|
||||
verify_simpleUsage();
|
||||
verify_backwardMatch();
|
||||
verify_logJoining();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,6 +108,69 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
verify_logJoining ()
|
||||
{
|
||||
EventLog log1("spam");
|
||||
EventLog log2("ham");
|
||||
|
||||
log1.event("baked beans");
|
||||
log2.event("eggs");
|
||||
|
||||
log1.verify("spam").before("baked beans");
|
||||
log2.verify("ham").before("eggs");
|
||||
|
||||
log1.ensureNot("ham");
|
||||
log1.ensureNot("eggs");
|
||||
log2.ensureNot("spam");
|
||||
log2.ensureNot("baked beans");
|
||||
|
||||
EventLog copy(log2);
|
||||
copy.event("bacon");
|
||||
copy.verify("ham").before("eggs").before("bacon");
|
||||
log2.verify("ham").before("eggs").before("bacon");
|
||||
log1.ensureNot("bacon");
|
||||
|
||||
CHECK(log1 != log2);
|
||||
CHECK(copy == log2);
|
||||
|
||||
log2.join(log1);
|
||||
|
||||
CHECK(log1 == log2);
|
||||
CHECK(copy != log2);
|
||||
|
||||
log1.verify("logJoin|{ham}").after("baked beans");
|
||||
log1.verify("logJoin|{ham}").after("ham").before("eggs").before("logJoin");
|
||||
|
||||
log2.event("sausage");
|
||||
log1.verify("sausage").after("logJoin").after("spam");
|
||||
|
||||
copy.ensureNot("logJoin");
|
||||
copy.ensureNot("sausage");
|
||||
copy.verify("joined|{spam}").after("EventLogHeader");
|
||||
|
||||
copy.event("spam tomato");
|
||||
log1.ensureNot("spam tomato");
|
||||
log2.ensureNot("spam tomato");
|
||||
copy.verify("joined|{spam}").before("spam tomato");
|
||||
|
||||
|
||||
CHECK (join(log1) == string(
|
||||
"Rec(EventLogHeader| ID = spam ), "
|
||||
"Rec(event|{baked beans}), "
|
||||
"Rec(EventLogHeader| ID = ham ), "
|
||||
"Rec(event|{eggs}), "
|
||||
"Rec(event|{bacon}), "
|
||||
"Rec(logJoin|{ham}), "
|
||||
"Rec(event|{sausage})"));
|
||||
|
||||
CHECK (join(copy) == string(
|
||||
"Rec(EventLogHeader| ID = ham ), "
|
||||
"Rec(joined|{spam}), "
|
||||
"Rec(event|{spam tomato})"));
|
||||
}
|
||||
|
||||
|
||||
/** @test prints TODO */
|
||||
void
|
||||
checkTODO ()
|
||||
|
|
|
|||
Loading…
Reference in a new issue