MCPcopy Create free account
hub / github.com/crossoverJie/gscript / TestArithmeticOperators

Function TestArithmeticOperators

syntax/parse_test.go:8–20  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestArithmeticOperators(t *testing.T) {
9 i := ArithmeticOperators("1.1+2+3+4\n")
10 assert.Equal(t, i, 10.1)
11 operators := ArithmeticOperators("1+2+3+4\n")
12 assert.Equal(t, operators, 10)
13
14 assert.Equal(t, ArithmeticOperators("1+2+4*2\n"), 11)
15
16 assert.Equal(t, ArithmeticOperators("1+(2+4)*2\n"), 13)
17 assert.Equal(t, ArithmeticOperators("1+(2+4)*1.5\n"), 10.0)
18 assert.Equal(t, ArithmeticOperators("(1+(2+4)*1.5)/10\n"), 1.0)
19
20}

Callers

nothing calls this directly

Calls 1

ArithmeticOperatorsFunction · 0.70

Tested by

no test coverage detected