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

Function TestMarshalNode

crypto/kms/pubkeystore_test.go:248–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246}
247
248func TestMarshalNode(t *testing.T) {
249 Convey("marshal unmarshal node", t, func() {
250 nodeInfo := &proto.Node{
251 ID: "0000000000000000000000000000000000000000000000000000000000001111",
252 Addr: "addr",
253 PublicKey: nil,
254 Nonce: cpuminer.Uint256{
255 A: 1,
256 B: 2,
257 C: 3,
258 D: 4,
259 },
260 }
261 nodeBuf, err := utils.EncodeMsgPack(nodeInfo)
262 if err != nil {
263 log.Errorf("encode error: %s", err)
264 }
265
266 nodeDec := proto.NewNode()
267 err = utils.DecodeMsgPack(nodeBuf.Bytes(), nodeDec)
268
269 So(reflect.DeepEqual(nodeDec, nodeInfo), ShouldBeTrue)
270 })
271}
272
273func TestMarshalBPInfo(t *testing.T) {
274 log.SetLevel(log.DebugLevel)

Callers

nothing calls this directly

Calls 5

EncodeMsgPackFunction · 0.92
ErrorfFunction · 0.92
NewNodeFunction · 0.92
DecodeMsgPackFunction · 0.92
BytesMethod · 0.45

Tested by

no test coverage detected