mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-29 19:49:26 +00:00
a4982fd9fe
* Continue MathTrig Breakup - Penultimate? Continuing the process of breaking MathTrip.php up into smaller classes. This round takes care of about half of what is left, so perhaps one round after this one will finish the job: - ARABIC - COMBIN; also implemented COMBINA - FACTDOUBLE - GCD (which accepts and ignores empty cells as arguments, but returns VALUE if all the arguments are that way; LCM does the same) - LOG_BASE, LOG10, LN - implemented MUNIT - MOD - POWER - RAND, RANDBETWEEN (RANDARRAY is too complicated to implement with this ticket) As you can see from the description, there are some functions which were combined in a single class. When not combined, I adopted PowerKiki's suggestion of using "execute" as the function name. Co-authored-by: Mark Baker <mark@lange.demon.co.uk>
34 lines
932 B
PHP
34 lines
932 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
|
|
|
|
class Log10Test extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerLN
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $number
|
|
*/
|
|
public function testLN($expectedResult, $number = 'omitted'): void
|
|
{
|
|
$this->mightHaveException($expectedResult);
|
|
$sheet = $this->sheet;
|
|
if ($number !== null) {
|
|
$sheet->getCell('A1')->setValue($number);
|
|
}
|
|
if ($number === 'omitted') {
|
|
$sheet->getCell('B1')->setValue('=LOG10()');
|
|
} else {
|
|
$sheet->getCell('B1')->setValue('=LOG10(A1)');
|
|
}
|
|
$result = $sheet->getCell('B1')->getCalculatedValue();
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-6);
|
|
}
|
|
|
|
public function providerLN()
|
|
{
|
|
return require 'tests/data/Calculation/MathTrig/LOG10.php';
|
|
}
|
|
}
|