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