baseline of test-dummy implementation or a mutation target binding
- we're using the source / target buffer paradigm to implement the mutation - we're using Record<string> to account for "the current content"
This commit is contained in:
parent
3f8946c157
commit
d8fe9bce94
4 changed files with 50 additions and 15 deletions
|
|
@ -51,9 +51,10 @@
|
|||
#include "lib/diff/tree-mutator.hpp"
|
||||
#include "lib/idi/genfunc.hpp"
|
||||
#include "lib/test/event-log.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
#include "lib/util.hpp"
|
||||
//#include "lib/format-string.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <functional>
|
||||
#include <string>
|
||||
//#include <vector>
|
||||
|
|
@ -72,7 +73,16 @@ namespace diff{
|
|||
// using std::function;
|
||||
using std::string;
|
||||
|
||||
using RecS = lib::diff::Record<string>;
|
||||
|
||||
namespace {
|
||||
template<typename T>
|
||||
string
|
||||
identify (const T* const entity)
|
||||
{
|
||||
return lib::idi::instanceTypeID(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -82,24 +92,40 @@ namespace diff{
|
|||
* @todo WIP 2/2016
|
||||
*/
|
||||
class TestMutationTarget
|
||||
: boost::noncopyable
|
||||
{
|
||||
|
||||
EventLog log_{this->identify()};
|
||||
EventLog log_{identify (this)};
|
||||
|
||||
RecS::Mutator content_{};
|
||||
RecS prev_content_{};
|
||||
|
||||
public:
|
||||
|
||||
/* === Operation / Mutation API === */
|
||||
|
||||
void
|
||||
initMutation (string mutatorID)
|
||||
{
|
||||
content_.swap (prev_content_);
|
||||
log_.event ("attachMutator "+mutatorID);
|
||||
}
|
||||
|
||||
|
||||
/* === Diagnostic / Verification === */
|
||||
|
||||
bool
|
||||
empty() const
|
||||
{
|
||||
UNIMPLEMENTED ("NIL check");
|
||||
return content_.empty();
|
||||
}
|
||||
|
||||
/** check for recorded element */
|
||||
bool
|
||||
contains (string spec) const
|
||||
{
|
||||
UNIMPLEMENTED ("check for recorded element");
|
||||
RecS const& currentValidContent{content_};
|
||||
return util::contains (currentValidContent, spec);
|
||||
}
|
||||
|
||||
EventMatch
|
||||
|
|
@ -146,11 +172,6 @@ namespace diff{
|
|||
|
||||
|
||||
private:
|
||||
string
|
||||
identify() const
|
||||
{
|
||||
return lib::idi::instanceTypeID(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -163,10 +184,21 @@ namespace diff{
|
|||
{
|
||||
TestMutationTarget& target_;
|
||||
|
||||
/* ==== re-Implementation of the operation API ==== */
|
||||
|
||||
virtual void
|
||||
injectNew (GenNode const& n) override
|
||||
{
|
||||
UNIMPLEMENTED("establish new child node at current position");
|
||||
}
|
||||
|
||||
|
||||
TestWireTap(TestMutationTarget& dummy, PAR const& chain)
|
||||
: PAR(chain)
|
||||
, target_(dummy)
|
||||
{ }
|
||||
{
|
||||
target_.initMutation (identify(this));
|
||||
}
|
||||
};
|
||||
|
||||
template<class PAR>
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ namespace diff{
|
|||
|
||||
|
||||
/**
|
||||
* Customisable intermediary to abstract
|
||||
* mutating operations on arbitrary, hierarchical object-like data.
|
||||
* Customisable intermediary to abstract mutating operations
|
||||
* on arbitrary, hierarchical object-like data.
|
||||
* The TreeMutator exposes two distinct interfaces
|
||||
* - the \em operation API -- similar to what a container exposes --
|
||||
* is the entirety of abstract operations that can be done to the
|
||||
|
|
@ -155,6 +155,7 @@ namespace diff{
|
|||
static Builder<TreeMutator> build();
|
||||
};
|
||||
|
||||
|
||||
namespace { // Mutator-Builder decorator components...
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
/** @test diagnostic binding: how to monitor and verify the mutations applied */
|
||||
void
|
||||
mutateDummy()
|
||||
{
|
||||
|
|
@ -131,7 +132,7 @@ namespace test{
|
|||
void
|
||||
mutateCollection()
|
||||
{
|
||||
TODO ("define how to map the mutation primitives on a generic collection");
|
||||
TODO ("define how to map the mutation primitives onto a generic collection");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1504,7 +1504,7 @@
|
|||
<node CREATED="1456430115696" ID="ID_546849410" MODIFIED="1456430120227" TEXT="es ist notwendig"/>
|
||||
<node CREATED="1456430109105" ID="ID_366046751" MODIFIED="1456430172153" TEXT="es ist machbar"/>
|
||||
</node>
|
||||
<node CREATED="1456430178935" ID="ID_1069025314" MODIFIED="1456430181467" TEXT="der Weg...">
|
||||
<node CREATED="1456430178935" HGAP="22" ID="ID_1069025314" MODIFIED="1457038595966" TEXT="der Weg..." VSHIFT="5">
|
||||
<node CREATED="1456430183863" ID="ID_464613085" MODIFIED="1456430193433" TEXT="expliziter Stack"/>
|
||||
<node CREATED="1456430194117" ID="ID_943734591" MODIFIED="1456430211847" TEXT="enthält Front-End"/>
|
||||
<node CREATED="1456430212811" ID="ID_90339221" MODIFIED="1456430233644" TEXT="und Backend in Puffer"/>
|
||||
|
|
@ -1656,9 +1656,10 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1457038737878" HGAP="44" ID="ID_643190842" MODIFIED="1457038749290" TEXT="Abstraktions-Grad"/>
|
||||
</node>
|
||||
<node CREATED="1456506821808" ID="ID_1852134358" MODIFIED="1456506824771" TEXT="Typ-Konstrukt"/>
|
||||
<node CREATED="1456523437616" ID="ID_410606899" MODIFIED="1456523446531" TEXT="Manipulations-Interface">
|
||||
<node CREATED="1456523437616" HGAP="27" ID="ID_410606899" MODIFIED="1457038546189" TEXT="Manipulations-Interface" VSHIFT="6">
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#990000" CREATED="1456523455997" ID="ID_1416114013" MODIFIED="1456523464201" TEXT="Deadlock!">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1456523507910" ID="ID_429333479" MODIFIED="1456523518005" TEXT="Henne oder Ei?"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue