/* GenericRecordRepresentation(Test) - introspective representation of object-like data 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/record.hpp" #include "lib/util.hpp" //////TODO necessary? #include //#include //#include #include //using std::string; using util::isSameObject; using std::vector; //using std::swap; using std::cout; using std::endl; namespace lib { namespace diff{ namespace test{ // using lumiera::error::LUMIERA_ERROR_LOGIC; namespace {//Test fixture.... }//(End)Test fixture using Seq = vector; using RecS = Record; /*************************************************************************************//** * @test Verify properties of a special collection type meant for external representation * of object-like data. * * @see IndexTable * @see DiffListApplication_test */ class GenericRecordRepresentation_test : public Test { virtual void run (Arg) { simpleUsage(); verifyCreation(); verifyMutations(); copy_and_move(); equality(); } void simpleUsage() { RecS enterprise("starship" , {"Name = USS Enterprise" ,"Registry = NCC-1701-D" ,"Class = Galaxy" ,"Owner = United Federation of Planets" ,"built=2363" } , {"Picard", "Riker", "Data", "Worf", "Troi", "Crusher", "La Forge"} ); CHECK (enterprise.getType() == "starship"); CHECK (enterprise.get("Registry") == "NCC-1701-D"); CHECK (enterprise.hasAttribute("Owner")); CHECK (!enterprise.hasAttribute("owner")); CHECK (!enterprise.hasAttribute("Owner ")); CHECK (enterprise.contains("Data")); CHECK (!contains (enterprise, "Woof")); CHECK (util::contains (enterprise, "Worf")); VERIFY_ERROR (INVALID, enterprise.get("warp10")); cout << "enterprise = " << string(enterprise)<