github.com/weaviate/weaviate@v1.24.6/entities/filters/filters_test.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package filters 13 14 import ( 15 "testing" 16 17 "github.com/stretchr/testify/assert" 18 ) 19 20 func TestOperators(t *testing.T) { 21 type test struct { 22 op Operator 23 expectedName string 24 expectedOnValue bool 25 } 26 27 tests := []test{ 28 {op: OperatorEqual, expectedName: "Equal", expectedOnValue: true}, 29 {op: OperatorNotEqual, expectedName: "NotEqual", expectedOnValue: true}, 30 {op: OperatorGreaterThan, expectedName: "GreaterThan", expectedOnValue: true}, 31 {op: OperatorGreaterThanEqual, expectedName: "GreaterThanEqual", expectedOnValue: true}, 32 {op: OperatorLessThanEqual, expectedName: "LessThanEqual", expectedOnValue: true}, 33 {op: OperatorLessThan, expectedName: "LessThan", expectedOnValue: true}, 34 {op: OperatorWithinGeoRange, expectedName: "WithinGeoRange", expectedOnValue: true}, 35 {op: OperatorLike, expectedName: "Like", expectedOnValue: true}, 36 {op: OperatorAnd, expectedName: "And", expectedOnValue: false}, 37 {op: OperatorOr, expectedName: "Or", expectedOnValue: false}, 38 } 39 40 for _, test := range tests { 41 t.Run(test.expectedName, func(t *testing.T) { 42 assert.Equal(t, test.expectedName, test.op.Name(), "name must match") 43 assert.Equal(t, test.expectedOnValue, test.op.OnValue(), "onValue must match") 44 }) 45 } 46 }