general increase/decrease testing funcs

master
michael 2022-09-14 21:50:33 +00:00
parent 55e4da77c5
commit 021c2301c5
1 changed files with 31 additions and 0 deletions

View File

@ -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 {