Created
August 29, 2010 19:52
-
-
Save evtuhovich/556620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f6ca31c4c261c8b4ac4e7badd3a0a807cf8d5779 Mon Sep 17 00:00:00 2001 | |
From: Ivan Evtukhovich <evtuhovich@gmail.com> | |
Date: Sun, 29 Aug 2010 23:46:16 +0400 | |
Subject: [PATCH 1/2] Specs for Float#mod bug, issue #451 | |
--- | |
spec/ruby/core/float/divmod_spec.rb | 3 +++ | |
spec/ruby/core/float/shared/modulo.rb | 2 ++ | |
2 files changed, 5 insertions(+), 0 deletions(-) | |
diff --git a/spec/ruby/core/float/divmod_spec.rb b/spec/ruby/core/float/divmod_spec.rb | |
index fa3ec97..2a41d35 100644 | |
--- a/spec/ruby/core/float/divmod_spec.rb | |
+++ b/spec/ruby/core/float/divmod_spec.rb | |
@@ -11,6 +11,9 @@ describe "Float#divmod" do | |
values = -1.0.divmod(bignum_value) | |
values[0].should == -1 | |
values[1].should be_close(9223372036854775808.000, TOLERANCE) | |
+ values = -1.0.divmod(1) | |
+ values[0].should == -1 | |
+ values[1].should == 0 | |
end | |
# Behaviour established as correct in r23953 | |
diff --git a/spec/ruby/core/float/shared/modulo.rb b/spec/ruby/core/float/shared/modulo.rb | |
index 1140d74..60a31c9 100644 | |
--- a/spec/ruby/core/float/shared/modulo.rb | |
+++ b/spec/ruby/core/float/shared/modulo.rb | |
@@ -7,6 +7,8 @@ describe :float_modulo, :shared => true do | |
6543.21.send(@method, 137).should be_close(6543.21.%(137), TOLERANCE) | |
5667.19.send(@method, bignum_value).should be_close(5667.19.%(0xffffffff), TOLERANCE) | |
6543.21.send(@method, 137.24).should be_close(6543.21.%(137.24), TOLERANCE) | |
+ | |
+ -1.0.send(@method, 1).should == 0 | |
end | |
ruby_version_is ""..."1.9" do | |
-- | |
1.7.0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment