calculator/tests/test_fmt.sh

38 lines
477 B
Bash

#!/bin/sh
test_count_digits() {
result=$("${QEMU}" -B 0x80000000 -s 2k tests/fmt_count_digits.elf)
expected=$(cat << END
00000001
00000001
00000001
00000001
00000001
00000002
00000003
00000003
00000004
00000009
0000000A
END
)
test $? -eq 0 && test "$result" = "$expected"
}
test_fmt_decimal() {
result=$("${QEMU}" -B 0x80000000 -s 2k tests/fmt_decimal.elf)
expected=$(cat << END
0
1
2
3
9
10
100
2147483648
END
)
test $? -eq 0 && test "$result" = "$expected"
}