From 209f0b2fd9310f503d4599b12483fddc04d1f7dd Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Thu, 8 May 2014 20:14:35 +0200 Subject: Removed gtest based test cases and added program options * selectively testing document construction in plain C++ code has turned out to be more work than worth it ** i.e. removed test cases and GTest dependency * added boost::program_options based frontent to InputXSLT ** example command: "./test --transformation ../dummy/transform.xsl --target out.xml" ** the plan is to use a simple shell script that generated test transformations and compares the output to reference files --- test.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index b3bf40e..9b978da 100644 --- a/test.cc +++ b/test.cc @@ -1,12 +1,54 @@ #include "plattform_guard.h" #include "transformation_facade.h" -#include "gtest/gtest.h" +#include "boost/program_options.hpp" -int main(int argc, char** argv) { - InputXSLT::PlattformGuard plattform; +#include - testing::InitGoogleTest(&argc, argv); +int main(int ac, char** av) { + boost::program_options::options_description optionDescription( + "Supported options" + ); + + optionDescription.add_options() + ("transformation", boost::program_options::value()->required(), "transformation file") + ("target", boost::program_options::value()->required(), "target file") + ; + + boost::program_options::variables_map variables; + + boost::program_options::store( + boost::program_options::parse_command_line( + ac, av, optionDescription + ), + variables + ); + + try { + boost::program_options::notify(variables); + } + catch ( std::exception& exception ) { + std::cerr << exception.what() << std::endl; + } + + if ( variables.count("transformation") && + variables.count("target") ) { + InputXSLT::PlattformGuard plattform; + + InputXSLT::TransformationFacade transformation( + variables["transformation"].as() + ); + + return transformation.generate( + variables["target"].as(), + { + {"test", "42"} + } + ); + } else { + std::cout << optionDescription << std::endl; + + return 1; + } - return RUN_ALL_TESTS(); } -- cgit v1.2.3