Skip to content

Commit 5766440

Browse files
author
dengsgo
committed
增加 util_test case
1 parent 66ddaae commit 5766440

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

engine/util_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ func TestParseAndExecSimple(t *testing.T) {
1717
{"-(1+2)*5/3", -5},
1818
{"1+(-(1+2)*5/3)", -4},
1919
{"3^4", 81},
20-
{"3^4.5", 81},
21-
{"3.5^4.5", 150.0625},
20+
{"3^4.5", 140.29611541307906},
21+
{"3.5^4.5", 280.7412308013823},
2222
{"8%2", 0},
2323
{"8%3", 2},
2424
{"8%3.5", 2},
@@ -60,6 +60,10 @@ func TestParseAndExecSimple(t *testing.T) {
6060
{"noerr(1/(1-1))", 0},
6161
{"0.1+0.2", 0.3},
6262
{"0.3-0.1", 0.2},
63+
{"10^-1", 0.1},
64+
{"10^-2", 0.01},
65+
{"10^-1*100", 10},
66+
{"10%0", 0},
6367
}
6468
for _, e := range exprs {
6569
r, _ := ParseAndExec(e.Expr)

0 commit comments

Comments
 (0)