C Library Functions  - unit_test_start (3)

NAME

unit_test_start(3f) - [M_framework__verify] reset counters and start a new test block (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Examples
Author
License

SYNOPSIS

subroutine unit_test_start(name,msg,opts,matched)

    character(len=*),intent(in)          :: name
    character(len=*),intent(in),optional :: msg
    character(len=*),intent(in),optional :: opts
    logical,intent(out),optional         :: matched

DESCRIPTION

unit_test_start(3f) is an initialization procedure for starting a new procedure test.

OPTIONS

NAME name of the procedure to test
MSG message to print
OPTS pass additional options to the optional shell command that can be assigned on the command line or by unit_test_mode(3f).
MATCHED
  if the match string has been set with unit_test_mode(3f) or on the command line this will return true if the name and msg concatenated with a space match the entire match string, where "*" matches any string and "?" matches any single character. This allows you to skip a test set if you wish by exiting.

EXAMPLES

Sample program:

    program demo_unit_test_start
    use M_framework, only: unit_test_start, unit_test, &
     & unit_test_end, unit_test_mode, unit_test_stop
    implicit none
    integer :: ival
    logical :: matched
    call unit_test_mode()
    call test_mysub1()
    call test_mysub2()
    call unit_test_stop()
    contains
    subroutine test_mysub1() ! first test
    call unit_test_start(’mysub1’)
    ! the example goodbad(1) command called here takes many options
    ! used to build an SQLite3 entry
    ival=10
    call unit_test(’mysub1’, ival > 3 ,   msg=’ if big enough’)
    call unit_test(’mysub1’, ival < 100 , msg=’ if small enough’)
    call unit_test_end(’mysub1’,msg=’completed checks of "mysub1"’)
    end subroutine test_mysub1

subroutine test_mysub2() ! second test call unit_test_start(’mysub1’,’’,matched=matched) ival=200 if(.not.matched)return ! makes it skippable call unit_test(’mysub1’, ival > 3 , msg=’ if big enough’) call unit_test(’mysub1’, ival < 100 , msg=’ if small enough’) call unit_test_end(’mysub1’,msg=’completed checks of "mysub2"’) end subroutine test_mysub2

end program demo_unit_test_start

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 unit_test_start (3) July 22, 2023
Generated by manServer 1.08 from 89f5b02e-8a77-47ea-a3c3-fadd3c518721 using man macros.