escape newlines in test inputs

This commit is contained in:
kageru 2022-12-09 12:50:12 +01:00
parent dd34e0a854
commit 98ebcaecb4
7 changed files with 50 additions and 39 deletions

View File

@ -20,7 +20,8 @@ fn part2(parsed: &Parsed) -> usize {
}
boilerplate! {
TEST_INPUT == "1000
TEST_INPUT == "\
1000
2000
3000

View File

@ -35,10 +35,11 @@ fn part2(parsed: &str) -> usize {
}
boilerplate! {
TEST_INPUT == "A Y
B X
C Z
",
TEST_INPUT == "\
A Y\n\
B X\n\
C Z\n\
",
tests: {
part1: { TEST_INPUT => 15 },
part2: {

View File

@ -40,12 +40,14 @@ fn part2(parsed: &Parsed) -> usize {
}
boilerplate! {
TEST_INPUT == "vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw",
TEST_INPUT == "\
vJrwpWtwJgWrhcsFMMfFFhFp\n\
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL\n\
PmmdzqPrVvPwwTWBwg\n\
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn\n\
ttgJtRGJQctTZtZT\n\
CrZsJsPPZsGzwwsLwLmpwMDw\
",
tests: {
part1: { TEST_INPUT => 157 },
part2: { TEST_INPUT => 70 },

View File

@ -30,12 +30,14 @@ fn part2(parsed: &Parsed) -> usize {
}
boilerplate! {
TEST_INPUT == "2-4,6-8
2-3,4-5
5-7,7-9
2-8,3-7
6-6,4-6
2-6,4-8",
TEST_INPUT == "\
2-4,6-8\n\
2-3,4-5\n\
5-7,7-9\n\
2-8,3-7\n\
6-6,4-6\n\
2-6,4-8\
",
tests: {
part1: { TEST_INPUT => 2 },
part2: { TEST_INPUT => 4 },

View File

@ -74,7 +74,8 @@ fn part2(parsed: &Node<'_>) -> usize {
}
boilerplate! {
TEST_INPUT == "$ cd /
TEST_INPUT == "\
$ cd /
$ ls
dir a
14848514 b.txt

View File

@ -82,11 +82,13 @@ const TEST_OUTPUT: &[bool] = &[true, true, false, true, false];
const TRANSPOSE_OUTPUT: &[[u8; 3]; 3] = &[[1, 4, 7], [2, 5, 8], [3, 6, 9]];
boilerplate! {
TEST_INPUT == "30373
25512
65332
33549
35390",
TEST_INPUT == "\
30373\n\
25512\n\
65332\n\
33549\n\
35390\
",
tests: {
part1: { TEST_INPUT => 21 },
part2: { TEST_INPUT => 8 },

View File

@ -63,26 +63,28 @@ fn step_towards(tail: &mut (i32, i32), head: (i32, i32)) -> bool {
}
boilerplate! {
TEST_INPUT == "R 4
U 4
L 3
D 1
R 4
D 1
L 5
R 2",
TEST_INPUT == "\
R 4\n\
U 4\n\
L 3\n\
D 1\n\
R 4\n\
D 1\n\
L 5\n\
R 2\
",
tests: {
part1: { TEST_INPUT => 13 },
part2: {
TEST_INPUT => 1,
"R 5
U 8
L 8
D 3
R 17
D 10
L 25
U 20" => 36,
"R 5\n\
U 8\n\
L 8\n\
D 3\n\
R 17\n\
D 10\n\
L 25\n\
U 20" => 36,
},
},
bench1 == 6367,