PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/EngineeringTest.php

1010 lines
26 KiB
PHP
Raw Normal View History

2012-07-31 20:56:11 +00:00
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
2012-07-31 20:56:11 +00:00
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert;
use PHPUnit\Framework\TestCase;
class EngineeringTest extends TestCase
2012-07-31 20:56:11 +00:00
{
/**
* @var ComplexAssert
*/
protected $complexAssert;
const BESSEL_PRECISION = 1E-8;
const COMPLEX_PRECISION = 1E-8;
const ERF_PRECISION = 1E-12;
2012-07-31 20:56:11 +00:00
public function setUp()
{
$this->complexAssert = new ComplexAssert();
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function tearDown()
{
$this->complexAssert = null;
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBESSELI
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBESSELI($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BESSELI(...$args);
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBESSELI()
{
return require 'data/Calculation/Engineering/BESSELI.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBESSELJ
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBESSELJ($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BESSELJ(...$args);
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBESSELJ()
{
return require 'data/Calculation/Engineering/BESSELJ.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBESSELK
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBESSELK($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BESSELK(...$args);
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBESSELK()
{
return require 'data/Calculation/Engineering/BESSELK.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBESSELY
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBESSELY($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BESSELY(...$args);
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBESSELY()
{
return require 'data/Calculation/Engineering/BESSELY.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerCOMPLEX
*
* @param mixed $expectedResult
*/
public function testParseComplex()
{
list($real, $imaginary, $suffix) = [1.23e-4, 5.67e+8, 'j'];
$result = Engineering::parseComplex('1.23e-4+5.67e+8j');
$this->assertArrayHasKey('real', $result);
$this->assertEquals($real, $result['real']);
$this->assertArrayHasKey('imaginary', $result);
$this->assertEquals($imaginary, $result['imaginary']);
$this->assertArrayHasKey('suffix', $result);
$this->assertEquals($suffix, $result['suffix']);
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerCOMPLEX
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCOMPLEX($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::COMPLEX(...$args);
self::assertEquals($expectedResult, $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCOMPLEX()
{
return require 'data/Calculation/Engineering/COMPLEX.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMAGINARY
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMAGINARY($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMAGINARY($value);
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMAGINARY()
{
return require 'data/Calculation/Engineering/IMAGINARY.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMREAL
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMREAL($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMREAL($value);
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMREAL()
{
return require 'data/Calculation/Engineering/IMREAL.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMABS
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMABS($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMABS($value);
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMABS()
{
return require 'data/Calculation/Engineering/IMABS.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMARGUMENT
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMARGUMENT($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMARGUMENT($value);
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMARGUMENT()
{
return require 'data/Calculation/Engineering/IMARGUMENT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMCONJUGATE
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMCONJUGATE($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMCONJUGATE($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMCONJUGATE()
{
return require 'data/Calculation/Engineering/IMCONJUGATE.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMCOS
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMCOS($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMCOS($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMCOS()
{
return require 'data/Calculation/Engineering/IMCOS.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMCOSH
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMCOSH($expectedResult, $value)
{
$result = Engineering::IMCOSH($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMCOSH()
{
return require 'data/Calculation/Engineering/IMCOSH.php';
}
/**
* @dataProvider providerIMCOT
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMCOT($expectedResult, $value)
{
$result = Engineering::IMCOT($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMCOT()
{
return require 'data/Calculation/Engineering/IMCOT.php';
}
/**
* @dataProvider providerIMCSC
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMCSC($expectedResult, $value)
{
$result = Engineering::IMCSC($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMCSC()
{
return require 'data/Calculation/Engineering/IMCSC.php';
}
/**
* @dataProvider providerIMCSCH
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMCSCH($expectedResult, $value)
{
$result = Engineering::IMCSCH($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMCSCH()
{
return require 'data/Calculation/Engineering/IMCSCH.php';
}
/**
* @dataProvider providerIMSEC
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMSEC($expectedResult, $value)
{
$result = Engineering::IMSEC($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMSEC()
{
return require 'data/Calculation/Engineering/IMSEC.php';
}
/**
* @dataProvider providerIMSECH
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMSECH($expectedResult, $value)
{
$result = Engineering::IMSECH($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMSECH()
{
return require 'data/Calculation/Engineering/IMSECH.php';
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMDIV
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIMDIV($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMDIV(...$args);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMDIV()
{
return require 'data/Calculation/Engineering/IMDIV.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMEXP
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMEXP($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMEXP($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMEXP()
{
return require 'data/Calculation/Engineering/IMEXP.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMLN
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMLN($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMLN($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMLN()
{
return require 'data/Calculation/Engineering/IMLN.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMLOG2
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMLOG2($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMLOG2($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMLOG2()
{
return require 'data/Calculation/Engineering/IMLOG2.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMLOG10
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMLOG10($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMLOG10($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMLOG10()
{
return require 'data/Calculation/Engineering/IMLOG10.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMPOWER
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIMPOWER($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMPOWER(...$args);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMPOWER()
{
return require 'data/Calculation/Engineering/IMPOWER.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMPRODUCT
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIMPRODUCT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMPRODUCT(...$args);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMPRODUCT()
{
return require 'data/Calculation/Engineering/IMPRODUCT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMSIN
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMSIN($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMSIN($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMSIN()
{
return require 'data/Calculation/Engineering/IMSIN.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMSINH
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMSINH($expectedResult, $value)
{
$result = Engineering::IMSINH($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMSINH()
{
return require 'data/Calculation/Engineering/IMSINH.php';
}
/**
* @dataProvider providerIMTAN
*
* @param mixed $expectedResult
* @param mixed $value
*/
public function testIMTAN($expectedResult, $value)
{
$result = Engineering::IMTAN($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
}
public function providerIMTAN()
{
return require 'data/Calculation/Engineering/IMTAN.php';
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMSQRT
*
* @param mixed $expectedResult
* @param mixed $value
2012-07-31 20:56:11 +00:00
*/
public function testIMSQRT($expectedResult, $value)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMSQRT($value);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMSQRT()
{
return require 'data/Calculation/Engineering/IMSQRT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMSUB
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIMSUB($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMSUB(...$args);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMSUB()
{
return require 'data/Calculation/Engineering/IMSUB.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerIMSUM
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testIMSUM($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::IMSUM(...$args);
self::assertTrue(
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
$this->complexAssert->getErrorMessage()
);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerIMSUM()
{
return require 'data/Calculation/Engineering/IMSUM.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerERF
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testERF($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::ERF(...$args);
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerERF()
{
return require 'data/Calculation/Engineering/ERF.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 18:17:04 +00:00
/**
* @dataProvider providerERFPRECISE
*
* @param mixed $expectedResult
*/
public function testERFPRECISE($expectedResult, ...$args)
{
$result = Engineering::ERFPRECISE(...$args);
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION);
Add further new Functions introduced in MS Excel 2013 and 2016 (#608) - Fix ISFORMULA() function to work with a cell reference to another worksheet - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016 - Text Functions - CONCAT() Synonym for CONCATENATE() - NUMBERVALUE() Converts text to a number, in a locale-independent way - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - Logical Functions - XOR() Returns a logical Exclusive Or of all arguments - Date/Time Functions - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - Lookup and Reference Functions - FORMULATEXT() Returns a formula as a string - Engineering Functions - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - ERFC.PRECISE() Synonym for ERFC - Math and Trig Functions - SEC() Returns the secant of an angle - SECH() Returns the hyperbolic secant of an angle - CSC() Returns the cosecant of an angle - CSCH() Returns the hyperbolic cosecant of an angle - COT() Returns the cotangent of an angle - COTH() Returns the hyperbolic cotangent of an angle - ACOT() Returns the cotangent of an angle - ACOTH() Returns the hyperbolic cotangent of an angle - Financial Functions - PDURATION() Calculates the number of periods required for an investment to reach a specified value - RRI() Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 18:17:04 +00:00
}
public function providerERFPRECISE()
{
return require 'data/Calculation/Engineering/ERFPRECISE.php';
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerERFC
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testERFC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::ERFC(...$args);
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerERFC()
{
return require 'data/Calculation/Engineering/ERFC.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBIN2DEC
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBIN2DEC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BINTODEC(...$args);
self::assertEquals($expectedResult, $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBIN2DEC()
{
return require 'data/Calculation/Engineering/BIN2DEC.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBIN2HEX
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBIN2HEX($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BINTOHEX(...$args);
self::assertEquals($expectedResult, $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBIN2HEX()
{
return require 'data/Calculation/Engineering/BIN2HEX.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBIN2OCT
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testBIN2OCT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::BINTOOCT(...$args);
self::assertEquals($expectedResult, $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerBIN2OCT()
{
return require 'data/Calculation/Engineering/BIN2OCT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerDEC2BIN
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDEC2BIN($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::DECTOBIN(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDEC2BIN()
{
return require 'data/Calculation/Engineering/DEC2BIN.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerDEC2HEX
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDEC2HEX($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::DECTOHEX(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDEC2HEX()
{
return require 'data/Calculation/Engineering/DEC2HEX.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerDEC2OCT
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDEC2OCT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::DECTOOCT(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDEC2OCT()
{
return require 'data/Calculation/Engineering/DEC2OCT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerHEX2BIN
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testHEX2BIN($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::HEXTOBIN(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerHEX2BIN()
{
return require 'data/Calculation/Engineering/HEX2BIN.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerHEX2DEC
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testHEX2DEC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::HEXTODEC(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerHEX2DEC()
{
return require 'data/Calculation/Engineering/HEX2DEC.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerHEX2OCT
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testHEX2OCT($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::HEXTOOCT(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerHEX2OCT()
{
return require 'data/Calculation/Engineering/HEX2OCT.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerOCT2BIN
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testOCT2BIN($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::OCTTOBIN(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerOCT2BIN()
{
return require 'data/Calculation/Engineering/OCT2BIN.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerOCT2DEC
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testOCT2DEC($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::OCTTODEC(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerOCT2DEC()
{
return require 'data/Calculation/Engineering/OCT2DEC.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerOCT2HEX
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testOCT2HEX($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::OCTTOHEX(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerOCT2HEX()
{
return require 'data/Calculation/Engineering/OCT2HEX.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerBITAND
*
* @param mixed $expectedResult
* @param mixed[] $args
*/
public function testBITAND($expectedResult, array $args)
{
$result = Engineering::BITAND(...$args);
self::assertEquals($expectedResult, $result, null);
}
public function providerBITAND()
{
return require 'data/Calculation/Engineering/BITAND.php';
}
/**
* @dataProvider providerBITOR
*
* @param mixed $expectedResult
* @param mixed[] $args
*/
public function testBITOR($expectedResult, array $args)
{
$result = Engineering::BITOR(...$args);
self::assertEquals($expectedResult, $result, null);
}
public function providerBITOR()
{
return require 'data/Calculation/Engineering/BITOR.php';
}
/**
* @dataProvider providerBITXOR
*
* @param mixed $expectedResult
* @param mixed[] $args
*/
public function testBITXOR($expectedResult, array $args)
{
$result = Engineering::BITXOR(...$args);
self::assertEquals($expectedResult, $result, null);
}
public function providerBITXOR()
{
return require 'data/Calculation/Engineering/BITXOR.php';
}
/**
* @dataProvider providerBITLSHIFT
*
* @param mixed $expectedResult
* @param mixed[] $args
*/
public function testBITLSHIFT($expectedResult, array $args)
{
$result = Engineering::BITLSHIFT(...$args);
self::assertEquals($expectedResult, $result, null);
}
public function providerBITLSHIFT()
{
return require 'data/Calculation/Engineering/BITLSHIFT.php';
}
/**
* @dataProvider providerBITRSHIFT
*
* @param mixed $expectedResult
* @param mixed[] $args
*/
public function testBITRSHIFT($expectedResult, array $args)
{
$result = Engineering::BITRSHIFT(...$args);
self::assertEquals($expectedResult, $result, null);
}
public function providerBITRSHIFT()
{
return require 'data/Calculation/Engineering/BITRSHIFT.php';
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerDELTA
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testDELTA($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::DELTA(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerDELTA()
{
return require 'data/Calculation/Engineering/DELTA.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerGESTEP
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testGESTEP($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::GESTEP(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerGESTEP()
{
return require 'data/Calculation/Engineering/GESTEP.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testGetConversionGroups()
{
$result = Engineering::getConversionGroups();
self::assertInternalType('array', $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testGetConversionGroupUnits()
{
$result = Engineering::getConversionGroupUnits();
self::assertInternalType('array', $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testGetConversionGroupUnitDetails()
{
$result = Engineering::getConversionGroupUnitDetails();
self::assertInternalType('array', $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
2015-05-17 13:00:02 +00:00
public function testGetConversionMultipliers()
{
$result = Engineering::getConversionMultipliers();
self::assertInternalType('array', $result);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
/**
* @dataProvider providerCONVERTUOM
*
* @param mixed $expectedResult
2012-07-31 20:56:11 +00:00
*/
public function testCONVERTUOM($expectedResult, ...$args)
2015-05-17 13:00:02 +00:00
{
$result = Engineering::CONVERTUOM(...$args);
self::assertEquals($expectedResult, $result, null);
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
public function providerCONVERTUOM()
{
return require 'data/Calculation/Engineering/CONVERTUOM.php';
2015-05-17 13:00:02 +00:00
}
2012-07-31 20:56:11 +00:00
}