Skip to content

Commit

Permalink
vm update
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Raddon committed Dec 5, 2014
1 parent b31e031 commit ecebb42
Show file tree
Hide file tree
Showing 17 changed files with 567 additions and 110 deletions.
30 changes: 30 additions & 0 deletions lex/dialect_expr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,49 @@ func TestLexExprDialect(t *testing.T) {
}

func TestLexLogicalDialect(t *testing.T) {

verifyExpr2Tokens(t, `4 > 5`,
[]Token{
tv(TokenInteger, "4"),
tv(TokenGT, ">"),
tv(TokenInteger, "5"),
})

verifyExpr2Tokens(t, `item || 5`,
[]Token{
tv(TokenIdentity, "item"),
tv(TokenOr, "||"),
tv(TokenInteger, "5"),
})

verifyExpr2Tokens(t, `10 > 5`,
[]Token{
tv(TokenInteger, "10"),
tv(TokenGT, ">"),
tv(TokenInteger, "5"),
})
verifyExpr2Tokens(t, `toint(10 * 5)`,
[]Token{
tv(TokenUdfExpr, "toint"),
tv(TokenLeftParenthesis, "("),
tv(TokenInteger, "10"),
tv(TokenMultiply, "*"),
tv(TokenInteger, "5"),
tv(TokenRightParenthesis, ")"),
})

verifyExpr2Tokens(t, `6 == !eq(5,6)`,
[]Token{
tv(TokenInteger, "6"),
tv(TokenEqualEqual, "=="),
tv(TokenNegate, "!"),
tv(TokenUdfExpr, "eq"),
tv(TokenLeftParenthesis, "("),
tv(TokenInteger, "5"),
tv(TokenComma, ","),
tv(TokenInteger, "6"),
tv(TokenRightParenthesis, ")"),
})

verifyExpr2Tokens(t, `(4 + 5)/2`,
[]Token{
Expand Down
Loading

0 comments on commit ecebb42

Please sign in to comment.