summaryrefslogtreecommitdiff
path: root/calc_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'calc_test.go')
-rw-r--r--calc_test.go61
1 files changed, 59 insertions, 2 deletions
diff --git a/calc_test.go b/calc_test.go
index ea3f014..1a8b8c6 100644
--- a/calc_test.go
+++ b/calc_test.go
@@ -393,16 +393,34 @@ func TestCalcCellValue(t *testing.T) {
"=ACOSH(2.5)": "1.56679923697241",
"=ACOSH(5)": "2.29243166956118",
"=ACOSH(ACOSH(5))": "1.47138332153668",
- // ACOT
+ // _xlfn.ACOT
"=_xlfn.ACOT(1)": "0.785398163397448",
"=_xlfn.ACOT(-2)": "2.67794504458899",
"=_xlfn.ACOT(0)": "1.5707963267949",
"=_xlfn.ACOT(_xlfn.ACOT(0))": "0.566911504941009",
- // ACOTH
+ // _xlfn.ACOTH
"=_xlfn.ACOTH(-5)": "-0.202732554054082",
"=_xlfn.ACOTH(1.1)": "1.52226121886171",
"=_xlfn.ACOTH(2)": "0.549306144334055",
"=_xlfn.ACOTH(ABS(-2))": "0.549306144334055",
+ // _xlfn.AGGREGATE
+ "=_xlfn.AGGREGATE(1,0,A1:A6)": "1.5",
+ "=_xlfn.AGGREGATE(2,0,A1:A6)": "4",
+ "=_xlfn.AGGREGATE(3,0,A1:A6)": "4",
+ "=_xlfn.AGGREGATE(4,0,A1:A6)": "3",
+ "=_xlfn.AGGREGATE(5,0,A1:A6)": "0",
+ "=_xlfn.AGGREGATE(6,0,A1:A6)": "0",
+ "=_xlfn.AGGREGATE(7,0,A1:A6)": "1.29099444873581",
+ "=_xlfn.AGGREGATE(8,0,A1:A6)": "1.11803398874989",
+ "=_xlfn.AGGREGATE(9,0,A1:A6)": "6",
+ "=_xlfn.AGGREGATE(10,0,A1:A6)": "1.66666666666667",
+ "=_xlfn.AGGREGATE(11,0,A1:A6)": "1.25",
+ "=_xlfn.AGGREGATE(12,0,A1:A6)": "1.5",
+ "=_xlfn.AGGREGATE(14,0,A1:A6,1)": "3",
+ "=_xlfn.AGGREGATE(15,0,A1:A6,1)": "0",
+ "=_xlfn.AGGREGATE(16,0,A1:A6,1)": "3",
+ "=_xlfn.AGGREGATE(17,0,A1:A6,1)": "0.75",
+ "=_xlfn.AGGREGATE(19,0,A1:A6,1)": "0.25",
// ARABIC
"=_xlfn.ARABIC(\"IV\")": "4",
"=_xlfn.ARABIC(\"-IV\")": "-4",
@@ -791,6 +809,31 @@ func TestCalcCellValue(t *testing.T) {
// POISSON
"=POISSON(20,25,FALSE)": "0.0519174686084913",
"=POISSON(35,40,TRUE)": "0.242414197690103",
+ // SUBTOTAL
+ "=SUBTOTAL(1,A1:A6)": "1.5",
+ "=SUBTOTAL(2,A1:A6)": "4",
+ "=SUBTOTAL(3,A1:A6)": "4",
+ "=SUBTOTAL(4,A1:A6)": "3",
+ "=SUBTOTAL(5,A1:A6)": "0",
+ "=SUBTOTAL(6,A1:A6)": "0",
+ "=SUBTOTAL(7,A1:A6)": "1.29099444873581",
+ "=SUBTOTAL(8,A1:A6)": "1.11803398874989",
+ "=SUBTOTAL(9,A1:A6)": "6",
+ "=SUBTOTAL(10,A1:A6)": "1.66666666666667",
+ "=SUBTOTAL(11,A1:A6)": "1.25",
+ "=SUBTOTAL(101,A1:A6)": "1.5",
+ "=SUBTOTAL(102,A1:A6)": "4",
+ "=SUBTOTAL(103,A1:A6)": "4",
+ "=SUBTOTAL(104,A1:A6)": "3",
+ "=SUBTOTAL(105,A1:A6)": "0",
+ "=SUBTOTAL(106,A1:A6)": "0",
+ "=SUBTOTAL(107,A1:A6)": "1.29099444873581",
+ "=SUBTOTAL(108,A1:A6)": "1.11803398874989",
+ "=SUBTOTAL(109,A1:A6)": "6",
+ "=SUBTOTAL(109,A1:A6,A1:A6)": "12",
+ "=SUBTOTAL(110,A1:A6)": "1.66666666666667",
+ "=SUBTOTAL(111,A1:A6)": "1.25",
+ "=SUBTOTAL(111,A1:A6,A1:A6)": "1.25",
// SUM
"=SUM(1,2)": "3",
`=SUM("",1,2)`: "3",
@@ -2344,6 +2387,15 @@ func TestCalcCellValue(t *testing.T) {
"=_xlfn.ACOTH()": "ACOTH requires 1 numeric argument",
`=_xlfn.ACOTH("X")`: "strconv.ParseFloat: parsing \"X\": invalid syntax",
"=_xlfn.ACOTH(_xlfn.ACOTH(2))": "#NUM!",
+ // _xlfn.AGGREGATE
+ "=_xlfn.AGGREGATE()": "AGGREGATE requires at least 3 arguments",
+ "=_xlfn.AGGREGATE(\"\",0,A4:A5)": "strconv.ParseFloat: parsing \"\": invalid syntax",
+ "=_xlfn.AGGREGATE(1,\"\",A4:A5)": "strconv.ParseFloat: parsing \"\": invalid syntax",
+ "=_xlfn.AGGREGATE(0,A4:A5)": "AGGREGATE has invalid function_num",
+ "=_xlfn.AGGREGATE(1,8,A4:A5)": "AGGREGATE has invalid options",
+ "=_xlfn.AGGREGATE(1,0,A5:A6)": "#DIV/0!",
+ "=_xlfn.AGGREGATE(13,0,A1:A6)": "#N/A",
+ "=_xlfn.AGGREGATE(18,0,A1:A6,1)": "#NUM!",
// _xlfn.ARABIC
"=_xlfn.ARABIC()": "ARABIC requires 1 numeric argument",
"=_xlfn.ARABIC(\"" + strings.Repeat("I", 256) + "\")": "#VALUE!",
@@ -2611,6 +2663,11 @@ func TestCalcCellValue(t *testing.T) {
"=POISSON(0,\"\",FALSE)": "strconv.ParseFloat: parsing \"\": invalid syntax",
"=POISSON(0,0,\"\")": "strconv.ParseBool: parsing \"\": invalid syntax",
"=POISSON(0,-1,TRUE)": "#N/A",
+ // SUBTOTAL
+ "=SUBTOTAL()": "SUBTOTAL requires at least 2 arguments",
+ "=SUBTOTAL(\"\",A4:A5)": "strconv.ParseFloat: parsing \"\": invalid syntax",
+ "=SUBTOTAL(0,A4:A5)": "SUBTOTAL has invalid function_num",
+ "=SUBTOTAL(1,A5:A6)": "#DIV/0!",
// SUM
"=SUM((": ErrInvalidFormula.Error(),
"=SUM(-)": ErrInvalidFormula.Error(),