add iteration and some diagnostics to the test

This commit is contained in:
Fischlurch 2016-03-04 19:23:21 +01:00
parent af50e84737
commit 9875c93ca7
2 changed files with 31 additions and 0 deletions

View file

@ -47,6 +47,7 @@
#include "lib/error.hpp"
#include "lib/symbol.hpp"
#include "lib/iter-adapter-stl.hpp"
#include "lib/diff/record.hpp"
#include "lib/diff/tree-mutator.hpp"
#include "lib/idi/genfunc.hpp"
@ -267,6 +268,15 @@ namespace diff{
}
using const_iterator = typename iter_stl::_SeqT<const VecS>::Range;
const_iterator begin() const { return iter_stl::eachElm(content_); }
const_iterator end() const { return const_iterator(); }
friend const_iterator begin (TestMutationTarget const& target) { return target.begin(); }
friend const_iterator end (TestMutationTarget const& target) { return target.end(); }
private:
};

View file

@ -28,6 +28,7 @@
#include "lib/diff/test-mutation-target.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/format-cout.hpp"
#include "lib/format-util.hpp"
#include "lib/util.hpp"
//#include <utility>
@ -107,6 +108,7 @@ namespace test{
void
mutateDummy()
{
MARK_TEST_FUN;
TestMutationTarget target;
auto mutator =
TreeMutator::build()
@ -119,6 +121,25 @@ namespace test{
CHECK (target.contains("α = 1"));
CHECK (target.verifyEvent("injectNew","α = 1")
.after("attachMutator"));
mutator.injectNew (ATTRIB3);
mutator.injectNew (ATTRIB3);
mutator.injectNew (CHILD_B);
mutator.injectNew (CHILD_B);
mutator.injectNew (CHILD_T);
CHECK (target.verify("attachMutator")
.beforeEvent("injectNew","α = 1")
.beforeEvent("injectNew","γ = 3.45")
.beforeEvent("injectNew","γ = 3.45")
.beforeEvent("injectNew","b")
.beforeEvent("injectNew","b")
.beforeEvent("injectNew","78:56:34.012")
);
cout << "Content after population; "
<< util::join(target) <<endl;
cout << "____Mutation-Log______________\n"
<< util::join(target.getLog(), "\n")
<< "\n───╼━━━━━━━━━╾────────────────"<<endl;
}