You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/pkg/types/bitmap_roaring_test.go

37 lines
828 B

// Copyright 2023 ROC. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package types_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/rocboss/paopao-ce/pkg/types"
)
var _ = Describe("Bitmap", Ordered, func() {
It("sql scaner for Bitmap", func() {
bitmap := types.NewBitmap()
bitmap.Data.Map.Add(128)
value, err := bitmap.Value()
Expect(err).To(BeNil())
var bm types.Bitmap
bm.Scan(value)
Expect(bm.Data.Map.Contains(128)).To(BeTrue())
})
It("sql scaner for Bitmap64", func() {
bitmap := types.NewBitmap64()
bitmap.Data.Map.Add(128)
value, err := bitmap.Value()
Expect(err).To(BeNil())
var bm types.Bitmap64
bm.Scan(value)
Expect(bm.Data.Map.Contains(128)).To(BeTrue())
})
})