From b3e7af90dcea88d3ea89009d1fa85f88b757fc8a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 29 Aug 2016 23:04:44 +0200 Subject: [PATCH] complete two more long standing test definitions --- tests/15library.tests | 46 ++++++- .../diff/generic-tree-representation-test.cpp | 113 ------------------ .../diff/tree-mutator-binding-test.cpp | 2 +- tests/library/diff/tree-mutator-test.cpp | 68 ++++++----- 4 files changed, 82 insertions(+), 147 deletions(-) delete mode 100644 tests/library/diff/generic-tree-representation-test.cpp diff --git a/tests/15library.tests b/tests/15library.tests index fcc62a16e..806f93339 100644 --- a/tests/15library.tests +++ b/tests/15library.tests @@ -169,9 +169,16 @@ END TEST "Diff: Generic recursive mutation with closure binding" TreeMutator_test < > 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» +out: nested:$ +out: data:$ +out: \)__END_Opaque.+ +out-lit: after...I +out: Opaque.+__\(α:1 β:-1 γ:3.45000 δ:⟂ «unique_ptr» +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» +out: nested:_CHILD_Record.+__\(α:-1 β:-1 γ:-1.00000 δ:⟂ «unique_ptr» +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» +out: nested:$ +out: data:a, a, a$ +out: \)__END_≺ζ≻\.+ +out: nested:_CHILD_Record.+≺ξ≻.+__\(α:-1 β:2 γ:-1.00000 δ:⟂ «unique_ptr» +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 < - - 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 -//#include -//#include - -//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 diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index f8fdc7fc2..564272f7e 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -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 diff --git a/tests/library/diff/tree-mutator-test.cpp b/tests/library/diff/tree-mutator-test.cpp index d5cfac2f5..f1104fec4 100644 --- a/tests/library/diff/tree-mutator-test.cpp +++ b/tests/library/diff/tree-mutator-test.cpp @@ -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 #include -//#include +#include 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 values; + values.push_back("a"); + values.push_back("b"); + + cout << join(values) <