MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestNodeID_MarshalBinary

Function TestNodeID_MarshalBinary

proto/nodeinfo_test.go:179–202  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func 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}

Callers

nothing calls this directly

Calls 3

MarshalBinaryMethod · 0.95
UnmarshalBinaryMethod · 0.95
NodeIDTypeAlias · 0.85

Tested by

no test coverage detected