25 lines
652 B
Bash
25 lines
652 B
Bash
#!/bin/sh
|
|
|
|
utest() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="3.14"
|
|
ACTUAL=$("$PROGRAM" -e '1 pi b im p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty stack
|
|
EXPECTED="'im' requires one value"
|
|
ACTUAL=$("$PROGRAM" -e 'im' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test non complex values
|
|
EXPECTED="'im' requires complex values"
|
|
ACTUAL=$("$PROGRAM" -e '1 im' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test with macro
|
|
EXPECTED="'im' requires complex values"
|
|
ACTUAL=$("$PROGRAM" -e '[ foo ] im' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
}
|
|
# vim: ts=4 sw=4 softtabstop=4 expandtab:
|