spec/cg_point_spec.rb in geomotion-0.1 vs spec/cg_point_spec.rb in geomotion-0.5
- old
+ new
@@ -30,9 +30,23 @@
point = CGPoint.make(x: 100, y: 200)
(@point + point).should == CGPointMake(110, 220)
end
end
+ describe "#- (unary)" do
+ it "should work" do
+ point = CGPoint.make(x: 100, y: 200)
+ (-point).should == CGPoint.new(-100, -200)
+ end
+ end
+
+ describe "#- (binary)" do
+ it "should work" do
+ point = CGPoint.make(x: 100, y: 200)
+ (point - point).should == CGPoint.new(0, 0)
+ end
+ end
+
describe "#inside?" do
it "should return true" do
rect = CGRectMake(0, 0, 100, 100)
@point.inside?(rect).should == true
end
\ No newline at end of file