complete two more long standing test definitions

This commit is contained in:
Fischlurch 2016-08-29 23:04:44 +02:00
parent 3774960dcc
commit b3e7af90dc
4 changed files with 82 additions and 147 deletions

View file

@ -169,9 +169,16 @@ END
TEST "Diff: Generic recursive mutation with closure binding" TreeMutator_test <<END
out-lit: |
out-lit: | »simpleAttributeBinding«
out: concrete TreeMutator .+Builder<ChangeOperation<TreeMutator, test::TreeMutator_test::simpleAttributeBinding().+lambda\(string\).+> >
out-lit: "data" closure received something that would be acceptable
out-lit: localData changed to: that would be acceptable
out-lit: |
out-lit: | »simpleCollectionBinding«
out-lit: a, b
out: concrete TreeMutator .+Builder<ChildCollectionMutator<TreeMutator,
out-lit: c, b
return: 0
END
@ -181,6 +188,40 @@ return: 0
END
TEST "Diff: integration test with opaque target data" DiffComplexApplication_test <<END
out-lit: before...
out: Opaque.+__\(α:-1 β:-1 γ:-1.00000 δ:⟂ «unique_ptr<Opaque>»
out: nested:$
out: data:$
out: \)__END_Opaque.+
out-lit: after...I
out: Opaque.+__\(α:1 β:-1 γ:3.45000 δ:⟂ «unique_ptr<Opaque>»
out: nested:$
out: data:b, b, 78:56:34\.012$
out: \)__END_Opaque.+
out-lit: after...II
out: Opaque.+__\(α:1 β:2 γ:3.45000 δ:⟂ «unique_ptr<Opaque>»
out: nested:_CHILD_Record.+__\(α:-1 β:-1 γ:-1.00000 δ:⟂ «unique_ptr<Opaque>»
out: nested:$
out: data:$
out: \)__END__CHILD_Record.+
out: data:78:56:34\.012, b$
out: \)__END_Opaque.+
out-lit: after...III
out: Opaque.+__\(α:1 β:2 γ:3.14159 δ:unique_ptr.+ ↗≺ζ≻.+__\(α:-1 β:-1 γ:-1.00000 δ:⟂ «unique_ptr<Opaque>»
out: nested:$
out: data:a, a, a$
out: \)__END_≺ζ≻\.+
out: nested:_CHILD_Record.+≺ξ≻.+__\(α:-1 β:2 γ:-1.00000 δ:⟂ «unique_ptr<Opaque>»
out: nested:$
out: data:b, a$
out: \)__END__CHILD_Record.+≺ξ≻.+
out: data:78:56:34.012, b$
out: \)__END_Opaque.+
return: 0
END
TEST "A Digxel (numeric component)" Digxel_test <<END
out-lit: empty____## +0.0 ##
out-lit: value____##-88.8 ##
@ -295,11 +336,6 @@ return: 0
END
PLANNED "GenericTreeRepresentation_test" GenericTreeRepresentation_test <<END
return: 0
END
TEST "HashGenerator_test" HashGenerator_test <<END
return: 0
END

View file

@ -1,113 +0,0 @@
/*
GenericTreeRepresentation(Test) - build and handle tree like data representation
Copyright (C) Lumiera.org
2015, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *****************************************************/
#include "lib/test/run.hpp"
#include "lib/test/test-helper.hpp"
#include "lib/diff/record.hpp"
//#include <utility>
//#include <string>
//#include <vector>
//using std::string;
//using std::vector;
//using std::swap;
namespace lib {
namespace diff{
namespace test{
// using lumiera::error::LUMIERA_ERROR_LOGIC;
namespace {//Test fixture....
}//(End)Test fixture
/***********************************************************************************//**
* @test Demonstrate how to build, explore and traverse tree-like data representation.
*
* @see IndexTable
* @see DiffListApplication_test
*/
class GenericTreeRepresentation_test : public Test
{
virtual void
run (Arg)
{
simpleUsage();
verifySnapshot();
sequenceIteration();
duplicateDetection();
copy_and_move();
}
void
simpleUsage()
{
}
void
verifySnapshot()
{
}
void
sequenceIteration()
{
}
void
duplicateDetection()
{
}
void
copy_and_move()
{
}
};
/** Register this test class... */
LAUNCHER (GenericTreeRepresentation_test, "unit common");
}}} // namespace lib::diff::test

View file

@ -708,7 +708,7 @@ namespace test{
CHECK (-1 == beta);
CHECK (-1 == gamma);
CHECK (mutator1.hasSrc()); // NOTE: the attribute binding has no "reference source sequence" and thus no dynamic state.
CHECK (not mutator1.hasSrc()); // NOTE: the attribute binding has no "reference source sequence" and thus no dynamic state.
// (in fact it is predetermined, because it relies on a likewise fixed class definition)
CHECK (mutator1.completeScope()); // NOTE: this is always true and NOP, for the same reason: the structure of the binding is fixed

View file

@ -26,36 +26,24 @@
#include "lib/test/test-helper.hpp"
#include "lib/diff/tree-mutator.hpp"
#include "lib/format-cout.hpp"
#include "lib/format-util.hpp"
#include "lib/util.hpp"
//#include <utility>
#include <string>
//#include <vector>
#include <vector>
using util::isnil;
using std::string;
//using std::vector;
//using std::swap;
using util::join;
using util::typeStr;
using std::string;
using std::vector;
namespace lib {
namespace diff{
namespace test{
// using lumiera::error::LUMIERA_ERROR_LOGIC;
namespace {//Test fixture....
}//(End)Test fixture
@ -64,11 +52,14 @@ namespace test{
* @test Demonstrate a customisable component for flexible bindings
* to enable generic tree changing and mutating operations to
* arbitrary hierarchical data structures.
* - we use lambdas to link into our private implementation
* - this test demonstrates the behaviour of an attribute setter
* - plus some of the _primitive operations_ available on collections
*
* @see TreeMutator
* @see DiffComplexApplication_test a way more complex usage scenario
* @see GenNodeBasic_test
* @see GenericRecordRepresentation_test
* @see GenericTreeRepresentation_test
*/
class TreeMutator_test : public Test
{
@ -77,14 +68,14 @@ namespace test{
run (Arg)
{
simpleAttributeBinding();
sequenceIteration();
copy_and_move();
simpleCollectionBinding();
}
void
simpleAttributeBinding()
{
MARK_TEST_FUN;
string localData;
auto mutator =
TreeMutator::build()
@ -110,14 +101,35 @@ namespace test{
void
sequenceIteration()
{
}
void
copy_and_move()
simpleCollectionBinding()
{
MARK_TEST_FUN;
vector<string> values;
values.push_back("a");
values.push_back("b");
cout << join(values) <<endl;
CHECK (2 == values.size());
CHECK ("a, b" == join(values));
auto mutator =
TreeMutator::build()
.attach (collection(values));
cout << "concrete TreeMutator size=" << sizeof(mutator)
<< " type="<< typeStr(mutator)
<< endl;
CHECK (isnil (values));
CHECK (mutator.matchSrc (GenNode("a")));
mutator.skipSrc (GenNode("a"));
CHECK (mutator.matchSrc (GenNode("b")));
CHECK (mutator.injectNew (GenNode("c")));
CHECK (mutator.acceptSrc (GenNode("b")));
cout << join(values) <<endl;
CHECK (2 == values.size());
CHECK ("c, b" == join(values));
}
};