MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestSortedSetIncrby

Function TestSortedSetIncrby

IceFireDB-PubSub/test/cmd_sorted_set_test.go:1259–1311  ·  view source on GitHub ↗

Test ZINCRBY

(t *testing.T)

Source from the content-addressed store, hash-verified

1257
1258// Test ZINCRBY
1259func TestSortedSetIncrby(t *testing.T) {
1260 server.Clear()
1261 c, err := proto.Dial(server.Addr())
1262 ok(t, err)
1263 defer c.Close()
1264 s := server.Direct()
1265
1266 // Normal cases
1267 {
1268 // New key
1269 mustDo(t, c,
1270 "ZINCRBY", "z", "1", "member",
1271 proto.String("1"),
1272 )
1273
1274 // Existing key
1275 mustDo(t, c,
1276 "ZINCRBY", "z", "2.5", "member",
1277 proto.String("3.5"),
1278 )
1279
1280 // New member
1281 mustDo(t, c,
1282 "ZINCRBY", "z", "1", "othermember",
1283 proto.String("1"),
1284 )
1285 }
1286
1287 t.Run("errors", func(t *testing.T) {
1288 mustDo(t, c,
1289 "ZINCRBY",
1290 proto.Error(errWrongNumber("zincrby")),
1291 )
1292 mustDo(t, c,
1293 "ZINCRBY", "set",
1294 proto.Error(errWrongNumber("zincrby")),
1295 )
1296 mustDo(t, c,
1297 "ZINCRBY", "set", "nofloat", "a",
1298 proto.Error(msgInvalidFloat),
1299 )
1300 mustDo(t, c,
1301 "ZINCRBY", "set", "1.0", "too", "many",
1302 proto.Error(errWrongNumber("zincrby")),
1303 )
1304
1305 s.Set("str", "value")
1306 mustDo(t, c,
1307 "ZINCRBY", "str", "1.0", "member",
1308 proto.Error(msgWrongType),
1309 )
1310 })
1311}
1312
1313func TestZscan(t *testing.T) {
1314 server.Clear()

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
StringFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70
CloseMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected