Skip to content

Commit

Permalink
Add indoc crate for multiline string literals
Browse files Browse the repository at this point in the history
The `indoc!` macro creates an unindented multiline string at compile time,
which looks better than newline escapes `\n`.
  • Loading branch information
eljamm committed Feb 5, 2024
1 parent 38759ce commit f2ff96e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ tinyjson = "2.5.1"
# Solution dependencies
regex = "1.10.3"
itertools = "0.12.1"
indoc = "2.0.4"
33 changes: 33 additions & 0 deletions data/examples/05.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
seeds: 79 14 55 13

seed-to-soil map:
50 98 2
52 50 48

soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15

fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4

water-to-light map:
88 18 7
18 25 70

light-to-temperature map:
45 77 23
81 45 19
68 64 13

temperature-to-humidity map:
0 69 1
1 0 69

humidity-to-location map:
60 56 37
56 93 4
26 changes: 26 additions & 0 deletions src/bin/05.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
advent_of_code::solution!(5);

pub fn part_one(input: &str) -> Option<u32> {
None
}

pub fn part_two(_input: &str) -> Option<u32> {
None
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_part_one() {
let result = part_one(&advent_of_code::template::read_file("examples", DAY));
assert_eq!(result, None);
}

#[test]
fn test_part_two() {
let result = part_two(&advent_of_code::template::read_file("examples", DAY));
assert_eq!(result, None);
}
}

0 comments on commit f2ff96e

Please sign in to comment.