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

Function TestDporSignatureJsonEncoding

types/block_test.go:159–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func TestDporSignatureJsonEncoding(t *testing.T) {
160 sig := HexToDporSig("0xc9efd3956760d72613081c50294ad582d0e36bea45878f3570cc9e8525b997472120d0ef25f88c3b64122b967bd5063633b744bc4e3ae3afc316bb4e5c7edc1d00")
161 jsonBytes, err := json.Marshal(sig)
162
163 if err != nil {
164 t.Error("error:", err)
165 }
166 fmt.Println("jsonBytes:", string(jsonBytes))
167
168 var ds DporSignature
169 err = json.Unmarshal(jsonBytes, &ds)
170 if err != nil {
171 t.Error("error:", err)
172 }
173 fmt.Printf("\nunmarshal:%+v\n", ds)
174 assert.Equal(t, sig, ds)
175}
176
177func TestDporSnapJsonEncoding(t *testing.T) {
178 dpor := DporSnap{

Callers

nothing calls this directly

Calls 3

HexToDporSigFunction · 0.85
ErrorMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected