calculator/tests/test_math.sh

34 lines
631 B
Bash
Raw Normal View History

#!/bin/sh
test_add64() {
result=$("${QEMU}" -B 0x80000000 -s 2k tests/math_add64.elf)
2025-02-14 11:09:46 +00:00
# 3.5
# 3.75
# 1.25
# -1.25
2025-02-13 10:32:39 +00:00
expected=$(cat << END
00000003.80000000
00000003.C0000000
END
)
2025-02-13 10:32:39 +00:00
# TODO: Ideally this test would allow calling the binary repeatedly with
# different inputs.
test $? -eq 0 && test "$result" = "$expected"
}
2025-02-14 11:09:46 +00:00
test_mul() {
result=$("${QEMU}" -B 0x80000000 -s 2k tests/math_mul.elf)
expected=$(cat << END
0000000F
0000003F
0063FF9C
FFFFFFEB
END
)
# TODO: Ideally this test would allow calling the binary repeatedly with
# different inputs.
test $? -eq 0 && test "$result" = "$expected"
}