assert(3f) - [M_verify] print filename, linenumber, and message to stderr and stop program (LICENSE:PD)
Synopsis
Description
Options
Examples
Author
License
function assert(file,linenum,expr,g1,g2g3,g4,g5,g6,g7,g8,g9)
character(len=*),intent(in) :: file character(len=*),intent(in) :: linenum logical,intent(in) :: expr class(*),intent(in),optional :: g1,g2,g3,g4,g5,g6,g7,g8,g9
assert(3f) prints strings to stderr and then stops program with exit code 1 It labels the first string as the filename, the next integer parameter as the linenumber, and then up to nine scalar values.It is primarily intended for use by the prep(1) preprocessor $ASSERT directive
filename a string assumed to be the current filename when compiling linenum assumed to be the line number of the source code the ASSERT(3f) procedure was called at. expr logical value g[1-9] optional value(s) to print as a message before stopping. May be of type INTEGER, LOGICAL, REAL, DOUBLEPRECISION, COMPLEX, or CHARACTER.
Sample program:
program demo_assert use M_verify, only : assert implicit none real :: a, toobig=1024 a=2000 call assert(myroutine, 101, a > toobig, The value is too large, a, > , toobig) end program demo_assert
John S. Urban
Public Domain
Nemo Release 3.1 | assert (3) | February 23, 2025 |