summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-15 01:28:31 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-15 01:28:31 +0000
commitd2ce5de68dd38d787ba9b63db148c53c71dd003d (patch)
tree61a48701d72f1d5ff18623257986714e32f7b2e3
parent8228ae8a0de5de5c75c2c53c64203bad1d688be4 (diff)
More testing updates
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1193 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--t/02-number-handling.t14
1 files changed, 11 insertions, 3 deletions
diff --git a/t/02-number-handling.t b/t/02-number-handling.t
index cad4eff3..95502666 100644
--- a/t/02-number-handling.t
+++ b/t/02-number-handling.t
@@ -64,7 +64,7 @@ foreach my $format (0 .. $#formats) {
my $thou = $formats[$format][1];
my $dec = $formats[$format][2];
foreach my $rawValue ('10t000d00', '9t999d99', '333d33',
- '7t777t777d77', '-12d34') {
+ '7t777t777d77', '-12d34', '0d00') {
$expected = $rawValue;
$expected =~ s/t/$thou/gx;
$expected =~ s/d/$dec/gx;
@@ -73,15 +73,23 @@ foreach my $format (0 .. $#formats) {
$value =~ s/d/\./gx;
##$value = Math::BigFloat->new($value);
$value = $form->parse_amount(\%myfooconfig,$value);
- is($form->format_amount(\%myconfig, $value, 2, 'x'), $expected,
+ is($form->format_amount(\%myconfig, $value, 2, '0'), $expected,
"form: $value formatted as $formats[$format][0] - $expected");
is($lsmb->format_amount('user' => \%myconfig,
'amount' => $value, 'precision' => 2,
- 'neg_format' => 'x'), $expected,
+ 'neg_format' => '0'), $expected,
"lsmb: $value formatted as $formats[$format][0] - $expected");
}
}
+$expected = $form->parse_amount({'numberformat' => '1000.00'}, '0.00');
+is($form->format_amount({'numberformat' => '1000.00'} , $expected, 2, 'x'), 'x',
+ "form: 0.00 with dash x");
+is($lsmb->format_amount('user' => {'numberformat' => '1000.00'},
+ 'amount' => $expected, 'precision' => 2,
+ 'neg_format' => 'x'), 'x',
+ "lsmb: 0.00 with dash x");
+
foreach my $format (0 .. $#formats) {
%myconfig = (numberformat => $formats[$format][0]);
my $thou = $formats[$format][1];