1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-08 22:57:50 +08:00
Files
kubo/blocks/key/key_test.go
Jeromy d7dab3afea Use gx vendored go-ipfs-utils where possible
For the rest of the packages in util, move them to thirdparty
and update the references. util is gone!

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-02-12 17:21:40 -08:00

29 lines
414 B
Go

package key
import (
"bytes"
"testing"
mh "gx/ipfs/QmYf7ng2hG5XBtJA3tN34DQ2GUN5HNksEw1rLDkmr6vGku/go-multihash"
)
func TestKey(t *testing.T) {
h1, err := mh.Sum([]byte("beep boop"), mh.SHA2_256, -1)
if err != nil {
t.Error(err)
}
k1 := Key(h1)
h2 := mh.Multihash(k1)
k2 := Key(h2)
if !bytes.Equal(h1, h2) {
t.Error("Multihashes not equal.")
}
if k1 != k2 {
t.Error("Keys not equal.")
}
}