func TestBloomTestAndAdd(t *testing.T) {
	f := NewBloomFilter(100, 0.01)
	if f.Test([]byte(`a`)) {
		t.Error("`a` should not be a member")
	}
	if f.Add([]byte(`a`)) != f {
		t.Error("Returned BloomFilter should be the same instance")
	}
	if !f.Test([]byte(`a`)) {
		t.Error("`a` should be a member")
	}
	if !f.TestAndAdd([]byte(`a`)) {
		t.Error("`a` should be a member")
	}
	if f.TestAndAdd([]byte(`b`)) {
		t.Error("`b` should not be a member")
	}
	if !f.Test([]byte(`a`)) {
		t.Error("`a` should be a member")
	}
	if !f.Test([]byte(`b`)) {
		t.Error("`b` should be a member")
	}
	if f.Test([]byte(`c`)) {
		t.Error("`c` should not be a member")
	}
	for i := 0; i < 1000000; i++ {
		f.TestAndAdd([]byte(strconv.Itoa(i)))
	}
	if !f.Test([]byte(`x`)) {
		t.Error("`x` should be a member")
	}
}
Ensures that Test, Add, and TestAndAdd behave correctly.
package boom
import (
	"strconv"
	"testing"
)
func TestBloomCapacity(t *testing.T) {
	f := NewBloomFilter(100, 0.1)
	if capacity := f.Capacity(); capacity != 480 {
		t.Errorf("Expected 480, got %d", capacity)
	}
}
func TestBloomK(t *testing.T) {
	f := NewBloomFilter(100, 0.1)
	if k := f.K(); k != 4 {
		t.Errorf("Expected 4, got %d", k)
	}
}
func TestBloomCount(t *testing.T) {
	f := NewBloomFilter(100, 0.1)
	for i := 0; i < 10; i++ {
		f.Add([]byte(strconv.Itoa(i)))
	}
	if count := f.Count(); count != 10 {
		t.Errorf("Expected 10, got %d", count)
	}
}
func TestBloomEstimatedFillRatio(t *testing.T) {
	f := NewBloomFilter(100, 0.5)
	for i := 0; i < 100; i++ {
		f.Add([]byte(strconv.Itoa(i)))
	}
	if ratio := f.EstimatedFillRatio(); ratio > 0.5 {
		t.Errorf("Expected less than or equal to 0.5, got %f", ratio)
	}
}
func TestBloomFillRatio(t *testing.T) {
	f := NewBloomFilter(100, 0.1)
	f.Add([]byte(`a`))
	f.Add([]byte(`b`))
	f.Add([]byte(`c`))
	if ratio := f.FillRatio(); ratio != 0.025 {
		t.Errorf("Expected 0.025, got %f", ratio)
	}
}