Skip to content

Commit

Permalink
Fix the formula calculation result issue of the OR function (qax-os#1374
Browse files Browse the repository at this point in the history
)

Co-authored-by: gonghaibin <gonghaibin@qq.com>
  • Loading branch information
gonghaibinx and gonghaibin committed Oct 20, 2022
1 parent 920ec7b commit 2dc0e8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11623,6 +11623,9 @@ func (fn *formulaFuncs) OR(argsList *list.List) formulaArg {
return newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE)
case ArgNumber:
or = token.Number != 0
if or {
return newStringFormulaArg(strings.ToUpper(strconv.FormatBool(or)))
}
case ArgMatrix:
// TODO
return newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE)
Expand Down
1 change: 1 addition & 0 deletions calc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@ func TestCalcCellValue(t *testing.T) {
"=OR(0)": "FALSE",
"=OR(1=2,2=2)": "TRUE",
"=OR(1=2,2=3)": "FALSE",
"=OR(1=1,2=3)": "TRUE",
"=OR(\"TRUE\",\"FALSE\")": "TRUE",
// SWITCH
"=SWITCH(1,1,\"A\",2,\"B\",3,\"C\",\"N\")": "A",
Expand Down

0 comments on commit 2dc0e8c

Please sign in to comment.