mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-05 22:40:25 +08:00
add core/float/== spec
This commit is contained in:
18
test/test-android/app/core/float/equal_value_spec.rb
Normal file
18
test/test-android/app/core/float/equal_value_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class Core_Float_EqualValue_Mock1 < Java::Lang::Object
|
||||
def ==(obj)
|
||||
2.0 == obj
|
||||
end
|
||||
end
|
||||
|
||||
describe "Float#==" do
|
||||
it "returns true if self has the same value as other" do
|
||||
(1.0 == 1).should == true
|
||||
(2.71828 == 1.428).should == false
|
||||
(-4.2 == 4.2).should == false
|
||||
end
|
||||
|
||||
it "calls 'other == self' if coercion fails" do
|
||||
(1.0 == Core_Float_EqualValue_Mock1.new).should == false
|
||||
(2.0 == Core_Float_EqualValue_Mock1.new).should == true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user