Standard library / testing
testing.BenchmarkResult.String()
Format timing and other benchmark metrics; exact formatting is not a stable data contract. Expected stdout: 'true\nPASS\n'. Run as a _test.go file using the Go test harness.
Formal Syntax & Structure
go syntaxgo
func (r BenchmarkResult) String() stringReturn Value
string
Result of the operation described above.
Working Example
Example Snippetgo
package main
import ( "fmt" "testing" "time")
func TestReference(t *testing.T) { r := testing.BenchmarkResult{N: 2, T: 10 * time.Nanosecond, MemBytes: 24, MemAllocs: 6} fmt.Println(len(r.String()) > 0)}