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

Function TestZscan

IceFireDB-PubSub/test/cmd_sorted_set_test.go:1313–1409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1311}
1312
1313func TestZscan(t *testing.T) {
1314 server.Clear()
1315 c, err := proto.Dial(server.Addr())
1316 ok(t, err)
1317 defer c.Close()
1318 s := server.Direct()
1319
1320 // We cheat with zscan. It always returns everything.
1321
1322 s.ZAdd("h", 1.0, "field1")
1323 s.ZAdd("h", 2.0, "field2")
1324
1325 // No problem
1326 mustDo(t, c,
1327 "ZSCAN", "h", "0",
1328 proto.Array(
1329 proto.String("0"),
1330 proto.Array(
1331 proto.String("field1"),
1332 proto.String("1"),
1333 proto.String("field2"),
1334 proto.String("2"),
1335 ),
1336 ),
1337 )
1338
1339 // Invalid cursor
1340 mustDo(t, c,
1341 "ZSCAN", "h", "42",
1342 proto.Array(
1343 proto.String("0"),
1344 proto.Array(),
1345 ),
1346 )
1347
1348 // COUNT (ignored)
1349 mustDo(t, c,
1350 "ZSCAN", "h", "0", "COUNT", "200",
1351 proto.Array(
1352 proto.String("0"),
1353 proto.Array(
1354 proto.String("field1"),
1355 proto.String("1"),
1356 proto.String("field2"),
1357 proto.String("2"),
1358 ),
1359 ),
1360 )
1361
1362 // MATCH
1363 s.ZAdd("h", 3.0, "aap")
1364 s.ZAdd("h", 4.0, "noot")
1365 s.ZAdd("h", 5.0, "mies")
1366 mustDo(t, c,
1367 "ZSCAN", "h", "0", "MATCH", "mi*",
1368 proto.Array(
1369 proto.String("0"),
1370 proto.Array(

Callers

nothing calls this directly

Calls 13

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

Tested by

no test coverage detected