27 lines
597 B
Go
27 lines
597 B
Go
// Copyright 2021, Henrik Sölver henrik.solver@gmail.com
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
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")
|
|
}
|