forked from TrueCloudLab/neoneo-go
pkg/vm/stack: make some use of testReadInt64()
GolangCI complains: testReadInt64 is unused (from deadcode) Fix it to always provide correctly-sized buffer for the binary.Read().
This commit is contained in:
parent
6be27ad4b0
commit
d6c3f74e3c
2 changed files with 7 additions and 1 deletions
|
@ -64,6 +64,8 @@ func TestByteArrConversion(t *testing.T) {
|
||||||
ba, err := a.ByteArray()
|
ba, err := a.ByteArray()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
|
assert.Equal(t, num, testReadInt64(ba.val))
|
||||||
|
|
||||||
have, err := ba.Integer()
|
have, err := ba.Integer()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,11 @@ func testMakeStackInt(t *testing.T, num int64) *Int {
|
||||||
|
|
||||||
func testReadInt64(data []byte) int64 {
|
func testReadInt64(data []byte) int64 {
|
||||||
var ret int64
|
var ret int64
|
||||||
buf := bytes.NewBuffer(data)
|
var arr [8]byte
|
||||||
|
|
||||||
|
// expands or shrinks data automatically
|
||||||
|
copy(arr[:], data)
|
||||||
|
buf := bytes.NewBuffer(arr[:])
|
||||||
binary.Read(buf, binary.LittleEndian, &ret)
|
binary.Read(buf, binary.LittleEndian, &ret)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue