Skip to content

Commit 9f50458

Browse files
committed
Add specs for basic bare hex float strings (sans pP)
1 parent 8722181 commit 9f50458

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

spec/ruby/core/kernel/Float_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ def to_f() 1.2 end
222222
end
223223
end
224224

225+
describe "for hexidecimal literals" do
226+
it "interprets positive hex value" do
227+
@object.send(:Float, "0x10").should == 16.0
228+
@object.send(:Float, "0X10").should == 16.0
229+
end
230+
231+
it "interprets negative hex value" do
232+
@object.send(:Float, "-0x10").should == -16.0
233+
@object.send(:Float, "-0X10").should == -16.0
234+
end
235+
end
236+
225237
describe "for hexadecimal literals with binary exponent" do
226238
%w(p P).each do |p|
227239
it "interprets the fractional part (on the left side of '#{p}') in hexadecimal" do

0 commit comments

Comments
 (0)