diff --git a/tests/testutil.sh b/tests/testutil.sh index e22d90b..c4f27cb 100644 --- a/tests/testutil.sh +++ b/tests/testutil.sh @@ -45,6 +45,37 @@ function expect_change { fi } +function expect_increase { + read -r out + comp=$1 + desc=$2 + expected=1 + res=$(echo "$out>$comp" | bc) + if [[ $res = $expected ]]; then + log_ok + echo $desc correctly increased + else + log_fail + echo $desc did not increase ($out should be greater than $comp) + exit 1 + fi +} + +function expect_decrease { + read -r out + comp=$1 + desc=$2 + expected=1 + res=$(echo "$out<$comp" | bc) + if [[ $res = $expected ]]; then + log_ok + echo $desc correctly decreased + else + log_fail + echo $desc did not decrease ($out should be less than than $comp) + exit 1 + fi +} # Get balance of an account. function get_balance {