summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authormhsn <mail@mhsn.net>2024-12-01 12:01:00 +0000
committermhsn <mail@mhsn.net>2024-12-01 12:01:00 +0000
commit9015922392c9881ca62871692c3a6671243c1fe3 (patch)
tree3ced4980927b65675c07cfc0d8967feba85cf3b7 /check
parent0b1a6fc65a62a656bef6055027faf2f5e1f3235a (diff)
downloadaoc-9015922392c9881ca62871692c3a6671243c1fe3.tar.gz
aoc-9015922392c9881ca62871692c3a6671243c1fe3.zip
Add util scripts
Diffstat (limited to 'check')
-rwxr-xr-xcheck25
1 files changed, 25 insertions, 0 deletions
diff --git a/check b/check
new file mode 100755
index 0000000..06f444b
--- /dev/null
+++ b/check
@@ -0,0 +1,25 @@
+#!/usr/bin/env zsh
+
+year=$1
+day=$2
+lang=$3
+input=$4
+
+
+script=$(readlink -f "$0")
+script_path=$(dirname "$script")
+
+aoc_path=$script_path/$1/$2
+data_path="$aoc_path/data/$4.txt"
+
+if [[ $lang == "python" ]]; then
+ got=$(cat $data_path | python $aoc_path/python/main.py)
+elif [[ $lang == "rust" ]]; then
+ got=$(cat $data_path | cargo run --manifest-path $aoc_path/rust/Cargo.toml -- <(cat $data_path))
+else
+ echo "Unknown lang: $lang"
+ exit 1
+fi
+
+diff <(echo $got) "$aoc_path/data/$4.ans" && echo "Solved with $lang!"
+echo $got