MCPcopy Create free account
hub / github.com/evilsocket/sum / BenchmarkWrappedRecordsLoopWithAllBut

Function BenchmarkWrappedRecordsLoopWithAllBut

wrapper/records_benchmark_test.go:47–70  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

45}
46
47func BenchmarkWrappedRecordsLoopWithAllBut(b *testing.B) {
48 setupRecords(b, true)
49 defer teardownRecords(b)
50
51 records, err := storage.LoadRecords(testFolder)
52 if err != nil {
53 b.Fatal(err)
54 }
55
56 reference := records.Find(1)
57 if reference == nil {
58 b.Fatal("expected record with id 1")
59 }
60
61 wrapped := WrapRecords(records)
62 wRef := WrapRecord(reference)
63
64 b.ResetTimer()
65 for i := 0; i < b.N; i++ {
66 if allBut := wrapped.AllBut(wRef); len(allBut) != testRecords-1 {
67 b.Fatalf("expected %d wrapped records, got %d", testRecords-1, len(allBut))
68 }
69 }
70}

Callers

nothing calls this directly

Calls 6

WrapRecordsFunction · 0.85
WrapRecordFunction · 0.85
AllButMethod · 0.80
setupRecordsFunction · 0.70
teardownRecordsFunction · 0.70
FindMethod · 0.45

Tested by

no test coverage detected