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

Function TestGetbit

IceFireDB-Redis-Proxy/test/cmd_string_test.go:1466–1520  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1464}
1465
1466func TestGetbit(t *testing.T) {
1467 server.Clear()
1468 c, err := proto.Dial(server.Addr())
1469 ok(t, err)
1470 defer c.Close()
1471 s := server.Direct()
1472
1473 {
1474 s.Set("findme", "\x08")
1475 must0(t, c,
1476 "GETBIT", "findme", "0",
1477 )
1478 must1(t, c,
1479 "GETBIT", "findme", "4",
1480 )
1481 must0(t, c,
1482 "GETBIT", "findme", "5",
1483 )
1484 }
1485
1486 // Non-existing
1487 {
1488 must0(t, c,
1489 "GETBIT", "nosuch", "1",
1490 )
1491 must0(t, c,
1492 "GETBIT", "nosuch", "1000",
1493 )
1494 }
1495
1496 // Wrong type of existing key
1497 {
1498 s.HSet("wrong", "aap", "noot")
1499 mustDo(t, c,
1500 "GETBIT", "wrong", "1",
1501 proto.Error(msgWrongType),
1502 )
1503 }
1504
1505 // Wrong usage
1506 {
1507 mustDo(t, c,
1508 "GETBIT", "foo",
1509 proto.Error(errWrongNumber("getbit")),
1510 )
1511 mustDo(t, c,
1512 "GETBIT", "spurious", "arguments", "!",
1513 proto.Error(errWrongNumber("getbit")),
1514 )
1515 mustDo(t, c,
1516 "GETBIT", "many", "noint",
1517 proto.Error("ERR bit offset is not an integer or out of range"),
1518 )
1519 }
1520}
1521
1522func TestSetbit(t *testing.T) {
1523 server.Clear()

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
must0Function · 0.70
must1Function · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected