/* TextTemplate(Test) - verify the minimalistic text substitution engine Copyright (C) Lumiera.org 2024, 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. * *****************************************************/ /** @file text-template-test.cpp ** unit test \ref TextTemplate_test */ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp"///////////////////////TODO #include "lib/text-template.hpp" #include "lib/format-cout.hpp"///////////////////////TODO #include "lib/test/diagnostic-output.hpp"///////////////////////TODO //#include //#include #include //using std::array; namespace lib { namespace test { using MapS = std::map; /***************************************************************************//** * @test verify a minimalistic text substitution engine with flexible * data binding, used for tool integration and script generation * - cover the core parsing and templating functionality, * using a direct binding * - demonstrate the default-binding for a data map * - cover the binding to Lumiera's »External Tree Description« * @see text-template.hpp * @see GnuplotGen_test */ class TextTemplate_test : public Test { virtual void run (Arg) { simpeUsage(); verify_instantiation(); verify_keySubstituton(); verify_conditional(); verify_iteration(); verify_Map_binding(); verify_ETD_binding(); } /** @test TODO simple point-and-shot usage... * @todo WIP 4/24 ✔ define ⟶ 🔁 implement */ void simpeUsage() { MapS snaps{{"whatever", "cruel world"} ,{"greeting", "farewell"}}; CHECK (TextTemplate::apply ("${greeting} ${whatever} ↯", snaps) == "farewell cruel world ↯"_expect); } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_instantiation() { } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_keySubstituton() { UNIMPLEMENTED ("nebbich"); } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_conditional() { } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_iteration() { } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_Map_binding() { } /** @test TODO * @todo WIP 4/24 🔁 define ⟶ implement */ void verify_ETD_binding() { } }; LAUNCHER (TextTemplate_test, "unit common"); }} // namespace lib::test