1
1
mirror of https://github.com/theoludwig/advent_of_code_2023.git synced 2024-10-29 22:17:19 +01:00

test: add cases for input.txt

This commit is contained in:
Théo LUDWIG 2023-12-08 18:56:07 +01:00
parent 97c302d9e1
commit 755e211f3f
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
10 changed files with 61 additions and 56 deletions

View File

@ -9,3 +9,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yml,yaml,md}]
indent_size = 2

View File

@ -1,24 +1,26 @@
name: "ci"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: "always"
CARGO_TERM_COLOR: "always"
jobs:
ci:
runs-on: "ubuntu-latest"
ci:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
steps:
- uses: "actions/checkout@v4"
- uses: "dtolnay/rust-toolchain@stable"
with:
components: "clippy, rustfmt"
- run: "rustc --version"
- run: "rustc --version"
- run: "cargo build --verbose"
- run: "cargo test --verbose"
- run: "cargo clippy --verbose -- -D warnings"
- run: "cargo fmt -- --check"
- run: "cargo build --verbose"
- run: "cargo test --verbose"
- run: "cargo clippy --verbose -- -D warnings"
- run: "cargo fmt -- --check"

View File

@ -27,13 +27,7 @@ treb7uchet
In this example, the calibration values of these four lines are `12`, `38`, `15`, and `77`. Adding these together produces `142`.
Consider your entire calibration document. What is the sum of all of the calibration values?
To begin, [get your puzzle input](./input.txt).
Your puzzle answer was `55130`.
**The first half of this puzzle is complete! It provides one gold star: `*`.**
Consider your entire calibration document. **What is the sum of all of the calibration values?**
## Instructions - Part 2
@ -54,7 +48,3 @@ zoneight234
In this example, the calibration values are `29`, `83`, `13`, `24`, `42`, `14`, and `76`. Adding these together produces `281`.
**What is the sum of all of the calibration values?**
Your puzzle answer was `54985`.
**Both parts of this puzzle are complete! They provide two gold stars: `**`.**

View File

@ -76,4 +76,14 @@ mod day_1_tests {
fn test_part_2_example() {
assert_eq!(part_2(include_str!("../input_example_2.txt")), 281);
}
#[test]
fn test_part_1() {
assert_eq!(part_1(include_str!("../input.txt")), 55130);
}
#[test]
fn test_part_2() {
assert_eq!(part_2(include_str!("../input.txt")), 54985);
}
}

View File

@ -32,12 +32,6 @@ In the example above, games 1, 2, and 5 would have been **possible** if the bag
Determine which games would have been possible if the bag had been loaded with only 12 red cubes, 13 green cubes, and 14 blue cubes. **What is the sum of the IDs of those games?**
To begin, [get your puzzle input](./input.txt).
Your puzzle answer was `2617`.
**The first half of this puzzle is complete! It provides one gold star: `*`.**
## Instructions - Part 2
The Elf says they've stopped producing snow because they aren't getting any **water**! He isn't sure why the water stopped; however, he can show you how to get to the water source to check it out for yourself. It's just up ahead!
@ -63,7 +57,3 @@ Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
The **power** of a set of cubes is equal to the numbers of red, green, and blue cubes multiplied together. The power of the minimum set of cubes in game 1 is `48`. In games 2-5 it was `12`, `1560`, `630`, and `36`, respectively. Adding up these five powers produces the sum **`2286`**.
For each game, find the minimum set of cubes that must have been present. **What is the sum of the power of these sets?**
Your puzzle answer was `59795`.
**Both parts of this puzzle are complete! They provide two gold stars: `**`.**

View File

@ -185,4 +185,14 @@ mod day_2_tests {
fn test_part_2_example() {
assert_eq!(part_2(include_str!("../input_example_1.txt")), 2286);
}
#[test]
fn test_part_1() {
assert_eq!(part_1(include_str!("../input.txt")), 2617);
}
#[test]
fn test_part_2() {
assert_eq!(part_2(include_str!("../input.txt")), 59795);
}
}

View File

@ -35,12 +35,6 @@ In this schematic, two numbers are **not** part numbers because they are not adj
Of course, the actual engine schematic is much larger. **What is the sum of all of the part numbers in the engine schematic?**
To begin, [get your puzzle input](./input.txt).
Your puzzle answer was `553079`.
**The first half of this puzzle is complete! It provides one gold star: `*`.**
## Instructions - Part 2
The engineer finds the missing part and installs it in the engine! As the engine springs to life, you jump in the closest gondola, finally ready to ascend to the water source.
@ -71,7 +65,3 @@ Consider the same engine schematic again:
In this schematic, there are **two** gears. The first is in the top left; it has part numbers `467` and `35`, so its gear ratio is `16345`. The second gear is in the lower right; its gear ratio is `451490`. (The `*` adjacent to `617` is **not** a gear because it is only adjacent to one part number.) Adding up all of the gear ratios produces **`467835`**.
**What is the sum of all of the gear ratios in your engine schematic?**
Your puzzle answer was `84363105`.
**Both parts of this puzzle are complete! They provide two gold stars: `**`.**

View File

@ -213,4 +213,14 @@ mod day_3_tests {
fn test_part_2_example() {
assert_eq!(part_2(include_str!("../input_example_1.txt")), 467835);
}
#[test]
fn test_part_1() {
assert_eq!(part_1(include_str!("../input.txt")), 553079);
}
#[test]
fn test_part_2() {
assert_eq!(part_2(include_str!("../input.txt")), 84363105);
}
}

View File

@ -41,12 +41,6 @@ So, in this example, the Elf's pile of scratchcards is worth **`13`** points.
Take a seat in the large pile of colorful cards. **How many points are they worth in total?**
To begin, [get your puzzle input](./input.txt).
Your puzzle answer was `24160`.
**The first half of this puzzle is complete! It provides one gold star: `*`.**
## Instructions - Part 2
Just as you're about to report your findings to the Elf, one of you realizes that the rules have actually been printed on the back of every card this whole time.
@ -79,7 +73,3 @@ Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11
Once all of the originals and copies have been processed, you end up with 1 instance of card 1, **`2`** instances of card 2, **`4`** instances of card 3, **`8`** instances of card 4, **`14`** instances of card 5, and **`1`** instance of card 6. In total, this example pile of scratchcards causes you to ultimately have **`30`** scratchcards!
Process all of the original and copied scratchcards until no more scratchcards are won. Including the original set of scratchcards, **how many total scratchcards do you end up with**?
Your puzzle answer was `5659035`.
**Both parts of this puzzle are complete! They provide two gold stars: `**`.**

View File

@ -160,4 +160,14 @@ mod day_4_tests {
fn test_part_2_example() {
assert_eq!(part_2(include_str!("../input_example_1.txt")), 30);
}
#[test]
fn test_part_1() {
assert_eq!(part_1(include_str!("../input.txt")), 24160);
}
#[test]
fn test_part_2() {
assert_eq!(part_2(include_str!("../input.txt")), 5659035);
}
}