adventofcode/2023/03/part1.t
2023-12-03 15:12:17 -05:00

38 lines
584 B
Perl

use 5.38.0;
use Test2::V0;
use Path::Tiny;
use Part1;
my $input = path('input')->slurp;
my $example = <<'END';
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..
END
is [Part1::find_numbers('467..114..')] => [
{ n => 467, prefix => 0, length =>3 },
{ n => 114, prefix => 5, length =>3 },
];
my @n = Part1::numbers_near_symbols($example);
is 0+@n => 8;
is [ map { $_->{n}} @n] => [467,35,633,617,592,755,664,598];
is Part1::solution_1($example) => 4361;
is Part1::solution_1($input) => 'TODO';
done_testing;