DiffMessage: start with drafting the most simple test case
damn it! why the hell is the C++ language so tedious to write.... even after years of practice you need hours to get the most basic stuff to fly
This commit is contained in:
parent
9d5d758f0c
commit
9ad0dd9918
3 changed files with 46 additions and 5 deletions
|
|
@ -411,7 +411,7 @@ namespace iter_stl {
|
|||
* materialised iterator contents.
|
||||
* At construction, the given source iterator
|
||||
* is immediately discharged into an internal buffer (vector).
|
||||
* This captured value sequence can be retrieved once as
|
||||
* This captured value sequence can then be retrieved _once_ as
|
||||
* Lumiera Forward Iterator
|
||||
*/
|
||||
template<typename VAL>
|
||||
|
|
|
|||
|
|
@ -224,8 +224,8 @@ namespace lib {
|
|||
: public IterSource<typename IT::value_type>
|
||||
, boost::noncopyable
|
||||
{
|
||||
typedef IterSource<typename IT::value_type> _Base;
|
||||
typedef typename _Base::Pos Pos;
|
||||
using _Base = IterSource<typename IT::value_type>;
|
||||
using Pos = typename _Base::Pos;
|
||||
|
||||
IT src_;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/format-util.hpp"
|
||||
#include "lib/diff/diff-message.hpp"
|
||||
#include "lib/diff/tree-diff-application.hpp"
|
||||
#include "lib/iter-adapter-stl.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
|
|
@ -36,6 +37,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using lib::iter_stl::IterSnapshot;
|
||||
using lib::iter_stl::snapshot;
|
||||
using util::isnil;
|
||||
using util::join;
|
||||
|
|
@ -65,6 +67,9 @@ namespace test{
|
|||
ATTRIB_NODE = MakeRec().genNode("δ"), // empty named node to be attached as attribute δ
|
||||
CHILD_NODE = SUB_NODE; // yet another child node, same ID as SUB_NODE (!)
|
||||
|
||||
|
||||
int instances = 0; ///< verify instance management
|
||||
|
||||
}//(End)Test fixture
|
||||
|
||||
|
||||
|
|
@ -122,11 +127,47 @@ namespace test{
|
|||
demonstrate_treeApplication();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @test demonstrate the intended usage pattern
|
||||
* - a diff generation context is allocated
|
||||
* - the MutationMessage takes ownership
|
||||
* - and exposes the generated diff sequence
|
||||
* - which is pulled during iteration
|
||||
*/
|
||||
void
|
||||
demonstrate_simpleUsage()
|
||||
{
|
||||
UNIMPLEMENTED("generate and iterate, everything right here");
|
||||
using Source = WrappedLumieraIter<IterSnapshot<DiffStep>>;
|
||||
|
||||
/* opaque generation context */
|
||||
struct Generator
|
||||
: TreeDiffLanguage
|
||||
, Source
|
||||
{
|
||||
Generator()
|
||||
: Source{snapshot({ins(TYPE_X)
|
||||
,set(ATTRIB1)
|
||||
,del(CHILD_T)})}
|
||||
{
|
||||
++instances;
|
||||
}
|
||||
|
||||
~Generator()
|
||||
{
|
||||
--instances;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CHECK (0 == instances);
|
||||
{
|
||||
DiffMessage diffMsg{new Generator};
|
||||
CHECK (!isnil (diffMsg));
|
||||
CHECK (1 == instances);
|
||||
|
||||
CHECK ("ins" == string(diffMsg->verb()));
|
||||
}
|
||||
CHECK (0 == instances);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue