Created
October 16, 2012 05:52
-
-
Save jspahrsummers/3897415 to your computer and use it in GitHub Desktop.
Example usage of a CGRectDivide replacement macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe(@"CGRectDivide macro", ^{ | |
CGRect rect = CGRectMake(10, 20, 30, 40); | |
it(@"should accept NULLs", ^{ | |
CGRectDivide(rect, NULL, NULL, 10, CGRectMinXEdge); | |
}); | |
it(@"should accept pointers", ^{ | |
CGRect slice, remainder; | |
CGRectDivide(rect, &slice, &remainder, 10, CGRectMinXEdge); | |
expect(slice).to.equal(CGRectMake(10, 20, 10, 40)); | |
expect(remainder).to.equal(CGRectMake(20, 20, 20, 40)); | |
}); | |
it(@"should accept raw variables", ^{ | |
CGRect slice, remainder; | |
CGRectDivide(rect, slice, remainder, 10, CGRectMinXEdge); | |
expect(slice).to.equal(CGRectMake(10, 20, 10, 40)); | |
expect(remainder).to.equal(CGRectMake(20, 20, 20, 40)); | |
}); | |
it(@"should accept properties", ^{ | |
GeometryTestObject *obj = [[GeometryTestObject alloc] init]; | |
expect(obj).notTo.beNil(); | |
CGRectDivide(rect, obj.slice, obj.remainder, 10, CGRectMinXEdge); | |
expect(obj.slice).to.equal(CGRectMake(10, 20, 10, 40)); | |
expect(obj.remainder).to.equal(CGRectMake(20, 20, 20, 40)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment