Skip to content

Commit

Permalink
Merge pull request #16 from muktihari/dev
Browse files Browse the repository at this point in the history
Resolve issue #15
  • Loading branch information
muktihari authored Mar 5, 2021
2 parents ee87e96 + 97aa44c commit 4475970
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boolean/boolean.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (v *visitor) arithmetic(xVisitor, yVisitor *visitor, op token.Token) {
case token.QUO:
v.res, v.kind = fmt.Sprintf("%f", x/y), token.FLOAT
case token.REM:
v.res, v.kind = fmt.Sprintf("%f", x+y), token.FLOAT
v.err = ErrInvalidOperationOnFloat
}
return
}
Expand Down
2 changes: 2 additions & 0 deletions expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/muktihari/expr"
"github.com/muktihari/expr/boolean"
"github.com/muktihari/expr/float"
"github.com/muktihari/expr/integer"
)
Expand Down Expand Up @@ -142,6 +143,7 @@ func TestBool(t *testing.T) {
{In: "-4 * -2 > -1", Eq: true},
{In: "10 % 2 > -2", Eq: true},
{In: "10 % 2 < 1", Eq: true},
{In: "10.2 % 2 > 2", Err: boolean.ErrInvalidOperationOnFloat},
}

for _, tc := range tt {
Expand Down

0 comments on commit 4475970

Please sign in to comment.