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