OCHamcrest
Modules | Defines
Number Matchers
Matcher Library

Matchers that perform numeric comparisons.
More...

Modules

 Primitive Number Matchers
 
Matchers for testing equality against primitive numeric types.

Defines

#define closeTo   HC_closeTo
 closeTo(aValue, aDelta) - Matches if object is a number close to a given value, within a given delta.
#define greaterThan   HC_greaterThan
 greaterThan(aNumber) - Matches if object is greater than a given number.
#define greaterThanOrEqualTo   HC_greaterThanOrEqualTo
 greaterThanOrEqualTo(aNumber) - Matches if object is greater than or equal to a given number.
#define lessThan   HC_lessThan
 lessThan(aNumber) - Matches if object is less than a given number.
#define lessThanOrEqualTo   HC_lessThanOrEqualTo
 lessThanOrEqualTo(aNumber) - Matches if object is less than or equal to a given number.

Detailed Description

Matchers that perform numeric comparisons.

Define Documentation

#define closeTo   HC_closeTo

closeTo(aValue, aDelta) - Matches if object is a number close to a given value, within a given delta.

Parameters:
aValueThe double value to compare against as the expected value.
aDeltaThe double maximum delta between the values for which the numbers are considered close.

This matcher invokes -doubleValue on the evaluated object to get its value as a double. The result is compared against aValue to see if the difference is within a positive aDelta.

Example:

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_closeTo instead.)

greaterThan(aNumber) - Matches if object is greater than a given number.

Parameters:
aNumberThe NSNumber to compare against.

Example:

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_greaterThan instead.)

greaterThanOrEqualTo(aNumber) - Matches if object is greater than or equal to a given number.

Parameters:
aNumberThe NSNumber to compare against.

Example:

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_greaterThanOrEqualTo instead.)

#define lessThan   HC_lessThan

lessThan(aNumber) - Matches if object is less than a given number.

Parameters:
aNumberThe NSNumber to compare against.

Example:

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_lessThan instead.)

lessThanOrEqualTo(aNumber) - Matches if object is less than or equal to a given number.

Parameters:
aNumberThe NSNumber to compare against.

Example:

(In the event of a name clash, don't #define HC_SHORTHAND and use the synonym HC_lessThanOrEqualTo instead.)