Skip to content

Commit d6c8518

Browse files
committed
chore(ci): remove doc tests using macro
1 parent 085ff53 commit d6c8518

19 files changed

+2
-194
lines changed

rust/2017/day_01/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::time::Instant;
33
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
44

55
fn main() -> Result<()> {
6-
let input = parse_input(include_str!("../input"));
6+
let input = parse_input("input");
77

88
println!("Results for Day 1");
99
println!("============================");

rust/2017/day_02/src/main.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ where
1717
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
1818

1919
fn main() {
20-
let input = parse_input(include_str!("../input"));
20+
let input = parse_input("input");
2121

2222
println!("Results for Day 2");
2323
println!("============================");
@@ -64,12 +64,6 @@ mod tests {
6464
assert_eq!(day_02::part_01(&parse_input(data)), 18);
6565
}
6666

67-
#[test]
68-
fn real_input_part_01() {
69-
let input = parse_input(include_str!("../input"));
70-
assert_eq!(day_02::part_01(&input), 34925)
71-
}
72-
7367
#[test]
7468
fn test_data_part_02() {
7569
let data = "

rust/2023/src/day_01.rs

-12
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ fn sum_first_and_last_digit(line: &str) -> u32 {
4646
* Note that the last line only has one number, so it is repeated.
4747
*
4848
*/
49-
// Your puzzle answer was
50-
```
51-
use advent_of_code_2023::day_01::*;
52-
let data = include_str!("../input/2023/day1.txt");
53-
assert_eq!(solve_part_01(&input_generator(data)), 54304);
54-
```
5549
#[aoc(day1, part1)]
5650
pub fn solve_part_01(input: &str) -> u32 {
5751
input.lines().map(sum_first_and_last_digit).sum()
@@ -88,12 +82,6 @@ const TRANSLATIONS: [(&str, &str); 9] = [
8882
* Some of the numbers overlap, like eightwothree should be 823 when cleaned.
8983
*
9084
*/
91-
// Your puzzle answer was
92-
```
93-
use advent_of_code_2023::day_01::*;
94-
let data = include_str!("../input/2023/day1.txt");
95-
assert_eq!(solve_part_02(&input_generator(data)), 54418);
96-
```
9785
#[aoc(day1, part2)]
9886
pub fn solve_part_02(input: &str) -> u32 {
9987
input

rust/2023/src/day_04.rs

-12
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ pub fn input_generator(input: &str) -> Input {
5353
* So winning numbers sums for each card is:
5454
* 8 + 2 + 2 + 1 + 0 + 0 = 13
5555
*/
56-
// Your puzzle answer was
57-
```
58-
use advent_of_code_2023::day_04::*;
59-
let data = include_str!("../input/2023/day4.txt");
60-
assert_eq!(solve_part_01(&input_generator(data)), 27454);
61-
```
6256
#[aoc(day4, part1)]
6357
pub fn solve_part_01(input: &Input) -> u32 {
6458
input
@@ -85,12 +79,6 @@ pub fn solve_part_01(input: &Input) -> u32 {
8579
* Find out how many scratchcards we win.
8680
*
8781
*/
88-
// Your puzzle answer was
89-
```
90-
use advent_of_code_2023::day_04::*;
91-
let data = include_str!("../input/2023/day4.txt");
92-
assert_eq!(solve_part_02(&input_generator(data)), 6857330);
93-
```
9482
#[aoc(day4, part2)]
9583
pub fn solve_part_02(input: &Input) -> u32 {
9684
// Create a list of starting cards, one of each

rust/2023/src/day_05.rs

-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ pub fn input_generator(input: &str) -> Input {
141141
*
142142
* Given a list of seeds, and a list of maps, walk through the maps
143143
* to find the location of the seeds. Return the lowest location.
144-
*
145144
*/
146145
#[aoc(day5, part1)]
147146
pub fn solve_part_01(input: &Input) -> u64 {
@@ -157,8 +156,6 @@ pub fn solve_part_01(input: &Input) -> u64 {
157156
* number is the length of the range.
158157
*
159158
* Otherwise, the calculation is the same as part one. Just A LOT more seeds.
160-
*
161-
* No doctest for this one, it takes too long.
162159
*/
163160
#[aoc(day5, part2)]
164161
pub fn solve_part_02(input: &Input) -> u64 {

rust/2023/src/day_08.rs

-13
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,7 @@ pub fn input_generator(input: &str) -> Input {
6969
* We get a list of directions, and a list of instructions.
7070
* Steps through the directions, and select the correct instruction (left or right).
7171
* Keep track of the steps, and return the number of steps when we reach the ZZZ location.
72-
*
7372
*/
74-
// Your puzzle answer was
75-
#[doc = r#"```
76-
use advent_of_code_2023::day_08::*;
77-
let data = include_str!("../input/2023/day8.txt");
78-
assert_eq!(solve_part_01(&input_generator(data)), 22411);
79-
```"#]
8073
#[aoc(day8, part1)]
8174
pub fn solve_part_01(input: &Input) -> u64 {
8275
let Input {
@@ -108,13 +101,7 @@ pub fn solve_part_01(input: &Input) -> u64 {
108101
* with an A as a start location. We then need to calculate the
109102
* number of steps it takes for _all of them_ to reach a location
110103
* that ends with a Z.
111-
*
112104
*/
113-
#[doc = r#"```
114-
use advent_of_code_2023::day_08::*;
115-
let data = include_str!("../input/2023/day8.txt");
116-
assert_eq!(solve_part_02(&input_generator(data)), 11188774513823);
117-
```"#]
118105
#[aoc(day8, part2)]
119106
pub fn solve_part_02(input: &Input) -> i64 {
120107
let Input {

rust/2023/src/day_09.rs

-11
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ pub fn input_generator(input: &str) -> Input {
7070
* Add all the last values together, and you get the answer = 114
7171
*
7272
*/
73-
// Your puzzle answer was
74-
#[doc = r#"```
75-
use advent_of_code_2023::day_09::*;
76-
let data = include_str!("../input/2023/day9.txt");
77-
assert_eq!(solve_part_01(&input_generator(data)), 1853145119);
78-
```"#]
7973
#[aoc(day9, part1)]
8074
pub fn solve_part_01(input: &Input) -> i64 {
8175
input
@@ -110,11 +104,6 @@ pub fn solve_part_01(input: &Input) -> i64 {
110104
* Add all the first values together, and you get the answer = 2
111105
*
112106
*/
113-
#[doc = r#"```
114-
use advent_of_code_2023::day_09::*;
115-
let data = include_str!("../input/2023/day9.txt");
116-
assert_eq!(solve_part_02(&input_generator(data)), 923);
117-
```"#]
118107
#[aoc(day9, part2)]
119108
pub fn solve_part_02(input: &Input) -> i64 {
120109
input

rust/2023/src/day_11.rs

-12
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,14 @@ fn galaxy_distance(input: &Input, expansion_rate: usize) -> usize {
7777
*
7878
*
7979
*/
80-
// Your puzzle answer was
81-
#[doc = r#"```
82-
use advent_of_code_2023::day_11::*;
83-
let data = include_str!("../input/2023/day11.txt");
84-
assert_eq!(solve_part_01(&input_generator(data)), 9795148);
85-
```"#]
8680
#[aoc(day11, part1)]
8781
pub fn solve_part_01(input: &Input) -> usize {
8882
galaxy_distance(input, 2)
8983
}
9084

9185
/* Part Two
9286
*
93-
*
9487
*/
95-
#[doc = r#"```
96-
use advent_of_code_2023::day_11::*;
97-
let data = include_str!("../input/2023/day11.txt");
98-
assert_eq!(solve_part_02(&input_generator(data)), 650672493820);
99-
```"#]
10088
#[aoc(day11, part2)]
10189
pub fn solve_part_02(input: &Input) -> usize {
10290
galaxy_distance(input, 1_000_000)

rust/2023/src/day_12.rs

-11
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ pub fn possible_arrangements(springs: &[u8], damaged: &[usize]) -> usize {
8484
*
8585
*
8686
*/
87-
// Your puzzle answer was
88-
#[doc = r#"```
89-
use advent_of_code_2023::day_12::*;
90-
let data = include_str!("../input/2023/day12.txt");
91-
assert_eq!(solve_part_01(&input_generator(data)), 8270);
92-
```"#]
9387
#[aoc(day12, part1)]
9488
pub fn solve_part_01(input: &Input) -> usize {
9589
input
@@ -103,11 +97,6 @@ pub fn solve_part_01(input: &Input) -> usize {
10397
*
10498
*
10599
*/
106-
#[doc = r#"```
107-
use advent_of_code_2023::day_12::*;
108-
let data = include_str!("../input/2023/day12.txt");
109-
assert_eq!(solve_part_02(&input_generator(data)), 204640299929836);
110-
```"#]
111100
#[aoc(day12, part2)]
112101
pub fn solve_part_02(input: &Input) -> usize {
113102
input

rust/2023/src/day_13.rs

-13
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,15 @@ fn summarize(input: &Input, smudges: i32) -> i32 {
8383

8484
/* Part One
8585
*
86-
*
8786
*/
88-
// Your puzzle answer was
89-
#[doc = r#"```
90-
use advent_of_code_2023::day_13::*;
91-
let data = include_str!("../input/2023/day13.txt");
92-
assert_eq!(solve_part_01(&input_generator(data)), 27300);
93-
```"#]
9487
#[aoc(day13, part1)]
9588
pub fn solve_part_01(input: &Input) -> i32 {
9689
summarize(input, 0)
9790
}
9891

9992
/* Part Two
10093
*
101-
*
10294
*/
103-
#[doc = r#"```
104-
use advent_of_code_2023::day_13::*;
105-
let data = include_str!("../input/2023/day13.txt");
106-
assert_eq!(solve_part_02(&input_generator(data)), 29276);
107-
```"#]
10895
#[aoc(day13, part2)]
10996
pub fn solve_part_02(input: &Input) -> i32 {
11097
summarize(input, 1)

rust/2023/src/day_14.rs

-13
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ fn tilt_north(grid: &mut Grid<u8>) {
6262

6363
/* Part One
6464
*
65-
*
6665
*/
67-
// Your puzzle answer was
68-
#[doc = r#"```
69-
use advent_of_code_2023::day_14::*;
70-
let data = include_str!("../input/2023/day14.txt");
71-
assert_eq!(solve_part_01(&input_generator(data)), 108614);
72-
```"#]
7366
#[aoc(day14, part1)]
7467
pub fn solve_part_01(input: &Input) -> i32 {
7568
let mut grid = input.grid.clone();
@@ -80,13 +73,7 @@ pub fn solve_part_01(input: &Input) -> i32 {
8073

8174
/* Part Two
8275
*
83-
*
8476
*/
85-
#[doc = r#"```
86-
use advent_of_code_2023::day_14::*;
87-
let data = include_str!("../input/2023/day14.txt");
88-
assert_eq!(solve_part_02(&input_generator(data)), 96447);
89-
```"#]
9077
#[aoc(day14, part2)]
9178
pub fn solve_part_02(input: &Input) -> i32 {
9279
let mut grid = input.grid.clone();

rust/2023/src/day_15.rs

-13
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@ fn hash(steps: &str) -> usize {
4141
*
4242
* Get the ASCII value of each character in the sequence and add it to 0.
4343
* Then multiply the result by 17 and get the remainder of 256.
44-
*
4544
*/
46-
// Your puzzle answer was
47-
#[doc = r#"```
48-
use advent_of_code_2023::day_15::*;
49-
let data = include_str!("../input/2023/day15.txt");
50-
assert_eq!(solve_part_01(&input_generator(data)), 516070);
51-
```"#]
5245
#[aoc(day15, part1)]
5346
pub fn solve_part_01(input: &Input) -> usize {
5447
input.steps.iter().map(|step| hash(step)).sum()
@@ -61,13 +54,7 @@ pub fn solve_part_01(input: &Input) -> usize {
6154
*
6255
* Then get the "focusing power" by multiplying the box number + 1 with the
6356
* sequence number + 1 and the operation.
64-
*
6557
*/
66-
#[doc = r#"```
67-
use advent_of_code_2023::day_15::*;
68-
let data = include_str!("../input/2023/day15.txt");
69-
assert_eq!(solve_part_02(&input_generator(data)), 244981);
70-
```"#]
7158
#[aoc(day15, part2)]
7259
pub fn solve_part_02(input: &Input) -> usize {
7360
let mut boxes = vec![Vec::new(); 256];

rust/2023/src/day_16.rs

-12
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ pub fn input_generator(input: &str) -> Input {
9999
* Find the number of energized tiles after firing the beam from the top left
100100
* of the grid.
101101
*/
102-
// Your puzzle answer was
103-
#[doc = r#"```
104-
use advent_of_code_2023::day_16::*;
105-
let data = include_str!("../input/2023/day16.txt");
106-
assert_eq!(solve_part_01(&input_generator(data)), 7562);
107-
```"#]
108102
#[aoc(day16, part1)]
109103
pub fn solve_part_01(input: &Input) -> usize {
110104
fire_ze_lasers(input, Beam::new(ORIGIN, RIGHT))
@@ -114,13 +108,7 @@ pub fn solve_part_01(input: &Input) -> usize {
114108
*
115109
* Find the maximum number of energized tiles after firing the beam
116110
* inwards from all edges of the grid.
117-
*
118111
*/
119-
#[doc = r#"```
120-
use advent_of_code_2023::day_16::*;
121-
let data = include_str!("../input/2023/day16.txt");
122-
assert_eq!(solve_part_02(&input_generator(data)), 7793);
123-
```"#]
124112
#[aoc(day16, part2)]
125113
pub fn solve_part_02(input: &Input) -> usize {
126114
let mut possible_starts = vec![];

rust/2023/src/day_17.rs

-13
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,7 @@ fn dijkstra(grid: &Grid<u8>, min_steps: u32, max_steps: u32) -> u32 {
9595
* Find the lowest cost path from the top left corner to the bottom
9696
* right corner. You can only move a maximum of 3 steps in a straight
9797
* line before needing to turn left or right.
98-
*
9998
*/
100-
// Your puzzle answer was
101-
#[doc = r#"```
102-
use advent_of_code_2023::day_17::*;
103-
let data = include_str!("../input/2023/day17.txt");
104-
assert_eq!(solve_part_01(&input_generator(data)), 1013);
105-
```"#]
10699
#[aoc(day17, part1)]
107100
pub fn solve_part_01(input: &Input) -> u32 {
108101
dijkstra(&input.grid, 1, 3)
@@ -115,13 +108,7 @@ pub fn solve_part_01(input: &Input) -> u32 {
115108
* line before needing to turn left or right. You must take at least
116109
* 4 steps before turning left or right, this includes at least
117110
* 4 steps before reaching the end.
118-
*
119111
*/
120-
#[doc = r#"```
121-
use advent_of_code_2023::day_17::*;
122-
let data = include_str!("../input/2023/day17.txt");
123-
assert_eq!(solve_part_02(&input_generator(data)), 1215);
124-
```"#]
125112
#[aoc(day17, part2)]
126113
pub fn solve_part_02(input: &Input) -> u32 {
127114
dijkstra(&input.grid, 4, 10)

rust/2023/src/day_19.rs

-12
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ pub fn input_generator(input: &str) -> Input {
7979
/* Part One
8080
*
8181
*/
82-
// Your puzzle answer was
83-
#[doc = r#"```
84-
use advent_of_code_2023::day_19::*;
85-
let data = include_str!("../input/2023/day19.txt");
86-
assert_eq!(solve_part_01(&input_generator(data)), 331208);
87-
```"#]
8882
#[aoc(day19, part1)]
8983
pub fn solve_part_01(input: &Input) -> u64 {
9084
let mut accepted = 0;
@@ -211,13 +205,7 @@ fn count_accepted(
211205

212206
/* Part Two
213207
*
214-
*
215208
*/
216-
#[doc = r#"```
217-
use advent_of_code_2023::day_19::*;
218-
let data = include_str!("../input/2023/day19.txt");
219-
assert_eq!(solve_part_02(&input_generator(data)), 121464316215623);
220-
```"#]
221209
#[aoc(day19, part2)]
222210
pub fn solve_part_02(input: &Input) -> u64 {
223211
let mut ranges: HashMap<char, (u64, u64)> = HashMap::new();

0 commit comments

Comments
 (0)