better verification in test
...actually iterate the populated collection and verify each element in order. Also verify and document the mutator's storage requirements
This commit is contained in:
parent
e84844142f
commit
d98fde5b0e
2 changed files with 32 additions and 11 deletions
|
|
@ -34,7 +34,7 @@
|
|||
** several bindings on top of a single TreeMutator -- and this header defines
|
||||
** a building block for one such layer, especially for binding to a representation
|
||||
** of "child objects" managed within a typical STL container.
|
||||
**
|
||||
**
|
||||
** @note the header tree-mutator-collection-binding.hpp with specific builder templates
|
||||
** is included way down, after the class definitions. This is done so for sake
|
||||
** of readability.
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//== anonymous namespace...
|
||||
|
||||
|
||||
|
|
@ -187,7 +187,7 @@
|
|||
|
||||
|
||||
/* ==== re-Implementation of the operation API ==== */
|
||||
|
||||
|
||||
/** skip next pending src element,
|
||||
* causing this element to be discarded
|
||||
*/
|
||||
|
|
@ -321,6 +321,8 @@
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Nested DSL to define the specifics of a collection binding.
|
||||
*/
|
||||
|
|
@ -501,7 +503,7 @@
|
|||
* and wrap a language reference to the concrete collection
|
||||
* implementing the "object children". The result is a default configured
|
||||
* binding, which should be further adapted with the builder functions,
|
||||
* using lambdas as callback into the otherwise opaque implementation code.
|
||||
* using lambdas as callback into the otherwise opaque implementation code.
|
||||
*/
|
||||
template<class COLL>
|
||||
auto
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "lib/test/test-helper.hpp"
|
||||
#include "lib/diff/tree-mutator.hpp"
|
||||
#include "lib/diff/test-mutation-target.hpp"
|
||||
#include "lib/iter-adapter-stl.hpp"
|
||||
#include "lib/time/timevalue.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/format-util.hpp"
|
||||
|
|
@ -39,8 +40,11 @@
|
|||
using util::join;
|
||||
using util::isnil;
|
||||
using util::contains;
|
||||
using util::stringify;
|
||||
using lib::iter_stl::eachElm;
|
||||
using lib::time::Time;
|
||||
using std::string;
|
||||
|
||||
//using std::vector;
|
||||
//using std::swap;
|
||||
|
||||
|
|
@ -311,7 +315,12 @@ namespace test{
|
|||
})
|
||||
);
|
||||
|
||||
cout << lib::test::showSizeof(mutator) <<endl;
|
||||
CHECK (sizeof(mutator) <= sizeof(VecD) // the buffer for pending elements
|
||||
+ sizeof(VecD*) // the reference to the original collection
|
||||
+ sizeof(void*) // the reference from the ChildCollectionMutator to the CollectionBinding
|
||||
+ 2 * sizeof(VecD::iterator) // one Lumiera RangeIter (comprised of pos and end iterators)
|
||||
+ 3 * sizeof(void*) // the three unused default configured binding functions
|
||||
+ 1 * sizeof(void*)); // one back reference from the closures to this scope
|
||||
|
||||
|
||||
// --- first round: populate the collection ---
|
||||
|
|
@ -321,7 +330,6 @@ namespace test{
|
|||
|
||||
mutator.injectNew (ATTRIB1);
|
||||
CHECK (!isnil (target));
|
||||
cout << "inject..." << join(target) <<endl;
|
||||
CHECK (contains(join(target), "≺α∣1≻"));
|
||||
|
||||
mutator.injectNew (ATTRIB3);
|
||||
|
|
@ -329,12 +337,23 @@ namespace test{
|
|||
mutator.injectNew (CHILD_B);
|
||||
mutator.injectNew (CHILD_B);
|
||||
mutator.injectNew (CHILD_T);
|
||||
cout << "inject......" << join(target) <<endl;
|
||||
CHECK (contains(join(target), "≺α∣1≻"));
|
||||
CHECK (contains(join(target), "≺γ∣3.45≻"));
|
||||
CHECK (contains(join(target), "∣b≻"));
|
||||
CHECK (contains(join(target), "∣78:56:34.012≻"));
|
||||
|
||||
auto contents = stringify(eachElm(target));
|
||||
CHECK ("≺α∣1≻" == *contents);
|
||||
++contents;
|
||||
CHECK ("≺γ∣3.45≻" == *contents);
|
||||
++contents;
|
||||
CHECK ("≺γ∣3.45≻" == *contents);
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣b≻"));
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣b≻"));
|
||||
++contents;
|
||||
CHECK (contains(*contents, "∣78:56:34.012≻"));
|
||||
++contents;
|
||||
CHECK (isnil (contents));
|
||||
|
||||
cout << "injected......" << join(target) <<endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue