visualizer
/
vendor
/
phpoffice
/
phpexcel
/
unitTests
/
Classes
/
PHPExcel
/
Calculation
/
MathTrigTest.php
MathTrigTest.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.2.0, at vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Calculation/MathTrigTest.php
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | require_once 'testDataFileIterator.php'; |
| 5 | |
| 6 | class MathTrigTest extends PHPUnit_Framework_TestCase |
| 7 | { |
| 8 | |
| 9 | public function setUp() |
| 10 | { |
| 11 | if (!defined('PHPEXCEL_ROOT')) |
| 12 | { |
| 13 | define('PHPEXCEL_ROOT', APPLICATION_PATH . '/'); |
| 14 | } |
| 15 | require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
| 16 | |
| 17 | PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * @dataProvider providerATAN2 |
| 22 | */ |
| 23 | public function testATAN2() |
| 24 | { |
| 25 | $args = func_get_args(); |
| 26 | $expectedResult = array_pop($args); |
| 27 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ATAN2'),$args); |
| 28 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 29 | } |
| 30 | |
| 31 | public function providerATAN2() |
| 32 | { |
| 33 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/ATAN2.data'); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @dataProvider providerCEILING |
| 38 | */ |
| 39 | public function testCEILING() |
| 40 | { |
| 41 | $args = func_get_args(); |
| 42 | $expectedResult = array_pop($args); |
| 43 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','CEILING'),$args); |
| 44 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 45 | } |
| 46 | |
| 47 | public function providerCEILING() |
| 48 | { |
| 49 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/CEILING.data'); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @dataProvider providerCOMBIN |
| 54 | */ |
| 55 | public function testCOMBIN() |
| 56 | { |
| 57 | $args = func_get_args(); |
| 58 | $expectedResult = array_pop($args); |
| 59 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','COMBIN'),$args); |
| 60 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 61 | } |
| 62 | |
| 63 | public function providerCOMBIN() |
| 64 | { |
| 65 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/COMBIN.data'); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @dataProvider providerEVEN |
| 70 | */ |
| 71 | public function testEVEN() |
| 72 | { |
| 73 | $args = func_get_args(); |
| 74 | $expectedResult = array_pop($args); |
| 75 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','EVEN'),$args); |
| 76 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 77 | } |
| 78 | |
| 79 | public function providerEVEN() |
| 80 | { |
| 81 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/EVEN.data'); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @dataProvider providerODD |
| 86 | */ |
| 87 | public function testODD() |
| 88 | { |
| 89 | $args = func_get_args(); |
| 90 | $expectedResult = array_pop($args); |
| 91 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ODD'),$args); |
| 92 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 93 | } |
| 94 | |
| 95 | public function providerODD() |
| 96 | { |
| 97 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/ODD.data'); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * @dataProvider providerFACT |
| 102 | */ |
| 103 | public function testFACT() |
| 104 | { |
| 105 | $args = func_get_args(); |
| 106 | $expectedResult = array_pop($args); |
| 107 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACT'),$args); |
| 108 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 109 | } |
| 110 | |
| 111 | public function providerFACT() |
| 112 | { |
| 113 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACT.data'); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * @dataProvider providerFACTDOUBLE |
| 118 | */ |
| 119 | public function testFACTDOUBLE() |
| 120 | { |
| 121 | $args = func_get_args(); |
| 122 | $expectedResult = array_pop($args); |
| 123 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FACTDOUBLE'),$args); |
| 124 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 125 | } |
| 126 | |
| 127 | public function providerFACTDOUBLE() |
| 128 | { |
| 129 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/FACTDOUBLE.data'); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * @dataProvider providerFLOOR |
| 134 | */ |
| 135 | public function testFLOOR() |
| 136 | { |
| 137 | $args = func_get_args(); |
| 138 | $expectedResult = array_pop($args); |
| 139 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','FLOOR'),$args); |
| 140 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 141 | } |
| 142 | |
| 143 | public function providerFLOOR() |
| 144 | { |
| 145 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/FLOOR.data'); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * @dataProvider providerGCD |
| 150 | */ |
| 151 | public function testGCD() |
| 152 | { |
| 153 | $args = func_get_args(); |
| 154 | $expectedResult = array_pop($args); |
| 155 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','GCD'),$args); |
| 156 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 157 | } |
| 158 | |
| 159 | public function providerGCD() |
| 160 | { |
| 161 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/GCD.data'); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * @dataProvider providerLCM |
| 166 | */ |
| 167 | public function testLCM() |
| 168 | { |
| 169 | $args = func_get_args(); |
| 170 | $expectedResult = array_pop($args); |
| 171 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LCM'),$args); |
| 172 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 173 | } |
| 174 | |
| 175 | public function providerLCM() |
| 176 | { |
| 177 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/LCM.data'); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * @dataProvider providerINT |
| 182 | */ |
| 183 | public function testINT() |
| 184 | { |
| 185 | $args = func_get_args(); |
| 186 | $expectedResult = array_pop($args); |
| 187 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','INT'),$args); |
| 188 | $this->assertEquals($expectedResult, $result); |
| 189 | } |
| 190 | |
| 191 | public function providerINT() |
| 192 | { |
| 193 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/INT.data'); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * @dataProvider providerSIGN |
| 198 | */ |
| 199 | public function testSIGN() |
| 200 | { |
| 201 | $args = func_get_args(); |
| 202 | $expectedResult = array_pop($args); |
| 203 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SIGN'),$args); |
| 204 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 205 | } |
| 206 | |
| 207 | public function providerSIGN() |
| 208 | { |
| 209 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/SIGN.data'); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * @dataProvider providerPOWER |
| 214 | */ |
| 215 | public function testPOWER() |
| 216 | { |
| 217 | $args = func_get_args(); |
| 218 | $expectedResult = array_pop($args); |
| 219 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','POWER'),$args); |
| 220 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 221 | } |
| 222 | |
| 223 | public function providerPOWER() |
| 224 | { |
| 225 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/POWER.data'); |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * @dataProvider providerLOG |
| 230 | */ |
| 231 | public function testLOG() |
| 232 | { |
| 233 | $args = func_get_args(); |
| 234 | $expectedResult = array_pop($args); |
| 235 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','LOG_BASE'),$args); |
| 236 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 237 | } |
| 238 | |
| 239 | public function providerLOG() |
| 240 | { |
| 241 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/LOG.data'); |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * @dataProvider providerMOD |
| 246 | */ |
| 247 | public function testMOD() |
| 248 | { |
| 249 | $args = func_get_args(); |
| 250 | $expectedResult = array_pop($args); |
| 251 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MOD'),$args); |
| 252 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 253 | } |
| 254 | |
| 255 | public function providerMOD() |
| 256 | { |
| 257 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MOD.data'); |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * @dataProvider providerMDETERM |
| 262 | */ |
| 263 | public function testMDETERM() |
| 264 | { |
| 265 | $args = func_get_args(); |
| 266 | $expectedResult = array_pop($args); |
| 267 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MDETERM'),$args); |
| 268 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 269 | } |
| 270 | |
| 271 | public function providerMDETERM() |
| 272 | { |
| 273 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MDETERM.data'); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * @dataProvider providerMINVERSE |
| 278 | */ |
| 279 | public function testMINVERSE() |
| 280 | { |
| 281 | $args = func_get_args(); |
| 282 | $expectedResult = array_pop($args); |
| 283 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MINVERSE'),$args); |
| 284 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 285 | } |
| 286 | |
| 287 | public function providerMINVERSE() |
| 288 | { |
| 289 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MINVERSE.data'); |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * @dataProvider providerMMULT |
| 294 | */ |
| 295 | public function testMMULT() |
| 296 | { |
| 297 | $args = func_get_args(); |
| 298 | $expectedResult = array_pop($args); |
| 299 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MMULT'),$args); |
| 300 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 301 | } |
| 302 | |
| 303 | public function providerMMULT() |
| 304 | { |
| 305 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MMULT.data'); |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * @dataProvider providerMULTINOMIAL |
| 310 | */ |
| 311 | public function testMULTINOMIAL() |
| 312 | { |
| 313 | $args = func_get_args(); |
| 314 | $expectedResult = array_pop($args); |
| 315 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MULTINOMIAL'),$args); |
| 316 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 317 | } |
| 318 | |
| 319 | public function providerMULTINOMIAL() |
| 320 | { |
| 321 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MULTINOMIAL.data'); |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * @dataProvider providerMROUND |
| 326 | */ |
| 327 | public function testMROUND() |
| 328 | { |
| 329 | $args = func_get_args(); |
| 330 | $expectedResult = array_pop($args); |
| 331 | PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); |
| 332 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','MROUND'),$args); |
| 333 | PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_ARRAY); |
| 334 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 335 | } |
| 336 | |
| 337 | public function providerMROUND() |
| 338 | { |
| 339 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/MROUND.data'); |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * @dataProvider providerPRODUCT |
| 344 | */ |
| 345 | public function testPRODUCT() |
| 346 | { |
| 347 | $args = func_get_args(); |
| 348 | $expectedResult = array_pop($args); |
| 349 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','PRODUCT'),$args); |
| 350 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 351 | } |
| 352 | |
| 353 | public function providerPRODUCT() |
| 354 | { |
| 355 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/PRODUCT.data'); |
| 356 | } |
| 357 | |
| 358 | /** |
| 359 | * @dataProvider providerQUOTIENT |
| 360 | */ |
| 361 | public function testQUOTIENT() |
| 362 | { |
| 363 | $args = func_get_args(); |
| 364 | $expectedResult = array_pop($args); |
| 365 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','QUOTIENT'),$args); |
| 366 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 367 | } |
| 368 | |
| 369 | public function providerQUOTIENT() |
| 370 | { |
| 371 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/QUOTIENT.data'); |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * @dataProvider providerROUNDUP |
| 376 | */ |
| 377 | public function testROUNDUP() |
| 378 | { |
| 379 | $args = func_get_args(); |
| 380 | $expectedResult = array_pop($args); |
| 381 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDUP'),$args); |
| 382 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 383 | } |
| 384 | |
| 385 | public function providerROUNDUP() |
| 386 | { |
| 387 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDUP.data'); |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * @dataProvider providerROUNDDOWN |
| 392 | */ |
| 393 | public function testROUNDDOWN() |
| 394 | { |
| 395 | $args = func_get_args(); |
| 396 | $expectedResult = array_pop($args); |
| 397 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROUNDDOWN'),$args); |
| 398 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 399 | } |
| 400 | |
| 401 | public function providerROUNDDOWN() |
| 402 | { |
| 403 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROUNDDOWN.data'); |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * @dataProvider providerSERIESSUM |
| 408 | */ |
| 409 | public function testSERIESSUM() |
| 410 | { |
| 411 | $args = func_get_args(); |
| 412 | $expectedResult = array_pop($args); |
| 413 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SERIESSUM'),$args); |
| 414 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 415 | } |
| 416 | |
| 417 | public function providerSERIESSUM() |
| 418 | { |
| 419 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/SERIESSUM.data'); |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * @dataProvider providerSUMSQ |
| 424 | */ |
| 425 | public function testSUMSQ() |
| 426 | { |
| 427 | $args = func_get_args(); |
| 428 | $expectedResult = array_pop($args); |
| 429 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SUMSQ'),$args); |
| 430 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 431 | } |
| 432 | |
| 433 | public function providerSUMSQ() |
| 434 | { |
| 435 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/SUMSQ.data'); |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * @dataProvider providerTRUNC |
| 440 | */ |
| 441 | public function testTRUNC() |
| 442 | { |
| 443 | $args = func_get_args(); |
| 444 | $expectedResult = array_pop($args); |
| 445 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','TRUNC'),$args); |
| 446 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 447 | } |
| 448 | |
| 449 | public function providerTRUNC() |
| 450 | { |
| 451 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/TRUNC.data'); |
| 452 | } |
| 453 | |
| 454 | /** |
| 455 | * @dataProvider providerROMAN |
| 456 | */ |
| 457 | public function testROMAN() |
| 458 | { |
| 459 | $args = func_get_args(); |
| 460 | $expectedResult = array_pop($args); |
| 461 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','ROMAN'),$args); |
| 462 | $this->assertEquals($expectedResult, $result); |
| 463 | } |
| 464 | |
| 465 | public function providerROMAN() |
| 466 | { |
| 467 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/ROMAN.data'); |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * @dataProvider providerSQRTPI |
| 472 | */ |
| 473 | public function testSQRTPI() |
| 474 | { |
| 475 | $args = func_get_args(); |
| 476 | $expectedResult = array_pop($args); |
| 477 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig','SQRTPI'),$args); |
| 478 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 479 | } |
| 480 | |
| 481 | public function providerSQRTPI() |
| 482 | { |
| 483 | return new testDataFileIterator('rawTestData/Calculation/MathTrig/SQRTPI.data'); |
| 484 | } |
| 485 | |
| 486 | /** |
| 487 | * @dataProvider providerSUMIF |
| 488 | */ |
| 489 | public function testSUMIF() |
| 490 | { |
| 491 | $args = func_get_args(); |
| 492 | $expectedResult = array_pop($args); |
| 493 | $result = call_user_func_array(array('PHPExcel_Calculation_MathTrig', 'SUMIF'), $args); |
| 494 | $this->assertEquals($expectedResult, $result, NULL, 1E-12); |
| 495 | } |
| 496 | |
| 497 | public function providerSUMIF() |
| 498 | { |
| 499 | return array( |
| 500 | array( |
| 501 | array( |
| 502 | array(1), |
| 503 | array(5), |
| 504 | array(10), |
| 505 | ), |
| 506 | '>=5', |
| 507 | 15, |
| 508 | ), |
| 509 | array( |
| 510 | array( |
| 511 | array('text'), |
| 512 | array(2), |
| 513 | ), |
| 514 | '=text', |
| 515 | array( |
| 516 | array(10), |
| 517 | array(100), |
| 518 | ), |
| 519 | 10, |
| 520 | ), |
| 521 | array( |
| 522 | array( |
| 523 | array('"text with quotes"'), |
| 524 | array(2), |
| 525 | ), |
| 526 | '="text with quotes"', |
| 527 | array( |
| 528 | array(10), |
| 529 | array(100), |
| 530 | ), |
| 531 | 10, |
| 532 | ), |
| 533 | array( |
| 534 | array( |
| 535 | array('"text with quotes"'), |
| 536 | array(''), |
| 537 | ), |
| 538 | '>"', // Compare to the single characater " (double quote) |
| 539 | array( |
| 540 | array(10), |
| 541 | array(100), |
| 542 | ), |
| 543 | 10 |
| 544 | ), |
| 545 | array( |
| 546 | array( |
| 547 | array(''), |
| 548 | array('anything'), |
| 549 | ), |
| 550 | '>"', // Compare to the single characater " (double quote) |
| 551 | array( |
| 552 | array(10), |
| 553 | array(100), |
| 554 | ), |
| 555 | 100 |
| 556 | ), |
| 557 | ); |
| 558 | } |
| 559 | |
| 560 | } |
| 561 |