diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 15:15:48 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-28 15:15:48 +0000 |
commit | 8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4 (patch) | |
tree | 7905b284cb5b3d62c17ad8a939e339621a498a2c /spec/ruby/core/integer/shared | |
parent | 6530b14cee76e2512424d225e64d3c61dd1f6511 (diff) | |
download | ruby-8c5b60eb22d6d661e87992a65d54e3a5bc0aeed4.tar.gz |
Update to ruby/spec@a6b8805
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/integer/shared')
-rw-r--r-- | spec/ruby/core/integer/shared/integer_rounding.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/ruby/core/integer/shared/integer_rounding.rb b/spec/ruby/core/integer/shared/integer_rounding.rb new file mode 100644 index 0000000000..ecbda1bb4a --- /dev/null +++ b/spec/ruby/core/integer/shared/integer_rounding.rb @@ -0,0 +1,31 @@ +describe :integer_rounding_positive_precision, shared: true do + it "returns self if not passed a precision" do + [2, -4, 10**70, -10**100].each do |v| + v.send(@method).should eql(v) + end + end + + ruby_version_is "2.4" do + it "returns self if passed a precision of zero" do + [2, -4, 10**70, -10**100].each do |v| + v.send(@method, 0).should eql(v) + end + end + end + + ruby_version_is "2.4"..."2.5" do + it "returns itself as a float if passed a positive precision" do + [2, -4, 10**70, -10**100].each do |v| + v.send(@method, 42).should eql(v.to_f) + end + end + end + + ruby_version_is "2.5" do + it "returns itself if passed a positive precision" do + [2, -4, 10**70, -10**100].each do |v| + v.send(@method, 42).should eql(v) + end + end + end +end |