[PATCH] RtTimeoutTest, test_damaged_restart: use assert_in_delta instead of assert_equal for floating point values

1 view
Skip to first unread message

Enrico Bianco

unread,
Nov 17, 2009, 11:29:01 AM11/17/09
to ruote
Below is a patch against the master branch on GitHub that changes an
assert_equal into an assert_in_delta for floating point values.
Asserting that floating point values be exactly equal is usually a
futile exercise due to limitations in precision.

- Enrico


From 6f23206ac7cb13e11640fce417ebe3e5eba4357a Mon Sep 17 00:00:00 2001
From: Enrico Bianco <enr...@gmail.com>
Date: Tue, 17 Nov 2009 11:24:25 -0500
Subject: [PATCH] RtTimeoutTest, test_damaged_restart: use
assert_in_delta instead of assert_equal for floating point values

---
test/functional/rt_5_timeout.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/functional/rt_5_timeout.rb b/test/functional/
rt_5_timeout.rb
index 5eb46aa..947d295 100644
--- a/test/functional/rt_5_timeout.rb
+++ b/test/functional/rt_5_timeout.rb
@@ -91,7 +91,7 @@ class RtTimeoutTest < Test::Unit::TestCase

assert_equal 1, @engine.processes.size
assert_equal 1, @engine.scheduler.jobs.size
- assert_equal at, @engine.scheduler.jobs.values.first.at
+ assert_in_delta at, @engine.scheduler.jobs.values.first.at,
1.0e-5

sleep 0.400

--
1.6.0.2

John Mettraux

unread,
Nov 17, 2009, 7:17:33 PM11/17/09
to openwfe...@googlegroups.com
On Wed, Nov 18, 2009 at 1:29 AM, Enrico Bianco <enr...@gmail.com> wrote:
> Below is a patch against the master branch on GitHub that changes an
> assert_equal into an assert_in_delta for floating point values.
> Asserting that floating point values be exactly equal is usually a
> futile exercise due to limitations in precision.

It's in, many thanks !

http://github.com/jmettraux/ruote/commit/f7eace8a3f5fb79677a7fd2816a7bd3b1b32412b

Cheers,

--
John Mettraux - http://jmettraux.wordpress.com
Reply all
Reply to author
Forward
0 new messages