mirror of
https://github.com/redis/go-redis.git
synced 2025-11-24 18:41:04 +03:00
Add ParseReq method and tweak benchmarks.
This commit is contained in:
18
req_test.go
18
req_test.go
@@ -60,10 +60,18 @@ func (t *RequestTest) BenchmarkStatusReq(c *C) {
|
||||
t.benchmarkReq(c, "+OK\r\n", redis.NewStatusReq(), Equals, "OK")
|
||||
}
|
||||
|
||||
func (t *RequestTest) BenchmarkIntReq(c *C) {
|
||||
t.benchmarkReq(c, ":1\r\n", redis.NewIntReq(), Equals, int64(1))
|
||||
}
|
||||
|
||||
func (t *RequestTest) BenchmarkStringReq(c *C) {
|
||||
t.benchmarkReq(c, "$5\r\nhello\r\n", redis.NewStringReq(), Equals, "hello")
|
||||
}
|
||||
|
||||
func (t *RequestTest) BenchmarkFloatReq(c *C) {
|
||||
t.benchmarkReq(c, "$5\r\n1.111\r\n", redis.NewFloatReq(), Equals, 1.111)
|
||||
}
|
||||
|
||||
func (t *RequestTest) BenchmarkStringSliceReq(c *C) {
|
||||
t.benchmarkReq(
|
||||
c,
|
||||
@@ -73,3 +81,13 @@ func (t *RequestTest) BenchmarkStringSliceReq(c *C) {
|
||||
[]string{"hello", "hello"},
|
||||
)
|
||||
}
|
||||
|
||||
func (t *RequestTest) BenchmarkIfaceSliceReq(c *C) {
|
||||
t.benchmarkReq(
|
||||
c,
|
||||
"*2\r\n$5\r\nhello\r\n$5\r\nhello\r\n",
|
||||
redis.NewIfaceSliceReq(),
|
||||
DeepEquals,
|
||||
[]interface{}{"hello", "hello"},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user