Copyright: (C) 2004 James Duncan Davidson, Michael Milvich, Nicolas Roard
- Declared in:
- UKTest.h
@abstract The protocol that marks a class as a test class.
All classes that conforms to UKTest, including their subclasses, are picked up by UKRunner.
If a filtering option such as -c is passed to ukrun, this can prevent the a test class to be picked up.
Reports a failure.
Tests that an expression is false.
Tests that two primitive floats are equal or almost,
this evaluates whether
fabs(a - b) <= d
is true.
d is the error margin.
a is the expected value and b the tested value.
Tests that two primitive floats are not equal, this
evaluates whether
fabs(a - b) > d
is true.
d is the error margin.
a is the non-expected value and b the tested value.
Tests that two primitive integers are equal.
a is the expected value and b the tested value.
Tests that two primitive integers are not equal.
a is the non-expected value and b the tested value.
Tests that
ref ==
.
nil
Tests that
ref !=
.
nil
Tests macro that a is a subclass of b, this uses -[NSObject isKindOfClass:] behind the scene.
Most of the time
UKObjectsEqual([a class], [b
class])
would be similar, but not always (i.e.
NSCFArray/NSArray on Mac OS X). Example:
UKObjectKindOf(myObject, NSArray)
Tests that
[a isEqual: b]
.
a is the expected value and b the tested value.
Tests that
![a isEqual: b]
.
a is the non-expected value and b the tested value.
Tests that the objects are not identical with a != b.
a is the non-expected value and b the tested value.
Tests that the objects are identical with
a == b
.
a is the expected value and b the tested value.
Reports a success.
Tests that the code piece raises an exception.
The exception testing macros get a bit more
involved than all the other ones we have here
because of the need for embedding the try-catch in
the generated code. In addition, the statements are
wrapped in a do{...}while(
NO
) block so that the generated code is
sane even if the macro appears in a context
like:
if (someFlag) UKRaisesException(someExpression) else UKRaisesException(someOtherExpression)
Tests that the code piece raises an exception of the class name b.
See NSException.
Tests that the code piece raises an exception of the name b.
See also -[NSException name].
Tests that b is a substring of a, this uses -[NSString rangeOfString:].
Tests that b is not a substring of a, this uses -[NSString rangeOfString:].
Tests that
[a isEqual: b]
.
a is the expected value and b the tested value.
This is the same than UKObjectsEqual() , this just helps readibility a bit, since testing string equality is pretty common.
Tests that
![a isEqual: b]
.
a is the non-expected value and b the tested value.
This is the same than UKObjectsNotEqual() , this just helps readibility a bit, since testing string equality is pretty common.
Tests that an expression is true.