aboutsummaryrefslogtreecommitdiff
path: root/bitfield/bitfield_test.go
blob: cad2a93f403c748fc85f541370451f85f18438b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package bitfield

import "testing"

func TestNew(t *testing.T) {
	bf := New(63)
	bf.Set(7)
	if !bf.At(7) {
		t.Error("want set, got clear")
	}
	bf.Clear(7)
	if bf.At(7) {
		t.Error("want cleared, got set")
	}
	// beyond range
	if bf.At(64) {
		t.Error("want clear, got set")
	}
	t.Log("len:", len(bf), bf, bf.At(7))
}