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

Function TestPubKey

crypto/asymmetric/keypair_test.go:110–142  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestPubKey(t *testing.T) {
111 pubKeyTests := []struct {
112 name string
113 key []byte
114 }{
115 {
116 name: "Test serialize",
117 key: []byte{
118 0x02,
119 0xc1, 0xdb, 0x96, 0xf2, 0xba, 0x7e, 0x1c, 0xb4,
120 0xe9, 0x82, 0x2d, 0x12, 0xde, 0x0f, 0x63, 0xfb,
121 0x66, 0x6f, 0xeb, 0x82, 0x8c, 0x7f, 0x50, 0x9e,
122 0x81, 0xfa, 0xb9, 0xbd, 0x7a, 0x34, 0x03, 0x9c,
123 },
124 },
125 }
126
127 for _, test := range pubKeyTests {
128 pubKey, err := ParsePubKey(test.key)
129
130 if err != nil {
131 t.Errorf("%s could not parse public key: %v", test.name, err)
132 continue
133 }
134
135 serializedKey := pubKey.Serialize()
136
137 if !bytes.Equal(test.key, serializedKey) {
138 t.Errorf("%s unexpected serialized bytes - got: %x, want: %x", test.name,
139 serializedKey, test.key)
140 }
141 }
142}
143
144func TestPublicKey_MarshalBinary(t *testing.T) {
145 Convey("marshal unmarshal public key", t, func() {

Callers

nothing calls this directly

Calls 3

ParsePubKeyFunction · 0.85
ErrorfMethod · 0.80
SerializeMethod · 0.45

Tested by

no test coverage detected