MCPcopy Create free account
hub / github.com/antonmedv/gitmal / FuzzBase85Roundtrip

Function FuzzBase85Roundtrip

pkg/gitdiff/base85_test.go:99–118  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

97}
98
99func FuzzBase85Roundtrip(f *testing.F) {
100 f.Add([]byte{0x2b, 0x0d})
101 f.Add([]byte{0xbc, 0xb4, 0x3f})
102 f.Add([]byte{0xfa, 0x62, 0x05, 0x83, 0x24, 0x39, 0xd5, 0x25})
103 f.Add([]byte{0x31, 0x59, 0x02, 0xa0, 0x61, 0x12, 0xd9, 0x43, 0xb8, 0x23, 0x1a, 0xb4, 0x02, 0xae, 0xfa, 0xcc, 0x22, 0xad, 0x41, 0xb9, 0xb8})
104
105 f.Fuzz(func(t *testing.T, in []byte) {
106 n := len(in)
107 dst := make([]byte, base85Len(n))
108 out := make([]byte, n)
109
110 base85Encode(dst, in)
111 if err := base85Decode(out, dst); err != nil {
112 t.Fatalf("unexpected error decoding base85 data: %v", err)
113 }
114 if !bytes.Equal(in, out) {
115 t.Errorf("decoded data differed from input data:\n input: %x\n output: %x\nencoding: %s\n", in, out, string(dst))
116 }
117 })
118}

Callers

nothing calls this directly

Calls 4

base85LenFunction · 0.85
base85DecodeFunction · 0.85
ErrorfMethod · 0.80
base85EncodeFunction · 0.70

Tested by

no test coverage detected