EngineeringTest.php
19.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
<?php
// Custom assertion class for handling precision of Complex numbers
require_once 'custom/complexAssert.php';
// Data Provider handler
require_once 'testDataFileIterator.php';
class EngineeringTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT'))
{
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Calculation_Functions::setCompatibilityMode(PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerBESSELI
*/
public function testBESSELI()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELI'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerBESSELI()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BESSELI.data');
}
/**
* @dataProvider providerBESSELJ
*/
public function testBESSELJ()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELJ'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerBESSELJ()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BESSELJ.data');
}
/**
* @dataProvider providerBESSELK
*/
public function testBESSELK()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELK'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerBESSELK()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BESSELK.data');
}
/**
* @dataProvider providerBESSELY
*/
public function testBESSELY()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BESSELY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerBESSELY()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BESSELY.data');
}
/**
* @dataProvider providerCOMPLEX
*/
public function testCOMPLEX()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','COMPLEX'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerCOMPLEX()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/COMPLEX.data');
}
/**
* @dataProvider providerIMAGINARY
*/
public function testIMAGINARY()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMAGINARY'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerIMAGINARY()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMAGINARY.data');
}
/**
* @dataProvider providerIMREAL
*/
public function testIMREAL()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMREAL'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerIMREAL()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMREAL.data');
}
/**
* @dataProvider providerIMABS
*/
public function testIMABS()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMABS'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerIMABS()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMABS.data');
}
/**
* @dataProvider providerIMARGUMENT
*/
public function testIMARGUMENT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMARGUMENT'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-8);
}
public function providerIMARGUMENT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMARGUMENT.data');
}
/**
* @dataProvider providerIMCONJUGATE
*/
public function testIMCONJUGATE()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCONJUGATE'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMCONJUGATE()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMCONJUGATE.data');
}
/**
* @dataProvider providerIMCOS
*/
public function testIMCOS()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMCOS'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMCOS()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMCOS.data');
}
/**
* @dataProvider providerIMDIV
*/
public function testIMDIV()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMDIV'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMDIV()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMDIV.data');
}
/**
* @dataProvider providerIMEXP
*/
public function testIMEXP()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMEXP'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMEXP()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMEXP.data');
}
/**
* @dataProvider providerIMLN
*/
public function testIMLN()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLN'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMLN()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLN.data');
}
/**
* @dataProvider providerIMLOG2
*/
public function testIMLOG2()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG2'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMLOG2()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG2.data');
}
/**
* @dataProvider providerIMLOG10
*/
public function testIMLOG10()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMLOG10'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMLOG10()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMLOG10.data');
}
/**
* @dataProvider providerIMPOWER
*/
public function testIMPOWER()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPOWER'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMPOWER()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMPOWER.data');
}
/**
* @dataProvider providerIMPRODUCT
*/
public function testIMPRODUCT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMPRODUCT'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMPRODUCT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMPRODUCT.data');
}
/**
* @dataProvider providerIMSIN
*/
public function testIMSIN()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSIN'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMSIN()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSIN.data');
}
/**
* @dataProvider providerIMSQRT
*/
public function testIMSQRT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSQRT'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMSQRT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSQRT.data');
}
/**
* @dataProvider providerIMSUB
*/
public function testIMSUB()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUB'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMSUB()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSUB.data');
}
/**
* @dataProvider providerIMSUM
*/
public function testIMSUM()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','IMSUM'),$args);
$complexAssert = new complexAssert();
$this->assertTrue($complexAssert->assertComplexEquals($expectedResult, $result, 1E-8),
$complexAssert->getErrorMessage());
}
public function providerIMSUM()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/IMSUM.data');
}
/**
* @dataProvider providerERF
*/
public function testERF()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERF'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
}
public function providerERF()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/ERF.data');
}
/**
* @dataProvider providerERFC
*/
public function testERFC()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','ERFC'),$args);
$this->assertEquals($expectedResult, $result, NULL, 1E-12);
}
public function providerERFC()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/ERFC.data');
}
/**
* @dataProvider providerBIN2DEC
*/
public function testBIN2DEC()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTODEC'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerBIN2DEC()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2DEC.data');
}
/**
* @dataProvider providerBIN2HEX
*/
public function testBIN2HEX()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOHEX'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerBIN2HEX()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2HEX.data');
}
/**
* @dataProvider providerBIN2OCT
*/
public function testBIN2OCT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','BINTOOCT'),$args);
$this->assertEquals($expectedResult, $result);
}
public function providerBIN2OCT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/BIN2OCT.data');
}
/**
* @dataProvider providerDEC2BIN
*/
public function testDEC2BIN()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerDEC2BIN()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2BIN.data');
}
/**
* @dataProvider providerDEC2HEX
*/
public function testDEC2HEX()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOHEX'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerDEC2HEX()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2HEX.data');
}
/**
* @dataProvider providerDEC2OCT
*/
public function testDEC2OCT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DECTOOCT'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerDEC2OCT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/DEC2OCT.data');
}
/**
* @dataProvider providerHEX2BIN
*/
public function testHEX2BIN()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerHEX2BIN()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2BIN.data');
}
/**
* @dataProvider providerHEX2DEC
*/
public function testHEX2DEC()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTODEC'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerHEX2DEC()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2DEC.data');
}
/**
* @dataProvider providerHEX2OCT
*/
public function testHEX2OCT()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','HEXTOOCT'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerHEX2OCT()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/HEX2OCT.data');
}
/**
* @dataProvider providerOCT2BIN
*/
public function testOCT2BIN()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOBIN'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerOCT2BIN()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2BIN.data');
}
/**
* @dataProvider providerOCT2DEC
*/
public function testOCT2DEC()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTODEC'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerOCT2DEC()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2DEC.data');
}
/**
* @dataProvider providerOCT2HEX
*/
public function testOCT2HEX()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','OCTTOHEX'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerOCT2HEX()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/OCT2HEX.data');
}
/**
* @dataProvider providerDELTA
*/
public function testDELTA()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','DELTA'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerDELTA()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/DELTA.data');
}
/**
* @dataProvider providerGESTEP
*/
public function testGESTEP()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','GESTEP'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerGESTEP()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/GESTEP.data');
}
public function testGetConversionGroups()
{
$result = PHPExcel_Calculation_Engineering::getConversionGroups();
$this->assertInternalType('array', $result);
}
public function testGetConversionGroupUnits()
{
$result = PHPExcel_Calculation_Engineering::getConversionGroupUnits();
$this->assertInternalType('array', $result);
}
public function testGetConversionGroupUnitDetails()
{
$result = PHPExcel_Calculation_Engineering::getConversionGroupUnitDetails();
$this->assertInternalType('array', $result);
}
public function testGetConversionMultipliers()
{
$result = PHPExcel_Calculation_Engineering::getConversionMultipliers();
$this->assertInternalType('array', $result);
}
/**
* @dataProvider providerCONVERTUOM
*/
public function testCONVERTUOM()
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_Engineering','CONVERTUOM'),$args);
$this->assertEquals($expectedResult, $result, NULL);
}
public function providerCONVERTUOM()
{
return new testDataFileIterator('rawTestData/Calculation/Engineering/CONVERTUOM.data');
}
}