mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 03:44:26 -08:00
general increase/decrease testing funcs
This commit is contained in:
@@ -45,6 +45,37 @@ function expect_change {
|
|||||||
fi
|
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.
|
# Get balance of an account.
|
||||||
function get_balance {
|
function get_balance {
|
||||||
|
|||||||
Reference in New Issue
Block a user