MCPcopy
hub / github.com/klauspost/compress / testBlockRoundtrip

Function testBlockRoundtrip

s2/s2_test.go:1258–1274  ·  view source on GitHub ↗
(t *testing.T, src []byte)

Source from the content-addressed store, hash-verified

1256}
1257
1258func testBlockRoundtrip(t *testing.T, src []byte) {
1259 dst := Encode(nil, src)
1260 t.Logf("encoded to %d -> %d bytes", len(src), len(dst))
1261 decoded, err := Decode(nil, dst)
1262 if err != nil {
1263 t.Error(err)
1264 return
1265 }
1266 if len(decoded) != len(src) {
1267 t.Error("decoded len:", len(decoded), "!=", len(src))
1268 return
1269 }
1270 err = cmp(decoded, src)
1271 if err != nil {
1272 t.Error(err)
1273 }
1274}
1275
1276func testBetterBlockRoundtrip(t *testing.T, src []byte) {
1277 dst := EncodeBetter(nil, src)

Callers 2

testFileFunction · 0.85
TestDataRoundtripsFunction · 0.85

Calls 4

EncodeFunction · 0.70
DecodeFunction · 0.70
cmpFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…