Commit 952f7698 authored by Bharat Garhewal's avatar Bharat Garhewal
Browse files

Fix tests

parent 50ad8f76
Pipeline #60927 failed with stages
in 3 minutes and 59 seconds
......@@ -33,19 +33,29 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let matches = cli::parse()?;
let rule2_mode = match matches.value_of("rule2").unwrap() {
let rule2_mode = match matches
.get_one::<String>("rule2")
.expect("Safe")
.to_string()
.as_str()
{
"none" => Rule2::Nothing,
"ads" => Rule2::Ads,
"seq" => Rule2::SepSeq,
_ => unreachable!(),
};
let rule3_mode = match matches.value_of("rule3").unwrap() {
let rule3_mode = match matches
.get_one::<String>("rule3")
.expect("Safe")
.to_string()
.as_str()
{
"ads" => Rule3::Ads,
"seq" => Rule3::SepSeq,
_ => unreachable!(),
};
let use_ly_ads: bool = matches.occurrences_of("ly_ads") != 0;
let path_name = matches.value_of("model").unwrap();
let path_name = matches.get_one::<String>("model").unwrap();
let oracle_choice = match matches.value_of("eq_oracle").unwrap() {
"int" => EqOracle::Internal,
"hads_tree" => EqOracle::HadsTree,
......@@ -57,21 +67,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"soucha_spyh" => EqOracle::SouchaSPYH,
_ => unreachable!(),
};
let extra_states: usize = matches.value_of("extra_states").map_or(10, |x| {
let extra_states: usize = matches.get_one::<String>("extra_states").map_or(10, |x| {
x.parse()
.expect("Extra states must be a valid unsigned integer.")
});
let _rnd_infix_len: usize = matches.value_of("expected_infix_length").map_or(0, |x| {
x.parse()
.expect("Expected infix length must be a valid unsigned integer.")
});
let _rnd_infix_len: usize = matches
.get_one::<String>("expected_infix_length")
.map_or(0, |x| {
x.parse()
.expect("Expected infix length must be a valid unsigned integer.")
});
let seed: u64 = matches
.value_of("seed")
.get_one::<String>("seed")
.map_or(0, |s| s.parse::<u64>().unwrap_or_default());
let logging_level = match matches.value_of_t("v")? {
let logging_level = match matches.get_one::<usize>("v").expect("Safe") {
0 => LevelFilter::Off,
1 => LevelFilter::Info,
2 => LevelFilter::Debug,
......
use clap::{Arg, Command};
use clap::{Arg, Command, PossibleValue};
/// # Errors
/// If no match is made.
......@@ -11,8 +11,8 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
.arg(
Arg::new("v")
.short('v')
.multiple_occurrences(false)
.help("Sets the level of verbosity: 0 => disabled, 1 => Info, 2 => Debug, 3.. => Trace")
.value_parser(clap::value_parser!(usize))
.default_value("0"),
)
.arg(
......@@ -29,10 +29,13 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
.value_name("RULE2")
.help("Rule 2 mode.")
.default_value("ads")
.possible_values(&["none", "seq", "ads"])
.value_parser([
PossibleValue::new("none").help("Do not attempt to identify frontier states when applying Rule2."),
PossibleValue::new("seq").help("Use a sep-seq to identify frontier states when applying Rule2."),
PossibleValue::new("ads").help("Use an ADS to identify frontier states when applying Rule2."),
])
.required(false)
.takes_value(true)
.multiple_occurrences(false),
)
.arg(
Arg::new("rule3")
......@@ -41,9 +44,11 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
.help("Rule 3 mode.")
.required(false)
.default_value("ads")
.possible_values(&["seq", "ads"])
.value_parser([
PossibleValue::new("seq").help("Use a sep-seq to identify frontier states when applying Rule3."),
PossibleValue::new("ads").help("Use an ADS to identify frontier states when applying Rule3."),
])
.takes_value(true)
.multiple_occurrences(false),
)
.arg(
Arg::new("eq_oracle")
......@@ -51,7 +56,19 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
.long("eq_oracle")
.value_name("EO")
.default_value("hads_tree")
.possible_values(&["int", "seq", "hads_tree", "iads", "soucha_h", "soucha_hsi", "soucha_spy", "soucha_spyh"])
.value_parser(
[
PossibleValue::new("int").help("Internal equivalence oracle."),
PossibleValue::new("seq").help("SepSeq-based tree oracle."),
PossibleValue::new("iads").help("Soucha's IADS oracle."),
PossibleValue::new("hads_tree").help("H-ADS oracle"),
PossibleValue::new("soucha_h").help("Soucha's H-method oracle."),
PossibleValue::new("soucha_hsi").help("Soucha's HSI-method oracle."),
PossibleValue::new("soucha_spy").help("Soucha's SPY-method oracle."),
PossibleValue::new("soucha_spyh").help("Soucha's SPYH-method oracle."),
PossibleValue::new("seq").help("SepSeq-based tree oracle."),
]
)
.help("Equivalence Oracle")
.takes_value(true),
)
......@@ -59,16 +76,16 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
Arg::new("extra_states")
.short('k')
.long("extra_states")
.value_parser(clap::value_parser!(usize))
.value_name("ES")
.takes_value(true)
.multiple_occurrences(false),
)
.arg(
Arg::new("expected_infix_length")
.short('l')
.long("expected_infix_length")
.value_parser(clap::value_parser!(usize))
.takes_value(true)
.multiple_occurrences(false)
.multiple_values(false)
)
.arg(
......@@ -104,7 +121,6 @@ pub fn parse() -> Result<clap::ArgMatches, Box<dyn std::error::Error>> {
.help("Provide a DOT file for the model to be learned")
.required(true)
.takes_value(true)
.multiple_occurrences(false),
)
.get_matches();
Ok(matches)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment