Dateimanagement: erst nur letzte Version anzeigen / alle Versionen ausklappbar.
[kivitendo-erp.git] / t / form / format_amount.t
index 58a7c17..8de39a2 100644 (file)
@@ -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