X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fform%2Fformat_amount.t;h=8de39a2e33e2ac7543610db1691d8dc249f6a03c;hb=f4da9593b8f91ae5d57437ed124f9c9d859bc698;hp=58a7c17c82f286911c6529e07bb6c2780a09936b;hpb=f46dfda018cac3aeaa549d678ad036d0cfff2e6d;p=kivitendo-erp.git diff --git a/t/form/format_amount.t b/t/form/format_amount.t index 58a7c17c8..8de39a2e3 100644 --- a/t/form/format_amount.t +++ b/t/form/format_amount.t @@ -32,6 +32,7 @@ is($::form->format_amount($config, 1.00045, -5), '1.00045', 'negative places 2') is($::form->format_amount($config, 1, -2), '1.00', 'negative places 3'); # bugs amd edge cases +$config->{numberformat} = '1.000,00'; is($::form->format_amount({ numberformat => '1.000,00' }, 0.00005), '0,00005', 'messing with small numbers and no precision'); is($::form->format_amount({ numberformat => '1.000,00' }, undef), '0', 'undef'); @@ -44,6 +45,14 @@ is($::form->format_amount($config, -0.545, 0), '-1', 'neg rounding up with preci is($::form->format_amount($config, 1.00), '1', 'autotrim to 0 places'); +is($::form->format_amount($config, 10), '10', 'autotrim does not harm integers'); +is($::form->format_amount($config, 10, 2), '10,00' , 'autotrim does not harm integers 2'); +is($::form->format_amount($config, 10, -2), '10,00' , 'autotrim does not harm integers 3'); +is($::form->format_amount($config, 10, 0), '10', 'autotrim does not harm integers 4'); + +is($::form->format_amount($config, 0, 0), '0' , 'trivial zero'); +is($::form->format_amount($config, -0.002, 2), '0,00' , 'negative zero'); +is($::form->format_amount($config, -0.002, 3), '-0,002' , 'negative zero'); # dash stuff