func TestEncoderNode1(t *testing.T) {
	expected := []byte{0x81, 0x06, 0x02, 0x04, 0x59, 0x6F, 0x4D, 0x6F}
	var prim = NewPrimitivePacketEncoder(0x02)
	prim.SetStringValue("YoMo")
	var node = NewNodePacketEncoder(0x01)
	node.AddPrimitivePacket(prim)
	res := node.Encode()
	for i, p := range res {
		if p != expected[i] {
			t.Errorf("i=%v, expected=%#x, actual=%#x", i, expected[i], res[i])
		}
	}
}
0x81 : {
0x02: "YoMo",
},
package y3
import (
	"testing"
)
func TestEncoderPrimitiveInt32(t *testing.T) {
	expected := []byte{0x01, 0x01, 0x7F}
	var prim = NewPrimitivePacketEncoder(0x01)
	prim.SetInt32Value(-1)
	res := prim.Encode()
	for i, p := range res {
		if p != expected[i] {
			t.Errorf("i=%v, expected=%#x, actual=%#x", i, expected[i], res[i])
		}
	}
}
func TestEncoderPrimitiveString(t *testing.T) {
	expected := []byte{0x01, 0x04, 0x59, 0x6F, 0x4D, 0x6F}
	var prim = NewPrimitivePacketEncoder(0x01)
	prim.SetStringValue("YoMo")
	res := prim.Encode()
	for i, p := range res {
		if p != expected[i] {
			t.Errorf("i=%v, expected=%v, actual=%v", i, expected[i], res[i])
		}
	}
}