...

Source file src/github.com/gomodule/redigo/internal/commandinfo_test.go

Documentation: github.com/gomodule/redigo/internal

     1  package internal
     2  
     3  import "testing"
     4  
     5  func TestLookupCommandInfo(t *testing.T) {
     6  	for _, n := range []string{"watch", "WATCH", "wAtch"} {
     7  		if LookupCommandInfo(n) == (CommandInfo{}) {
     8  			t.Errorf("LookupCommandInfo(%q) = CommandInfo{}, expected non-zero value", n)
     9  		}
    10  	}
    11  }
    12  
    13  func benchmarkLookupCommandInfo(b *testing.B, names ...string) {
    14  	for i := 0; i < b.N; i++ {
    15  		for _, c := range names {
    16  			LookupCommandInfo(c)
    17  		}
    18  	}
    19  }
    20  
    21  func BenchmarkLookupCommandInfoCorrectCase(b *testing.B) {
    22  	benchmarkLookupCommandInfo(b, "watch", "WATCH", "monitor", "MONITOR")
    23  }
    24  
    25  func BenchmarkLookupCommandInfoMixedCase(b *testing.B) {
    26  	benchmarkLookupCommandInfo(b, "wAtch", "WeTCH", "monItor", "MONiTOR")
    27  }
    28  

View as plain text