20 lines
493 B
Bash
20 lines
493 B
Bash
#!/bin/sh
|
|
|
|
utest() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="3"
|
|
ACTUAL=$("$PROGRAM" -e 'pi $ p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty stack
|
|
EXPECTED="'$' requires one operand"
|
|
ACTUAL=$("$PROGRAM" -e '$' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test non numerical values
|
|
EXPECTED="'$' requires numeric values"
|
|
ACTUAL=$("$PROGRAM" -e '[ foo ] $' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
}
|
|
# vim: ts=4 sw=4 softtabstop=4 expandtab:
|