- add a benchmark test for pinMap lookup

- run benchmarks in ci
This commit is contained in:
Karan Misra 2014-03-23 05:23:25 +05:30
parent 0ac16b97dd
commit 5a1a40d53b
2 changed files with 11 additions and 1 deletions

View File

@ -6,5 +6,5 @@ go:
- tip
script:
- go test ./... | grep -v 'no test files'
- go test -bench=. -v ./... | grep -v 'no test files'
- pushd samples && find . -name "*.go" -exec go build {} \; && popd

View File

@ -45,3 +45,13 @@ func TestPinMapLookup(t *testing.T) {
}
}
}
func BenchmarkPinMapLookup(b *testing.B) {
var pinMap = PinMap{
&PinDesc{ID: "P1_1", Aliases: []string{"AN1", "10"}, Caps: CapAnalog},
&PinDesc{ID: "P1_2", Aliases: []string{"10", "GPIO10"}, Caps: CapNormal},
}
for i := 0; i < b.N; i++ {
pinMap.Lookup("GPIO10", CapNormal)
}
}