pFUnit
Preprocessor Directives

@Assert Preprocessor Directives

@assertEqual

@assertTrue

@assertEqualUserDefined

A convenience function that allows a user to write

@assertEqualUserDefined(a,b)

instead of

call assertTrue(a==b,...)

while a more instructive error message about the arguments and source code position is added by the preprocessor. The user may add an error message as follows.

@assertEqualUserDefined(a,b,message='a and b should be equal here.')

@assertFalse

@assertLessThan

@assertLessThanOrEqual

@assertGreaterThan

@assertGreaterThanOrEqual

@assertIsMemberOf

@assertContains

@assertAny

@assertAll

@assertNotAll

@assertNone

@assertIsPermutationOf

@assertExceptionRaised

@assertSameShape

@assertIsNaN

@assertIsFinite

@assertAssociated

maps to a call to the logical intrinsic function associated.

@assertAssociated(a)

becomes

call assertTrue(associated(a))

The directive also handles the two-argument pointer-target case.

@assertAssociated(pointer,target)

becomes

call assertTrue(associated(pointer,target))

neglecting message and source location information.

A message may be passed as follows.

@assertAssociated(a,message="A message.")
@assertAssociated(pointer,target,message="A message.")

@assertNotAssociated

This directive is the same as assertAssociated, except that it maps to assertFalse. This directive was originally released as assertUnAssociated.

@assertEquivalent

This directive compares two logical values and throws an exception annotated with some useful information. We get a special directive for this one because comparing logicals uses the .eqv. infix operator in standard Fortran. The arguments a and b below may be 1d arrays.

@assertEquivalent(a,b)

becomes

call assertTrue(a.eqv.b)

neglecting the specification of message and source location information.