Solve 2024-16 (part 1)
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { solveFirst, solveSecond } from './index.ts';
|
||||
|
||||
describe('2024-16', () => {
|
||||
it('first', () => {
|
||||
const testInput = `###############
|
||||
#.......#....E#
|
||||
#.#.###.#.###.#
|
||||
#.....#.#...#.#
|
||||
#.###.#####.#.#
|
||||
#.#.#.......#.#
|
||||
#.#.#####.###.#
|
||||
#...........#.#
|
||||
###.#.#####.#.#
|
||||
#...#.....#.#.#
|
||||
#.#.#.###.#.#.#
|
||||
#.....#...#.#.#
|
||||
#.###.#.#.#.#.#
|
||||
#S..#.....#...#
|
||||
###############`;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
expect(solveFirst(testInput)).toBe(7036);
|
||||
expect(
|
||||
solveFirst(`#################
|
||||
#...#...#...#..E#
|
||||
#.#.#.#.#.#.#.#.#
|
||||
#.#.#.#...#...#.#
|
||||
#.#.#.#.###.#.#.#
|
||||
#...#.#.#.....#.#
|
||||
#.#.#.#.#.#####.#
|
||||
#.#...#.#.#.....#
|
||||
#.#.#####.#.###.#
|
||||
#.#.#.......#...#
|
||||
#.#.###.#####.###
|
||||
#.#.#...#.....#.#
|
||||
#.#.#.#####.###.#
|
||||
#.#.#.........#.#
|
||||
#.#.#.#########.#
|
||||
#S#.............#
|
||||
#################`)
|
||||
).toBe(11048);
|
||||
expect(
|
||||
solveFirst(`####################################################
|
||||
#......................................#..........E#
|
||||
#......................................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.................#...........#
|
||||
#....................#.............................#
|
||||
#S...................#.............................#
|
||||
####################################################`)
|
||||
).toBe(5078);
|
||||
expect(
|
||||
solveFirst(`###########################
|
||||
#######################..E#
|
||||
######################..#.#
|
||||
#####################..##.#
|
||||
####################..###.#
|
||||
###################..##...#
|
||||
##################..###.###
|
||||
#################..####...#
|
||||
################..#######.#
|
||||
###############..##.......#
|
||||
##############..###.#######
|
||||
#############..####.......#
|
||||
############..###########.#
|
||||
###########..##...........#
|
||||
##########..###.###########
|
||||
#########..####...........#
|
||||
########..###############.#
|
||||
#######..##...............#
|
||||
######..###.###############
|
||||
#####..####...............#
|
||||
####..###################.#
|
||||
###..##...................#
|
||||
##..###.###################
|
||||
#..####...................#
|
||||
#.#######################.#
|
||||
#S........................#
|
||||
###########################`)
|
||||
).toBe(21148);
|
||||
}
|
||||
});
|
||||
it('second', () => {
|
||||
// TODO: add second input
|
||||
const testInput = ``;
|
||||
// TODO: add second solution
|
||||
expect(solveSecond(testInput)).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user