MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestComputePartMap

Function TestComputePartMap

pkg/filestore/blockstore_test.go:547–577  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

545}
546
547func TestComputePartMap(t *testing.T) {
548 partDataSize = 100
549 defer func() {
550 partDataSize = DefaultPartDataSize
551 }()
552 file := &WaveFile{}
553 m := file.computePartMap(0, 250)
554 testIntMapsEq(t, "map1", m, map[int]int{0: 100, 1: 100, 2: 50})
555 m = file.computePartMap(110, 40)
556 log.Printf("map2:%#v\n", m)
557 testIntMapsEq(t, "map2", m, map[int]int{1: 40})
558 m = file.computePartMap(110, 90)
559 testIntMapsEq(t, "map3", m, map[int]int{1: 90})
560 m = file.computePartMap(110, 91)
561 testIntMapsEq(t, "map4", m, map[int]int{1: 90, 2: 1})
562 m = file.computePartMap(820, 340)
563 testIntMapsEq(t, "map5", m, map[int]int{8: 80, 9: 100, 10: 100, 11: 60})
564
565 // now test circular
566 file = &WaveFile{Opts: wshrpc.FileOpts{Circular: true, MaxSize: 1000}}
567 m = file.computePartMap(10, 250)
568 testIntMapsEq(t, "map6", m, map[int]int{0: 90, 1: 100, 2: 60})
569 m = file.computePartMap(990, 40)
570 testIntMapsEq(t, "map7", m, map[int]int{9: 10, 0: 30})
571 m = file.computePartMap(990, 130)
572 testIntMapsEq(t, "map8", m, map[int]int{9: 10, 0: 100, 1: 20})
573 m = file.computePartMap(5, 1105)
574 testIntMapsEq(t, "map9", m, map[int]int{0: 100, 1: 10, 2: 100, 3: 100, 4: 100, 5: 100, 6: 100, 7: 100, 8: 100, 9: 100})
575 m = file.computePartMap(2005, 1105)
576 testIntMapsEq(t, "map9", m, map[int]int{0: 100, 1: 10, 2: 100, 3: 100, 4: 100, 5: 100, 6: 100, 7: 100, 8: 100, 9: 100})
577}
578
579func TestSimpleDBFlush(t *testing.T) {
580 initDb(t)

Callers

nothing calls this directly

Calls 2

computePartMapMethod · 0.95
testIntMapsEqFunction · 0.85

Tested by

no test coverage detected