dc/tests/test_int
Marco Cetica d0156fae3a
All checks were successful
dc / build (push) Successful in 13s
Added '@' and '$' functions(RNG and INT function)
2024-03-14 15:57:46 +01:00

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: