file_candidates/
file_candidates.rs1use std::process::ExitCode;
2
3use fixture3_ddmin::{DdminInput, DdminOptions, OracleOutcome, ddmin};
4
5#[derive(Clone, Debug, PartialEq, Eq)]
6struct FileCandidate {
7 path: &'static str,
8 required: bool,
9}
10
11fn main() -> ExitCode {
12 let input = DdminInput::new(
13 vec![
14 FileCandidate { path: "fixture/src/lib.rs", required: true },
15 FileCandidate { path: "fixture/README.md", required: false },
16 FileCandidate { path: "fixture/noise.log", required: false },
17 ],
18 DdminOptions::default(),
19 );
20 let mut oracle = |remaining: &[FileCandidate]| {
21 if remaining.iter().any(|candidate| candidate.required) {
22 OracleOutcome::Interesting
23 } else {
24 OracleOutcome::NotInteresting
25 }
26 };
27
28 let output = ddmin(input, &mut oracle);
29 let [remaining] = output.remaining() else {
30 return ExitCode::from(1);
31 };
32 if remaining.path == "fixture/src/lib.rs" { ExitCode::SUCCESS } else { ExitCode::from(1) }
33}