Add some integration tests and runner

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-25 13:48:03 -05:00
parent 145739aee2
commit 362590292a
6 changed files with 199 additions and 0 deletions

34
tests/test_div.asm Normal file
View File

@@ -0,0 +1,34 @@
.section data $0x0 {
number: .u8 $10
main:
; Test division
mov %status, $1
mov %r0, (number)u8
div %r0, $2
cmpeq %r0, $5
jz end
; Test integer division
mov %status, $2
mov %r1, $2
div %r0, %r1
cmpeq %r0, $2
jz end
; Test negative division with idiv
mov %status, $3
idiv %r0, $0xFFFFFFFFFFFFFFFF ; -1
cmpeq %r0, $0xFFFFFFFFFFFFFFFE ; -2
jz end
mov %status, $0
end:
halt
.export main
}
.meta {
entry: main
}