34 lines
709 B
Rust
34 lines
709 B
Rust
use yyyi_ru::mtgott::parser::*;
|
|
|
|
fn generate_strings(
|
|
prefix: &mut String,
|
|
target_length: usize,
|
|
alphabet: &[char],
|
|
f: &mut impl Fn(String),
|
|
) {
|
|
if prefix.len() == target_length {
|
|
f(prefix.clone());
|
|
} else {
|
|
for &c in alphabet {
|
|
prefix.push(c);
|
|
generate_strings(prefix, target_length, alphabet, f);
|
|
prefix.pop();
|
|
}
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_parse_file_with_all_combinations() {
|
|
let alphabet = [' ', '{', '%', '}', '$', 'a'];
|
|
let target_length = 3;
|
|
|
|
generate_strings(&mut String::new(), target_length, &alphabet, &mut |s| {
|
|
println!("Parsing {s}");
|
|
parse_one_file(&s);
|
|
});
|
|
}
|
|
|
|
#[test]
|
|
fn t1(){
|
|
|
|
} |