提交 1d3e72a3 作者: Juan Batiz-Benet

gofmt

上级 5eed3362
package util package util
import ( import (
"bytes" "bytes"
"fmt" "fmt"
mh "github.com/jbenet/go-multihash" mh "github.com/jbenet/go-multihash"
"testing" "testing"
) )
func TestKey(t *testing.T) { func TestKey(t *testing.T) {
h1, err := mh.Sum([]byte("beep boop"), mh.SHA2_256, -1) h1, err := mh.Sum([]byte("beep boop"), mh.SHA2_256, -1)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
k1 := Key(h1) k1 := Key(h1)
h2 := mh.Multihash(k1) h2 := mh.Multihash(k1)
k2 := Key(h2) k2 := Key(h2)
if !bytes.Equal(h1, h2) { if !bytes.Equal(h1, h2) {
t.Error("Multihashes not equal.") t.Error("Multihashes not equal.")
} }
if k1 != k2 { if k1 != k2 {
t.Error("Keys not equal.") t.Error("Keys not equal.")
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论