summaryrefslogtreecommitdiff
path: root/check
blob: 7f81561a0d5b3ebd379960ddccd973fc9feb9cc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env sh

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 --)
else
    echo "Unknown lang: $lang"
    exit 1
fi

echo "$got" | diff $aoc_path/data/$4.ans - && echo Solved wtih $lang!
echo $got