cleaned up tests for SetBit

This commit is contained in:
Todd Gruben 2016-02-22 11:30:06 -06:00
parent 5862f714b3
commit 08266d3496
2 changed files with 15 additions and 15 deletions

View file

@ -19,11 +19,11 @@ func TestFragment_SetBit(t *testing.T) {
defer f.Close()
// Set bits on the fragment.
if err := f.SetBit(120, 1); err != nil {
if _, err := f.SetBit(120, 1); err != nil {
t.Fatal(err)
} else if err := f.SetBit(120, 6); err != nil {
} else if _, err := f.SetBit(120, 6); err != nil {
t.Fatal(err)
} else if err := f.SetBit(121, 0); err != nil {
} else if _, err := f.SetBit(121, 0); err != nil {
t.Fatal(err)
}
@ -50,11 +50,11 @@ func TestFragment_ClearBit(t *testing.T) {
defer f.Close()
// Set and then clear bits on the fragment.
if err := f.SetBit(1000, 1); err != nil {
if _, err := f.SetBit(1000, 1); err != nil {
t.Fatal(err)
} else if err := f.SetBit(1000, 2); err != nil {
} else if _, err := f.SetBit(1000, 2); err != nil {
t.Fatal(err)
} else if err := f.ClearBit(1000, 1); err != nil {
} else if _, err := f.ClearBit(1000, 1); err != nil {
t.Fatal(err)
}
@ -77,11 +77,11 @@ func TestFragment_Snapshot(t *testing.T) {
defer f.Close()
// Set and then clear bits on the fragment.
if err := f.SetBit(1000, 1); err != nil {
if _, err := f.SetBit(1000, 1); err != nil {
t.Fatal(err)
} else if err := f.SetBit(1000, 2); err != nil {
} else if _, err := f.SetBit(1000, 2); err != nil {
t.Fatal(err)
} else if err := f.ClearBit(1000, 1); err != nil {
} else if _, err := f.ClearBit(1000, 1); err != nil {
t.Fatal(err)
}
@ -218,7 +218,7 @@ func TestFragment_LRUCache_Persistence(t *testing.T) {
// Set bits on the fragment.
for i := uint64(0); i < 1000; i++ {
if err := f.SetBit(i, 0); err != nil {
if _, err := f.SetBit(i, 0); err != nil {
t.Fatal(err)
}
}
@ -250,7 +250,7 @@ func TestFragment_RankCache_Persistence(t *testing.T) {
// Set bits on the fragment.
for i := uint64(0); i < 1000; i++ {
if err := f.SetBit(i, 0); err != nil {
if _, err := f.SetBit(i, 0); err != nil {
t.Fatal(err)
}
}
@ -332,7 +332,7 @@ func (f *Fragment) Reopen() error {
// MustSetBits sets bits on a bitmap. Panic on error.
func (f *Fragment) MustSetBits(bitmapID uint64, profileIDs ...uint64) {
for _, profileID := range profileIDs {
if err := f.SetBit(bitmapID, profileID); err != nil {
if _, err := f.SetBit(bitmapID, profileID); err != nil {
panic(err)
}
}
@ -341,7 +341,7 @@ func (f *Fragment) MustSetBits(bitmapID uint64, profileIDs ...uint64) {
// MustClearBits clears bits on a bitmap. Panic on error.
func (f *Fragment) MustClearBits(bitmapID uint64, profileIDs ...uint64) {
for _, profileID := range profileIDs {
if err := f.ClearBit(bitmapID, profileID); err != nil {
if _, err := f.ClearBit(bitmapID, profileID); err != nil {
panic(err)
}
}

View file

@ -210,7 +210,7 @@ func TestHandler_Query_Bitmap_Protobuf(t *testing.T) {
t.Fatalf("unexpected attr length: %d", len(attrs))
} else if k, v := attrs[0].GetKey(), attrs[0].GetStringValue(); k != "a" || v != "b" {
t.Fatalf("unexpected attr[0]: %s=%v", k, v)
} else if k, v := attrs[1].GetKey(), attrs[1].GetIntValue(); k != "c" || v != int64(1) {
} else if k, v := attrs[1].GetKey(), attrs[1].GetUintValue(); k != "c" || v != uint64(1) {
t.Fatalf("unexpected attr[1]: %s=%v", k, v)
} else if k, v := attrs[2].GetKey(), attrs[2].GetBoolValue(); k != "d" || v != true {
t.Fatalf("unexpected attr[2]: %s=%v", k, v)
@ -267,7 +267,7 @@ func TestHandler_Query_Bitmap_Profiles_Protobuf(t *testing.T) {
t.Fatalf("unexpected attr length: %d", len(attrs))
} else if k, v := attrs[0].GetKey(), attrs[0].GetStringValue(); k != "a" || v != "b" {
t.Fatalf("unexpected attr[0]: %s=%v", k, v)
} else if k, v := attrs[1].GetKey(), attrs[1].GetIntValue(); k != "c" || v != int64(1) {
} else if k, v := attrs[1].GetKey(), attrs[1].GetUintValue(); k != "c" || v != uint64(1) {
t.Fatalf("unexpected attr[1]: %s=%v", k, v)
} else if k, v := attrs[2].GetKey(), attrs[2].GetBoolValue(); k != "d" || v != true {
t.Fatalf("unexpected attr[2]: %s=%v", k, v)