25 lines
498 B
Go
25 lines
498 B
Go
package ipp
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestUnMarshalSingleRange(T *testing.T) {
|
|
testdata := []byte{
|
|
0x00, 0x04,
|
|
0x66, 0x6c, 0x6f, 0x70, //flop
|
|
0x00, 0x08,
|
|
0x00, 0x0, 0x0, 0x4, 0x00, 0x0, 0x0, 0x5,
|
|
}
|
|
|
|
buf := bytes.NewBuffer(testdata)
|
|
|
|
n, v := unmarshalSingleRangeOfInteger(buf)
|
|
assert.Equal(T, "flop", n, "Should be equal")
|
|
assert.Equal(T, int32(4), v.lower, "Should be equal")
|
|
assert.Equal(T, int32(5), v.upper, "Should be equal")
|
|
}
|