Use named data provider in AddressHelper tests

This commit is contained in:
Nathan Dench 2021-05-13 11:13:18 +10:00 committed by Mark Baker
parent 8e7771cde1
commit e6a4442d9a
3 changed files with 31 additions and 41 deletions

View File

@ -1,16 +1,13 @@
<?php
return [
// Basic arithmetic
['=D3+F7+G4+C6+5', '=R3C4+R7C6+R4C7+R6C3+5'],
['=D3-F7-G4-C6-5', '=R3C4-R7C6-R4C7-R6C3-5'],
['=D3*F7*G4*C6*5', '=R3C4*R7C6*R4C7*R6C3*5'],
['=D3/F7/G4/C6/5', '=R3C4/R7C6/R4C7/R6C3/5'],
// Formulas
['=SUM(E1:E5)', '=SUM(R1C5:R5C5)'],
['=SUM(E1:E5, D5)', '=SUM(R1C5:R5C5, R5C4)'],
['=SUM(E1:E5, D5)-C5', '=SUM(R1C5:R5C5, R5C4)-R5C3'],
['=IF(E1>E2, E3, E4)', '=IF(R1C5>R2C5, R3C5, R4C5)'],
// String literals
['=CONCAT("Result of formula expression =R3C3+R4C3 is: ", C3+C4)', '=CONCAT("Result of formula expression =R3C3+R4C3 is: ", R3C3+R4C3)'],
'Basic addition' => ['=D3+F7+G4+C6+5', '=R3C4+R7C6+R4C7+R6C3+5'],
'Basic subtraction' => ['=D3-F7-G4-C6-5', '=R3C4-R7C6-R4C7-R6C3-5'],
'Basic multiplication' => ['=D3*F7*G4*C6*5', '=R3C4*R7C6*R4C7*R6C3*5'],
'Basic division' => ['=D3/F7/G4/C6/5', '=R3C4/R7C6/R4C7/R6C3/5'],
'Simple formula' => ['=SUM(E1:E5)', '=SUM(R1C5:R5C5)'],
'Formula with range and cell' => ['=SUM(E1:E5, D5)', '=SUM(R1C5:R5C5, R5C4)'],
'Formula arithmetic' => ['=SUM(E1:E5, D5)-C5', '=SUM(R1C5:R5C5, R5C4)-R5C3'],
'Formula with comparison' => ['=IF(E1>E2, E3, E4)', '=IF(R1C5>R2C5, R3C5, R4C5)'],
'String literal' => ['=CONCAT("Result of formula expression =R3C3+R4C3 is: ", C3+C4)', '=CONCAT("Result of formula expression =R3C3+R4C3 is: ", R3C3+R4C3)'],
];

View File

@ -1,21 +1,17 @@
<?php
return [
// Basic arithmetic without the current row/column
['=D3+F7+G4+C6+5', '=R[-2]C[-1]+R[2]C[1]+R[-1]C[2]+R[1]C[-2]+5', 5, 5],
['=D3-F7-G4-C6-5', '=R[-2]C[-1]-R[2]C[1]-R[-1]C[2]-R[1]C[-2]-5', 5, 5],
['=D3*F7*G4*C6*5', '=R[-2]C[-1]*R[2]C[1]*R[-1]C[2]*R[1]C[-2]*5', 5, 5],
['=D3/F7/G4/C6/5', '=R[-2]C[-1]/R[2]C[1]/R[-1]C[2]/R[1]C[-2]/5', 5, 5],
// Basic Arithmetic with the current row/column
['=E3+E7+G5+C5+E5+5', '=R[-2]C+R[2]C+RC[2]+RC[-2]+RC+5', 5, 5],
['=E3-E7-G5-C5-E5-5', '=R[-2]C-R[2]C-RC[2]-RC[-2]-RC-5', 5, 5],
['=E3*E7*G5*C5*E5*5', '=R[-2]C*R[2]C*RC[2]*RC[-2]*RC*5', 5, 5],
['=E3/E7/G5/C5/E5/5', '=R[-2]C/R[2]C/RC[2]/RC[-2]/RC/5', 5, 5],
// Formulas
['=SUM(E1:E5)', '=SUM(R[-4]C:RC)', 5, 5],
['=SUM(E1:E5, D5)', '=SUM(R[-4]C:RC, RC[-1])', 5, 5],
['=SUM(E1:E5, D5)-C5', '=SUM(R[-4]C:RC, RC[-1])-RC[-2]', 5, 5],
['=IF(E1>E2, E3, E4)', '=IF(R[-4]C>R[-3]C, R[-2]C, R[-1]C)', 5, 5],
// String literals
['=CONCAT("Result of formula expression =R[-2]C[-2]+R[-1]C[-2] is: ", C3+C4)', '=CONCAT("Result of formula expression =R[-2]C[-2]+R[-1]C[-2] is: ", R[-2]C[-2]+R[-1]C[-2])', 5, 5],
'Basic addition' => ['=D3+F7+G4+C6+5', '=R[-2]C[-1]+R[2]C[1]+R[-1]C[2]+R[1]C[-2]+5', 5, 5],
'Basic subtraction' => ['=D3-F7-G4-C6-5', '=R[-2]C[-1]-R[2]C[1]-R[-1]C[2]-R[1]C[-2]-5', 5, 5],
'Basic multiplication' => ['=D3*F7*G4*C6*5', '=R[-2]C[-1]*R[2]C[1]*R[-1]C[2]*R[1]C[-2]*5', 5, 5],
'Basic division' => ['=D3/F7/G4/C6/5', '=R[-2]C[-1]/R[2]C[1]/R[-1]C[2]/R[1]C[-2]/5', 5, 5],
'Basic addition with current row/column' => ['=E3+E7+G5+C5+E5+5', '=R[-2]C+R[2]C+RC[2]+RC[-2]+RC+5', 5, 5],
'Basic subtraction with current row/column' => ['=E3-E7-G5-C5-E5-5', '=R[-2]C-R[2]C-RC[2]-RC[-2]-RC-5', 5, 5],
'Basic multiplication with current row/column' => ['=E3*E7*G5*C5*E5*5', '=R[-2]C*R[2]C*RC[2]*RC[-2]*RC*5', 5, 5],
'Basic division with current row/column' => ['=E3/E7/G5/C5/E5/5', '=R[-2]C/R[2]C/RC[2]/RC[-2]/RC/5', 5, 5],
'Simple formula' => ['=SUM(E1:E5)', '=SUM(R[-4]C:RC)', 5, 5],
'Formula with range and cell' => ['=SUM(E1:E5, D5)', '=SUM(R[-4]C:RC, RC[-1])', 5, 5],
'Formula arithmetic' => ['=SUM(E1:E5, D5)-C5', '=SUM(R[-4]C:RC, RC[-1])-RC[-2]', 5, 5],
'Formula with comparison' => ['=IF(E1>E2, E3, E4)', '=IF(R[-4]C>R[-3]C, R[-2]C, R[-1]C)', 5, 5],
'String literal' => ['=CONCAT("Result of formula expression =R[-2]C[-2]+R[-1]C[-2] is: ", C3+C4)', '=CONCAT("Result of formula expression =R[-2]C[-2]+R[-1]C[-2] is: ", R[-2]C[-2]+R[-1]C[-2])', 5, 5],
];

View File

@ -1,16 +1,13 @@
<?php
return [
// Basic arithmetic
['=D3+F7+G4+C6+5', 'of:=[.D3]+[.F7]+[.G4]+[.C6]+5'],
['=D3-F7-G4-C6-5', 'of:=[.D3]-[.F7]-[.G4]-[.C6]-5'],
['=D3*F7*G4*C6*5', 'of:=[.D3]*[.F7]*[.G4]*[.C6]*5'],
['=D3/F7/G4/C6/5', 'of:=[.D3]/[.F7]/[.G4]/[.C6]/5'],
// Formulas
['=SUM(E1:E5)', 'of:=SUM([.E1:.E5])'],
['=SUM(E1:E5, D5)', 'of:=SUM([.E1:.E5], [.D5])'],
['=SUM(E1:E5, D5)-C5', 'of:=SUM([.E1:.E5], [.D5])-[.C5]'],
['=IF(E1>E2, E3, E4)', 'of:=IF([.E1]>[.E2], [.E3], [.E4])'],
// String literals
['=CONCAT("Result of formula expression =[.C3]+[.C4] is: ", C3+C4)', 'of:=CONCAT("Result of formula expression =[.C3]+[.C4] is: ", [.C3]+[.C4])'],
'Basic addition' => ['=D3+F7+G4+C6+5', 'of:=[.D3]+[.F7]+[.G4]+[.C6]+5'],
'Basic subtraction' => ['=D3-F7-G4-C6-5', 'of:=[.D3]-[.F7]-[.G4]-[.C6]-5'],
'Basic multiplication' => ['=D3*F7*G4*C6*5', 'of:=[.D3]*[.F7]*[.G4]*[.C6]*5'],
'Basic division' => ['=D3/F7/G4/C6/5', 'of:=[.D3]/[.F7]/[.G4]/[.C6]/5'],
'Simple formula' => ['=SUM(E1:E5)', 'of:=SUM([.E1:.E5])'],
'Formula with range and cell' => ['=SUM(E1:E5, D5)', 'of:=SUM([.E1:.E5], [.D5])'],
'Formula arithmetic' => ['=SUM(E1:E5, D5)-C5', 'of:=SUM([.E1:.E5], [.D5])-[.C5]'],
'Formula with comparison' => ['=IF(E1>E2, E3, E4)', 'of:=IF([.E1]>[.E2], [.E3], [.E4])'],
'String literal' => ['=CONCAT("Result of formula expression =[.C3]+[.C4] is: ", C3+C4)', 'of:=CONCAT("Result of formula expression =[.C3]+[.C4] is: ", [.C3]+[.C4])'],
];