27 lines
740 B
TypeScript
27 lines
740 B
TypeScript
import {Observatory} from "./day_eleven";
|
|
|
|
describe('Observatory', () => {
|
|
const input = `...#......
|
|
.......#..
|
|
#.........
|
|
..........
|
|
......#...
|
|
.#........
|
|
.........#
|
|
..........
|
|
.......#..
|
|
#...#.....`;
|
|
|
|
it('should calculate the shortest path between every galaxy', () => {
|
|
const observatory = new Observatory(input);
|
|
expect(observatory.shortestPaths).toEqual(82000210);
|
|
});
|
|
|
|
it.each([
|
|
[[9, 0], [9, 4], 1_000_004],
|
|
[[0, 3], [8, 7], 3_000_012],
|
|
])(`should calculate the distance between two galaxies`, (galaxyOne, galaxyTwo, expectedDistance) => {
|
|
const observatory = new Observatory(input);
|
|
expect(observatory.distanceBetween(galaxyOne as [number, number], galaxyTwo as [number, number])).toEqual(expectedDistance);
|
|
});
|
|
}); |