29 lines
704 B
JavaScript
29 lines
704 B
JavaScript
|
import { test, expect } from "vitest";
|
||
|
|
||
|
import { expectSolution } from '../01/main.js';
|
||
|
import { parseInput, sampleInput, puzzleInput, mapScores, solutionPart1 } from './part1.js';
|
||
|
|
||
|
test( "input parsing", () => {
|
||
|
expect(parseInput(sampleInput)).toEqual([['A','B'],['B','A'],['C','C']]);
|
||
|
});
|
||
|
|
||
|
test( "mapScore", () => {
|
||
|
expect( mapScores(['A','B']) ).toEqual([6,2]);
|
||
|
expect( mapScores(['B','A']) ).toEqual([0,1]);
|
||
|
expect( mapScores(['C','C']) ).toEqual([3,3]);
|
||
|
});
|
||
|
|
||
|
test( "part 1, sample", () => {
|
||
|
expect(
|
||
|
solutionPart1(sampleInput)
|
||
|
).toEqual(15)
|
||
|
|
||
|
});
|
||
|
|
||
|
test("part 1", () => {
|
||
|
expectSolution(solutionPart1(puzzleInput)).toEqual(12458);
|
||
|
});
|
||
|
|
||
|
test.todo("part 2", () => {
|
||
|
});
|