IncrByEqual verify that the return value of the incr operation is correct
(t *testing.T, key string, delta int)
| 164 | |
| 165 | //IncrByEqual verify that the return value of the incr operation is correct |
| 166 | func (es *ExampleString) IncrByEqual(t *testing.T, key string, delta int) { |
| 167 | var vi int |
| 168 | if v, ok := es.values[key]; ok { |
| 169 | vi, _ = strconv.Atoi(v) |
| 170 | vi = vi + delta |
| 171 | es.values[key] = strconv.Itoa(vi) |
| 172 | } else { |
| 173 | vi = delta |
| 174 | es.values[key] = strconv.Itoa(vi) |
| 175 | } |
| 176 | reply, err := redis.Int(es.conn.Do("incrby", key, delta)) |
| 177 | assert.Equal(t, vi, reply) |
| 178 | assert.NoError(t, err) |
| 179 | } |
| 180 | |
| 181 | //IncrByFloatEqual verify that the return value of the incr operation is correct |
| 182 | func (es *ExampleString) IncrByFloatEqual(t *testing.T, key string, delta float64) { |