ITM Grid Service Library: Fortran 90

itm_assert Module Reference

Functions/Subroutines

subroutine, public assertSetStopMode (doStop)
 Set the default assertion stop behaviour.
subroutine, public assertSetMsgPrefix (prefix)
 Set a prefix for the assertion fail message.
subroutine, public assertReset ()
 Reset the assertion module to its default state.
subroutine, public assertStopOnFailed (failmsg, doStop)
 Stop if a previously called assertion failed (delayed stop).
subroutine, public assert (test, failmsg, doStop)
 A generic assertion, tests a given logical expression.
subroutine, public assertEqual (x1, x2, failmsg, doStop)
 Test double precision floating point numbers for equality.

Variables

logical, save defaultDoStop = .true.
integer, save failCount = 0
integer, save msgPrefixLen = 0
character(256), save msgPrefix

Function/Subroutine Documentation

subroutine,public itm_assert::assert ( logical,intent(in)  test,
character(*),intent(in),optional  failmsg,
logical,intent(in),optional  doStop 
)

A generic assertion, tests a given logical expression.

If it evaluates to .false., print the fail message and possibly stop execution.

Parameters:
testThe logical expression to test.
failmsgThe message to print on fail. If omitted, a generic message is printed. Can be modified with a prefix (see assertSetMsgPrefix)
doStopControls whether to stop execution. If doStop .true., the program is stopped. If .false., only the fail message is printed and bookkeeping is done for delayed stopping (see assertStopOnFailed). If given, overrides the default behaviour set by assertSetStopMode.
See also:
assertStopOnFailed
assertSetStopMode
assertSetMsgPrefix
Author:
H.-J. Klingshirn
Version:
1.0

Definition at line 161 of file itm_assert.f90.

subroutine,public itm_assert::assertEqual ( real(ITM_R8),intent(in)  x1,
real(ITM_R8),intent(in)  x2,
character(*),intent(in),optional  failmsg,
logical,intent(in),optional  doStop 
)

Test double precision floating point numbers for equality.

Parameters:
x1,x2The values to test
failmsgSame as for assert
doStopSame as for assert
See also:
assert

Definition at line 180 of file itm_assert.f90.

subroutine,public itm_assert::assertReset ( )

Reset the assertion module to its default state.

Reset stop mode and message prefix to their default values. Also resets the fail counter, i.e. any previous failed assertions are forgotton.

Definition at line 103 of file itm_assert.f90.

subroutine,public itm_assert::assertSetMsgPrefix ( character(len=*),intent(in),optional  prefix)

Set a prefix for the assertion fail message.

Parameters:
prefixThe prefix string for the fail messages. Optional. If omitted, clear the prefix string (i.e. no prefix is used anymore)

Definition at line 86 of file itm_assert.f90.

subroutine,public itm_assert::assertSetStopMode ( logical,intent(in),optional  doStop)

Set the default assertion stop behaviour.

Parameters:
doStop.true. means immediate stop on fail, .false. means don't stop on fail (for use with delayed stopping,
See also:
assertStopOnFailed). The default value is .true., it is set if doStop is omitted.

Definition at line 70 of file itm_assert.f90.

subroutine,public itm_assert::assertStopOnFailed ( character(*),intent(in),optional  failmsg,
logical,intent(in),optional  doStop 
)

Stop if a previously called assertion failed (delayed stop).

This is useful if the default stop mode is set to continue on failed assertions (which can be enabled by call assertSetStopMode( .false. ).

Parameters:
failmsgMessage to print if assertion(s) failed.
doStopControls stop behaviour,
See also:
assert. Overrides the default set with
assertSetStopMode

Definition at line 120 of file itm_assert.f90.


Variable Documentation

logical,save itm_assert::defaultDoStop = .true.

Definition at line 16 of file itm_assert.f90.

integer,save itm_assert::failCount = 0

Definition at line 17 of file itm_assert.f90.

character(256),save itm_assert::msgPrefix

Definition at line 19 of file itm_assert.f90.

integer,save itm_assert::msgPrefixLen = 0

Definition at line 18 of file itm_assert.f90.

All Classes Namespaces Files Functions Variables