1 2failures=0 3 4check() { 5 if [ $(($1)) != $2 ]; then 6 failures=$((failures+1)) 7 echo "For $1, expected $2 actual $(($1))" 8 fi 9} 10 11check "0&&0" 0 12check "1&&0" 0 13check "0&&1" 0 14check "1&&1" 1 15check "2&&2" 1 16check "1&&2" 1 17check "1<<40&&1<<40" 1 18check "1<<40&&4" 1 19 20check "0||0" 0 21check "1||0" 1 22check "0||1" 1 23check "1||1" 1 24check "2||2" 1 25check "1||2" 1 26check "1<<40||1<<40" 1 27check "1<<40||4" 1 28 29exit $((failures != 0)) 30