Created
March 10, 2019 17:48
-
-
Save voronkovich/15e779e665ebe5a1a3cc44fb42b6dc57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
binary="${1:-./a.out}"; | |
test() { | |
input="$1"; | |
expected="$2"; | |
actual="$(echo $input | $binary)"; | |
if [ "$expected" = "$actual" ]; then | |
echo "\e[032mOK\e[0m"; | |
return; | |
fi | |
echo "\n\e[31mFail!\e[0m"; | |
echo "\e[33mInput\e[0m:\n"; | |
echo "$input\n"; | |
echo "\e[032mExpected\e[0m: $expected"; | |
echo "\e[032mActual\e[0m: $actual"; | |
} | |
test \ | |
"4 59\nfGRR\nfGRRefGRRtfGRRuCfGRRXfGRRQfGRRpfGRRxofGRRwfGRRQQfGRRgfGRRqR" \ | |
"0 5 10 16 21 26 31 37 42 48 53 "; | |
test \ | |
"4 12\ntest\ntestestteste" \ | |
"0 3 7 "; | |
test \ | |
"1 1\na\nb" \ | |
""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment