tests: fix x64 output comparison
parent
10677c2b0c
commit
67a76cee1e
|
@ -27,6 +27,7 @@ enum Register {
|
||||||
rax
|
rax
|
||||||
rdi
|
rdi
|
||||||
rsi
|
rsi
|
||||||
|
rbp
|
||||||
edx
|
edx
|
||||||
rdx
|
rdx
|
||||||
r12
|
r12
|
||||||
|
@ -214,6 +215,13 @@ pub fn (var g Gen) ret() {
|
||||||
g.write8(0xc3)
|
g.write8(0xc3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (var g Gen) push(reg Register) {
|
||||||
|
match reg {
|
||||||
|
.rbp { g.write8(0x55) }
|
||||||
|
else {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// returns label's relative address
|
// returns label's relative address
|
||||||
pub fn (var g Gen) gen_loop_start(from int) int {
|
pub fn (var g Gen) gen_loop_start(from int) int {
|
||||||
g.mov(.r12, from)
|
g.mov(.r12, from)
|
||||||
|
|
|
@ -49,9 +49,12 @@ fn test_x64() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
expected = expected.trim_space().trim('\n').replace('\r\n', '\n')
|
expected = expected.trim_space().trim('\n').replace('\r\n', '\n')
|
||||||
mut found := res.output.trim_space().trim('\n').replace('\r\n', '\n')
|
var found := res.output.trim_space().trim('\n').replace('\r\n', '\n')
|
||||||
found = found[..found.len-1] // remove ACK char TODO fix this
|
// 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 {
|
if expected != found {
|
||||||
println(term.red('FAIL'))
|
println(term.red('FAIL'))
|
||||||
println('============')
|
println('============')
|
||||||
|
@ -72,4 +75,3 @@ fn test_x64() {
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue