Script to prepare days and years

This commit is contained in:
Fabian Schmidt
2024-11-01 16:52:33 +01:00
parent 828566cce3
commit a687f18918
13 changed files with 124 additions and 0 deletions

20
template/bin/d.rs.tmpl Normal file
View File

@@ -0,0 +1,20 @@
use std::fs;
use y{{YEAR}}::days::d{{DAY}};
fn main() {
part1();
part2();
}
fn part1() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/{{DAY}}_input.txt")).unwrap();
println!("{}", d{{DAY}}::process_part1(&content));
}
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/{{DAY}}_input.txt")).unwrap();
println!("{}", d{{DAY}}::process_part2(&content));
}

26
template/days/d.rs.tmpl Normal file
View File

@@ -0,0 +1,26 @@
pub fn process_part1(input: &str) -> i32 {
0
}
pub fn process_part2(input: &str) -> i32 {
0
}
#[cfg(test)]
mod tests {
use super::*;
const INPUT: &str = "{{EXAMPLE}}";
#[test]
fn part1() {
let result = process_part1(INPUT);
assert_eq!(result, 0);
}
#[test]
fn part2() {
let result = process_part2(INPUT);
assert_eq!(result, 0);
}
}