-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbits_test.go
More file actions
45 lines (33 loc) · 727 Bytes
/
Copy pathbits_test.go
File metadata and controls
45 lines (33 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package ribbons
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestBits(t *testing.T) {
Convey("Check bits", t, func() {
Convey("Check set", func() {
u := uint64(0)
u = setBit(u, 3)
So(u, ShouldEqual, 8)
u = setBit(u, 0)
So(u, ShouldEqual, 9)
})
Convey("Check del", func() {
u := uint64(8)
u = delBit(u, 3)
So(u, ShouldEqual, 0)
u = delBit(u, 3)
So(u, ShouldEqual, 0)
})
Convey("Check has", func() {
u := uint64(8)
So(hasBit(u, 3), ShouldBeTrue)
So(hasBit(u, 0), ShouldBeFalse)
})
Convey("Check extract", func() {
u := uint64(9)
bits := extractToggledBits(bucketSize, u, 0)
So(bits, ShouldResemble, []uint64{0, 3})
})
})
}