(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestNodeID_MarshalBinary(t *testing.T) { |
| 180 | Convey("NodeID MarshalBinary", t, func() { |
| 181 | var nodeID, nodeID2, nodeID3 NodeID |
| 182 | |
| 183 | nb, err := nodeID.MarshalBinary() |
| 184 | So(err, ShouldBeNil) |
| 185 | |
| 186 | nodeID = NodeID("0000000000000000000000000000000000000000000000000000000000000000") |
| 187 | nb, err = nodeID.MarshalBinary() |
| 188 | So(err, ShouldBeNil) |
| 189 | So(len(nb), ShouldEqual, hash.HashSize) |
| 190 | |
| 191 | err = nodeID2.UnmarshalBinary([]byte("0000")) |
| 192 | So(err, ShouldNotBeNil) |
| 193 | |
| 194 | err = nodeID2.UnmarshalBinary(nb) |
| 195 | So(err, ShouldBeNil) |
| 196 | So(nodeID2, ShouldResemble, nodeID) |
| 197 | |
| 198 | nodeID3.UnmarshalBinary([]byte("0000000000000000000000000000000000000000000000000000000000000000")) |
| 199 | So(err, ShouldBeNil) |
| 200 | So(nodeID3, ShouldResemble, nodeID) |
| 201 | }) |
| 202 | } |
nothing calls this directly
no test coverage detected