Add dummy parameter parsing to cucumber
This commit is contained in:
parent
6faa5f45e8
commit
63c9d599f9
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -654,6 +654,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cheap-ruler",
|
"cheap-ruler",
|
||||||
"chksum-md5",
|
"chksum-md5",
|
||||||
|
"clap",
|
||||||
"cucumber",
|
"cucumber",
|
||||||
"futures",
|
"futures",
|
||||||
"geo-types",
|
"geo-types",
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
cheap-ruler = "0.4.0"
|
cheap-ruler = "0.4.0"
|
||||||
chksum-md5 = "0.0.0"
|
chksum-md5 = "0.0.0"
|
||||||
|
clap = "4.5.4"
|
||||||
cucumber = "0.21.0"
|
cucumber = "0.21.0"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
geo-types = "0.7.13"
|
geo-types = "0.7.13"
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
|
extern crate clap;
|
||||||
|
|
||||||
mod osm;
|
mod osm;
|
||||||
|
|
||||||
use core::panic;
|
use core::panic;
|
||||||
use std::collections::{HashMap, HashSet, VecDeque};
|
use std::collections::{HashMap, HashSet, VecDeque};
|
||||||
|
use std::error::Error;
|
||||||
use std::fs::{create_dir_all, DirEntry, File};
|
use std::fs::{create_dir_all, DirEntry, File};
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{env, fs};
|
use std::str::FromStr;
|
||||||
|
use std::{env, fmt, fs};
|
||||||
|
|
||||||
use cheap_ruler::CheapRuler;
|
use cheap_ruler::CheapRuler;
|
||||||
|
use clap::{Arg, Parser};
|
||||||
use cucumber::{self, gherkin::Step, given, when, World};
|
use cucumber::{self, gherkin::Step, given, when, World};
|
||||||
use futures::{future, FutureExt};
|
use futures::{future, FutureExt};
|
||||||
use geo_types::{point, Point};
|
use geo_types::{point, Point};
|
||||||
@ -280,7 +285,56 @@ impl Iterator for LexicographicFileWalker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive( clap::ValueEnum, Clone, Default, Debug)]
|
||||||
|
enum LoadMethod {
|
||||||
|
Mmap,
|
||||||
|
#[default]
|
||||||
|
Datastore,
|
||||||
|
Directly,
|
||||||
|
}
|
||||||
|
impl ToString for LoadMethod {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
LoadMethod::Mmap => "mmap".into(),
|
||||||
|
LoadMethod::Datastore => "datastore".into(),
|
||||||
|
LoadMethod::Directly => "directly".into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(clap::ValueEnum, Clone, Default, Debug)]
|
||||||
|
enum RoutingAlgorithm {
|
||||||
|
#[default]
|
||||||
|
CH,
|
||||||
|
MLD,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for RoutingAlgorithm {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
RoutingAlgorithm::CH => "ch".into(),
|
||||||
|
RoutingAlgorithm::MLD => "mld".into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: move to external file
|
||||||
|
#[derive(Parser, Debug)]
|
||||||
|
#[command(version, about, long_about = None)]
|
||||||
|
struct Args {
|
||||||
|
// underlying memory storage
|
||||||
|
#[arg(short, default_value_t = LoadMethod::Datastore)]
|
||||||
|
memory: LoadMethod,
|
||||||
|
|
||||||
|
// Number of times to greet
|
||||||
|
#[arg(short, default_value_t = RoutingAlgorithm::CH)]
|
||||||
|
p: RoutingAlgorithm,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let args = Args::parse();
|
||||||
|
println!("name: {:?}", args);
|
||||||
|
|
||||||
// create OSRM digest before any tests are executed since cucumber-rs doesn't have @beforeAll
|
// create OSRM digest before any tests are executed since cucumber-rs doesn't have @beforeAll
|
||||||
let exe_path = env::current_exe().expect("failed to get current exe path");
|
let exe_path = env::current_exe().expect("failed to get current exe path");
|
||||||
let path = exe_path
|
let path = exe_path
|
||||||
|
Loading…
Reference in New Issue
Block a user