tests: fix x64 output comparison

pull/4532/head^2
Alexander Medvednikov 2020-04-20 22:57:41 +02:00
parent 10677c2b0c
commit 67a76cee1e
2 changed files with 14 additions and 4 deletions

View File

@ -27,6 +27,7 @@ enum Register {
rax
rdi
rsi
rbp
edx
rdx
r12
@ -214,6 +215,13 @@ pub fn (var g Gen) ret() {
g.write8(0xc3)
}
pub fn (var g Gen) push(reg Register) {
match reg {
.rbp { g.write8(0x55) }
else {}
}
}
// returns label's relative address
pub fn (var g Gen) gen_loop_start(from int) int {
g.mov(.r12, from)

View File

@ -49,9 +49,12 @@ fn test_x64() {
panic(err)
}
expected = expected.trim_space().trim('\n').replace('\r\n', '\n')
mut found := res.output.trim_space().trim('\n').replace('\r\n', '\n')
found = found[..found.len-1] // remove ACK char TODO fix this
var found := res.output.trim_space().trim('\n').replace('\r\n', '\n')
// remove ACK char TODO fix this in x64
buf := [byte(0x06)]
ack := string(buf)
found = found.replace(ack, '')
found = found.trim_space()
if expected != found {
println(term.red('FAIL'))
println('============')
@ -72,4 +75,3 @@ fn test_x64() {
exit(1)
}
}