add template

This commit is contained in:
benkyd
2022-12-16 18:59:14 +00:00
parent e9737a56f1
commit 4059e9fad5
4 changed files with 59 additions and 2 deletions

0
2022/rs/15.input Normal file
View File

30
2022/rs/src/day_15.rs Normal file
View File

@@ -0,0 +1,30 @@
pub const CHALLENGE_INPUT: &str = include_str!("../15.input");
pub const EXAMPLE_INPUT: &str = "498,4 -> 498,6 -> 496,6\n503,4 -> 502,4 -> 502,9 -> 494,9";
pub fn part_1(input: &str) -> i32 {
return 1;
}
pub fn part_2(input: &str) -> i32 {
return 1;
}
#[cfg(test)]
mod test {
use crate::day_15;
#[test]
fn part1_test() {
assert_eq!(day_15::part_1(day_15::EXAMPLE_INPUT), 24);
assert_eq!(day_15::part_1(day_15::CHALLENGE_INPUT), 757);
}
#[test]
fn part2_test() {
assert_eq!(day_15::part_2(day_15::EXAMPLE_INPUT), 93);
assert_eq!(day_15::part_2(day_15::CHALLENGE_INPUT), 24943);
}
}

View File

@@ -2,8 +2,9 @@
#![allow(unused_variables)]
mod day_14;
mod day_15;
fn main() {
println!("Part 1: {}", day_14::part_1(day_14::CHALLENGE_INPUT));
println!("Part 2: {}", day_14::part_2(day_14::CHALLENGE_INPUT));
println!("Part 1: {}", day_15::part_1(day_15::CHALLENGE_INPUT));
println!("Part 2: {}", day_15::part_2(day_15::CHALLENGE_INPUT));
}

26
2022/rs/template.rs Normal file
View File

@@ -0,0 +1,26 @@
pub const CHALLENGE_INPUT: &str = include_str!("../**.input");
pub const EXAMPLE_INPUT: &str = "";
pub fn part_1(input: &str) -> i32 {
}
pub fn part_2(input: &str) -> i32 {
}
#[cfg(test)]
mod test {
use crate::day;
#[test]
fn part1_test() {
assert_eq!(day::part_1(day::EXAMPLE_INPUT), 1);
assert_eq!(day::part_1(day::CHALLENGE_INPUT), 1);
}
#[test]
fn part2_test() {
assert_eq!(day::part_2(day::EXAMPLE_INPUT), 1);
assert_eq!(day::part_2(day::CHALLENGE_INPUT), 1);
}
}