/* GenericTreeMutator(Test) - customisable intermediary to abstract tree changing operations Copyright (C) Lumiera.org 2015, Hermann Vosseler 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/tree-mutator.hpp" #include "lib/util.hpp" //#include #include //#include #include using util::isnil; using std::string; //using std::vector; //using std::swap; using std::cout; using std::endl; using lib::test::showType; using lib::test::demangleCxx; namespace lib { namespace diff{ namespace test{ // using lumiera::error::LUMIERA_ERROR_LOGIC; namespace {//Test fixture.... }//(End)Test fixture /*****************************************************************************//** * @test Demonstrate a customisable component for flexible bindings * to enable generic tree changing and mutating operations to * arbitrary hierarchical data structures. * * @see TreeMutator * @see GenNodeBasic_test * @see GenNodeBasic_test * @see GenericTreeRepresentation_test */ class GenericTreeMutator_test : public Test { virtual void run (Arg) { simpleAttributeBinding(); sequenceIteration(); copy_and_move(); } void simpleAttributeBinding() { string localData; auto mutator = TreeMutator::build() .change("data", [&](string val) { cout << "\"data\" closure received something "<