mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
6423b6c718
pr: https://github.com/milvus-io/milvus/pull/33881 issue: https://github.com/milvus-io/milvus/issues/33956 Signed-off-by: jaime <yun.zhang@zilliz.com>
34 lines
703 B
Go
34 lines
703 B
Go
package predicates
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
type PredicateSuite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func (s *PredicateSuite) TestValueEqual() {
|
|
p := ValueEqual("key", "value")
|
|
s.Equal("key", p.Key())
|
|
s.Equal("value", p.TargetValue())
|
|
s.Equal(PredTargetValue, p.Target())
|
|
s.Equal(PredTypeEqual, p.Type())
|
|
s.True(p.IsTrue("value"))
|
|
s.False(p.IsTrue("not_value"))
|
|
s.True(p.IsTrue([]byte("value")))
|
|
s.False(p.IsTrue(1))
|
|
}
|
|
|
|
func (s *PredicateSuite) TestPredicateValue() {
|
|
s.True(predicateValue(PredTypeEqual, 1, 1))
|
|
s.False(predicateValue(PredTypeEqual, 1, 2))
|
|
s.False(predicateValue(0, 1, 1))
|
|
}
|
|
|
|
func TestPredicates(t *testing.T) {
|
|
suite.Run(t, new(PredicateSuite))
|
|
}
|