diff --git a/.travis.yml b/.travis.yml index e25f3c4..3e57700 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/pin_test.go b/pin_test.go index 8aea34b..10eef62 100644 --- a/pin_test.go +++ b/pin_test.go @@ -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) + } +}