XCTAssert

Veröffentlicht von Marco Betschart am

Overview

Detail

XCTAssert(expression, format…)

Generates a failure when expression evaluates to false.

 

XCTAssertEqual(a1, a2, format…)

Generates a failure when a1 is not equal to a2. This test is for C scalars, structs and unions.

 

XCTAssertEqualObjects(a1, a2, format…)

Generates a failure when !{ [a1 isEqual:a2] } is false (or one is nil and the other is not).

 

XCTAssertEqualWithAccuracy(a1, a2, accuracy, format…)

Generates a failure when a1 is not equal to a2 within + or – accuracy. This test is for scalars such as floats and doubles, where small differences could make these items not exactly equal, but works for all scalars.

 

XCTAssertFalse(expression, format…)

Generates a failure when the expression evaluates to true.

 

XCTAssertNotEqual(a1, a2, format…)

Generates a failure when \a1 is not nil.

 

XCTAssertNotEqualObjects(a1, a2, format…)

Generates a failure when { [a1 isEqual:a2] } is false (or both are nil).

 

XCTAssertNotEqualWithAccuracy(a1, a2, accuracy, format…)

Generates a failure when a1 is equal to a2 within + or – accuracy. This test is for scalars such as floats and doubles, where small differences could make these items not exactly equal, but works for all scalars.

XCTAssertNoThrow(expression, format…)

Generates a failure when expression does throw an exception.

 

XCTAssertNoThrowSpecific(expression, specificException, format…)

Generates a failure when expression does throw an exception of the specified class. Any other exception is okay (i.e. does not generate a failure).

 

XCTAssertNoThrowSpecificNamed(expression, specificException, exception_name, format…)

Generates a failure when expression does throw an exception of a specific class with a specific name. Useful for those frameworks like AppKit or Foundation that throw generic NSException w/specific names (NSInvalidArgumentException, etc).

 

XCTAssertNotNil(a1, format…)

Generates a failure when a1 is nil.

 

XCTAssertThrows(expression, format…)

Generates a failure when expression does not throw an exception.

 

XCTAssertThrowsSpecific(expression, specificException, format…)

Generates a failure when expression does not throw an exception of a specific class.

 

XCTAssertThrowsSpecificNamed(expression, specificException, exception_name, format…)

Generates a failure when expression does not throw an exception of a specific class with a specific name. Useful for those frameworks like AppKit or Foundation that throw generic NSException w/specific names (NSInvalidArgumentException, etc).

 

XCTAssertTrue(expression, format…)

Generates a failure when expression evaluates to false.

 

XCTFail

Generates a failure unconditionally.

 

And the oscar goes to … Harry Hornreich! – Thank you!

Kategorien: Technologie

Marco Betschart

nerdpreneur out of conviction. lover of the never ending journey of exploration. self growth and tech enthusiast. ambitious rock climber and from time to time, adrenaline junkie.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.