Fix the formula calculation result issue of the OR function (#1374)

Co-authored-by: gonghaibin <gonghaibin@qq.com>
pull/2/head
gonghaibinx 2 years ago committed by GitHub
parent 2df615fa28
commit f843a9ea56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -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",

Loading…
Cancel
Save