1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
use clap::{Parser, ValueEnum};
use std::path::PathBuf;
#[derive(Debug, Parser)]
#[command(name = "stressed")]
pub struct Args {
/// Path to the solution
pub solver_path: PathBuf,
/// Path to sampler (generator)
#[arg(
short = 's',
long = "sampler",
value_name = "sampler_path",
visible_alias = "generator"
)]
pub sampler_path: PathBuf,
/// Path to checker: either to reference solver, or to the dedicated
/// checker. See --use-custom-checker for details.
#[arg(short = 'c', long = "checker", value_name = "check")]
pub checker_path: PathBuf,
/// Whether to use custom checker. Without this flag, --checker argument is
/// interpreted as path to the reference solver. If --use-custom-checker flag
/// is present, --checker receives *testcase* and, **immediately after**, *the program's answer*
/// and should exit with zero or non-zero exit code.
#[arg(long = "use-custom-checker")]
pub custom_checker: bool,
/// Use stdin to supply random seed to sampler. The default behaviour is
/// to specify it as the only argument to the sampler.
#[arg(long = "sampler-use-stdin")]
pub sampler_use_stdin: bool,
/// Trim output of solvers. The default
/// behaviour is to trim only the last line.
/// Specify this option to trim every line.
/// This can be slow for output-intensive tasks
#[arg(long = "trim-output")]
pub trim_output: bool,
/// Path to save failing test case. The default behaviour
/// (when this flag is not given) is not to save the test case.
#[arg(long = "save-failing-to")]
pub save_failing_to: Option<PathBuf>,
/// Mode to use for diffs; works only for default checker
#[arg(value_enum, long = "diff-mode", default_value_t = DiffMode::Line)]
pub diff_mode: DiffMode,
// #[arg(short, long)]
// pub debug: bool,
/// Do not show progress bar
#[arg(long = "no-progress")]
pub no_progress: bool,
/// Number of samples to try
#[arg(short = 'n', long = "niter", default_value_t = 10000)]
pub niter: usize,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum DiffMode {
/// Output diff per line
Line,
/// Output diff per character
Char,
/// Do not output diff at all; instead, just output what the tested program answered.
/// This might be desirable since the reference solver's output is printed anyway.
None,
}
pub fn parse_args() -> Args {
Args::parse()
}