Improved expression tests
This commit is contained in:
parent
23c6134d9a
commit
8b49200a87
@ -87,6 +87,8 @@ func TestExpressionParse(t *testing.T) {
|
|||||||
src := []byte(test.Expression)
|
src := []byte(test.Expression)
|
||||||
tokens := token.Tokenize(src)
|
tokens := token.Tokenize(src)
|
||||||
expr := expression.Parse(tokens)
|
expr := expression.Parse(tokens)
|
||||||
|
defer expr.Close()
|
||||||
|
|
||||||
assert.NotNil(t, expr)
|
assert.NotNil(t, expr)
|
||||||
assert.Equal(t, expr.String(), test.Result)
|
assert.Equal(t, expr.String(), test.Result)
|
||||||
})
|
})
|
||||||
@ -94,7 +96,7 @@ func TestExpressionParse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkExpression(b *testing.B) {
|
func BenchmarkExpression(b *testing.B) {
|
||||||
src := []byte("(1+2-3*4)!=(5*6-7+8)\n")
|
src := []byte("(1+2-3*4)+(5*6-7+8)\n")
|
||||||
tokens := token.Tokenize(src)
|
tokens := token.Tokenize(src)
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user