summaryrefslogtreecommitdiff
path: root/calc_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-06-28 23:18:48 +0800
committerxuri <xuri.me@gmail.com>2022-06-28 23:18:48 +0800
commiteee6607e477f229d2459628324cbfae5549f611a (patch)
tree28b7222edb131906d9ea9fbd5d85cc9e852f517c /calc_test.go
parent301f7bc21755cdf7c91c9acd50ddcdcf0285f779 (diff)
ref #65, new formula functions: DMAX and DMIN
Diffstat (limited to 'calc_test.go')
-rw-r--r--calc_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/calc_test.go b/calc_test.go
index 7cf9e48..089bfd3 100644
--- a/calc_test.go
+++ b/calc_test.go
@@ -4603,7 +4603,7 @@ func TestCalcCOVAR(t *testing.T) {
}
}
-func TestCalcDCOUNTandDCOUNTA(t *testing.T) {
+func TestCalcDCOUNTandDCOUNTAandDMAXandDMIN(t *testing.T) {
cellData := [][]interface{}{
{"Tree", "Height", "Age", "Yield", "Profit", "Height"},
{"=Apple", ">1000%", nil, nil, nil, "<16"},
@@ -4631,6 +4631,10 @@ func TestCalcDCOUNTandDCOUNTA(t *testing.T) {
"=DCOUNTA(A4:E10,\"Profit\",A1:F2)": "2",
"=DCOUNTA(A4:E10,\"Tree\",A1:F2)": "2",
"=DCOUNTA(A4:E10,\"Age\",A2:F3)": "0",
+ "=DMAX(A4:E10,\"Tree\",A1:F3)": "0",
+ "=DMAX(A4:E10,\"Profit\",A1:F3)": "96",
+ "=DMIN(A4:E10,\"Tree\",A1:F3)": "0",
+ "=DMIN(A4:E10,\"Profit\",A1:F3)": "45",
}
for formula, expected := range formulaList {
assert.NoError(t, f.SetCellFormula("Sheet1", "A11", formula))
@@ -4651,6 +4655,10 @@ func TestCalcDCOUNTandDCOUNTA(t *testing.T) {
"=DCOUNTA(A4:E10,NA(),A1:F2)": "#VALUE!",
"=DCOUNTA(A4:E4,,A1:F2)": "#VALUE!",
"=DCOUNTA(A4:E10,\"x\",A2:F3)": "#VALUE!",
+ "=DMAX()": "DMAX requires 3 arguments",
+ "=DMAX(A4:E10,\"x\",A1:F3)": "#VALUE!",
+ "=DMIN()": "DMIN requires 3 arguments",
+ "=DMIN(A4:E10,\"x\",A1:F3)": "#VALUE!",
}
for formula, expected := range calcError {
assert.NoError(t, f.SetCellFormula("Sheet1", "A11", formula))