src/testing stub AllocsPerRun

This commit is contained in:
Damian Gryski
2021-11-11 08:57:28 -08:00
committed by Ayke
parent 44bb381220
commit 7273a2b5fd
+13
View File
@@ -302,6 +302,19 @@ func Verbose() bool {
return flagVerbose
}
// AllocsPerRun returns the average number of allocations during calls to f.
// Although the return value has type float64, it will always be an integral
// value.
//
// Not implemented.
func AllocsPerRun(runs int, f func()) (avg float64) {
f()
for i := 0; i < runs; i++ {
f()
}
return 0
}
func TestMain(m *M) {
os.Exit(m.Run())
}