(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestBlockMarshal(t *testing.T) { |
| 103 | block := testBlock() |
| 104 | |
| 105 | blockBytes, err := block.Bytes() |
| 106 | if err != nil { |
| 107 | t.Fatal(err) |
| 108 | } |
| 109 | |
| 110 | wantBytes := []byte(hex.EncodeToString(blockBytes)) |
| 111 | gotBytes, err := block.MarshalText() |
| 112 | if err != nil { |
| 113 | t.Fatal(err) |
| 114 | } |
| 115 | |
| 116 | if !bytes.Equal(gotBytes, wantBytes) { |
| 117 | t.Errorf("MarshalText(%v):\ngot: %x\n\twant: %x", block, gotBytes, wantBytes) |
| 118 | } |
| 119 | |
| 120 | gotBlock := new(Block) |
| 121 | err = gotBlock.UnmarshalText(wantBytes) |
| 122 | if err != nil { |
| 123 | t.Fatal(err) |
| 124 | } |
| 125 | |
| 126 | if !testutil.DeepEqual(gotBlock, block) { |
| 127 | t.Errorf("UnmarshalText(%x):\ngot: %v\n\twant: %v", wantBytes, gotBlock, block) |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func TestBlockScan(t *testing.T) { |
| 132 | block := testBlock() |
nothing calls this directly
no test coverage detected