25 lines
642 B
Bash
25 lines
642 B
Bash
#!/bin/sh
|
|
|
|
utest() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="0"
|
|
ACTUAL=$("$PROGRAM" -e '1 acos p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty stack
|
|
EXPECTED="'acos' requires one operand"
|
|
ACTUAL=$("$PROGRAM" -e 'acos' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test non numerical values
|
|
EXPECTED="'acos' requires numeric values"
|
|
ACTUAL=$("$PROGRAM" -e '[ foo ] acos' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test complex number
|
|
EXPECTED="(0,3.14)"
|
|
ACTUAL=$("$PROGRAM" -e '11.57 -0 b acos p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
}
|
|
# vim: ts=4 sw=4 softtabstop=4 expandtab:
|