(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestBlockHeaderScanValue(t *testing.T) { |
| 52 | filledBytes := mustDecodeHex("080310011a0909000000000000000120e80728d0860330013a0909000000000000000242090900000000000000034a090900000000000000045246080110011a4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") |
| 53 | val, err := filledBlock.Value() |
| 54 | if err != nil { |
| 55 | t.Fatal(err) |
| 56 | } |
| 57 | vBytes, ok := val.([]byte) |
| 58 | if !ok { |
| 59 | t.Fatal("expected value to return byte slice") |
| 60 | } |
| 61 | if !bytes.Equal(vBytes, filledBytes) { |
| 62 | t.Errorf("Value(emptyBlock):\n\tgot: %x\n\twant: %x", vBytes, filledBytes) |
| 63 | } |
| 64 | |
| 65 | scanned := new(BlockHeader) |
| 66 | err = scanned.Scan(vBytes) |
| 67 | if err != nil { |
| 68 | t.Fatal(err) |
| 69 | } |
| 70 | |
| 71 | if !testutil.DeepEqual(scanned, filledBlock) { |
| 72 | t.Errorf("Scan(%x):\n\tgot: %v\n\twant: %v", vBytes, scanned, filledBlock) |
| 73 | } |
| 74 | |
| 75 | err = scanned.Scan(int64(5)) |
| 76 | if err == nil { |
| 77 | t.Fatal("expected error for scanning bad Value type") |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func hashPtr(hash Hash) *Hash { return &hash } |
nothing calls this directly
no test coverage detected