jeudi 7 mai 2015

XCode unit testing syntax with XCTAssertEqualObjects

I've added my first unit test into a project, and the following code works:

-(void)testSumOfArrayValues {
    NSNumber *testValues1=[UtilityClass sumOfArrayValues:@[@3,@100]];
    XCTAssertEqualObjects(testValues1,@103,@"The summed positive ints did not match expected answer");
}

But this code (which I'd much rather use) doesn't:

-(void)testSumOfArrayValues {
    XCTAssertEqualObjects([UtilityClass sumOfArrayValues:@[@3,@100]],@103,@"The summed positive ints did not match expected answer");
}

Instead, I get 12 different parse errors when I try. Any idea why this is happening and how else I could compress this test into one line? Thanks for reading.

Aucun commentaire:

Enregistrer un commentaire