program dc_args_test use dc_types use dc_string, only: StoA, JoinChar use dc_args, only: ARGS, Open, Close, & & Option, PutLine, Debug, Help, Strict, Get, HelpMsg, Number use dc_test, only: AssertEqual implicit none type(ARGS) :: arg logical :: OPT_size logical :: OPT_namelist character(STRING) :: VAL_namelist, char character(TOKEN), pointer :: argv(:) => null() continue call Open(arg) call HelpMsg(arg, 'Title', 'dcargs $Revision: 1.7 $ :: Test program of dc_args') call HelpMsg(arg, 'Usage', 'dcargs [Options] arg1, arg2, ...') call Option(arg, StoA('-s', 'size'), & & OPT_size, help="Return number of arguments") call Option(arg, StoA('N', '--namelist'), & & OPT_namelist, VAL_namelist, help="Namelist filename") call HelpMsg(arg, 'DESCRIPTION', & & '(1) Define type "HASH". ' // & & '(2) Open the variable. ' // & & '(3) set HelpMsg. ' // & & '(4) set Options. ' // & & '(5) call Debug. ' // & & '(6) call Help. ' // & & '(7) call Strict.') call HelpMsg(arg, 'Copyright', & & 'Copyright (C) GFD Dennou Club, 2006. All rights reserved.') call Debug(arg) call Help(arg) call Strict(arg) call Get(arg, argv) call AssertEqual('Number of arguments test', 3, number(arg)) call AssertEqual('Short option test 1', .true., OPT_size) call AssertEqual('Long option test 1', .true., OPT_namelist) call AssertEqual('Long option test 2', 'test.nml', VAL_namelist) char = trim(JoinChar(argv)) call AssertEqual('Strings of arguments test', 'arg1, arg2, arg3', char) deallocate(argv) call Close(arg) end program dc_args_test