implement, cover and use the log clearing function

This commit is contained in:
Fischlurch 2016-01-02 02:00:07 +01:00
parent c6945a452e
commit 3230660d86
5 changed files with 29 additions and 10 deletions

View file

@ -643,18 +643,21 @@ namespace test{
}
/** */
/** purge log contents while retaining just the original Header-ID */
EventLog&
clear()
{
UNIMPLEMENTED ("clear log contents while retaining just the original Header-ID");
string originalLogID = this->getID();
return this->clear (originalLogID);
}
/** */
/** purge log contents and also reset Header-ID */
EventLog&
clear (string alteredLogID)
{
UNIMPLEMENTED ("clear log contents and reset Header-ID");
log_->clear();
log({"type=EventLogHeader", "this="+alteredLogID});
return *this;
}
EventLog&
@ -667,7 +670,7 @@ namespace test{
EventLog&
clear (const X *const obj)
{
UNIMPLEMENTED ("clear log contents and reset Header-ID");
return clear (idi::instanceTypeID (obj));
}

View file

@ -31,7 +31,7 @@
//#include <boost/lexical_cast.hpp>
//#include <iostream>
#include <iostream>
//#include <string>
//#include <map>
@ -41,8 +41,8 @@ using lib::diff::GenNode;
//using boost::lexical_cast;
//using util::contains;
//using std::string;
//using std::cout;
//using std::endl;
using std::cout;
using std::endl;
namespace gui {
@ -114,7 +114,7 @@ namespace test {
EntryID<MockElm> elmID{"zeitgeist"};
// Access the log on the Test-Nexus hub
EventLog nexusLog = gui::test::Nexus::getLog();
EventLog nexusLog = gui::test::Nexus::startNewLog();
CHECK (nexusLog.ensureNot("zeitgeist"));
MockElm mock(elmID);
@ -156,6 +156,15 @@ namespace test {
.beforeEvent("warn","discarding note to unknown bID-zeitgeist"));
CHECK (elmLog.ensureNot("Flash")
.afterEvent("destroy","zeitgeist"));
cout << "____Probe-Log_________________\n"
<< util::join(mock.getLog(), "\n")
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
cout << "____Nexus-Log_________________\n"
<< util::join(gui::test::Nexus::getLog(), "\n")
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
}

View file

@ -234,6 +234,12 @@ namespace test{
return testNexus().getLog();
}
lib::test::EventLog const&
Nexus::startNewLog()
{
return testNexus().getLog().clear();
}
/**

View file

@ -80,6 +80,7 @@ namespace test{
static void zombificate(ctrl::BusTerm&);
static lib::test::EventLog const& getLog();
static lib::test::EventLog const& startNewLog();
};

View file

@ -369,7 +369,7 @@ namespace test{
log.clear("unbearable");
CHECK (log.ensureNot("eggs"));
CHECK (log.ensureNot("obnoxious"));
CHECK (log.verify("unbearable").type("EventLogHeader").on(&log));
CHECK (log.verify("unbearable").type("EventLogHeader").on("unbearable"));
}
};