32 lines
667 B
Bash
32 lines
667 B
Bash
#!/bin/sh
|
|
|
|
test_load() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="5"
|
|
ACTUAL=$("$PROGRAM" -e '5 sA lA p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty register
|
|
EXPECTED="0"
|
|
ACTUAL=$("$PROGRAM" -e 'lA p' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
}
|
|
|
|
test_uppercase_load() {
|
|
PROGRAM="$PWD/build/dc"
|
|
EXPECTED="5"
|
|
ACTUAL=$("$PROGRAM" -e '5 sA LA p')
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
|
|
# Test empty register
|
|
EXPECTED="Register 'A' is undefined"
|
|
ACTUAL=$("$PROGRAM" -e 'LA' 2>&1) || true
|
|
assert_eq "$EXPECTED" "$ACTUAL"
|
|
}
|
|
|
|
utest() {
|
|
test_load
|
|
test_uppercase_load
|
|
}
|
|
# vim: ts=4 sw=4 softtabstop=4 expandtab:
|