File tree 4 files changed +20
-12
lines changed
4 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ import { commands } from './day-02-dive.input';
3
3
4
4
describe ( 'Day 2 - Dive' , ( ) => {
5
5
test ( 'should throw Error for unknown commands' , ( ) => {
6
- const measurer = new DiverCommandsInterpreter ( [ [ 'unknown' , 1 ] ] ) ;
7
- expect ( ( ) => measurer . computeOffsetFromCommands ( ) ) . toThrowError ( ) ;
6
+ expect ( ( ) => {
7
+ const measurer = new DiverCommandsInterpreter ( [ [ 'unknown' , 1 ] ] ) ;
8
+ measurer . computeOffsetFromCommands ( ) ;
9
+ } ) . toThrowError ( ) ;
8
10
} ) ;
9
11
test ( 'should return [0, 0] for no commands' , ( ) => {
10
12
const measurer = new DiverCommandsInterpreter ( [ ] ) ;
Original file line number Diff line number Diff line change @@ -3,12 +3,16 @@ import { binaryNumbers } from './day-03-binary-diagnostic.input';
3
3
4
4
describe ( 'Day 3 - Binary Diagnostic' , ( ) => {
5
5
test ( 'should throw Error for empty readings' , ( ) => {
6
- const calculator = new DiagnosticReportCalculator ( [ ] ) ;
7
- expect ( ( ) => calculator . computeEpsilonAndGamma ( ) ) . toThrowError ( ) ;
6
+ expect ( ( ) => {
7
+ const calculator = new DiagnosticReportCalculator ( [ ] ) ;
8
+ calculator . computeEpsilonAndGamma ( ) ;
9
+ } ) . toThrowError ( ) ;
8
10
} ) ;
9
11
test ( 'should throw Error for inconsistent reading lengths' , ( ) => {
10
- const calculator = new DiagnosticReportCalculator ( [ '1' , '01' ] ) ;
11
- expect ( ( ) => calculator . computeEpsilonAndGamma ( ) ) . toThrowError ( ) ;
12
+ expect ( ( ) => {
13
+ const calculator = new DiagnosticReportCalculator ( [ '1' , '01' ] ) ;
14
+ calculator . computeEpsilonAndGamma ( ) ;
15
+ } ) . toThrowError ( ) ;
12
16
} ) ;
13
17
test ( 'should return 2743844 for puzzle part 1 answer' , ( ) => {
14
18
const calculator = new DiagnosticReportCalculator ( binaryNumbers ) ;
Original file line number Diff line number Diff line change 1
- import { BingoSolver , NO_WINNING_BOARDS_ERROR } from './day-04-bingo-squid' ;
1
+ import { BingoSolver , NO_BOARDS_PROVIDED_ERROR } from './day-04-bingo-squid' ;
2
2
import { boards , drawnNumbers } from './day-04-bingo-squid.input' ;
3
3
import { exampleBoards , exampleDrawnNumbers } from './day-04-bingo-squid.example' ;
4
4
5
5
describe ( 'Day 4 - Bingo Squid' , ( ) => {
6
- test ( 'should throw NO_WINNING_BOARDS_ERROR for empty boards' , ( ) => {
7
- const solver = new BingoSolver ( [ ] , [ ] ) ;
8
- expect ( ( ) => solver . computeWinningBoard ( ) ) . toThrowError ( NO_WINNING_BOARDS_ERROR ) ;
6
+ test ( 'should throw NO_BOARDS_PROVIDED_ERROR for empty boards' , ( ) => {
7
+ expect ( ( ) => {
8
+ const solver = new BingoSolver ( [ ] , [ ] ) ;
9
+ solver . computeWinningBoard ( ) ;
10
+ } ) . toThrowError ( NO_BOARDS_PROVIDED_ERROR ) ;
9
11
} ) ;
10
12
test ( 'should be able to compute winning board score from example input' , ( ) => {
11
13
const solver = new BingoSolver ( exampleBoards , exampleDrawnNumbers ) ;
Original file line number Diff line number Diff line change 1
- export const NO_DRAWN_NUMBERS_PROVIDED_ERROR = new Error ( 'There are no drawn numbers' ) ;
2
- export const NO_BOARDS_PROVIDED_ERROR = new Error ( 'There are no drawn numbers' ) ;
1
+ export const NO_DRAWN_NUMBERS_PROVIDED_ERROR = new Error ( 'No drawn numbers provided ' ) ;
2
+ export const NO_BOARDS_PROVIDED_ERROR = new Error ( 'No board numbers provided ' ) ;
3
3
export const NO_WINNING_BOARDS_ERROR = new Error ( 'There are no winning boards' ) ;
4
4
5
5
export interface WinningBoardResult {
You can’t perform that action at this time.
0 commit comments