calculator/tests/test_hex.sh

18 lines
558 B
Bash

#!/bin/sh
test_btohex() {
# FIXME: Remove grep when this bug is fixed:
# https://github.com/sysprog21/rv32emu/issues/561
result=$("${RV32EMU}" -d - -q tests/btohex.elf | grep -v '^[0-9]' | "${JQ}" .x11)
# 16693 is 5A in ASCII (reversed from input due to little endian)
test $? -eq 0 && test "${result}" -eq 13633
}
test_tohex() {
# FIXME: Remove grep when this bug is fixed:
# https://github.com/sysprog21/rv32emu/issues/561
result=$("${RV32EMU}" -q tests/tohex.elf | grep -v '^[0-9]')
test $? -eq 0 && test "${result}" = "CAFEFEED"
}