用 bash 实现类似 SelfEval 的工具。
bash 一键编译运行样例
1 2 3 4 5 6 7 8 9 10 11 12
| p="fib" ulimit -s 512000 if [ $2 == 1 ]; then g++ -o $1 $1.cpp -std=c++14 -O2 -Wall -fsanitize=address,undefined || exit else g++ -o $1 $1.cpp -std=c++14 -O2 -static || exit fi for i in $(seq $3 $4); do cp $p$i.in $1.in \time -f $p$i": %es %MKB" ./$1 || exit diff -Zq $1.out $p$i.ans done
|
bash 对拍
1 2 3 4 5 6 7 8 9 10 11 12 13
| cnt=1 while true; do ./$1_gen cp $1_good.in $1.in ./$1 || exit ./$1_good || exit if diff -Zq $1.out $1_good.out; then echo "$((cnt++)) AC" else echo "$cnt WA" exit fi done
|