Added more tests

This commit is contained in:
2025-03-13 16:02:09 +01:00
parent 5a5061c5d7
commit d96c351b4b
12 changed files with 205 additions and 39 deletions

26
src/arm/Sub_test.go Normal file
View File

@ -0,0 +1,26 @@
package arm_test
import (
"testing"
"git.urbach.dev/cli/q/src/arm"
"git.urbach.dev/cli/q/src/cpu"
"git.urbach.dev/go/assert"
)
func TestSubRegisterNumber(t *testing.T) {
usagePatterns := []struct {
Destination cpu.Register
Source cpu.Register
Number int
Code uint32
}{
{arm.X0, arm.X0, 1, 0xD1000400},
}
for _, pattern := range usagePatterns {
t.Logf("sub %s, %s, %d", pattern.Destination, pattern.Source, pattern.Number)
code := arm.SubRegisterNumber(pattern.Destination, pattern.Source, pattern.Number)
assert.DeepEqual(t, code, pattern.Code)
}
}