Update of /cvsroot/perl-xml/XML-LibXML-XPathContext/t
In directory sc8-pr-cvs1:/tmp/cvs-serv6810/t
Modified Files:
02-functions.t
Log Message:
Test ok($xc->findvalue('foo:copy(3.14)') == 3.14); can fail because of
precision errors in float math. Replace it with more robust test
Index: 02-functions.t
===================================================================
RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/02-functions.t,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- 02-functions.t 26 Mar 2003 15:26:46 -0000 1.6
+++ 02-functions.t 29 Mar 2003 15:45:48 -0000 1.7
@@ -1,6 +1,6 @@
# -*- cperl -*-
use Test;
-BEGIN { plan tests => 27 };
+BEGIN { plan tests => 28 };
use XML::LibXML;
use XML::LibXML::XPathContext;
@@ -19,7 +19,8 @@
# copy string, real, integer, nodelist
ok($xc->findvalue('foo:copy("bar")') eq 'bar');
-ok($xc->findvalue('foo:copy(3.14)') == 3.14);
+ok($xc->findvalue('foo:copy(3.14)') < 3.141); # can't use == here because of
+ok($xc->findvalue('foo:copy(3.14)') > 3.139); # float math
ok($xc->findvalue('foo:copy(7)') == 7);
ok($xc->find('foo:copy(//*)')->size() == 3);
my ($foo)=$xc->findnodes('(//*)[2]');
|