aboutsummaryrefslogtreecommitdiff
path: root/ber/obj_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-06-26 20:03:43 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-06-26 20:03:43 +0200
commitc5b32db26a2dc043bf0777f9f9532e4c360241b2 (patch)
tree08c4cdf16768b95343bc376ba2b9902ab5e0a5cf /ber/obj_test.go
parent04a9aaff365419eeb828cfc3ca8b084dcaf3707d (diff)
Add base128
Diffstat (limited to 'ber/obj_test.go')
-rw-r--r--ber/obj_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/ber/obj_test.go b/ber/obj_test.go
index 995db5c..73cc3f5 100644
--- a/ber/obj_test.go
+++ b/ber/obj_test.go
@@ -1 +1,19 @@
package ber
+
+import (
+ "testing"
+ "bytes"
+)
+
+func testBase128(t *testing.T, n int, e []byte) {
+ a := base128(n)
+ if !bytes.Equal(a, e) {
+ t.Error("Base128", n, "expexted", e, "got", a)
+ }
+}
+
+func TestBase128(t *testing.T) {
+ testBase128(t, 643, []byte{0x85, 0x03})
+ testBase128(t, 113549, []byte{0x86, 0xF7, 0x0D})
+ testBase128(t, 49152, []byte{0x83, 0x80, 0x00})
+}