Format y2015d15 and add check to prevent overriding days...

This commit is contained in:
2024-11-04 11:32:48 +01:00
parent ca267835d1
commit d31ff0dd3a
7 changed files with 157 additions and 7 deletions

View File

@@ -16,5 +16,6 @@ fn part1() {
fn part2() {
let root = env!("CARGO_MANIFEST_DIR");
let content = fs::read_to_string(format!("{root}/resources/15_input.txt")).unwrap();
println!("{}", d15::process_part2(&content));
// change comments in part1
//println!("{}", d15::process_part2(&content));
}

20
y2015/src/bin/d18.rs Normal file
View File

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

View File

@@ -185,10 +185,4 @@ Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3";
let result = process_part1(INPUT);
assert_eq!(result, 62842880);
}
#[test]
fn part2() {
let result = process_part2(INPUT);
assert_eq!(result, 0);
}
}

26
y2015/src/days/d18.rs 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);
}
}

View File

@@ -17,3 +17,9 @@ pub mod d9;
pub mod d16;
pub mod d17;
pub mod d18;
pub mod d18;
pub mod d18;