MCPcopy
hub / github.com/canopy-network/canopy / TestConsensusValidatorJSON

Function TestConsensusValidatorJSON

lib/consensus_test.go:645–660  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

643}
644
645func TestConsensusValidatorJSON(t *testing.T) {
646 expected := &ConsensusValidator{
647 PublicKey: newTestPublicKeyBytes(t),
648 VotingPower: 100,
649 NetAddress: "tcp://example.com",
650 }
651 // convert structure to json bytes
652 gotBytes, err := json.Marshal(expected)
653 require.NoError(t, err)
654 // convert bytes to structure
655 got := new(ConsensusValidator)
656 // unmarshal into bytes
657 require.NoError(t, json.Unmarshal(gotBytes, got))
658 // compare got vs expected
659 require.Equal(t, expected, got)
660}
661
662func TestViewCheckBasic(t *testing.T) {
663 tests := []struct {

Callers

nothing calls this directly

Calls 4

EqualMethod · 0.80
newTestPublicKeyBytesFunction · 0.70
MarshalMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected