advent-of-code-2023/src/day_six.test.ts

21 lines
613 B
TypeScript

import {BoatRace, Race} from "./day_six";
describe('Day Six', () => {
const input = `Time: 7 15 30
Distance: 9 40 200`;
it.each([
[[7, 9], 4],
[[15, 40], 8],
[[30, 200], 9],
[[71530, 940200], 71503]
])('should calculate that race %s could be won %s different ways', (race, expected) => {
const boatRace = new BoatRace(input);
expect(boatRace.numberOfWinningMethods(race as Race)).toEqual(expected);
});
it('should calculate the total number of winning methods', () => {
const boatRace = new BoatRace(input);
expect(boatRace.totalNumberOfWaysToBeatRace()).toEqual(71503);
})
});