Skip to content

Instantly share code, notes, and snippets.

@tjkendev
Created July 3, 2017 15:18
Show Gist options
  • Save tjkendev/2063dd330cbb1d68099a3b298d76bbcf to your computer and use it in GitHub Desktop.
Save tjkendev/2063dd330cbb1d68099a3b298d76bbcf to your computer and use it in GitHub Desktop.
竸プロのinとoutのdiffチェック
#!/bin/bash
# ICPCの回答チェック (diffを取る)
# usage: sh domestic-2017.sh "python a.py" A
name="domestic-2017"
in_ext="in"
out_ext="diff"
# コードの実行コマンド: 例) "python a.py"
program_command=$1
# 問題番号: 例) "A"
alphabet=$2
# 入力
input_files=(`find ./${name}/${alphabet}*.${in_ext}`)
# 出力
output_files=(`find ./${name}/${alphabet}*.${out_ext}`)
num=${#input_files[@]}
for i in `seq 0 $(($num-1))`; do
input=${input_files[$i]}
output=${output_files[$i]}
echo "$input ==> $output"
$program_command < $input | colordiff -u - $output
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment