@@ -411,29 +411,65 @@ public static function providerForTestWithRounding(): array
411
411
public static function providerForTestWithScale (): array
412
412
{
413
413
return [
414
- 'Scaling zero ' => [
414
+ 'Scaling zero ' => [
415
415
'value ' => 0 ,
416
- 'scale ' => 0 ,
417
- 'withScale ' => 0 ,
418
- 'expected ' => ['float ' => 0 , 'string ' => '0 ' ]
416
+ 'scale ' => 2 ,
417
+ 'withScale ' => 2 ,
418
+ 'expected ' => ['float ' => 0.00 , 'string ' => '0.00 ' ]
419
419
],
420
- 'Scaling with decimal ' => [
420
+ 'Scaling zero with one decimal ' => [
421
421
'value ' => 0.0 ,
422
+ 'scale ' => 2 ,
423
+ 'withScale ' => 2 ,
424
+ 'expected ' => ['float ' => 0.00 , 'string ' => '0.00 ' ]
425
+ ],
426
+ 'Scaling zero with two decimals ' => [
427
+ 'value ' => 0.00 ,
428
+ 'scale ' => 3 ,
429
+ 'withScale ' => 3 ,
430
+ 'expected ' => ['float ' => 0.000 , 'string ' => '0.000 ' ]
431
+ ],
432
+ 'Scaling zero with three decimals ' => [
433
+ 'value ' => 0.000 ,
422
434
'scale ' => 1 ,
423
435
'withScale ' => 1 ,
424
- 'expected ' => ['float ' => 0.0 , 'string ' => '0 ' ]
436
+ 'expected ' => ['float ' => 0.0 , 'string ' => '0.0 ' ]
437
+ ],
438
+ 'Scaling with integer ' => [
439
+ 'value ' => 5 ,
440
+ 'scale ' => 2 ,
441
+ 'withScale ' => 2 ,
442
+ 'expected ' => ['float ' => 5.00 , 'string ' => '5.00 ' ]
425
443
],
426
- 'Scaling large negative number ' => [
444
+ 'Scaling with decimal and reducing precision ' => [
445
+ 'value ' => 123.4567 ,
446
+ 'scale ' => 2 ,
447
+ 'withScale ' => 2 ,
448
+ 'expected ' => ['float ' => 123.45 , 'string ' => '123.45 ' ]
449
+ ],
450
+ 'Scaling large negative number ' => [
427
451
'value ' => -553.99999 ,
428
452
'scale ' => 5 ,
429
453
'withScale ' => 1 ,
430
454
'expected ' => ['float ' => -553.9 , 'string ' => '-553.9 ' ]
431
455
],
432
- 'Scaling with precision reduction ' => [
456
+ 'Scaling with precision reduction ' => [
433
457
'value ' => 10.5555 ,
434
458
'scale ' => 4 ,
435
459
'withScale ' => 3 ,
436
460
'expected ' => ['float ' => 10.555 , 'string ' => '10.555 ' ]
461
+ ],
462
+ 'Scaling large positive number ' => [
463
+ 'value ' => 999999.999 ,
464
+ 'scale ' => 2 ,
465
+ 'withScale ' => 2 ,
466
+ 'expected ' => ['float ' => 999999.99 , 'string ' => '999999.99 ' ]
467
+ ],
468
+ 'Scaling with small negative number ' => [
469
+ 'value ' => -0.12345 ,
470
+ 'scale ' => 4 ,
471
+ 'withScale ' => 4 ,
472
+ 'expected ' => ['float ' => -0.1234 , 'string ' => '-0.1234 ' ]
437
473
]
438
474
];
439
475
}
0 commit comments