(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestPublicKey_MarshalBinary(t *testing.T) { |
| 145 | Convey("marshal unmarshal public key", t, func() { |
| 146 | _, publicKey, _ := GenSecp256k1KeyPair() |
| 147 | publicKey2 := new(PublicKey) |
| 148 | buf, _ := publicKey.MarshalBinary() |
| 149 | publicKey2.UnmarshalBinary(buf) |
| 150 | |
| 151 | So(publicKey.IsEqual(publicKey2), ShouldBeTrue) |
| 152 | |
| 153 | publicKey3 := new(PublicKey) |
| 154 | publicKey3.UnmarshalBinary(buf) |
| 155 | |
| 156 | buf1, _ := publicKey.MarshalHash() |
| 157 | buf2, _ := publicKey2.MarshalHash() |
| 158 | buf3, _ := publicKey3.MarshalHash() |
| 159 | |
| 160 | So(buf1, ShouldResemble, buf2) |
| 161 | So(buf1, ShouldResemble, buf3) |
| 162 | So(publicKey.Msgsize(), ShouldEqual, publicKey2.Msgsize()) |
| 163 | }) |
| 164 | } |
| 165 | |
| 166 | func TestPrivateKey_Serialize(t *testing.T) { |
| 167 | Convey("marshal unmarshal private key", t, func() { |
nothing calls this directly
no test coverage detected