67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
import {getFurthestDistance, tilesContained} from "./day_ten";
|
|
|
|
describe('Day Ten', () => {
|
|
it.each([
|
|
[`.....
|
|
.S-7.
|
|
.|.|.
|
|
.L-J.
|
|
.....`, 4], [
|
|
`-L|F7
|
|
7S-7|
|
|
L|7||
|
|
-L-J|
|
|
L|-JF`, 4],
|
|
[`..F7.
|
|
.FJ|.
|
|
SJ.L7
|
|
|F--J
|
|
LJ...`, 8]
|
|
])('should calculate the number of steps to the exit', (input, expected) => {
|
|
const result = getFurthestDistance(input);
|
|
expect(result).toEqual(expected);
|
|
});
|
|
|
|
describe('Part Two', () => {
|
|
it.each([
|
|
['.....\n' +
|
|
'.S-7.\n' +
|
|
'.|.|.\n' +
|
|
'.L-J.\n' +
|
|
'.....', 1],
|
|
['...........\n' +
|
|
'.S-------7.\n' +
|
|
'.|F-----7|.\n' +
|
|
'.||.....||.\n' +
|
|
'.||.....||.\n' +
|
|
'.|L-7.F-J|.\n' +
|
|
'.|..|.|..|.\n' +
|
|
'.L--J.L--J.\n' +
|
|
'...........\n', 4],
|
|
['.F----7F7F7F7F-7....\n' +
|
|
'.|F--7||||||||FJ....\n' +
|
|
'.||.FJ||||||||L7....\n' +
|
|
'FJL7L7LJLJ||LJ.L-7..\n' +
|
|
'L--J.L7...LJS7F-7L7.\n' +
|
|
'....F-J..F7FJ|L7L7L7\n' +
|
|
'....L7.F7||L7|.L7L7|\n' +
|
|
'.....|FJLJ|FJ|F7|.LJ\n' +
|
|
'....FJL-7.||.||||...\n' +
|
|
'....L---J.LJ.LJLJ...', 8],
|
|
['FF7FSF7F7F7F7F7F---7\n' +
|
|
'L|LJ||||||||||||F--J\n' +
|
|
'FL-7LJLJ||||||LJL-77\n' +
|
|
'F--JF--7||LJLJ7F7FJ-\n' +
|
|
'L---JF-JLJ.||-FJLJJ7\n' +
|
|
'|F|F-JF---7F7-L7L|7|\n' +
|
|
'|FFJF7L7F-JF7|JL---7\n' +
|
|
'7-L-JL7||F7|L7F-7F7|\n' +
|
|
'L.L7LFJ|||||FJL7||LJ\n' +
|
|
'L7JLJL-JLJLJL--JLJ.L', 10]
|
|
])('should count the number of tiles fully contained within the loop', (input, expected) => {
|
|
// const result = tilesContained(input);
|
|
const result = tilesContained(input);
|
|
expect(result).toEqual(expected);
|
|
})
|
|
});
|
|
}); |