add script to quickly set up puzzle code templates
This commit is contained in:
parent
0b21259853
commit
618a65bb5d
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
day=$1
|
||||||
|
day_long=$(printf "%02d" "$day")
|
||||||
|
dir="day_$day_long"
|
||||||
|
|
||||||
|
puzzle_name=$2
|
||||||
|
|
||||||
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
cp solution.ts.template "$dir/solution.ts"
|
||||||
|
|
||||||
|
sed -e "s/%%DAY%%/$day/g" \
|
||||||
|
-e "s/%%DAY_LONG%%/$day_long/g" \
|
||||||
|
-e "s/%%PUZZLE_NAME%%/$puzzle_name/g" \
|
||||||
|
solution.test.ts.template > "$dir/solution.test.ts"
|
||||||
|
|
||||||
|
./get_input.sh "$day"
|
||||||
|
|
||||||
|
touch "$dir/sample.txt"
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { readlines } from "../_utils";
|
||||||
|
|
||||||
|
const solution = require("./solution");
|
||||||
|
|
||||||
|
describe("day %%DAY%%: %%PUZZLE_NAME%%, pt 1", () => {
|
||||||
|
test("sample input", async () => {
|
||||||
|
const sample = await readlines("./day_%%DAY_LONG%%/sample.txt");
|
||||||
|
expect(solution.part1_solver(sample)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("submission input", async () => {
|
||||||
|
const input = await readlines("./day_%%DAY_LONG%%/input.txt");
|
||||||
|
expect(solution.part1_solver(input)).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("day %%DAY%%: %%PUZZLE_NAME%%, pt 2", () => {
|
||||||
|
test("sample input", async () => {
|
||||||
|
const sample = await readlines("./day_%%DAY_LONG%%/sample.txt");
|
||||||
|
expect(solution.part2_solver(sample)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("submission input", async () => {
|
||||||
|
const input = await readlines("./day_%%DAY_LONG%%/input.txt");
|
||||||
|
expect(solution.part2_solver(input)).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
export function part1_solver(lines: string[]): number {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
export function part2_solver(lines: string[]): number {
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue