This commit is contained in:
parent
f7be86a3d9
commit
31c5ed614c
27 changed files with 548 additions and 61 deletions
11
src/cpu/Register.go
Normal file
11
src/cpu/Register.go
Normal file
|
@ -0,0 +1,11 @@
|
|||
package cpu
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Register represents the number of the register.
|
||||
type Register uint8
|
||||
|
||||
// String returns the human readable name of the register.
|
||||
func (r Register) String() string {
|
||||
return fmt.Sprintf("r%d", r)
|
||||
}
|
13
src/cpu/Register_test.go
Normal file
13
src/cpu/Register_test.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package cpu_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestRegisterString(t *testing.T) {
|
||||
register := cpu.Register(1)
|
||||
assert.Equal(t, "r1", register.String())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue