Fix testing output

This commit is contained in:
2024-12-02 13:11:48 +01:00
parent 8e1060e6a4
commit b5fd8a73fa
4 changed files with 9 additions and 20 deletions
+1 -7
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'bun:test'; import { describe, expect, it } from 'bun:test';
import { solveFirst, solveSecond } from './index.ts'; import { solveFirst } from './index.ts';
describe('2023-25', () => { describe('2023-25', () => {
it('first', () => { it('first', () => {
@@ -18,10 +18,4 @@ rzs: qnr cmg lsr rsh
frs: qnr lhk lsr`; frs: qnr lhk lsr`;
expect(solveFirst(testInput)).toBe(54); expect(solveFirst(testInput)).toBe(54);
}); });
it('second', () => {
// TODO: add second input
const testInput = ``;
// TODO: add second solution
expect(solveSecond(testInput)).toBe(0);
});
}); });
+4 -8
View File
@@ -73,13 +73,9 @@ export function solveFirst(input: string): number {
mult = result.mult; mult = result.mult;
} while (edgeLength > 3); } while (edgeLength > 3);
console.log(`That took ${i} tries`); if (process.env.NODE_ENV !== 'test') {
console.log(mult); console.log(`That took ${i} tries`);
console.log(mult);
}
return mult; return mult;
} }
export function solveSecond(input: string): number {
// TODO: add code
return 0;
}
+1 -5
View File
@@ -1,12 +1,8 @@
import { join } from 'path'; import { join } from 'path';
import { solveFirst, solveSecond } from './index.ts'; import { solveFirst } from './index.ts';
const input = await Bun.file(join(__dirname, 'input.txt')).text(); const input = await Bun.file(join(__dirname, 'input.txt')).text();
const firstAnswer = solveFirst(input); const firstAnswer = solveFirst(input);
console.log(firstAnswer); console.log(firstAnswer);
const secondAnswer = solveSecond(input);
console.log(secondAnswer);
+3
View File
@@ -13,5 +13,8 @@ describe('2024-02', () => {
}); });
it('second', () => { it('second', () => {
expect(solveSecond(testInput)).toBe(4); expect(solveSecond(testInput)).toBe(4);
expect(solveSecond(testInput)).toBeGreaterThanOrEqual(
solveFirst(testInput)
);
}); });
}); });