Preprocessor Directives

@Assert Preprocessor Directives




A convenience function that allows a user to write


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.')


















maps to a call to the logical intrinsic function associated.



call assertTrue(associated(a))

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



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.")


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


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.



call assertTrue(a.eqv.b)

neglecting the specification of message and source location information.