We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b26d4b7 commit 4fc6235Copy full SHA for 4fc6235
optimizer/optimizer_test.go
@@ -28,6 +28,18 @@ func TestOptimize_constant_folding(t *testing.T) {
28
assert.Equal(t, ast.Dump(expected), ast.Dump(tree.Node))
29
}
30
31
+func TestOptimize_constant_folding_with_floats(t *testing.T) {
32
+ tree, err := parser.Parse(`1 + 2.0 * ((1.0 * 2) / 2) - 0`)
33
+ require.NoError(t, err)
34
+
35
+ err = optimizer.Optimize(&tree.Node, nil)
36
37
38
+ expected := &ast.FloatNode{Value: 3.0}
39
40
+ assert.Equal(t, ast.Dump(expected), ast.Dump(tree.Node))
41
+}
42
43
func TestOptimize_in_array(t *testing.T) {
44
config := conf.New(map[string]int{"v": 0})
45
0 commit comments