(t *testing.T)
| 1464 | } |
| 1465 | |
| 1466 | func 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 | |
| 1522 | func TestSetbit(t *testing.T) { |
| 1523 | server.Clear() |
nothing calls this directly
no test coverage detected