(b *testing.B)
| 45 | } |
| 46 | |
| 47 | func 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 | } |
nothing calls this directly
no test coverage detected