implementing option tests marked @todo
This commit is contained in:
parent
14ad02777f
commit
853f6012d5
@ -122,24 +122,23 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!option_variables.count("input")) {
|
if(!option_variables.count("input")) {
|
||||||
SimpleLogger().Write(logWARNING) << "No input file specified";
|
|
||||||
SimpleLogger().Write() << visible_options;
|
SimpleLogger().Write() << visible_options;
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(1 > requested_num_threads) {
|
if(1 > requested_num_threads) {
|
||||||
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
|
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!boost::filesystem::is_regular_file(input_path)) {
|
if(!boost::filesystem::is_regular_file(input_path)) {
|
||||||
SimpleLogger().Write(logWARNING) << "Input file " << input_path.c_str() << " not found!";
|
SimpleLogger().Write(logWARNING) << "Input file " << input_path.c_str() << " not found!";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!boost::filesystem::is_regular_file(profile_path)) {
|
if(!boost::filesystem::is_regular_file(profile_path)) {
|
||||||
SimpleLogger().Write(logWARNING) << "Profile " << profile_path.c_str() << " not found!";
|
SimpleLogger().Write(logWARNING) << "Profile " << profile_path.c_str() << " not found!";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
|
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
|
||||||
@ -205,7 +204,7 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
if( externalMemory.all_edges_list.empty() ) {
|
if( externalMemory.all_edges_list.empty() ) {
|
||||||
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
|
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
externalMemory.PrepareData(output_file_name, restrictionsFileName);
|
externalMemory.PrepareData(output_file_name, restrictionsFileName);
|
||||||
@ -222,13 +221,13 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
} catch(boost::program_options::too_many_positional_options_error& e) {
|
} catch(boost::program_options::too_many_positional_options_error& e) {
|
||||||
SimpleLogger().Write(logWARNING) << "Only one input file can be specified";
|
SimpleLogger().Write(logWARNING) << "Only one input file can be specified";
|
||||||
return -1;
|
return 1;
|
||||||
} catch(boost::program_options::error& e) {
|
} catch(boost::program_options::error& e) {
|
||||||
SimpleLogger().Write(logWARNING) << e.what();
|
SimpleLogger().Write(logWARNING) << e.what();
|
||||||
return -1;
|
return 1;
|
||||||
} catch(std::exception & e) {
|
} catch(std::exception & e) {
|
||||||
SimpleLogger().Write(logWARNING) << "Unhandled exception: " << e.what();
|
SimpleLogger().Write(logWARNING) << "Unhandled exception: " << e.what();
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ Feature: osrm-extract command line options: files
|
|||||||
When I run "osrm-extract --profile {profile} {base}.osm"
|
When I run "osrm-extract --profile {profile} {base}.osm"
|
||||||
Then stderr should be empty
|
Then stderr should be empty
|
||||||
And it should exit with code 0
|
And it should exit with code 0
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-extract - Missing input file
|
Scenario: osrm-extract - Missing input file
|
||||||
When I run "osrm-extract over-the-rainbow.osrm --profile {profile}"
|
When I run "osrm-extract over-the-rainbow.osrm --profile {profile}"
|
||||||
And stderr should contain "over-the-rainbow.osrm"
|
And stderr should contain "over-the-rainbow.osrm"
|
||||||
|
@ -3,8 +3,7 @@ Feature: osrm-extract command line options: help
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-extract - Help should be shown when no options are passed
|
Scenario: osrm-extract - Help should be shown when no options are passed
|
||||||
When I run "osrm-extract"
|
When I run "osrm-extract"
|
||||||
Then stderr should be empty
|
Then stderr should be empty
|
||||||
@ -45,4 +44,4 @@ Feature: osrm-extract command line options: help
|
|||||||
And stdout should contain "--profile"
|
And stdout should contain "--profile"
|
||||||
And stdout should contain "--threads"
|
And stdout should contain "--threads"
|
||||||
And stdout should contain 12 lines
|
And stdout should contain 12 lines
|
||||||
And it should exit with code 0
|
And it should exit with code 0
|
||||||
|
@ -3,8 +3,7 @@ Feature: osrm-extract command line options: invalid options
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-extract - Non-existing option
|
Scenario: osrm-extract - Non-existing option
|
||||||
When I run "osrm-extract --fly-me-to-the-moon"
|
When I run "osrm-extract --fly-me-to-the-moon"
|
||||||
Then stdout should be empty
|
Then stdout should be empty
|
||||||
|
@ -17,13 +17,16 @@ Feature: osrm-prepare command line options: files
|
|||||||
When I run "osrm-prepare {base}.osrm --profile {profile}"
|
When I run "osrm-prepare {base}.osrm --profile {profile}"
|
||||||
Then stderr should be empty
|
Then stderr should be empty
|
||||||
And it should exit with code 0
|
And it should exit with code 0
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> Stashed changes
|
||||||
Scenario: osrm-prepare - Order of options should not matter
|
Scenario: osrm-prepare - Order of options should not matter
|
||||||
When I run "osrm-prepare --profile {profile} {base}.osrm"
|
When I run "osrm-prepare --profile {profile} {base}.osrm"
|
||||||
Then stderr should be empty
|
Then stderr should be empty
|
||||||
And it should exit with code 0
|
And it should exit with code 0
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-prepare - Missing input file
|
Scenario: osrm-prepare - Missing input file
|
||||||
When I run "osrm-prepare over-the-rainbow.osrm --profile {profile}"
|
When I run "osrm-prepare over-the-rainbow.osrm --profile {profile}"
|
||||||
And stderr should contain "over-the-rainbow.osrm"
|
And stderr should contain "over-the-rainbow.osrm"
|
||||||
|
@ -3,8 +3,7 @@ Feature: osrm-prepare command line options: help
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-prepare - Help should be shown when no options are passed
|
Scenario: osrm-prepare - Help should be shown when no options are passed
|
||||||
When I run "osrm-prepare"
|
When I run "osrm-prepare"
|
||||||
Then stderr should be empty
|
Then stderr should be empty
|
||||||
@ -48,4 +47,4 @@ Feature: osrm-prepare command line options: help
|
|||||||
And stdout should contain "--profile"
|
And stdout should contain "--profile"
|
||||||
And stdout should contain "--threads"
|
And stdout should contain "--threads"
|
||||||
And stdout should contain 15 lines
|
And stdout should contain 15 lines
|
||||||
And it should exit with code 0
|
And it should exit with code 0
|
||||||
|
@ -3,11 +3,10 @@ Feature: osrm-prepare command line options: invalid options
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: osrm-prepare - Non-existing option
|
Scenario: osrm-prepare - Non-existing option
|
||||||
When I run "osrm-prepare --fly-me-to-the-moon"
|
When I run "osrm-prepare --fly-me-to-the-moon"
|
||||||
Then stdout should be empty
|
Then stdout should be empty
|
||||||
And stderr should contain "exception"
|
And stderr should contain "Exception"
|
||||||
And stderr should contain "fly-me-to-the-moon"
|
And stderr should contain "fly-me-to-the-moon"
|
||||||
And it should exit with code 1
|
And it should exit with code 1
|
||||||
|
54
prepare.cpp
54
prepare.cpp
@ -121,34 +121,34 @@ int main (int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(option_variables.count("help")) {
|
if(option_variables.count("help")) {
|
||||||
SimpleLogger().Write() << std::endl << visible_options;
|
SimpleLogger().Write() << "\n" << visible_options;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::program_options::notify(option_variables);
|
boost::program_options::notify(option_variables);
|
||||||
|
|
||||||
// if(boost::filesystem::is_regular_file(config_file_path)) {
|
|
||||||
// SimpleLogger().Write() << "Reading options from: " << config_file_path.c_str();
|
|
||||||
// std::string config_str;
|
|
||||||
// PrepareConfigFile( config_file_path.c_str(), config_str );
|
|
||||||
// std::stringstream config_stream( config_str );
|
|
||||||
// boost::program_options::store(parse_config_file(config_stream, config_file_options), option_variables);
|
|
||||||
// boost::program_options::notify(option_variables);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(!option_variables.count("restrictions")) {
|
if(!option_variables.count("restrictions")) {
|
||||||
restrictions_path = std::string( input_path.c_str()) + ".restrictions";
|
restrictions_path = std::string(input_path.string() + ".restrictions");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!option_variables.count("input")) {
|
if(!option_variables.count("input")) {
|
||||||
SimpleLogger().Write(logWARNING) << "No input file specified";
|
SimpleLogger().Write() << "\n" << visible_options;
|
||||||
SimpleLogger().Write() << visible_options;
|
return 0;
|
||||||
return -1;
|
}
|
||||||
|
|
||||||
|
if(!boost::filesystem::is_regular_file(input_path)) {
|
||||||
|
SimpleLogger().Write(logWARNING) << "Input file " << input_path.string() << " not found!";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!boost::filesystem::is_regular_file(profile_path)) {
|
||||||
|
SimpleLogger().Write(logWARNING) << "Profile " << profile_path.string() << " not found!";
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(1 > requested_num_threads) {
|
if(1 > requested_num_threads) {
|
||||||
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
|
SimpleLogger().Write(logWARNING) << "Number of threads must be 1 or larger";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
|
SimpleLogger().Write() << "Input file: " << input_path.filename().string();
|
||||||
@ -183,11 +183,11 @@ int main (int argc, char *argv[]) {
|
|||||||
std::ifstream in;
|
std::ifstream in;
|
||||||
in.open (input_path.c_str(), std::ifstream::in | std::ifstream::binary);
|
in.open (input_path.c_str(), std::ifstream::in | std::ifstream::binary);
|
||||||
|
|
||||||
std::string nodeOut(input_path.c_str()); nodeOut += ".nodes";
|
std::string nodeOut(input_path.string() + ".nodes");
|
||||||
std::string edgeOut(input_path.c_str()); edgeOut += ".edges";
|
std::string edgeOut(input_path.string() + ".edges");
|
||||||
std::string graphOut(input_path.c_str()); graphOut += ".hsgr";
|
std::string graphOut(input_path.string() + ".hsgr");
|
||||||
std::string rtree_nodes_path(input_path.c_str()); rtree_nodes_path += ".ramIndex";
|
std::string rtree_nodes_path(input_path.string() + ".ramIndex");
|
||||||
std::string rtree_leafs_path(input_path.c_str()); rtree_leafs_path += ".fileIndex";
|
std::string rtree_leafs_path(input_path.string() + ".fileIndex");
|
||||||
|
|
||||||
/*** Setup Scripting Environment ***/
|
/*** Setup Scripting Environment ***/
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ int main (int argc, char *argv[]) {
|
|||||||
lua_tostring(myLuaState,-1) <<
|
lua_tostring(myLuaState,-1) <<
|
||||||
" occured in scripting block" <<
|
" occured in scripting block" <<
|
||||||
std::endl;
|
std::endl;
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
speedProfile.trafficSignalPenalty = 10*lua_tointeger(myLuaState, -1);
|
speedProfile.trafficSignalPenalty = 10*lua_tointeger(myLuaState, -1);
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ int main (int argc, char *argv[]) {
|
|||||||
lua_tostring(myLuaState,-1) <<
|
lua_tostring(myLuaState,-1) <<
|
||||||
" occured in scripting block" <<
|
" occured in scripting block" <<
|
||||||
std::endl;
|
std::endl;
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
speedProfile.uTurnPenalty = 10*lua_tointeger(myLuaState, -1);
|
speedProfile.uTurnPenalty = 10*lua_tointeger(myLuaState, -1);
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ int main (int argc, char *argv[]) {
|
|||||||
|
|
||||||
if( edgeList.empty() ) {
|
if( edgeList.empty() ) {
|
||||||
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
|
SimpleLogger().Write(logWARNING) << "The input data is empty, exiting.";
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleLogger().Write() <<
|
SimpleLogger().Write() <<
|
||||||
@ -395,7 +395,7 @@ int main (int argc, char *argv[]) {
|
|||||||
SimpleLogger().Write(logWARNING) <<
|
SimpleLogger().Write(logWARNING) <<
|
||||||
"Failed at edges of node " << node <<
|
"Failed at edges of node " << node <<
|
||||||
" of " << numberOfNodes;
|
" of " << numberOfNodes;
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
//Serialize edges
|
//Serialize edges
|
||||||
hsgr_output_stream.write((char*) ¤tEdge, sizeof(StaticGraph<EdgeData>::_StrEdge));
|
hsgr_output_stream.write((char*) ¤tEdge, sizeof(StaticGraph<EdgeData>::_StrEdge));
|
||||||
@ -419,14 +419,14 @@ int main (int argc, char *argv[]) {
|
|||||||
SimpleLogger().Write() << "finished preprocessing";
|
SimpleLogger().Write() << "finished preprocessing";
|
||||||
} catch(boost::program_options::too_many_positional_options_error& e) {
|
} catch(boost::program_options::too_many_positional_options_error& e) {
|
||||||
SimpleLogger().Write(logWARNING) << "Only one file can be specified";
|
SimpleLogger().Write(logWARNING) << "Only one file can be specified";
|
||||||
return -1;
|
return 1;
|
||||||
} catch(boost::program_options::error& e) {
|
} catch(boost::program_options::error& e) {
|
||||||
SimpleLogger().Write(logWARNING) << e.what();
|
SimpleLogger().Write(logWARNING) << e.what();
|
||||||
return -1;
|
return 1;
|
||||||
} catch ( const std::exception &e ) {
|
} catch ( const std::exception &e ) {
|
||||||
SimpleLogger().Write(logWARNING) <<
|
SimpleLogger().Write(logWARNING) <<
|
||||||
"Exception occured: " << e.what() << std::endl;
|
"Exception occured: " << e.what() << std::endl;
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user