dc/tests/test_bor
Marco Cetica 62ad335e58
All checks were successful
dc / build (push) Successful in 15s
Added bitwise operators and fixed various bugs
2024-03-19 12:30:02 +01:00

20 lines
515 B
Bash

#!/bin/sh
utest() {
PROGRAM="$PWD/build/dc"
EXPECTED="1011b"
ACTUAL=$("$PROGRAM" -e '2 d i o 1000 0011 } p')
assert_eq "$EXPECTED" "$ACTUAL"
# Test empty stack
EXPECTED="'}' requires two operands"
ACTUAL=$("$PROGRAM" -e '}' 2>&1) || true
assert_eq "$EXPECTED" "$ACTUAL"
# Test non numerical values
EXPECTED="'}' requires numeric values"
ACTUAL=$("$PROGRAM" -e '5 [ foo ] }' 2>&1) || true
assert_eq "$EXPECTED" "$ACTUAL"
}
# vim: ts=4 sw=4 softtabstop=4 expandtab: