Skip to content

Commit

Permalink
errors normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Oct 22, 2022
1 parent ab56425 commit 21d1764
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions rotate/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ func (bs *Bloomfilter) Union(that interface{}) (float64, error) {
return bs.capacity(), bloomfilter.ErrImpossibleToTreat
}
if other.Config.N != bs.Config.N {
return bs.capacity(), fmt.Errorf("error: diferrent n values %d vs. %d", other.Config.N, bs.Config.N)
return bs.capacity(), fmt.Errorf("different n values %d vs. %d", other.Config.N, bs.Config.N)
}

if other.Config.P != bs.Config.P {
return bs.capacity(), fmt.Errorf("error: diferrent p values %.2f vs. %.2f", other.Config.P, bs.Config.P)
return bs.capacity(), fmt.Errorf("different p values %.2f vs. %.2f", other.Config.P, bs.Config.P)
}

if _, err := bs.Current.Union(other.Current); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions rotate/rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestRotate_Union_koIncompatibleN(t *testing.T) {
cfg := testutils.TestCfg
cfg.N = 1
set2 := New(ctx, Config{cfg, 5})
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "error: diferrent n values") {
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "different n values") {
t.Errorf("Unexpected error, %v", err)
}
}
Expand All @@ -59,7 +59,7 @@ func TestRotate_Union_koIncompatibleP(t *testing.T) {
cfg := testutils.TestCfg
cfg.P = 0.5
set2 := New(ctx, Config{cfg, 5})
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "error: diferrent p values") {
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "different p values") {
t.Errorf("Unexpected error, %v", err)
}
}
Expand All @@ -70,7 +70,7 @@ func TestRotate_Union_koIncompatibleCurrentBFs(t *testing.T) {

set1 := New(ctx, Config{testutils.TestCfg, 5})
set2 := New(ctx, Config{testutils.TestCfg2, 5})
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "error: diferrent p values") {
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "different p values") {
t.Errorf("Unexpected error, %v", err)
}
}
Expand All @@ -81,7 +81,7 @@ func TestRotate_Union_koDifferentHashFuncsBFs(t *testing.T) {

set1 := New(ctx, Config{testutils.TestCfg, 5})
set2 := New(ctx, Config{testutils.TestCfg3, 5})
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "error: different hashers") {
if _, err := set1.Union(set2); err == nil || !strings.Contains(err.Error(), "different hashers") {
t.Errorf("Unexpected error, %v", err)
}
}
Expand Down

0 comments on commit 21d1764

Please sign in to comment.