package ber import ( "bytes" "testing" ) func testString(t *testing.T, s string, e []byte) { a := marshalString(s) if !bytes.Equal(a, e) { t.Error("String", s, "expexted", e, "got", a) } b := unmarshalString(e) if b != s { t.Error("DeString", e, "expexted", s, "got", b) } } func TestString(t *testing.T) { testString(t, "111", []byte{0x31, 0x31, 0x31}) testString(t, "0A16", []byte{0x30, 0x41, 0x31, 0x36}) }