Flattened package hierarchy

This commit is contained in:
Eduard Urbach 2024-08-25 20:38:22 +02:00
parent 12dcf672cb
commit a4dc5a4eff
Signed by: eduard
GPG key ID: 49226B848C78F6C8
89 changed files with 42 additions and 42 deletions

39
src/x64/Pop_test.go Normal file
View file

@ -0,0 +1,39 @@
package x64_test
import (
"testing"
"git.akyoto.dev/cli/q/src/cpu"
"git.akyoto.dev/cli/q/src/x64"
"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)
}
}