mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-05 06:23:10 +00:00
17 lines
333 B
Go
17 lines
333 B
Go
package multiaddr
|
|
|
|
import "testing"
|
|
|
|
func expectVarint(t *testing.T, x, expected int) {
|
|
size := VarintSize(x)
|
|
if size != expected {
|
|
t.Fatalf("expected varintsize of %d to be %d, got %d", x, expected, size)
|
|
}
|
|
}
|
|
|
|
func TestVarintSize(t *testing.T) {
|
|
expectVarint(t, (1<<7)-1, 1)
|
|
expectVarint(t, 0, 1)
|
|
expectVarint(t, 1<<7, 2)
|
|
}
|