MCPcopy Create free account
hub / github.com/chain/txvm / TestHashMarshalText

Function TestHashMarshalText

protocol/bc/hash_test.go:27–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestHashMarshalText(t *testing.T) {
28 hash := NewHash([32]byte{1})
29 got, err := hash.MarshalText()
30 if err != nil {
31 t.Fatal(err)
32 }
33
34 want := []byte("0100000000000000000000000000000000000000000000000000000000000000")
35
36 if !bytes.Equal(got, want) {
37 t.Errorf("MarshalText(%x) = %x want %x", hash.Bytes(), got, want)
38 }
39}
40
41func TestHashUnmarshalText(t *testing.T) {
42 text := []byte("0100000000000000000000000000000000000000000000000000000000000000")

Callers

nothing calls this directly

Calls 4

MarshalTextMethod · 0.95
BytesMethod · 0.95
NewHashFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected