From f208c570bf69e620b10046a354460d38df752cc8 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 15 May 2012 16:33:06 -0700 Subject: [PATCH] Fix unit test calling code. --- src/main.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ba23ff80d..153f539a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include +#include #include #include @@ -108,18 +109,20 @@ int main(int argc, char* argv[]) } else if (vm.count("test")) { - std::vector vCmd; - int iCmd = vm.count("parameters"); + int iCmd = vm.count("parameters"); + std::vector pvCmd; + + pvCmd.push_back(argv[0]); if (iCmd) + { + std::vector vCmd; + vCmd = vm["parameters"].as >(); - std::vector pvCmd; - - pvCmd.resize(iCmd); - - for (int i=0; i != iCmd; ++i) - pvCmd[i] = (char*) (vCmd[i].c_str()); + BOOST_FOREACH(std::string& param, vCmd) + pvCmd.push_back(const_cast(param.c_str())); + } iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]); }