diff options
author | =Corey Hulen <corey@hulen.com> | 2015-07-29 01:26:10 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-07-29 01:26:10 -0800 |
commit | 9677a9f71777d75f3def0b0cb238050a30ec6a67 (patch) | |
tree | 8579fae8134ef2167a2cc97d95b0225e8acfdb46 /Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go | |
parent | 81e55eb57c367a1403f693712411c0781287ea55 (diff) | |
download | chat-9677a9f71777d75f3def0b0cb238050a30ec6a67.tar.gz chat-9677a9f71777d75f3def0b0cb238050a30ec6a67.tar.bz2 chat-9677a9f71777d75f3def0b0cb238050a30ec6a67.zip |
Fixes mm-1355 adds rate limiting apis
Diffstat (limited to 'Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go')
-rw-r--r-- | Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go b/Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go deleted file mode 100644 index 1b9e15810..000000000 --- a/Godeps/_workspace/src/gopkg.in/redis.v2/parser_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package redis - -import ( - "testing" - - "gopkg.in/bufio.v1" -) - -func BenchmarkParseReplyStatus(b *testing.B) { - benchmarkParseReply(b, "+OK\r\n", nil, false) -} - -func BenchmarkParseReplyInt(b *testing.B) { - benchmarkParseReply(b, ":1\r\n", nil, false) -} - -func BenchmarkParseReplyError(b *testing.B) { - benchmarkParseReply(b, "-Error message\r\n", nil, true) -} - -func BenchmarkParseReplyString(b *testing.B) { - benchmarkParseReply(b, "$5\r\nhello\r\n", nil, false) -} - -func BenchmarkParseReplySlice(b *testing.B) { - benchmarkParseReply(b, "*2\r\n$5\r\nhello\r\n$5\r\nworld\r\n", parseSlice, false) -} - -func benchmarkParseReply(b *testing.B, reply string, p multiBulkParser, wanterr bool) { - b.StopTimer() - - buf := &bufio.Buffer{} - rd := bufio.NewReader(buf) - for i := 0; i < b.N; i++ { - buf.WriteString(reply) - } - - b.StartTimer() - - for i := 0; i < b.N; i++ { - _, err := parseReply(rd, p) - if !wanterr && err != nil { - panic(err) - } - } -} - -func BenchmarkAppendArgs(b *testing.B) { - buf := make([]byte, 0, 64) - args := []string{"hello", "world", "foo", "bar"} - for i := 0; i < b.N; i++ { - appendArgs(buf, args) - } -} |