aboutsummaryrefslogtreecommitdiff
path: root/ber/string_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ber/string_test.go')
-rw-r--r--ber/string_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/ber/string_test.go b/ber/string_test.go
new file mode 100644
index 0000000..72c3a2a
--- /dev/null
+++ b/ber/string_test.go
@@ -0,0 +1,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})
+}