1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation; |
4
|
|
|
|
5
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Engineering; |
6
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions; |
7
|
|
|
use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; |
8
|
|
|
use PHPUnit\Framework\TestCase; |
9
|
|
|
|
10
|
|
|
class EngineeringTest extends TestCase |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var ComplexAssert |
14
|
|
|
*/ |
15
|
|
|
protected $complexAssert; |
16
|
|
|
|
17
|
|
|
const BESSEL_PRECISION = 1E-8; |
18
|
|
|
const COMPLEX_PRECISION = 1E-8; |
19
|
|
|
const ERF_PRECISION = 1E-12; |
20
|
|
|
|
21
|
|
|
public function setUp() |
22
|
|
|
{ |
23
|
|
|
$this->complexAssert = new ComplexAssert(); |
24
|
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function tearDown() |
28
|
|
|
{ |
29
|
|
|
$this->complexAssert = null; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @dataProvider providerBESSELI |
34
|
|
|
* |
35
|
|
|
* @param mixed $expectedResult |
36
|
|
|
*/ |
37
|
|
|
public function testBESSELI($expectedResult, ...$args) |
38
|
|
|
{ |
39
|
|
|
$result = Engineering::BESSELI(...$args); |
40
|
|
|
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function providerBESSELI() |
44
|
|
|
{ |
45
|
|
|
return require 'data/Calculation/Engineering/BESSELI.php'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @dataProvider providerBESSELJ |
50
|
|
|
* |
51
|
|
|
* @param mixed $expectedResult |
52
|
|
|
*/ |
53
|
|
|
public function testBESSELJ($expectedResult, ...$args) |
54
|
|
|
{ |
55
|
|
|
$result = Engineering::BESSELJ(...$args); |
56
|
|
|
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function providerBESSELJ() |
60
|
|
|
{ |
61
|
|
|
return require 'data/Calculation/Engineering/BESSELJ.php'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @dataProvider providerBESSELK |
66
|
|
|
* |
67
|
|
|
* @param mixed $expectedResult |
68
|
|
|
*/ |
69
|
|
|
public function testBESSELK($expectedResult, ...$args) |
70
|
|
|
{ |
71
|
|
|
$result = Engineering::BESSELK(...$args); |
72
|
|
|
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function providerBESSELK() |
76
|
|
|
{ |
77
|
|
|
return require 'data/Calculation/Engineering/BESSELK.php'; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @dataProvider providerBESSELY |
82
|
|
|
* |
83
|
|
|
* @param mixed $expectedResult |
84
|
|
|
*/ |
85
|
|
|
public function testBESSELY($expectedResult, ...$args) |
86
|
|
|
{ |
87
|
|
|
$result = Engineering::BESSELY(...$args); |
88
|
|
|
self::assertEquals($expectedResult, $result, null, self::BESSEL_PRECISION); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function providerBESSELY() |
92
|
|
|
{ |
93
|
|
|
return require 'data/Calculation/Engineering/BESSELY.php'; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @dataProvider providerCOMPLEX |
98
|
|
|
* |
99
|
|
|
* @param mixed $expectedResult |
100
|
|
|
*/ |
101
|
|
|
public function testParseComplex() |
102
|
|
|
{ |
103
|
|
|
list($real, $imaginary, $suffix) = [1.23e-4, 5.67e+8, 'j']; |
104
|
|
|
|
105
|
|
|
$result = Engineering::parseComplex('1.23e-4+5.67e+8j'); |
|
|
|
|
106
|
|
|
$this->assertArrayHasKey('real', $result); |
107
|
|
|
$this->assertEquals($real, $result['real']); |
108
|
|
|
$this->assertArrayHasKey('imaginary', $result); |
109
|
|
|
$this->assertEquals($imaginary, $result['imaginary']); |
110
|
|
|
$this->assertArrayHasKey('suffix', $result); |
111
|
|
|
$this->assertEquals($suffix, $result['suffix']); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @dataProvider providerCOMPLEX |
116
|
|
|
* |
117
|
|
|
* @param mixed $expectedResult |
118
|
|
|
*/ |
119
|
|
|
public function testCOMPLEX($expectedResult, ...$args) |
120
|
|
|
{ |
121
|
|
|
$result = Engineering::COMPLEX(...$args); |
|
|
|
|
122
|
|
|
self::assertEquals($expectedResult, $result); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function providerCOMPLEX() |
126
|
|
|
{ |
127
|
|
|
return require 'data/Calculation/Engineering/COMPLEX.php'; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @dataProvider providerIMAGINARY |
132
|
|
|
* |
133
|
|
|
* @param mixed $expectedResult |
134
|
|
|
* @param mixed $value |
135
|
|
|
*/ |
136
|
|
|
public function testIMAGINARY($expectedResult, $value) |
137
|
|
|
{ |
138
|
|
|
$result = Engineering::IMAGINARY($value); |
139
|
|
|
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function providerIMAGINARY() |
143
|
|
|
{ |
144
|
|
|
return require 'data/Calculation/Engineering/IMAGINARY.php'; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @dataProvider providerIMREAL |
149
|
|
|
* |
150
|
|
|
* @param mixed $expectedResult |
151
|
|
|
* @param mixed $value |
152
|
|
|
*/ |
153
|
|
|
public function testIMREAL($expectedResult, $value) |
154
|
|
|
{ |
155
|
|
|
$result = Engineering::IMREAL($value); |
156
|
|
|
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function providerIMREAL() |
160
|
|
|
{ |
161
|
|
|
return require 'data/Calculation/Engineering/IMREAL.php'; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @dataProvider providerIMABS |
166
|
|
|
* |
167
|
|
|
* @param mixed $expectedResult |
168
|
|
|
* @param mixed $value |
169
|
|
|
*/ |
170
|
|
|
public function testIMABS($expectedResult, $value) |
171
|
|
|
{ |
172
|
|
|
$result = Engineering::IMABS($value); |
173
|
|
|
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function providerIMABS() |
177
|
|
|
{ |
178
|
|
|
return require 'data/Calculation/Engineering/IMABS.php'; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @dataProvider providerIMARGUMENT |
183
|
|
|
* |
184
|
|
|
* @param mixed $expectedResult |
185
|
|
|
* @param mixed $value |
186
|
|
|
*/ |
187
|
|
|
public function testIMARGUMENT($expectedResult, $value) |
188
|
|
|
{ |
189
|
|
|
$result = Engineering::IMARGUMENT($value); |
190
|
|
|
self::assertEquals($expectedResult, $result, null, self::COMPLEX_PRECISION); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function providerIMARGUMENT() |
194
|
|
|
{ |
195
|
|
|
return require 'data/Calculation/Engineering/IMARGUMENT.php'; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @dataProvider providerIMCONJUGATE |
200
|
|
|
* |
201
|
|
|
* @param mixed $expectedResult |
202
|
|
|
* @param mixed $value |
203
|
|
|
*/ |
204
|
|
|
public function testIMCONJUGATE($expectedResult, $value) |
205
|
|
|
{ |
206
|
|
|
$result = Engineering::IMCONJUGATE($value); |
207
|
|
|
self::assertTrue( |
208
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
209
|
|
|
$this->complexAssert->getErrorMessage() |
210
|
|
|
); |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function providerIMCONJUGATE() |
214
|
|
|
{ |
215
|
|
|
return require 'data/Calculation/Engineering/IMCONJUGATE.php'; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @dataProvider providerIMCOS |
220
|
|
|
* |
221
|
|
|
* @param mixed $expectedResult |
222
|
|
|
* @param mixed $value |
223
|
|
|
*/ |
224
|
|
|
public function testIMCOS($expectedResult, $value) |
225
|
|
|
{ |
226
|
|
|
$result = Engineering::IMCOS($value); |
227
|
|
|
self::assertTrue( |
228
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
229
|
|
|
$this->complexAssert->getErrorMessage() |
230
|
|
|
); |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
public function providerIMCOS() |
234
|
|
|
{ |
235
|
|
|
return require 'data/Calculation/Engineering/IMCOS.php'; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @dataProvider providerIMCOSH |
240
|
|
|
* |
241
|
|
|
* @param mixed $expectedResult |
242
|
|
|
* @param mixed $value |
243
|
|
|
*/ |
244
|
|
|
public function testIMCOSH($expectedResult, $value) |
245
|
|
|
{ |
246
|
|
|
$result = Engineering::IMCOSH($value); |
247
|
|
|
self::assertTrue( |
248
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
249
|
|
|
$this->complexAssert->getErrorMessage() |
250
|
|
|
); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function providerIMCOSH() |
254
|
|
|
{ |
255
|
|
|
return require 'data/Calculation/Engineering/IMCOSH.php'; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @dataProvider providerIMCOT |
260
|
|
|
* |
261
|
|
|
* @param mixed $expectedResult |
262
|
|
|
* @param mixed $value |
263
|
|
|
*/ |
264
|
|
|
public function testIMCOT($expectedResult, $value) |
265
|
|
|
{ |
266
|
|
|
$result = Engineering::IMCOT($value); |
267
|
|
|
self::assertTrue( |
268
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
269
|
|
|
$this->complexAssert->getErrorMessage() |
270
|
|
|
); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
public function providerIMCOT() |
274
|
|
|
{ |
275
|
|
|
return require 'data/Calculation/Engineering/IMCOT.php'; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @dataProvider providerIMCSC |
280
|
|
|
* |
281
|
|
|
* @param mixed $expectedResult |
282
|
|
|
* @param mixed $value |
283
|
|
|
*/ |
284
|
|
|
public function testIMCSC($expectedResult, $value) |
285
|
|
|
{ |
286
|
|
|
$result = Engineering::IMCSC($value); |
287
|
|
|
self::assertTrue( |
288
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
289
|
|
|
$this->complexAssert->getErrorMessage() |
290
|
|
|
); |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
public function providerIMCSC() |
294
|
|
|
{ |
295
|
|
|
return require 'data/Calculation/Engineering/IMCSC.php'; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @dataProvider providerIMCSCH |
300
|
|
|
* |
301
|
|
|
* @param mixed $expectedResult |
302
|
|
|
* @param mixed $value |
303
|
|
|
*/ |
304
|
|
|
public function testIMCSCH($expectedResult, $value) |
305
|
|
|
{ |
306
|
|
|
$result = Engineering::IMCSCH($value); |
307
|
|
|
self::assertTrue( |
308
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
309
|
|
|
$this->complexAssert->getErrorMessage() |
310
|
|
|
); |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
public function providerIMCSCH() |
314
|
|
|
{ |
315
|
|
|
return require 'data/Calculation/Engineering/IMCSCH.php'; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* @dataProvider providerIMSEC |
320
|
|
|
* |
321
|
|
|
* @param mixed $expectedResult |
322
|
|
|
* @param mixed $value |
323
|
|
|
*/ |
324
|
|
|
public function testIMSEC($expectedResult, $value) |
325
|
|
|
{ |
326
|
|
|
$result = Engineering::IMSEC($value); |
327
|
|
|
self::assertTrue( |
328
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
329
|
|
|
$this->complexAssert->getErrorMessage() |
330
|
|
|
); |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
public function providerIMSEC() |
334
|
|
|
{ |
335
|
|
|
return require 'data/Calculation/Engineering/IMSEC.php'; |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @dataProvider providerIMSECH |
340
|
|
|
* |
341
|
|
|
* @param mixed $expectedResult |
342
|
|
|
* @param mixed $value |
343
|
|
|
*/ |
344
|
|
|
public function testIMSECH($expectedResult, $value) |
345
|
|
|
{ |
346
|
|
|
$result = Engineering::IMSECH($value); |
347
|
|
|
self::assertTrue( |
348
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
349
|
|
|
$this->complexAssert->getErrorMessage() |
350
|
|
|
); |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
public function providerIMSECH() |
354
|
|
|
{ |
355
|
|
|
return require 'data/Calculation/Engineering/IMSECH.php'; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @dataProvider providerIMDIV |
360
|
|
|
* |
361
|
|
|
* @param mixed $expectedResult |
362
|
|
|
*/ |
363
|
|
|
public function testIMDIV($expectedResult, ...$args) |
364
|
|
|
{ |
365
|
|
|
$result = Engineering::IMDIV(...$args); |
366
|
|
|
self::assertTrue( |
367
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
368
|
|
|
$this->complexAssert->getErrorMessage() |
369
|
|
|
); |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
public function providerIMDIV() |
373
|
|
|
{ |
374
|
|
|
return require 'data/Calculation/Engineering/IMDIV.php'; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* @dataProvider providerIMEXP |
379
|
|
|
* |
380
|
|
|
* @param mixed $expectedResult |
381
|
|
|
* @param mixed $value |
382
|
|
|
*/ |
383
|
|
|
public function testIMEXP($expectedResult, $value) |
384
|
|
|
{ |
385
|
|
|
$result = Engineering::IMEXP($value); |
386
|
|
|
self::assertTrue( |
387
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
388
|
|
|
$this->complexAssert->getErrorMessage() |
389
|
|
|
); |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
public function providerIMEXP() |
393
|
|
|
{ |
394
|
|
|
return require 'data/Calculation/Engineering/IMEXP.php'; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @dataProvider providerIMLN |
399
|
|
|
* |
400
|
|
|
* @param mixed $expectedResult |
401
|
|
|
* @param mixed $value |
402
|
|
|
*/ |
403
|
|
|
public function testIMLN($expectedResult, $value) |
404
|
|
|
{ |
405
|
|
|
$result = Engineering::IMLN($value); |
406
|
|
|
self::assertTrue( |
407
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
408
|
|
|
$this->complexAssert->getErrorMessage() |
409
|
|
|
); |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
public function providerIMLN() |
413
|
|
|
{ |
414
|
|
|
return require 'data/Calculation/Engineering/IMLN.php'; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* @dataProvider providerIMLOG2 |
419
|
|
|
* |
420
|
|
|
* @param mixed $expectedResult |
421
|
|
|
* @param mixed $value |
422
|
|
|
*/ |
423
|
|
|
public function testIMLOG2($expectedResult, $value) |
424
|
|
|
{ |
425
|
|
|
$result = Engineering::IMLOG2($value); |
426
|
|
|
self::assertTrue( |
427
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
428
|
|
|
$this->complexAssert->getErrorMessage() |
429
|
|
|
); |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
public function providerIMLOG2() |
433
|
|
|
{ |
434
|
|
|
return require 'data/Calculation/Engineering/IMLOG2.php'; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @dataProvider providerIMLOG10 |
439
|
|
|
* |
440
|
|
|
* @param mixed $expectedResult |
441
|
|
|
* @param mixed $value |
442
|
|
|
*/ |
443
|
|
|
public function testIMLOG10($expectedResult, $value) |
444
|
|
|
{ |
445
|
|
|
$result = Engineering::IMLOG10($value); |
446
|
|
|
self::assertTrue( |
447
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
448
|
|
|
$this->complexAssert->getErrorMessage() |
449
|
|
|
); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
public function providerIMLOG10() |
453
|
|
|
{ |
454
|
|
|
return require 'data/Calculation/Engineering/IMLOG10.php'; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* @dataProvider providerIMPOWER |
459
|
|
|
* |
460
|
|
|
* @param mixed $expectedResult |
461
|
|
|
*/ |
462
|
|
|
public function testIMPOWER($expectedResult, ...$args) |
463
|
|
|
{ |
464
|
|
|
$result = Engineering::IMPOWER(...$args); |
465
|
|
|
self::assertTrue( |
466
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
467
|
|
|
$this->complexAssert->getErrorMessage() |
468
|
|
|
); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
public function providerIMPOWER() |
472
|
|
|
{ |
473
|
|
|
return require 'data/Calculation/Engineering/IMPOWER.php'; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
/** |
477
|
|
|
* @dataProvider providerIMPRODUCT |
478
|
|
|
* |
479
|
|
|
* @param mixed $expectedResult |
480
|
|
|
*/ |
481
|
|
|
public function testIMPRODUCT($expectedResult, ...$args) |
482
|
|
|
{ |
483
|
|
|
$result = Engineering::IMPRODUCT(...$args); |
484
|
|
|
self::assertTrue( |
485
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
486
|
|
|
$this->complexAssert->getErrorMessage() |
487
|
|
|
); |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
public function providerIMPRODUCT() |
491
|
|
|
{ |
492
|
|
|
return require 'data/Calculation/Engineering/IMPRODUCT.php'; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* @dataProvider providerIMSIN |
497
|
|
|
* |
498
|
|
|
* @param mixed $expectedResult |
499
|
|
|
* @param mixed $value |
500
|
|
|
*/ |
501
|
|
|
public function testIMSIN($expectedResult, $value) |
502
|
|
|
{ |
503
|
|
|
$result = Engineering::IMSIN($value); |
504
|
|
|
self::assertTrue( |
505
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
506
|
|
|
$this->complexAssert->getErrorMessage() |
507
|
|
|
); |
508
|
|
|
} |
509
|
|
|
|
510
|
|
|
public function providerIMSIN() |
511
|
|
|
{ |
512
|
|
|
return require 'data/Calculation/Engineering/IMSIN.php'; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @dataProvider providerIMSINH |
517
|
|
|
* |
518
|
|
|
* @param mixed $expectedResult |
519
|
|
|
* @param mixed $value |
520
|
|
|
*/ |
521
|
|
|
public function testIMSINH($expectedResult, $value) |
522
|
|
|
{ |
523
|
|
|
$result = Engineering::IMSINH($value); |
524
|
|
|
self::assertTrue( |
525
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
526
|
|
|
$this->complexAssert->getErrorMessage() |
527
|
|
|
); |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
public function providerIMSINH() |
531
|
|
|
{ |
532
|
|
|
return require 'data/Calculation/Engineering/IMSINH.php'; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* @dataProvider providerIMTAN |
537
|
|
|
* |
538
|
|
|
* @param mixed $expectedResult |
539
|
|
|
* @param mixed $value |
540
|
|
|
*/ |
541
|
|
|
public function testIMTAN($expectedResult, $value) |
542
|
|
|
{ |
543
|
|
|
$result = Engineering::IMTAN($value); |
544
|
|
|
self::assertTrue( |
545
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
546
|
|
|
$this->complexAssert->getErrorMessage() |
547
|
|
|
); |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
public function providerIMTAN() |
551
|
|
|
{ |
552
|
|
|
return require 'data/Calculation/Engineering/IMTAN.php'; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* @dataProvider providerIMSQRT |
557
|
|
|
* |
558
|
|
|
* @param mixed $expectedResult |
559
|
|
|
* @param mixed $value |
560
|
|
|
*/ |
561
|
|
|
public function testIMSQRT($expectedResult, $value) |
562
|
|
|
{ |
563
|
|
|
$result = Engineering::IMSQRT($value); |
564
|
|
|
self::assertTrue( |
565
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
566
|
|
|
$this->complexAssert->getErrorMessage() |
567
|
|
|
); |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
public function providerIMSQRT() |
571
|
|
|
{ |
572
|
|
|
return require 'data/Calculation/Engineering/IMSQRT.php'; |
573
|
|
|
} |
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* @dataProvider providerIMSUB |
577
|
|
|
* |
578
|
|
|
* @param mixed $expectedResult |
579
|
|
|
*/ |
580
|
|
|
public function testIMSUB($expectedResult, ...$args) |
581
|
|
|
{ |
582
|
|
|
$result = Engineering::IMSUB(...$args); |
583
|
|
|
self::assertTrue( |
584
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
585
|
|
|
$this->complexAssert->getErrorMessage() |
586
|
|
|
); |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
public function providerIMSUB() |
590
|
|
|
{ |
591
|
|
|
return require 'data/Calculation/Engineering/IMSUB.php'; |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
/** |
595
|
|
|
* @dataProvider providerIMSUM |
596
|
|
|
* |
597
|
|
|
* @param mixed $expectedResult |
598
|
|
|
*/ |
599
|
|
|
public function testIMSUM($expectedResult, ...$args) |
600
|
|
|
{ |
601
|
|
|
$result = Engineering::IMSUM(...$args); |
602
|
|
|
self::assertTrue( |
603
|
|
|
$this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), |
604
|
|
|
$this->complexAssert->getErrorMessage() |
605
|
|
|
); |
606
|
|
|
} |
607
|
|
|
|
608
|
|
|
public function providerIMSUM() |
609
|
|
|
{ |
610
|
|
|
return require 'data/Calculation/Engineering/IMSUM.php'; |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* @dataProvider providerERF |
615
|
|
|
* |
616
|
|
|
* @param mixed $expectedResult |
617
|
|
|
*/ |
618
|
|
|
public function testERF($expectedResult, ...$args) |
619
|
|
|
{ |
620
|
|
|
$result = Engineering::ERF(...$args); |
|
|
|
|
621
|
|
|
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION); |
622
|
|
|
} |
623
|
|
|
|
624
|
|
|
public function providerERF() |
625
|
|
|
{ |
626
|
|
|
return require 'data/Calculation/Engineering/ERF.php'; |
627
|
|
|
} |
628
|
|
|
|
629
|
|
|
/** |
630
|
|
|
* @dataProvider providerERFPRECISE |
631
|
|
|
* |
632
|
|
|
* @param mixed $expectedResult |
633
|
|
|
*/ |
634
|
|
|
public function testERFPRECISE($expectedResult, ...$args) |
635
|
|
|
{ |
636
|
|
|
$result = Engineering::ERFPRECISE(...$args); |
|
|
|
|
637
|
|
|
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION); |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
public function providerERFPRECISE() |
641
|
|
|
{ |
642
|
|
|
return require 'data/Calculation/Engineering/ERFPRECISE.php'; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
/** |
646
|
|
|
* @dataProvider providerERFC |
647
|
|
|
* |
648
|
|
|
* @param mixed $expectedResult |
649
|
|
|
*/ |
650
|
|
|
public function testERFC($expectedResult, ...$args) |
651
|
|
|
{ |
652
|
|
|
$result = Engineering::ERFC(...$args); |
|
|
|
|
653
|
|
|
self::assertEquals($expectedResult, $result, null, self::ERF_PRECISION); |
654
|
|
|
} |
655
|
|
|
|
656
|
|
|
public function providerERFC() |
657
|
|
|
{ |
658
|
|
|
return require 'data/Calculation/Engineering/ERFC.php'; |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
/** |
662
|
|
|
* @dataProvider providerBIN2DEC |
663
|
|
|
* |
664
|
|
|
* @param mixed $expectedResult |
665
|
|
|
*/ |
666
|
|
|
public function testBIN2DEC($expectedResult, ...$args) |
667
|
|
|
{ |
668
|
|
|
$result = Engineering::BINTODEC(...$args); |
|
|
|
|
669
|
|
|
self::assertEquals($expectedResult, $result); |
670
|
|
|
} |
671
|
|
|
|
672
|
|
|
public function providerBIN2DEC() |
673
|
|
|
{ |
674
|
|
|
return require 'data/Calculation/Engineering/BIN2DEC.php'; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
/** |
678
|
|
|
* @dataProvider providerBIN2HEX |
679
|
|
|
* |
680
|
|
|
* @param mixed $expectedResult |
681
|
|
|
*/ |
682
|
|
|
public function testBIN2HEX($expectedResult, ...$args) |
683
|
|
|
{ |
684
|
|
|
$result = Engineering::BINTOHEX(...$args); |
|
|
|
|
685
|
|
|
self::assertEquals($expectedResult, $result); |
686
|
|
|
} |
687
|
|
|
|
688
|
|
|
public function providerBIN2HEX() |
689
|
|
|
{ |
690
|
|
|
return require 'data/Calculation/Engineering/BIN2HEX.php'; |
691
|
|
|
} |
692
|
|
|
|
693
|
|
|
/** |
694
|
|
|
* @dataProvider providerBIN2OCT |
695
|
|
|
* |
696
|
|
|
* @param mixed $expectedResult |
697
|
|
|
*/ |
698
|
|
|
public function testBIN2OCT($expectedResult, ...$args) |
699
|
|
|
{ |
700
|
|
|
$result = Engineering::BINTOOCT(...$args); |
|
|
|
|
701
|
|
|
self::assertEquals($expectedResult, $result); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
public function providerBIN2OCT() |
705
|
|
|
{ |
706
|
|
|
return require 'data/Calculation/Engineering/BIN2OCT.php'; |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* @dataProvider providerDEC2BIN |
711
|
|
|
* |
712
|
|
|
* @param mixed $expectedResult |
713
|
|
|
*/ |
714
|
|
|
public function testDEC2BIN($expectedResult, ...$args) |
715
|
|
|
{ |
716
|
|
|
$result = Engineering::DECTOBIN(...$args); |
|
|
|
|
717
|
|
|
self::assertEquals($expectedResult, $result, null); |
718
|
|
|
} |
719
|
|
|
|
720
|
|
|
public function providerDEC2BIN() |
721
|
|
|
{ |
722
|
|
|
return require 'data/Calculation/Engineering/DEC2BIN.php'; |
723
|
|
|
} |
724
|
|
|
|
725
|
|
|
/** |
726
|
|
|
* @dataProvider providerDEC2HEX |
727
|
|
|
* |
728
|
|
|
* @param mixed $expectedResult |
729
|
|
|
*/ |
730
|
|
|
public function testDEC2HEX($expectedResult, ...$args) |
731
|
|
|
{ |
732
|
|
|
$result = Engineering::DECTOHEX(...$args); |
|
|
|
|
733
|
|
|
self::assertEquals($expectedResult, $result, null); |
734
|
|
|
} |
735
|
|
|
|
736
|
|
|
public function providerDEC2HEX() |
737
|
|
|
{ |
738
|
|
|
return require 'data/Calculation/Engineering/DEC2HEX.php'; |
739
|
|
|
} |
740
|
|
|
|
741
|
|
|
/** |
742
|
|
|
* @dataProvider providerDEC2OCT |
743
|
|
|
* |
744
|
|
|
* @param mixed $expectedResult |
745
|
|
|
*/ |
746
|
|
|
public function testDEC2OCT($expectedResult, ...$args) |
747
|
|
|
{ |
748
|
|
|
$result = Engineering::DECTOOCT(...$args); |
|
|
|
|
749
|
|
|
self::assertEquals($expectedResult, $result, null); |
750
|
|
|
} |
751
|
|
|
|
752
|
|
|
public function providerDEC2OCT() |
753
|
|
|
{ |
754
|
|
|
return require 'data/Calculation/Engineering/DEC2OCT.php'; |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
/** |
758
|
|
|
* @dataProvider providerHEX2BIN |
759
|
|
|
* |
760
|
|
|
* @param mixed $expectedResult |
761
|
|
|
*/ |
762
|
|
|
public function testHEX2BIN($expectedResult, ...$args) |
763
|
|
|
{ |
764
|
|
|
$result = Engineering::HEXTOBIN(...$args); |
|
|
|
|
765
|
|
|
self::assertEquals($expectedResult, $result, null); |
766
|
|
|
} |
767
|
|
|
|
768
|
|
|
public function providerHEX2BIN() |
769
|
|
|
{ |
770
|
|
|
return require 'data/Calculation/Engineering/HEX2BIN.php'; |
771
|
|
|
} |
772
|
|
|
|
773
|
|
|
/** |
774
|
|
|
* @dataProvider providerHEX2DEC |
775
|
|
|
* |
776
|
|
|
* @param mixed $expectedResult |
777
|
|
|
*/ |
778
|
|
|
public function testHEX2DEC($expectedResult, ...$args) |
779
|
|
|
{ |
780
|
|
|
$result = Engineering::HEXTODEC(...$args); |
|
|
|
|
781
|
|
|
self::assertEquals($expectedResult, $result, null); |
782
|
|
|
} |
783
|
|
|
|
784
|
|
|
public function providerHEX2DEC() |
785
|
|
|
{ |
786
|
|
|
return require 'data/Calculation/Engineering/HEX2DEC.php'; |
787
|
|
|
} |
788
|
|
|
|
789
|
|
|
/** |
790
|
|
|
* @dataProvider providerHEX2OCT |
791
|
|
|
* |
792
|
|
|
* @param mixed $expectedResult |
793
|
|
|
*/ |
794
|
|
|
public function testHEX2OCT($expectedResult, ...$args) |
795
|
|
|
{ |
796
|
|
|
$result = Engineering::HEXTOOCT(...$args); |
|
|
|
|
797
|
|
|
self::assertEquals($expectedResult, $result, null); |
798
|
|
|
} |
799
|
|
|
|
800
|
|
|
public function providerHEX2OCT() |
801
|
|
|
{ |
802
|
|
|
return require 'data/Calculation/Engineering/HEX2OCT.php'; |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
/** |
806
|
|
|
* @dataProvider providerOCT2BIN |
807
|
|
|
* |
808
|
|
|
* @param mixed $expectedResult |
809
|
|
|
*/ |
810
|
|
|
public function testOCT2BIN($expectedResult, ...$args) |
811
|
|
|
{ |
812
|
|
|
$result = Engineering::OCTTOBIN(...$args); |
|
|
|
|
813
|
|
|
self::assertEquals($expectedResult, $result, null); |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
public function providerOCT2BIN() |
817
|
|
|
{ |
818
|
|
|
return require 'data/Calculation/Engineering/OCT2BIN.php'; |
819
|
|
|
} |
820
|
|
|
|
821
|
|
|
/** |
822
|
|
|
* @dataProvider providerOCT2DEC |
823
|
|
|
* |
824
|
|
|
* @param mixed $expectedResult |
825
|
|
|
*/ |
826
|
|
|
public function testOCT2DEC($expectedResult, ...$args) |
827
|
|
|
{ |
828
|
|
|
$result = Engineering::OCTTODEC(...$args); |
|
|
|
|
829
|
|
|
self::assertEquals($expectedResult, $result, null); |
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
public function providerOCT2DEC() |
833
|
|
|
{ |
834
|
|
|
return require 'data/Calculation/Engineering/OCT2DEC.php'; |
835
|
|
|
} |
836
|
|
|
|
837
|
|
|
/** |
838
|
|
|
* @dataProvider providerOCT2HEX |
839
|
|
|
* |
840
|
|
|
* @param mixed $expectedResult |
841
|
|
|
*/ |
842
|
|
|
public function testOCT2HEX($expectedResult, ...$args) |
843
|
|
|
{ |
844
|
|
|
$result = Engineering::OCTTOHEX(...$args); |
|
|
|
|
845
|
|
|
self::assertEquals($expectedResult, $result, null); |
846
|
|
|
} |
847
|
|
|
|
848
|
|
|
public function providerOCT2HEX() |
849
|
|
|
{ |
850
|
|
|
return require 'data/Calculation/Engineering/OCT2HEX.php'; |
851
|
|
|
} |
852
|
|
|
|
853
|
|
|
/** |
854
|
|
|
* @dataProvider providerBITAND |
855
|
|
|
* |
856
|
|
|
* @param mixed $expectedResult |
857
|
|
|
* @param mixed[] $args |
858
|
|
|
*/ |
859
|
|
|
public function testBITAND($expectedResult, array $args) |
860
|
|
|
{ |
861
|
|
|
$result = Engineering::BITAND(...$args); |
862
|
|
|
self::assertEquals($expectedResult, $result, null); |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
public function providerBITAND() |
866
|
|
|
{ |
867
|
|
|
return require 'data/Calculation/Engineering/BITAND.php'; |
868
|
|
|
} |
869
|
|
|
|
870
|
|
|
/** |
871
|
|
|
* @dataProvider providerBITOR |
872
|
|
|
* |
873
|
|
|
* @param mixed $expectedResult |
874
|
|
|
* @param mixed[] $args |
875
|
|
|
*/ |
876
|
|
|
public function testBITOR($expectedResult, array $args) |
877
|
|
|
{ |
878
|
|
|
$result = Engineering::BITOR(...$args); |
879
|
|
|
self::assertEquals($expectedResult, $result, null); |
880
|
|
|
} |
881
|
|
|
|
882
|
|
|
public function providerBITOR() |
883
|
|
|
{ |
884
|
|
|
return require 'data/Calculation/Engineering/BITOR.php'; |
885
|
|
|
} |
886
|
|
|
|
887
|
|
|
/** |
888
|
|
|
* @dataProvider providerBITXOR |
889
|
|
|
* |
890
|
|
|
* @param mixed $expectedResult |
891
|
|
|
* @param mixed[] $args |
892
|
|
|
*/ |
893
|
|
|
public function testBITXOR($expectedResult, array $args) |
894
|
|
|
{ |
895
|
|
|
$result = Engineering::BITXOR(...$args); |
896
|
|
|
self::assertEquals($expectedResult, $result, null); |
897
|
|
|
} |
898
|
|
|
|
899
|
|
|
public function providerBITXOR() |
900
|
|
|
{ |
901
|
|
|
return require 'data/Calculation/Engineering/BITXOR.php'; |
902
|
|
|
} |
903
|
|
|
|
904
|
|
|
/** |
905
|
|
|
* @dataProvider providerBITLSHIFT |
906
|
|
|
* |
907
|
|
|
* @param mixed $expectedResult |
908
|
|
|
* @param mixed[] $args |
909
|
|
|
*/ |
910
|
|
|
public function testBITLSHIFT($expectedResult, array $args) |
911
|
|
|
{ |
912
|
|
|
$result = Engineering::BITLSHIFT(...$args); |
913
|
|
|
self::assertEquals($expectedResult, $result, null); |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
public function providerBITLSHIFT() |
917
|
|
|
{ |
918
|
|
|
return require 'data/Calculation/Engineering/BITLSHIFT.php'; |
919
|
|
|
} |
920
|
|
|
|
921
|
|
|
/** |
922
|
|
|
* @dataProvider providerBITRSHIFT |
923
|
|
|
* |
924
|
|
|
* @param mixed $expectedResult |
925
|
|
|
* @param mixed[] $args |
926
|
|
|
*/ |
927
|
|
|
public function testBITRSHIFT($expectedResult, array $args) |
928
|
|
|
{ |
929
|
|
|
$result = Engineering::BITRSHIFT(...$args); |
930
|
|
|
self::assertEquals($expectedResult, $result, null); |
931
|
|
|
} |
932
|
|
|
|
933
|
|
|
public function providerBITRSHIFT() |
934
|
|
|
{ |
935
|
|
|
return require 'data/Calculation/Engineering/BITRSHIFT.php'; |
936
|
|
|
} |
937
|
|
|
|
938
|
|
|
/** |
939
|
|
|
* @dataProvider providerDELTA |
940
|
|
|
* |
941
|
|
|
* @param mixed $expectedResult |
942
|
|
|
*/ |
943
|
|
|
public function testDELTA($expectedResult, ...$args) |
944
|
|
|
{ |
945
|
|
|
$result = Engineering::DELTA(...$args); |
|
|
|
|
946
|
|
|
self::assertEquals($expectedResult, $result, null); |
947
|
|
|
} |
948
|
|
|
|
949
|
|
|
public function providerDELTA() |
950
|
|
|
{ |
951
|
|
|
return require 'data/Calculation/Engineering/DELTA.php'; |
952
|
|
|
} |
953
|
|
|
|
954
|
|
|
/** |
955
|
|
|
* @dataProvider providerGESTEP |
956
|
|
|
* |
957
|
|
|
* @param mixed $expectedResult |
958
|
|
|
*/ |
959
|
|
|
public function testGESTEP($expectedResult, ...$args) |
960
|
|
|
{ |
961
|
|
|
$result = Engineering::GESTEP(...$args); |
|
|
|
|
962
|
|
|
self::assertEquals($expectedResult, $result, null); |
963
|
|
|
} |
964
|
|
|
|
965
|
|
|
public function providerGESTEP() |
966
|
|
|
{ |
967
|
|
|
return require 'data/Calculation/Engineering/GESTEP.php'; |
968
|
|
|
} |
969
|
|
|
|
970
|
|
|
public function testGetConversionGroups() |
971
|
|
|
{ |
972
|
|
|
$result = Engineering::getConversionGroups(); |
973
|
|
|
self::assertInternalType('array', $result); |
974
|
|
|
} |
975
|
|
|
|
976
|
|
|
public function testGetConversionGroupUnits() |
977
|
|
|
{ |
978
|
|
|
$result = Engineering::getConversionGroupUnits(); |
979
|
|
|
self::assertInternalType('array', $result); |
980
|
|
|
} |
981
|
|
|
|
982
|
|
|
public function testGetConversionGroupUnitDetails() |
983
|
|
|
{ |
984
|
|
|
$result = Engineering::getConversionGroupUnitDetails(); |
985
|
|
|
self::assertInternalType('array', $result); |
986
|
|
|
} |
987
|
|
|
|
988
|
|
|
public function testGetConversionMultipliers() |
989
|
|
|
{ |
990
|
|
|
$result = Engineering::getConversionMultipliers(); |
991
|
|
|
self::assertInternalType('array', $result); |
992
|
|
|
} |
993
|
|
|
|
994
|
|
|
/** |
995
|
|
|
* @dataProvider providerCONVERTUOM |
996
|
|
|
* |
997
|
|
|
* @param mixed $expectedResult |
998
|
|
|
*/ |
999
|
|
|
public function testCONVERTUOM($expectedResult, ...$args) |
1000
|
|
|
{ |
1001
|
|
|
$result = Engineering::CONVERTUOM(...$args); |
1002
|
|
|
self::assertEquals($expectedResult, $result, null); |
1003
|
|
|
} |
1004
|
|
|
|
1005
|
|
|
public function providerCONVERTUOM() |
1006
|
|
|
{ |
1007
|
|
|
return require 'data/Calculation/Engineering/CONVERTUOM.php'; |
1008
|
|
|
} |
1009
|
|
|
} |
1010
|
|
|
|
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.