modify unit test

This commit is contained in:
wenyekui 2014-07-24 15:36:25 +08:00
parent ebdc1ee3ae
commit 58cdace7df
1 changed files with 12 additions and 4 deletions

View File

@ -12,7 +12,7 @@ func TestBgetCommand(t *testing.T) {
db.BSetBit([]byte("test_bget"), 2, 1) db.BSetBit([]byte("test_bget"), 2, 1)
_, err := bgetCommand(db, "test_bget", "a", "b", "c") _, err := bgetCommand(db, "test_bget", "a", "b", "c")
if err == nil || err.Error() != "ERR wrong number of arguments for 'bget' command" { if err == nil || err.Error() != "wrong number of arguments for 'bget' command" {
t.Fatal("invalid err %v", err) t.Fatal("invalid err %v", err)
} }
@ -30,7 +30,7 @@ func TestBDeleteCommand(t *testing.T) {
db := getTestDB() db := getTestDB()
_, err := bdeleteCommand(db, "test_bdelete", "a", "b", "c") _, err := bdeleteCommand(db, "test_bdelete", "a", "b", "c")
if err == nil || err.Error() != "ERR wrong number of arguments for 'bdelete' command" { if err == nil || err.Error() != "wrong number of arguments for 'bdelete' command" {
t.Fatalf("invalid err %v", err) t.Fatalf("invalid err %v", err)
} }
@ -57,7 +57,7 @@ func TestBDeleteCommand(t *testing.T) {
func TestBSetbitCommand(t *testing.T) { func TestBSetbitCommand(t *testing.T) {
db := getTestDB() db := getTestDB()
_, err := bsetbitCommand(db, "test_bsetbit", "a", "b", "c") _, err := bsetbitCommand(db, "test_bsetbit", "a", "b", "c")
if err == nil || err.Error() != "ERR wrong number of arguments for 'bsetbit' command" { if err == nil || err.Error() != "wrong number of arguments for 'bsetbit' command" {
t.Fatalf("invalid err %v", err) t.Fatalf("invalid err %v", err)
} }
n, err := bsetbitCommand(db, "test_bsetbit", "1", "1") n, err := bsetbitCommand(db, "test_bsetbit", "1", "1")
@ -80,7 +80,7 @@ func TestBMsetbitCommand(t *testing.T) {
db := getTestDB() db := getTestDB()
_, err := bmsetbitCommand(db, "test_bmsetbit", "a", "b", "c") _, err := bmsetbitCommand(db, "test_bmsetbit", "a", "b", "c")
if err == nil || err.Error() != "ERR wrong number of arguments for 'bmsetbit' command" { if err == nil || err.Error() != "wrong number of arguments for 'bmsetbit' command" {
t.Fatalf("invalid err %v", err) t.Fatalf("invalid err %v", err)
} }
n, err := bmsetbitCommand(db, "test_bmsetbit", "1", "1", "3", "1") n, err := bmsetbitCommand(db, "test_bmsetbit", "1", "1", "3", "1")
@ -91,3 +91,11 @@ func TestBMsetbitCommand(t *testing.T) {
t.Fatalf("wrong result: %v", n) t.Fatalf("wrong result: %v", n)
} }
} }
func TestBCountCommand(t *testing.T) {
db := getTestDB()
_, err := bcountCommand(db, "test_bcount", "a", "b", "c")
if err == nil || err.Error() != "wrong number of arguments for 'bcount' command" {
t.Fatalf("invalid err %v", err)
}
}