mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix unit test calling code.
This commit is contained in:
19
src/main.cpp
19
src/main.cpp
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/test/included/unit_test.hpp>
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
@@ -108,18 +109,20 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
else if (vm.count("test"))
|
else if (vm.count("test"))
|
||||||
{
|
{
|
||||||
std::vector<std::string> vCmd;
|
int iCmd = vm.count("parameters");
|
||||||
int iCmd = vm.count("parameters");
|
std::vector<char*> pvCmd;
|
||||||
|
|
||||||
|
pvCmd.push_back(argv[0]);
|
||||||
|
|
||||||
if (iCmd)
|
if (iCmd)
|
||||||
|
{
|
||||||
|
std::vector<std::string> vCmd;
|
||||||
|
|
||||||
vCmd = vm["parameters"].as<std::vector<std::string> >();
|
vCmd = vm["parameters"].as<std::vector<std::string> >();
|
||||||
|
|
||||||
std::vector<char*> pvCmd;
|
BOOST_FOREACH(std::string& param, vCmd)
|
||||||
|
pvCmd.push_back(const_cast<char*>(param.c_str()));
|
||||||
pvCmd.resize(iCmd);
|
}
|
||||||
|
|
||||||
for (int i=0; i != iCmd; ++i)
|
|
||||||
pvCmd[i] = (char*) (vCmd[i].c_str());
|
|
||||||
|
|
||||||
iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
|
iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user