diff options
Diffstat (limited to 'calc_test.go')
-rw-r--r-- | calc_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/calc_test.go b/calc_test.go index c6a7dbc..9bf6e08 100644 --- a/calc_test.go +++ b/calc_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/xuri/efp" ) func TestCalcCellValue(t *testing.T) { @@ -854,6 +855,18 @@ func TestCalcCellValue(t *testing.T) { } +func TestCalculate(t *testing.T) { + err := `strconv.ParseFloat: parsing "string": invalid syntax` + opd := NewStack() + opd.Push(efp.Token{TValue: "string"}) + opt := efp.Token{TValue: "-", TType: efp.TokenTypeOperatorPrefix} + assert.EqualError(t, calculate(opd, opt), err) + opd.Push(efp.Token{TValue: "string"}) + opd.Push(efp.Token{TValue: "string"}) + opt = efp.Token{TValue: "-", TType: efp.TokenTypeOperatorInfix} + assert.EqualError(t, calculate(opd, opt), err) +} + func TestCalcCellValueWithDefinedName(t *testing.T) { cellData := [][]interface{}{ {"A1 value", "B1 value", nil}, |