Compare the two parameters and return true if they are equal; return false otherwise. In the latter case print a message showing the expected value and the wrong one. Must be used as last command in a function, so that its return value is equal to that of the function.
The optional argument DESCRIPTION should be a short, one–line, string describing the expected value; it is used in the output text describing the failed comparison.
Example:
function my-func () {
echo $(($1 + $2))
}
function mytest-1.1 () {
dotest-equal 5 `my-func 2 3`
}
dotest mytest-
another example:
function my-func () {
echo $(($1 + $2))
}
function mytest-1.1 () {
dotest-equal 5 `my-func 2 3` && \
dotest-equal 5 `my-func 1 4` && \
dotest-equal 5 `my-func 3 2` && \
}
dotest mytest-
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.