Path: shared/dcpam_error_test.f90
Last Update: Thu Jul 26 17:33:36 JST 2007

dcpam_error モジュールのテストプログラム

Test program for "dcpam_error"

Authors:Yasuhiro MORIKAWA
Version:$Id: dcpam_error_test.f90,v 1.7 2007/07/26 08:33:36 morikawa Exp $
Tag Name:$Name: dcpam4-20070731 $
Copyright:Copyright (C) GFD Dennou Club, 2007. All rights reserved.


Note that Japanese and English are described in parallel.

dcpam_error モジュールの動作テストを行うためのプログラムです. このプログラムがコンパイルできること, および実行時に プログラムが正常終了することを確認してください.

This program checks the operation of "dcpam_error" module. Confirm compilation and execution of this program.

Required files


Included Modules

dcpam_error dc_test dc_types dc_string dc_args

Public Instance methods

Main Program :


program dcpam_error_test
  use dcpam_error, only: DC_NOERR, StoreError
  use dcpam_error, only: DCPAM_ENEGATIVE
  use dc_test, only: AssertEqual
  use dc_types, only: TOKEN
  use dc_string, only: StoA
  use dc_args, only: ARGS, Open, HelpMsg, Option, Debug, Help, Strict, Close
  implicit none

  !  実験の表題, モデルの名称, 所属機関名
  !  Title of a experiment, name of model, sub-organ
  character(*), parameter:: title = 'dcpam_error_test $Name: dcpam4-20070731 $ :: ' // 'Test program of "dcpam_error" module'
  character(*), parameter:: source = 'dcpam4 ' // '(See http://www.gfd-dennou.org/library/dcpam)'
  character(*), parameter:: institution = 'GFD Dennou Club (See http://www.gfd-dennou.org)'

  !  作業変数
  !  Work variables
  type(ARGS):: arg            ! コマンドライン引数. 
                              ! Command line arguments
  logical:: OPT_namelist      ! -N, --namelist オプションの有無. 
                              ! Existence of '-N', '--namelist' option
  character(TOKEN):: VAL_namelist
                              ! -N, --namelist オプションの値. 
                              ! Value of '-N', '--namelist' option
  logical :: err
  character(*), parameter :: subname = 'dcpam_error_test'

  !  コマンドライン引数の処理
  !  Command line arguments handling
  call Open( arg )
  call HelpMsg( arg, 'Title', title )
  call HelpMsg( arg, 'Usage', './dcpam_error_test [Options]' )
  call HelpMsg( arg, 'Source', source )
  call HelpMsg( arg, 'Institution', institution )
  call Option( arg, StoA('-N', '--namelist'), OPT_namelist, VAL_namelist, help = "NAMELIST filename" )
  call Debug( arg ) 
   call Help( arg ) 
   call Strict( arg, severe = .true. )
  call Close( arg )

  !  StoreError テスト
  !  Test of "StoreError"
  call StoreError( DC_NOERR, subname )

  call StoreError( DC_NOERR, subname, err=err )
  call AssertEqual( 'StoreError Test 1', .false., err )

  call StoreError( DCPAM_ENEGATIVE, subname, cause_c='arg1', err=err )
  call AssertEqual( 'StoreError Test 2', .true., err )

!  call StoreError( DCPAM_ENEGATIVE, subname, cause_c='arg1' )

end program dcpam_error_test