func TestSuffixKey(t *testing.T) {
	for _, tc := range []struct {
		depth   int
		index   int64
		want    []byte
		wantErr bool
	}{
		{depth: 0, index: 0x00, want: h2b("0000"), wantErr: false},
		{depth: 8, index: 0x00, want: h2b("0800"), wantErr: false},
		{depth: 15, index: 0xab, want: h2b("0fab"), wantErr: false},
		{depth: 16, index: 0x00, want: h2b("1000"), wantErr: false},
		{depth: 8, index: 0xabcd, want: h2b("08cd"), wantErr: false},
		{
			depth:   2,
			index:   new(big.Int).SetBytes(h2b("4000000000000000000000000000000000000000000000000000000000000000")).Int64(),
			want:    h2b("0200"),
			wantErr: false,
		},
	} {
		suffixKey, err := makeSuffixKey(tc.depth, tc.index)
		if got, want := err != nil, tc.wantErr; got != want {
			t.Errorf("makeSuffixKey(%v, %v): %v, want err: %v",
				tc.depth, tc.index, err, want)
			continue
		}
		if err != nil {
			continue
		}
		b, err := base64.StdEncoding.DecodeString(suffixKey)
		if err != nil {
			t.Errorf("DecodeString(%v): %v", suffixKey, err)
			continue
		}
		if got, want := b, tc.want; !bytes.Equal(got, want) {
			t.Errorf("makeSuffixKey(%v, %x): %x, want %x",
				tc.depth, tc.index, got, want)
		}
	}
}
TestSuffixKey documents the behavior of makeSuffixKey
package cache
import (
	"bytes"
	"encoding/base64"
	"encoding/hex"
	"fmt"
	"math/big"
	"testing"
	_ "github.com/golang/glog"  
)
func h2b(h string) []byte {
	b, err := hex.DecodeString(h)
	if err != nil {
		panic(err)
	}
	return b
}
func h2b6(h string) string {
	return base64.StdEncoding.EncodeToString(h2b(h))
}
func TestParseSuffix(t *testing.T) {
	for _, tc := range []struct {
		str     string
		bits    byte
		path    []byte
		wantErr bool
	}{
		{str: h2b6(""), wantErr: true},
		{str: h2b6("0100"), bits: 1, path: h2b("00")},
		{str: h2b6("01FC"), bits: 1, path: h2b("FC")},
		{str: h2b6("010123"), wantErr: true},
		{str: h2b6("080123"), wantErr: true},
		{str: h2b6("0801"), bits: 8, path: h2b("01")},
		{str: h2b6("090123"), bits: 9, path: h2b("0123")},
		{str: h2b6("1000"), wantErr: true},
		{str: h2b6("100123"), bits: 16, path: h2b("0123")},
		{str: h2b6("2001234567"), bits: 32, path: h2b("01234567")},
		{str: "----", wantErr: true},
	} {
		t.Run("", func(t *testing.T) {
			sfx, err := parseSuffix(tc.str)
			if got, want := err != nil, tc.wantErr; got != want {
				t.Fatalf("parseSuffix: %v, wantErr: %v", err, want)
			} else if err != nil {
				return
			}
			if got, want := sfx.Bits(), tc.bits; got != want {
				t.Errorf("parseSuffix: got %d bits, want %d", got, want)
			}
			if got, want := sfx.Path(), tc.path; !bytes.Equal(got, want) {
				t.Errorf("parseSuffix: got path %x, want %x", got, want)
			}
		})
	}
}