Simplified file structure
This commit is contained in:
39
src/arch/x64/Pop_test.go
Normal file
39
src/arch/x64/Pop_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package x64_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/arch/x64"
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
"git.akyoto.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestPopRegister(t *testing.T) {
|
||||
usagePatterns := []struct {
|
||||
Register cpu.Register
|
||||
Code []byte
|
||||
}{
|
||||
{x64.RAX, []byte{0x58}},
|
||||
{x64.RCX, []byte{0x59}},
|
||||
{x64.RDX, []byte{0x5A}},
|
||||
{x64.RBX, []byte{0x5B}},
|
||||
{x64.RSP, []byte{0x5C}},
|
||||
{x64.RBP, []byte{0x5D}},
|
||||
{x64.RSI, []byte{0x5E}},
|
||||
{x64.RDI, []byte{0x5F}},
|
||||
{x64.R8, []byte{0x41, 0x58}},
|
||||
{x64.R9, []byte{0x41, 0x59}},
|
||||
{x64.R10, []byte{0x41, 0x5A}},
|
||||
{x64.R11, []byte{0x41, 0x5B}},
|
||||
{x64.R12, []byte{0x41, 0x5C}},
|
||||
{x64.R13, []byte{0x41, 0x5D}},
|
||||
{x64.R14, []byte{0x41, 0x5E}},
|
||||
{x64.R15, []byte{0x41, 0x5F}},
|
||||
}
|
||||
|
||||
for _, pattern := range usagePatterns {
|
||||
t.Logf("pop %s", pattern.Register)
|
||||
code := x64.PopRegister(nil, pattern.Register)
|
||||
assert.DeepEqual(t, code, pattern.Code)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user