MCPcopy
hub / github.com/wavetermdev/waveterm / checkFileByteCount

Function checkFileByteCount

pkg/filestore/blockstore_test.go:291–306  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, zoneId string, name string, val byte, expected int)

Source from the content-addressed store, hash-verified

289}
290
291func checkFileByteCount(t *testing.T, ctx context.Context, zoneId string, name string, val byte, expected int) {
292 _, rdata, err := WFS.ReadFile(ctx, zoneId, name)
293 if err != nil {
294 t.Errorf("error reading data for file %q: %v", name, err)
295 return
296 }
297 var count int
298 for _, b := range rdata {
299 if b == val {
300 count++
301 }
302 }
303 if count != expected {
304 t.Errorf("byte count mismatch for file %q: expected %d, got %d", name, expected, count)
305 }
306}
307
308func checkFileDataAt(t *testing.T, ctx context.Context, zoneId string, name string, offset int64, data string) {
309 _, rdata, err := WFS.ReadAt(ctx, zoneId, name, offset, int64(len(data)))

Callers 2

TestSimpleDBFlushFunction · 0.85
TestConcurrentAppendFunction · 0.85

Calls 1

ReadFileMethod · 0.80

Tested by

no test coverage detected