21 lines
547 B
Bash
21 lines
547 B
Bash
#!/bin/sh
|
|
|
|
utest() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="5"
|
|
ACTUAL=$("$PROGRAM" -e '1 2 3 4 5 6 7 8 9 SX SX SX SX SX SX SX SX SX gM p cX')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test undefined register
|
|
EXPECTED="Register 'X' is undefined"
|
|
ACTUAL=$("$PROGRAM" -e 'gM' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty stack
|
|
EXPECTED="The stack of register 'X' is empty"
|
|
ACTUAL=$("$PROGRAM" -e '0 5 :X gM' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
}
|
|
# vim: ts=4 sw=4 softtabstop=4 expandtab:
|