Example #1
0
func TestBitmap8(t *testing.T) {

	bit8 := NewBitmap(8)
	keys := [][]byte{}

	for i := 0; i < 10000; i++ {

		key := idhash.Rand(8)
		bit8.Set(key)

		keys = append(keys, key)
	}

	for _, key := range keys {

		if !bit8.Has(key) {
			t.Fatal("Failed on Bitmap.Has()")
		}

		bit8.Del(key)
	}

	for _, key := range keys {

		if bit8.Has(key) {
			t.Fatal("Failed on Bitmap.Has()")
		}
	}
}
Example #2
0
func init() {

	for i := 0; i < glimit; i++ {
		gkeys = append(gkeys, idhash.Rand(8))
	}
}