Johanan Idicula dadb6bdeae
feat: Add benchmark example (#403)
* feat: Add benchmark example

Adds a simple benchmark example and its invocation.

* fix: Address PR comments

- Clarify meaning of `b.N`.
- Nix verbose flag in run example.

* fix: Reword b.N comment

* fix: Missing period
2021-12-02 07:04:59 -08:00

30 lines
973 B
Bash

# Run all tests in the current project in verbose mode.
$ go test -v
== RUN TestIntMinBasic
--- PASS: TestIntMinBasic (0.00s)
=== RUN TestIntMinTableDriven
=== RUN TestIntMinTableDriven/0,1
=== RUN TestIntMinTableDriven/1,0
=== RUN TestIntMinTableDriven/2,-2
=== RUN TestIntMinTableDriven/0,-1
=== RUN TestIntMinTableDriven/-1,0
--- PASS: TestIntMinTableDriven (0.00s)
--- PASS: TestIntMinTableDriven/0,1 (0.00s)
--- PASS: TestIntMinTableDriven/1,0 (0.00s)
--- PASS: TestIntMinTableDriven/2,-2 (0.00s)
--- PASS: TestIntMinTableDriven/0,-1 (0.00s)
--- PASS: TestIntMinTableDriven/-1,0 (0.00s)
PASS
ok examples/testing 0.023s
# Run all benchmarks in the current project in verbose
# mode. All tests are run prior to benchmarks. The `bench`
# flag receives a regex for benchmark function names.
$ go test -bench=.
goos: darwin
goarch: arm64
pkg: examples/testing
BenchmarkIntMin-8 1000000000 0.3136 ns/op
PASS
ok examples/testing 0.351s