[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [342] trunk/t/02-number-handling.t



Revision: 342
          http://svn.sourceforge.net/ledger-smb/?rev=342&view=rev
Author:   tetragon
Date:     2006-10-27 12:36:15 -0700 (Fri, 27 Oct 2006)

Log Message:
-----------
Add tests for parsing empty and invalid strings

Modified Paths:
--------------
    trunk/t/02-number-handling.t

Modified: trunk/t/02-number-handling.t
===================================================================
--- trunk/t/02-number-handling.t	2006-10-27 19:23:56 UTC (rev 341)
+++ trunk/t/02-number-handling.t	2006-10-27 19:36:15 UTC (rev 342)
@@ -114,6 +114,11 @@
 	$value = Math::BigFloat->new('-21');
 	cmp_ok($form->parse_amount(\%myconfig, $expected), '==',  $value,
 		"$expected parsed as $formats[$format][0] - $value");
+	
+	is($form->parse_amount(\%myconfig, ''), undef,
+		"Empty string returns undef");
+	cmp_ok($form->parse_amount(\%myconfig, 'foo'), '==',
+		Math::BigFloat->bnan(), "Invalid string returns NaN");
 }
 
 foreach my $format (0 .. $#formats) {
@@ -150,4 +155,9 @@
 		$form->parse_amount(\%myconfig, $expected)),
 		'==',  $value,
 		"$expected parsed as $formats[$format][0] - $value");
+
+	is($form->parse_amount(\%myconfig, ''), undef,
+		"Empty string returns undef");
+	cmp_ok($form->parse_amount(\%myconfig, 'foo'), '==',
+		Math::BigFloat->bnan(), "Invalid string returns NaN");
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.