(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestMarshalHashAccountStable2(t *testing.T) { |
| 48 | v1 := Account{ |
| 49 | Address: proto.AccountAddress{0x10}, |
| 50 | TokenBalance: [SupportTokenNumber]uint64{10, 10}, |
| 51 | Rating: 1110, |
| 52 | NextNonce: 1, |
| 53 | } |
| 54 | enc, err := utils.EncodeMsgPack(&v1) |
| 55 | if err != nil { |
| 56 | t.Fatalf("error occurred: %v", err) |
| 57 | } |
| 58 | v2 := Account{} |
| 59 | if err = utils.DecodeMsgPack(enc.Bytes(), &v2); err != nil { |
| 60 | t.Fatalf("error occurred: %v", err) |
| 61 | } |
| 62 | bts1, err := v1.MarshalHash() |
| 63 | if err != nil { |
| 64 | t.Fatal(err) |
| 65 | } |
| 66 | bts2, err := v2.MarshalHash() |
| 67 | if err != nil { |
| 68 | t.Fatal(err) |
| 69 | } |
| 70 | if !bytes.Equal(bts1, bts2) { |
| 71 | t.Fatal("hash not stable") |
| 72 | } |
| 73 | } |
nothing calls this directly
no test coverage detected