2018-11-27 15:55:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function calculationTestDataGenerator()
|
|
|
|
{
|
|
|
|
$dataArray1 = [
|
|
|
|
['please +', 'please *', 'increment'],
|
|
|
|
[1, 1, 1], // sum is 3
|
|
|
|
[3, 3, 3], // product is 27
|
|
|
|
];
|
|
|
|
$set0 = [3, $dataArray1, '=IF(A1="please +", SUM(A2:C2), 2)', 'E5'];
|
|
|
|
|
|
|
|
$set1 = [3, $dataArray1, '=IF(TRUE(), SUM(A2:C2), 2)', 'E5'];
|
|
|
|
|
|
|
|
$formula1 = '=IF(A1="please +",SUM(A2:C2),7 + IF(B1="please *", 4, 2))';
|
|
|
|
$set2 = [3, $dataArray1, $formula1, 'E5'];
|
|
|
|
|
|
|
|
$dataArray1[0][0] = 'not please + something else';
|
|
|
|
$set3 = [11, $dataArray1, $formula1, 'E5'];
|
|
|
|
|
|
|
|
$dataArray2 = [
|
|
|
|
['flag1', 'flag2', 'flag3', 'flag1'],
|
|
|
|
[1, 2, 3, 4],
|
|
|
|
[5, 6, 7, 8],
|
|
|
|
];
|
|
|
|
$set4 = [3, $dataArray2, '=IF($A$1=$B$1,A2,IF($A$1=$C$1,B2,IF($A$1=$D$1,C2,C3)))', 'E5'];
|
|
|
|
|
|
|
|
$dataArray2[0][0] = 'flag3';
|
|
|
|
$set5 = [2, $dataArray2, '=IF(A1=B1,A2,IF(A1=C1,B2,IF(A1=D1,C2,C3)))', 'E5'];
|
|
|
|
|
|
|
|
$dataArray3 = [
|
|
|
|
[1, 2, 3],
|
|
|
|
[4, 5, 6],
|
|
|
|
[7, 8, 9],
|
|
|
|
];
|
|
|
|
$set6 = [0, $dataArray3, '=IF(A1+B1>3,C1,0)', 'E5'];
|
|
|
|
|
|
|
|
$dataArray4 = [
|
|
|
|
['noflag', 0, 0],
|
|
|
|
[127000, 0, 0],
|
2019-08-12 17:03:41 +00:00
|
|
|
[10000, 0.03, 0],
|
|
|
|
[20000, 0.06, 0],
|
|
|
|
[40000, 0.09, 0],
|
|
|
|
[70000, 0.12, 0],
|
|
|
|
[90000, 0.03, 0],
|
2018-11-27 15:55:06 +00:00
|
|
|
];
|
|
|
|
$formula2 = '=IF(A1="flag",IF(A2<10, 0) + IF(A3<10000, 0))';
|
|
|
|
$set7 = [false, $dataArray4, $formula2, 'E5'];
|
|
|
|
|
|
|
|
$dataArray5 = [
|
|
|
|
[1, 2],
|
|
|
|
[3, 4],
|
|
|
|
['=A1+A2', '=SUM(B1:B2)'],
|
2019-08-12 17:03:41 +00:00
|
|
|
['take A', 0],
|
2018-11-27 15:55:06 +00:00
|
|
|
];
|
|
|
|
$formula3 = '=IF(A4="take A", A3, B3)';
|
|
|
|
$set8 = [4, $dataArray5, $formula3, 'E5', ['A3'], ['B3']];
|
|
|
|
|
2019-09-22 22:05:04 +00:00
|
|
|
$dataArray6 = [
|
2020-05-18 04:49:57 +00:00
|
|
|
['=IF(22,"a","b")'],
|
2019-09-22 22:05:04 +00:00
|
|
|
];
|
|
|
|
$set9 = ['a', $dataArray6, '=A1', 'A2'];
|
|
|
|
|
|
|
|
return [
|
2020-05-18 04:49:57 +00:00
|
|
|
$set0, $set1, $set2, $set3, $set4, $set5, $set6, $set7, $set8, $set9,
|
2019-09-22 22:05:04 +00:00
|
|
|
];
|
2019-08-12 17:03:41 +00:00
|
|
|
}
|
2018-11-27 15:55:06 +00:00
|
|
|
|
|
|
|
return calculationTestDataGenerator();
|