Skip to content

Commit c19d479

Browse files
committed
chore(01/2015): init day
1 parent 55bb6d6 commit c19d479

File tree

6 files changed

+41
-1
lines changed

6 files changed

+41
-1
lines changed

resources/2015/inputs/.gitkeep

Whitespace-only changes.

resources/2015/outputs/.gitkeep

Whitespace-only changes.

src/aoc/year.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::fmt::{Display, Formatter};
55

66
#[derive(Clone, Debug, Eq, PartialEq, Copy)]
77
pub enum Year {
8+
Year2015 = 2015,
89
Year2023 = 2023,
910
Year2024 = 2024,
1011
Year2025 = 2025,
@@ -13,6 +14,7 @@ pub enum Year {
1314
impl Display for Year {
1415
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
1516
let year = match self {
17+
Self::Year2015 => "2015",
1618
Self::Year2023 => "2023",
1719
Self::Year2024 => "2024",
1820
Self::Year2025 => "2025",
@@ -36,11 +38,17 @@ impl PartialOrd for Year {
3638

3739
impl ValueEnum for Year {
3840
fn value_variants<'a>() -> &'a [Self] {
39-
&[Self::Year2023, Self::Year2024]
41+
&[
42+
Self::Year2015,
43+
Self::Year2023,
44+
Self::Year2024,
45+
Self::Year2025,
46+
]
4047
}
4148

4249
fn to_possible_value(&self) -> Option<PossibleValue> {
4350
Some(match self {
51+
Self::Year2015 => PossibleValue::new("2015"),
4452
Self::Year2023 => PossibleValue::new("2023"),
4553
Self::Year2024 => PossibleValue::new("2024"),
4654
Self::Year2025 => PossibleValue::new("2025"),

src/solutions/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::aoc::puzzle_day::PuzzleDay;
22
use crate::aoc::year::Year;
33

4+
mod year2015;
45
mod year2023;
56
mod year2024;
67
mod year2025;
@@ -83,5 +84,9 @@ pub fn solution(puzzle_day: PuzzleDay) -> Box<dyn Solution> {
8384
25 => Box::new(year2023::day25::Day25),
8485
_ => panic!("Day not exist"),
8586
},
87+
Year::Year2015 => match i {
88+
1 => Box::new(year2015::day01::Day01),
89+
_ => panic!("Day not exist"),
90+
},
8691
}
8792
}

src/solutions/year2015/day01.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use crate::solutions::Solution;
2+
3+
pub struct Day01;
4+
5+
impl Solution for Day01 {
6+
fn part_one(&self, _input: &str) -> String {
7+
String::from("0")
8+
}
9+
10+
fn part_two(&self, _input: &str) -> String {
11+
String::from("0")
12+
}
13+
}
14+
15+
#[cfg(test)]
16+
mod tests {
17+
use crate::solutions::year2024::day01::Day01;
18+
use crate::solutions::Solution;
19+
20+
const EXAMPLE: &str = r#""#;
21+
22+
#[test]
23+
fn part_one_example_test() {
24+
assert_eq!("0", Day01.part_one(EXAMPLE));
25+
}
26+
}

src/solutions/year2015/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod day01;

0 commit comments

Comments
 (0)