filter: benchmark: error checking for write function update descriptions

This commit is contained in:
Ella Pietraroia 2020-02-07 11:24:36 +10:30
parent 99b0ccc1b5
commit b880657eae
2 changed files with 19 additions and 12 deletions

View File

@ -62,7 +62,10 @@ func BenchmarkBasic(b *testing.B) {
b.Log("Frames: ", len(testPackets))
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
_, err := f.Write(x)
if err != nil {
b.Fatalf("cannot write to basic filter: %v#", err)
}
}
}
}
@ -73,7 +76,10 @@ func BenchmarkDifference(b *testing.B) {
b.Log("Frames: ", len(testPackets))
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
_, err := f.Write(x)
if err != nil {
b.Fatalf("cannot write to diff filter: %v#", err)
}
}
}
}
@ -84,7 +90,10 @@ func BenchmarkKNN(b *testing.B) {
b.Log("Frames: ", len(testPackets))
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
_, err := f.Write(x)
if err != nil {
b.Fatalf("cannot write to KNN filter: %v#", err)
}
}
}
}
@ -95,7 +104,10 @@ func BenchmarkMOG(b *testing.B) {
b.Log("Frames: ", len(testPackets))
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
_, err := f.Write(x)
if err != nil {
b.Fatalf("cannot write to MOG filter: %v#", err)
}
}
}
}

File diff suppressed because one or more lines are too long