diff options
author | Adrian Kummerländer | 2014-05-08 20:14:35 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-05-08 20:14:35 +0200 |
commit | 209f0b2fd9310f503d4599b12483fddc04d1f7dd (patch) | |
tree | 6ef70e3d00871ecd122db6e3bce7db6e5477f1f9 /test.cc | |
parent | 168537848c7317f81ba44d0986e6cd7da2afb976 (diff) | |
download | InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar.gz InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar.bz2 InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar.lz InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar.xz InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.tar.zst InputXSLT-209f0b2fd9310f503d4599b12483fddc04d1f7dd.zip |
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
Diffstat (limited to 'test.cc')
-rw-r--r-- | test.cc | 52 |
1 files changed, 47 insertions, 5 deletions
@@ -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 <iostream> - 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<std::string>()->required(), "transformation file") + ("target", boost::program_options::value<std::string>()->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<std::string>() + ); + + return transformation.generate( + variables["target"].as<std::string>(), + { + {"test", "42"} + } + ); + } else { + std::cout << optionDescription << std::endl; + + return 1; + } - return RUN_ALL_TESTS(); } |