Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.0 #20

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/parser/antlr/custom_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (l *CustomListener) ExitComparatorExpression(ctx *lib.ComparatorExpressionC

func (l *CustomListener) ExitUnaryArithmeticExpression(ctx *lib.UnaryArithmeticExpressionContext) {
var leafNode logical.Node
if len(l.Nodes) > 0 {
if len(l.Nodes) > 0 && reflect.TypeOf(l.Nodes[0]) == reflect.TypeOf(&arithmetic.ArithmeticNode{}) {
leafNode = l.pop()
} else {
leafNode = l.mapTypesExpressionContext(ctx.GetExp().(*lib.TypesExpressionContext))
Expand Down
9 changes: 9 additions & 0 deletions pkg/application/boolean_expression_evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ func TestDefaultFieldFalse(t *testing.T) {
assert.False(t, res)
}

func TestNegativeComparison(t *testing.T) {
data := map[string]interface{}{
"a": -6,
}
res, err := evaluator.Evaluate("a > -10 AND a < -2", data)
assert.Nil(t, err)
assert.True(t, res)
}

func TestContainsAnyTrueCondition(t *testing.T) {
data := map[string]interface{}{
"age": []int32{1, 2, 3},
Expand Down
Loading