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! { boilerplate! {
TEST_INPUT == "1000 TEST_INPUT == "\
1000
2000 2000
3000 3000

View File

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

View File

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

View File

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

View File

@ -74,7 +74,8 @@ fn part2(parsed: &Node<'_>) -> usize {
} }
boilerplate! { boilerplate! {
TEST_INPUT == "$ cd / TEST_INPUT == "\
$ cd /
$ ls $ ls
dir a dir a
14848514 b.txt 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]]; const TRANSPOSE_OUTPUT: &[[u8; 3]; 3] = &[[1, 4, 7], [2, 5, 8], [3, 6, 9]];
boilerplate! { boilerplate! {
TEST_INPUT == "30373 TEST_INPUT == "\
25512 30373\n\
65332 25512\n\
33549 65332\n\
35390", 33549\n\
35390\
",
tests: { tests: {
part1: { TEST_INPUT => 21 }, part1: { TEST_INPUT => 21 },
part2: { TEST_INPUT => 8 }, part2: { TEST_INPUT => 8 },

View File

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