aboutsummaryrefslogtreecommitdiff
path: root/ber/obj_test.go
blob: 73cc3f55f94263034242ae0a43e7df8b72149f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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})
}