tile38/vendor/github.com/gomodule/redigo/redis/commandinfo_test.go

28 lines
689 B
Go
Raw Normal View History

2018-10-29 15:00:54 +03:00
package redis
2016-12-02 19:14:34 +03:00
import "testing"
func TestLookupCommandInfo(t *testing.T) {
for _, n := range []string{"watch", "WATCH", "wAtch"} {
2018-10-29 15:00:54 +03:00
if lookupCommandInfo(n) == (commandInfo{}) {
2016-12-02 19:14:34 +03:00
t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n)
}
}
}
func benchmarkLookupCommandInfo(b *testing.B, names ...string) {
for i := 0; i < b.N; i++ {
for _, c := range names {
2018-10-29 15:00:54 +03:00
lookupCommandInfo(c)
2016-12-02 19:14:34 +03:00
}
}
}
func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) {
benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR")
}
func BenchmarkLookupCommandInfoMixedCase(b *testing.B) {
benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR")
}