Skip to content

Commit

Permalink
fix sate compare in sematic walk
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacov committed Feb 22, 2020
1 parent d1a38f9 commit 0914d10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions v5/pkg/walkers/semantics/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,13 @@ func handleDateOp(n tsl.Node, eval EvalFunc) (bool, error) {
case tsl.NotEqOp:
return left != right, nil
case tsl.LtOp:
return right.Before(left), nil
return right.After(left), nil
case tsl.LteOp:
return !right.After(left), nil
return !right.Before(left), nil
case tsl.GtOp:
return left.Before(right), nil
return left.After(right), nil
case tsl.GteOp:
return !left.After(right), nil
return !left.Before(right), nil
}

return false, tsl.UnexpectedLiteralError{Literal: n.Func}
Expand Down
4 changes: 2 additions & 2 deletions v5/pkg/walkers/semantics/walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

func TestWalk(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Walk")
RunSpecs(t, "Semantic walker")
}

var _ = Describe("Walk", func() {
Expand Down Expand Up @@ -82,7 +82,7 @@ var _ = Describe("Walk", func() {

// dates
Entry("dates", "date = 2020-01-01T00:00:00Z", true),
Entry("dates", "date < 2020-01-02T00:00:00Z", false),
Entry("dates", "date > 2020-01-02T00:00:00Z", false),
Entry("dates", "date between 2019-12-30T00:00:00Z and 2020-01-02T00:00:00Z", true),
)
})

0 comments on commit 0914d10

Please sign in to comment.