From a807cc14ca7033ab0b022c7ca41478a58b277deb Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 9 Apr 2012 11:27:21 +0000 Subject: [PATCH] Unit tests git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@89020 2327b42d-5241-43d6-9e2a-de5ac946f064 --- .../PHPExcel/Calculation/FinancialTest.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/unitTests/PHPExcel/Calculation/FinancialTest.php b/unitTests/PHPExcel/Calculation/FinancialTest.php index c3b300a2..6988ac8e 100644 --- a/unitTests/PHPExcel/Calculation/FinancialTest.php +++ b/unitTests/PHPExcel/Calculation/FinancialTest.php @@ -287,6 +287,118 @@ class FinancialTest extends PHPUnit_Framework_TestCase return new testDataFileIterator('rawTestData/Calculation/Financial/DOLLARFR.data'); } + /** + * @dataProvider providerEFFECT + */ + public function testEFFECT() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','EFFECT'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerEFFECT() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/EFFECT.data'); + } + + /** + * @dataProvider providerFV + */ + public function testFV() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FV'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerFV() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/FV.data'); + } + + /** + * @dataProvider providerFVSCHEDULE + */ + public function testFVSCHEDULE() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','FVSCHEDULE'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerFVSCHEDULE() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/FVSCHEDULE.data'); + } + + /** + * @dataProvider providerINTRATE + */ + public function testINTRATE() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','INTRATE'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerINTRATE() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/INTRATE.data'); + } + + /** + * @dataProvider providerIPMT + */ + public function testIPMT() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IPMT'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerIPMT() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/IPMT.data'); + } + + /** + * @dataProvider providerIRR + */ + public function testIRR() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','IRR'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerIRR() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/IRR.data'); + } + + /** + * @dataProvider providerISPMT + */ + public function testISPMT() + { + $args = func_get_args(); + $expectedResult = array_pop($args); + $result = call_user_func_array(array('PHPExcel_Calculation_Financial','ISPMT'),$args); + $this->assertEquals($expectedResult, $result, NULL, 1E-8); + } + + public function providerISPMT() + { + return new testDataFileIterator('rawTestData/Calculation/Financial/ISPMT.data'); + } + /** * @dataProvider providerRATE */