aboutsummaryrefslogtreecommitdiff
path: root/ber/string_test.go
blob: 72c3a2a55cb1634b106cb7e1704fe28cc6890722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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})
}