Skip to content

Instantly share code, notes, and snippets.

Created January 19, 2015 16:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
- (void)compareColorArrayRGBs:(NSArray *)array toExpected:(NSArray *)expected {
XCTAssertEqual([expected count], [array count]);
for (int i = 0; i < [expected count]; i++) {
UIColor *color = [array objectAtIndex:i];
UIColor *expectedColor = [expected objectAtIndex:i];
CGFloat r, g, b, a;
CGFloat eR, eG, eB, eA;
[color getRed:&r green:&g blue:&b alpha:&a];
[expectedColor getRed:&eR green:&eG blue:&eB alpha:&eA];
XCTAssertEqualWithAccuracy(r, eR, 0.005);
XCTAssertEqualWithAccuracy(g, eG, 0.005);
XCTAssertEqualWithAccuracy(b, eB, 0.005);
XCTAssertEqualWithAccuracy(a, eA, 0.005);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment