Skip to content

Instantly share code, notes, and snippets.

Embed
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
You can’t perform that action at this time.