mirror of
https://github.com/kidoman/embd
synced 2024-12-22 04:40:04 +01:00
- add a benchmark test for pinMap lookup
- run benchmarks in ci
This commit is contained in:
parent
0ac16b97dd
commit
5a1a40d53b
@ -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
|
||||
|
10
pin_test.go
10
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)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user