MCPcopy Create free account
hub / github.com/CPChain/chain / TestProtocolCompatibility

Function TestProtocolCompatibility

protocols/cpc/handler_test.go:37–61  ·  view source on GitHub ↗

Tests that protocol versions and modes of operations are matched up properly.

(t *testing.T)

Source from the content-addressed store, hash-verified

35
36// Tests that protocol versions and modes of operations are matched up properly.
37func TestProtocolCompatibility(t *testing.T) {
38 // Define the compatibility chart
39 tests := []struct {
40 version uint
41 compatible bool
42 }{
43 {61, true}, {62, true}, {63, true},
44 }
45 // Make sure anything we screw up is restored
46 backup := ProtocolVersions
47 defer func() { ProtocolVersions = backup }()
48
49 // Try all available compatibility configs and check for errors
50 for i, tt := range tests {
51 ProtocolVersions = []uint{tt.version}
52
53 pm, _, err := newTestProtocolManager(0, nil, nil)
54 if pm != nil {
55 defer pm.Stop()
56 }
57 if (err == nil && !tt.compatible) || (err != nil && tt.compatible) {
58 t.Errorf("test %d: compatibility mismatch: have error %v, want compatibility %v", i, err, tt.compatible)
59 }
60 }
61}
62
63// Tests that block headers can be retrieved from a remote chain based on user queries.
64func TestGetBlockHeaders(t *testing.T) {

Callers

nothing calls this directly

Calls 2

newTestProtocolManagerFunction · 0.85
StopMethod · 0.65

Tested by

no test coverage detected