reg: rename Bytes() to Size() (#74)
It was pointed out #73 that Bytes() is a poor name for the size of the register in bytes. In idiomatic Go you would probably expect a Bytes() method to return []byte. This diff changes the Bytes() to Size(). As a result the Size type also needed to be renamed, and Width seemed a reasonable choice. Fixes #73
This commit is contained in:
committed by
GitHub
parent
7a0eb66183
commit
138eaf8dc3
@@ -2,10 +2,10 @@ package reg
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSpecBytes(t *testing.T) {
|
||||
func TestSpecSize(t *testing.T) {
|
||||
cases := []struct {
|
||||
Spec Spec
|
||||
Bytes uint
|
||||
Spec Spec
|
||||
Size uint
|
||||
}{
|
||||
{S0, 0},
|
||||
{S8L, 1},
|
||||
@@ -18,8 +18,8 @@ func TestSpecBytes(t *testing.T) {
|
||||
{S512, 64},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if c.Spec.Bytes() != c.Bytes {
|
||||
t.Errorf("%v.Bytes() = %d; expect = %d", c.Spec, c.Spec.Bytes(), c.Bytes)
|
||||
if c.Spec.Size() != c.Size {
|
||||
t.Errorf("%v.Size() = %d; expect = %d", c.Spec, c.Spec.Size(), c.Size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user