Improved expression tests

This commit is contained in:
Eduard Urbach 2024-06-16 22:55:12 +02:00
parent 23c6134d9a
commit 8b49200a87
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -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++ {