1package ndr
2
3import (
4	"bytes"
5	"encoding/hex"
6	"testing"
7
8	"github.com/stretchr/testify/assert"
9)
10
11const testPipe = "04000000010000000200000003000000040000000300000001000000020000000300000000000000"
12
13type structWithPipe struct {
14	A []uint32 `ndr:"pipe"`
15}
16
17func TestFillPipe(t *testing.T) {
18	hexStr := TestHeader + testPipe
19	b, _ := hex.DecodeString(hexStr)
20	a := new(structWithPipe)
21	dec := NewDecoder(bytes.NewReader(b))
22	err := dec.Decode(a)
23	if err != nil {
24		t.Fatalf("%v", err)
25	}
26	tp := []uint32{1, 2, 3, 4, 1, 2, 3}
27	assert.Equal(t, tp, a.A, "Value of pipe not as expected")
28}
29