[perl-Cairo] Use delta_ok to compare floating pointer numbers in a test



commit 10d0ac29d7da743054aa4136394e91f420f7deeb
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun May 16 23:05:23 2010 +0200

    Use delta_ok to compare floating pointer numbers in a test

 t/CairoSurface.t |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/t/CairoSurface.t b/t/CairoSurface.t
index 017eda5..9c00673 100644
--- a/t/CairoSurface.t
+++ b/t/CairoSurface.t
@@ -19,6 +19,11 @@ use constant IMG_HEIGHT => 256;
 
 use Cairo;
 
+unless (eval 'use Test::Number::Delta; 1;') {
+	my $reason = 'Test::Number::Delta not available';
+	*delta_ok = sub { SKIP: { skip $reason, 1 } };
+}
+
 my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
 isa_ok ($surf, 'Cairo::ImageSurface');
 isa_ok ($surf, 'Cairo::Surface');
@@ -120,9 +125,9 @@ SKIP: {
 		unless Cairo::VERSION >= Cairo::VERSION_ENCODE (1, 8, 0);
 
 	$surf->set_fallback_resolution (72, 72);
-        is_deeply ([$surf->get_fallback_resolution], [72, 72]);
+	delta_ok ([$surf->get_fallback_resolution], [72, 72]);
 
-        ok (defined $surf->has_show_text_glyphs);
+	ok (defined $surf->has_show_text_glyphs);
 }
 
 # --------------------------------------------------------------------------- #



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