Skip to content

Commit 5415af3

Browse files
stevegeekeregon
authored andcommitted
Move case to its own example and use nan_value helper
1 parent 3eb8587 commit 5415af3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

core/float/shared/to_i.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
describe :float_to_i, shared: true do
22
it "returns self truncated to an Integer" do
3-
-> { (0.0 / 0.0).send(@method) }.should raise_error(FloatDomainError)
43
899.2.send(@method).should eql(899)
54
-1.122256e-45.send(@method).should eql(0)
65
5_213_451.9201.send(@method).should eql(5213451)
76
1.233450999123389e+12.send(@method).should eql(1233450999123)
87
-9223372036854775808.1.send(@method).should eql(-9223372036854775808)
98
9223372036854775808.1.send(@method).should eql(9223372036854775808)
109
end
10+
11+
it "raises a FloatDomainError for NaN" do
12+
-> { nan_value.send(@method) }.should raise_error(FloatDomainError)
13+
end
1114
end

0 commit comments

Comments
 (0)