MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestBitMapStructure_BitOp

Function TestBitMapStructure_BitOp

structure/bitmap_1_test.go:76–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestBitMapStructure_BitOp(t *testing.T) {
77 bitmap := initBitMap()
78 defer bitmap.db.Clean()
79
80 // Test BitOp function
81 bitmapErr = bitmap.SetBits(string(randkv.GetTestKey(1)), 0, true, 1, false)
82 assert.Nil(t, bitmapErr)
83 bitmapErr = bitmap.SetBits(string(randkv.GetTestKey(2)), 0, false, 1, true)
84 assert.Nil(t, bitmapErr)
85 bitmapErr = bitmap.BitOp([]byte("AND"), string(randkv.GetTestKey(3)), string(randkv.GetTestKey(1)), string(randkv.GetTestKey(2)))
86 assert.Nil(t, bitmapErr)
87 values, err := bitmap.GetBits(string(randkv.GetTestKey(3)), 0, 1)
88 assert.Nil(t, err)
89 assert.Equal(t, []bool{false, false}, values)
90}
91
92func TestBitMapStructure_BitDel(t *testing.T) {
93 bitmap := initBitMap()

Callers

nothing calls this directly

Calls 6

GetTestKeyFunction · 0.92
initBitMapFunction · 0.85
CleanMethod · 0.45
SetBitsMethod · 0.45
BitOpMethod · 0.45
GetBitsMethod · 0.45

Tested by

no test coverage detected