aoc2025 test script
This commit is contained in:
36
scripts/aoc25
Executable file
36
scripts/aoc25
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
mkdir -p tmp
|
||||
echo "Test AoC 2025 solutions"
|
||||
NCC="node newt.js"
|
||||
total=0
|
||||
failed=0
|
||||
for fn in aoc2025/Day*.newt; do
|
||||
total=$((total + 1))
|
||||
echo Test $fn
|
||||
bn=$(basename $fn)
|
||||
$NCC $fn -o out.js > tmp/${bn}.compile
|
||||
if [ $? != "0" ]; then
|
||||
echo Compile failed for $fn
|
||||
failed=$((failed + 1))
|
||||
continue
|
||||
fi
|
||||
# if there is a golden file, run the code and compare output
|
||||
if [ -f ${fn}.golden ]; then
|
||||
node out.js > tmp/${bn}.out
|
||||
if [ $? != "0" ]; then
|
||||
echo Run failed for $fn
|
||||
failed=$((failed + 1))
|
||||
continue
|
||||
fi
|
||||
if ! diff -q tmp/${bn}.out ${fn}.golden; then
|
||||
echo "Output mismatch for $fn"
|
||||
failed=$((failed + 1))
|
||||
if [ $1 = "--fix" ]; then
|
||||
cp tmp/${bn}.out ${fn}.golden
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Total tests: $total"
|
||||
echo "Failed tests: $failed"
|
||||
Reference in New Issue
Block a user