#!/bin/sh

test_count_digits() {
  result=$(echo "count_digits" | "${QEMU}" -B 0x80000000 -s 2k tests/harness.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=$(echo "fmt_decimal" | "${QEMU}" -B 0x80000000 -s 2k tests/harness.elf)
  expected=$(cat << END
0
1
2
3
9
10
100
2147483648
END
)

  test $? -eq 0 && test "$result" = "$expected"
}