!--
! *** Caution!! ***
! 
! This file is generated from "dc_test.rb2f90" by Ruby 1.8.2.
! Please do not edit this file directly.
!
! [JAPANESE]
!
! ※※※ 注意!!! ※※※
!
! このファイルは "dc_test.rb2f90" から Ruby 1.8.2
! によって自動生成されたファイルです.
! このファイルを直接編集しませんようお願い致します.
!
!
!++
!
!== Test module
!
! Authors::   Yasuhiro MORIKAWA
! Version::   $Id: dc_test.f90,v 1.10 2007/04/16 09:23:32 morikawa Exp $
! Tag Name::  $Name: gt4f90io-20070417 $
! Copyright:: Copyright (C) GFD Dennou Club, 2005-2007. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!

module dc_test
  !
  !== Overview
  !
  ! Fortran 90/95 におけるテストプログラム作成を補助するための
  ! モジュールです.
  !
  ! {オブジェクト指向スクリプト言語 Ruby}[http://www.ruby-lang.org/]
  ! の {Test::Unit クラス}[http://www.ruby-lang.org/ja/man/?cmd=view;name=Test%3A%3AUnit]
  ! の機能の一部を模倣しています.
  !
  !== List
  !
  ! AssertEqual     :: 正答とチェックすべき値とを照合する.
  !
  !== Usage
  !
  ! AssertEqual サブルーチンは以下のように用います.
  ! まず, *message* にチェックする項目の名称を与えます.
  ! 与えられた文字列はテストプログラムを実行した際に表示されます.
  ! そして, *answer* には正答を, *check* には照合すべき値を与えます.
  ! *answer* と *check* にはそれぞれ文字型, 整数型, 単精度実数型, 
  ! 倍精度実数型, 論理型の変数および
  ! 配列 (1 〜 7次元) を与えることができます. 
  ! 2 つの引数の型および次元数は一致している必要があります.
  !
  !   program test
  !     use dc_test, only: AssertEqual
  !     implicit none
  !     character(32) :: str1
  !
  !     str1 = 'foo'
  !     call AssertEqual(message='String', answer='foo', check=str1)
  !   end program test
  !
  ! もしも *answer* と *check* の値, もしくは配列のサイズが異なる場合,
  ! テストプログラムはエラーを返して終了します.
  !
  !=== 具体例
  !
  ! 具体例は以下の通りです.
  !
  !   program test_sample
  !     use dc_types, only: STRING, DP
  !     use dc_test, only: AssertEqual
  !     character(STRING):: str1
  !     integer:: int1
  !     real:: numr1(2)
  !     real(DP):: numd1(2,3)
  !     logical:: y_n
  !
  !     str1 = "foo"
  !     call AssertEqual('Character', answer='foo', check=str1)
  !     int1 = 1
  !     call AssertEqual('Integer', answer=1, check=int1)
  !     numr1(:) = (/0.00123, 0.2/)
  !     call AssertEqual('Float', answer=(/0.00123, 0.2/), check=numr1)
  !     y_n = .true.
  !     call AssertEqual('Logical', answer=.true., check=y_n)
  !     numd1(1,:) = (/19.432d0, 75.3d0, 3.183d0/)
  !     numd1(2,:) = (/0.023d0, 0.9d0, 328.2d0/)
  !     call AssertEqual('Double precision 1', &
  !       & answer=(/19.432d0, 75.3d0, 3.183d0/), check=numd1(1,:))
  !     call AssertEqual('Double precision 2', &
  !       & answer=(/0.023d0, 0.9d0, 238.5d0/), check=numd1(2,:))
  !   end program test_sample
  !
  !
  ! 上記の例では, 最後のテストで敢えて間違った answer を与えているので,
  ! 以下のようなメッセージを出力してプログラムは強制終了します.
  !
  !      *** MESSAGE [DCAssertEqual] *** Checking Character OK
  !      *** MESSAGE [DCAssertEqual] *** Checking Integer OK
  !      *** MESSAGE [DCAssertEqual] *** Checking Float OK
  !      *** MESSAGE [DCAssertEqual] *** Checking Logical OK
  !      *** MESSAGE [DCAssertEqual] *** Checking Double precision 1 OK
  !      *** Error [DCAssertEqual] *** Checking Double precision 2 FAILURE
  !
  !       check(3) =  328.2
  !         is INCORRECT
  !       Correct answer is answer(3) =  238.5
  !
  !
  use dc_types, only : STRING, DP
  implicit none
  private
  public AssertEqual

  interface AssertEqual
                                              module procedure DCAssertEqualChar0
                      
    module procedure DCAssertEqualChar1
                      
    module procedure DCAssertEqualChar2
                      
    module procedure DCAssertEqualChar3
                      
    module procedure DCAssertEqualChar4
                      
    module procedure DCAssertEqualChar5
                      
    module procedure DCAssertEqualChar6
                      
    module procedure DCAssertEqualChar7
                      
                    
                          module procedure DCAssertEqualInt0
                      
    module procedure DCAssertEqualInt1
                      
    module procedure DCAssertEqualInt2
                      
    module procedure DCAssertEqualInt3
                      
    module procedure DCAssertEqualInt4
                      
    module procedure DCAssertEqualInt5
                      
    module procedure DCAssertEqualInt6
                      
    module procedure DCAssertEqualInt7
                      
                    
                          module procedure DCAssertEqualReal0
                      
    module procedure DCAssertEqualReal1
                      
    module procedure DCAssertEqualReal2
                      
    module procedure DCAssertEqualReal3
                      
    module procedure DCAssertEqualReal4
                      
    module procedure DCAssertEqualReal5
                      
    module procedure DCAssertEqualReal6
                      
    module procedure DCAssertEqualReal7
                      
                    
                          module procedure DCAssertEqualDouble0
                      
    module procedure DCAssertEqualDouble1
                      
    module procedure DCAssertEqualDouble2
                      
    module procedure DCAssertEqualDouble3
                      
    module procedure DCAssertEqualDouble4
                      
    module procedure DCAssertEqualDouble5
                      
    module procedure DCAssertEqualDouble6
                      
    module procedure DCAssertEqualDouble7
                      
                    

                        module procedure DCAssertEqualLogical0
                    
    module procedure DCAssertEqualLogical1
                    
    module procedure DCAssertEqualLogical2
                    
    module procedure DCAssertEqualLogical3
                    
    module procedure DCAssertEqualLogical4
                    
    module procedure DCAssertEqualLogical5
                    
    module procedure DCAssertEqualLogical6
                    
    module procedure DCAssertEqualLogical7
                    

  end interface

contains


  subroutine DCAssertEqualChar0(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer
    character(*), intent(in):: check
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                                        

                                                                
                    

  continue
    err_flag = .false.

                    
    err_flag = .not. trim(answer) == trim(check)
    wrong = check
    right = answer
    pos_str = ''

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar0


  subroutine DCAssertEqualChar1(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:)
    character(*), intent(in):: check(:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(1), check_shape(1), pos(1)
    logical :: consist_shape(1)
    character(TOKEN) :: pos_array(1)
    integer, allocatable :: mask_array(:)
    logical, allocatable :: judge(:)
    logical, allocatable :: judge_rev(:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:)
    character(STRING), allocatable :: check_fixed_length(:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge_rev (&
                      
      &    answer_shape(1)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                        
      &    answer_shape(1)  )  &
      &  )

    allocate( check_fixed_length (&
                        
      &    check_shape(1)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                      
        &    pos(1)  )

      right = answer (&
                      
        &    pos(1)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      

      pos_str = '(' // &
                      
        &    trim(adjustl(pos_array(1))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar1


  subroutine DCAssertEqualChar2(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:)
    character(*), intent(in):: check(:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(2), check_shape(2), pos(2)
    logical :: consist_shape(2)
    character(TOKEN) :: pos_array(2)
    integer, allocatable :: mask_array(:,:)
    logical, allocatable :: judge(:,:)
    logical, allocatable :: judge_rev(:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:)
    character(STRING), allocatable :: check_fixed_length(:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar2


  subroutine DCAssertEqualChar3(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:,:)
    character(*), intent(in):: check(:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(3), check_shape(3), pos(3)
    logical :: consist_shape(3)
    character(TOKEN) :: pos_array(3)
    integer, allocatable :: mask_array(:,:,:)
    logical, allocatable :: judge(:,:,:)
    logical, allocatable :: judge_rev(:,:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:,:)
    character(STRING), allocatable :: check_fixed_length(:,:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2), &
                        
      &    answer_shape(3)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2), &
                        
      &    check_shape(3)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar3


  subroutine DCAssertEqualChar4(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:,:,:)
    character(*), intent(in):: check(:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(4), check_shape(4), pos(4)
    logical :: consist_shape(4)
    character(TOKEN) :: pos_array(4)
    integer, allocatable :: mask_array(:,:,:,:)
    logical, allocatable :: judge(:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:,:,:)
    character(STRING), allocatable :: check_fixed_length(:,:,:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2), &
                        
      &    answer_shape(3), &
                        
      &    answer_shape(4)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2), &
                        
      &    check_shape(3), &
                        
      &    check_shape(4)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar4


  subroutine DCAssertEqualChar5(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:,:,:,:)
    character(*), intent(in):: check(:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(5), check_shape(5), pos(5)
    logical :: consist_shape(5)
    character(TOKEN) :: pos_array(5)
    integer, allocatable :: mask_array(:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:,:,:,:)
    character(STRING), allocatable :: check_fixed_length(:,:,:,:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2), &
                        
      &    answer_shape(3), &
                        
      &    answer_shape(4), &
                        
      &    answer_shape(5)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2), &
                        
      &    check_shape(3), &
                        
      &    check_shape(4), &
                        
      &    check_shape(5)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar5


  subroutine DCAssertEqualChar6(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:,:,:,:,:)
    character(*), intent(in):: check(:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(6), check_shape(6), pos(6)
    logical :: consist_shape(6)
    character(TOKEN) :: pos_array(6)
    integer, allocatable :: mask_array(:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:,:,:,:,:)
    character(STRING), allocatable :: check_fixed_length(:,:,:,:,:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2), &
                        
      &    answer_shape(3), &
                        
      &    answer_shape(4), &
                        
      &    answer_shape(5), &
                        
      &    answer_shape(6)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2), &
                        
      &    check_shape(3), &
                        
      &    check_shape(4), &
                        
      &    check_shape(5), &
                        
      &    check_shape(6)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar6


  subroutine DCAssertEqualChar7(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    character(*), intent(in):: answer(:,:,:,:,:,:,:)
    character(*), intent(in):: check(:,:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    character(STRING) :: wrong, right

                        integer :: answer_shape(7), check_shape(7), pos(7)
    logical :: consist_shape(7)
    character(TOKEN) :: pos_array(7)
    integer, allocatable :: mask_array(:,:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:,:)
                    

                                              character(STRING), allocatable :: answer_fixed_length(:,:,:,:,:,:,:)
    character(STRING), allocatable :: check_fixed_length(:,:,:,:,:,:,:)
                      
                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

                      
    allocate( answer_fixed_length (&
                              &    answer_shape(1), &
                        
      &    answer_shape(2), &
                        
      &    answer_shape(3), &
                        
      &    answer_shape(4), &
                        
      &    answer_shape(5), &
                        
      &    answer_shape(6), &
                        
      &    answer_shape(7)  )  &
      &  )

    allocate( check_fixed_length (&
                              &    check_shape(1), &
                        
      &    check_shape(2), &
                        
      &    check_shape(3), &
                        
      &    check_shape(4), &
                        
      &    check_shape(5), &
                        
      &    check_shape(6), &
                        
      &    check_shape(7)  )  &
      &  )

    answer_fixed_length = answer
    check_fixed_length = check

    judge = answer_fixed_length == check_fixed_length
    deallocate(answer_fixed_length, check_fixed_length)

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      
      write(unit=pos_array(7), fmt="(i20)") pos(7)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ',' // &
                      
        &    trim(adjustl(pos_array(7))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', trim(wrong)
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', trim(right)

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualChar7


  subroutine DCAssertEqualInt0(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer
    integer, intent(in):: check
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                                        

                    

  continue
    err_flag = .false.

                    
    err_flag = .not. answer == check
    wrong = check
    right = answer
    pos_str = ''

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt0


  subroutine DCAssertEqualInt1(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:)
    integer, intent(in):: check(:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(1), check_shape(1), pos(1)
    logical :: consist_shape(1)
    character(TOKEN) :: pos_array(1)
    integer, allocatable :: mask_array(:)
    logical, allocatable :: judge(:)
    logical, allocatable :: judge_rev(:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge_rev (&
                      
      &    answer_shape(1)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                      
        &    pos(1)  )

      right = answer (&
                      
        &    pos(1)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      

      pos_str = '(' // &
                      
        &    trim(adjustl(pos_array(1))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt1


  subroutine DCAssertEqualInt2(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:)
    integer, intent(in):: check(:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(2), check_shape(2), pos(2)
    logical :: consist_shape(2)
    character(TOKEN) :: pos_array(2)
    integer, allocatable :: mask_array(:,:)
    logical, allocatable :: judge(:,:)
    logical, allocatable :: judge_rev(:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt2


  subroutine DCAssertEqualInt3(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:,:)
    integer, intent(in):: check(:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(3), check_shape(3), pos(3)
    logical :: consist_shape(3)
    character(TOKEN) :: pos_array(3)
    integer, allocatable :: mask_array(:,:,:)
    logical, allocatable :: judge(:,:,:)
    logical, allocatable :: judge_rev(:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt3


  subroutine DCAssertEqualInt4(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:,:,:)
    integer, intent(in):: check(:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(4), check_shape(4), pos(4)
    logical :: consist_shape(4)
    character(TOKEN) :: pos_array(4)
    integer, allocatable :: mask_array(:,:,:,:)
    logical, allocatable :: judge(:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt4


  subroutine DCAssertEqualInt5(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:,:,:,:)
    integer, intent(in):: check(:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(5), check_shape(5), pos(5)
    logical :: consist_shape(5)
    character(TOKEN) :: pos_array(5)
    integer, allocatable :: mask_array(:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt5


  subroutine DCAssertEqualInt6(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:,:,:,:,:)
    integer, intent(in):: check(:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(6), check_shape(6), pos(6)
    logical :: consist_shape(6)
    character(TOKEN) :: pos_array(6)
    integer, allocatable :: mask_array(:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt6


  subroutine DCAssertEqualInt7(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    integer, intent(in):: answer(:,:,:,:,:,:,:)
    integer, intent(in):: check(:,:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    integer :: wrong, right

                        integer :: answer_shape(7), check_shape(7), pos(7)
    logical :: consist_shape(7)
    character(TOKEN) :: pos_array(7)
    integer, allocatable :: mask_array(:,:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      
      write(unit=pos_array(7), fmt="(i20)") pos(7)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ',' // &
                      
        &    trim(adjustl(pos_array(7))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualInt7


  subroutine DCAssertEqualReal0(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer
    real, intent(in):: check
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                                        

                    

  continue
    err_flag = .false.

                    
    err_flag = .not. answer == check
    wrong = check
    right = answer
    pos_str = ''

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal0


  subroutine DCAssertEqualReal1(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:)
    real, intent(in):: check(:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(1), check_shape(1), pos(1)
    logical :: consist_shape(1)
    character(TOKEN) :: pos_array(1)
    integer, allocatable :: mask_array(:)
    logical, allocatable :: judge(:)
    logical, allocatable :: judge_rev(:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge_rev (&
                      
      &    answer_shape(1)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                      
        &    pos(1)  )

      right = answer (&
                      
        &    pos(1)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      

      pos_str = '(' // &
                      
        &    trim(adjustl(pos_array(1))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal1


  subroutine DCAssertEqualReal2(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:)
    real, intent(in):: check(:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(2), check_shape(2), pos(2)
    logical :: consist_shape(2)
    character(TOKEN) :: pos_array(2)
    integer, allocatable :: mask_array(:,:)
    logical, allocatable :: judge(:,:)
    logical, allocatable :: judge_rev(:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal2


  subroutine DCAssertEqualReal3(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:,:)
    real, intent(in):: check(:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(3), check_shape(3), pos(3)
    logical :: consist_shape(3)
    character(TOKEN) :: pos_array(3)
    integer, allocatable :: mask_array(:,:,:)
    logical, allocatable :: judge(:,:,:)
    logical, allocatable :: judge_rev(:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal3


  subroutine DCAssertEqualReal4(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:,:,:)
    real, intent(in):: check(:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(4), check_shape(4), pos(4)
    logical :: consist_shape(4)
    character(TOKEN) :: pos_array(4)
    integer, allocatable :: mask_array(:,:,:,:)
    logical, allocatable :: judge(:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal4


  subroutine DCAssertEqualReal5(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:,:,:,:)
    real, intent(in):: check(:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(5), check_shape(5), pos(5)
    logical :: consist_shape(5)
    character(TOKEN) :: pos_array(5)
    integer, allocatable :: mask_array(:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal5


  subroutine DCAssertEqualReal6(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:,:,:,:,:)
    real, intent(in):: check(:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(6), check_shape(6), pos(6)
    logical :: consist_shape(6)
    character(TOKEN) :: pos_array(6)
    integer, allocatable :: mask_array(:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal6


  subroutine DCAssertEqualReal7(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real, intent(in):: answer(:,:,:,:,:,:,:)
    real, intent(in):: check(:,:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real :: wrong, right

                        integer :: answer_shape(7), check_shape(7), pos(7)
    logical :: consist_shape(7)
    character(TOKEN) :: pos_array(7)
    integer, allocatable :: mask_array(:,:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      
      write(unit=pos_array(7), fmt="(i20)") pos(7)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ',' // &
                      
        &    trim(adjustl(pos_array(7))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualReal7


  subroutine DCAssertEqualDouble0(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer
    real(DP), intent(in):: check
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                                        

                    

  continue
    err_flag = .false.

                    
    err_flag = .not. answer == check
    wrong = check
    right = answer
    pos_str = ''

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble0


  subroutine DCAssertEqualDouble1(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:)
    real(DP), intent(in):: check(:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(1), check_shape(1), pos(1)
    logical :: consist_shape(1)
    character(TOKEN) :: pos_array(1)
    integer, allocatable :: mask_array(:)
    logical, allocatable :: judge(:)
    logical, allocatable :: judge_rev(:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( judge_rev (&
                      
      &    answer_shape(1)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                      
        &    pos(1)  )

      right = answer (&
                      
        &    pos(1)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      

      pos_str = '(' // &
                      
        &    trim(adjustl(pos_array(1))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble1


  subroutine DCAssertEqualDouble2(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:)
    real(DP), intent(in):: check(:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(2), check_shape(2), pos(2)
    logical :: consist_shape(2)
    character(TOKEN) :: pos_array(2)
    integer, allocatable :: mask_array(:,:)
    logical, allocatable :: judge(:,:)
    logical, allocatable :: judge_rev(:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble2


  subroutine DCAssertEqualDouble3(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:,:)
    real(DP), intent(in):: check(:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(3), check_shape(3), pos(3)
    logical :: consist_shape(3)
    character(TOKEN) :: pos_array(3)
    integer, allocatable :: mask_array(:,:,:)
    logical, allocatable :: judge(:,:,:)
    logical, allocatable :: judge_rev(:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble3


  subroutine DCAssertEqualDouble4(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:,:,:)
    real(DP), intent(in):: check(:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(4), check_shape(4), pos(4)
    logical :: consist_shape(4)
    character(TOKEN) :: pos_array(4)
    integer, allocatable :: mask_array(:,:,:,:)
    logical, allocatable :: judge(:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble4


  subroutine DCAssertEqualDouble5(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:,:,:,:)
    real(DP), intent(in):: check(:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(5), check_shape(5), pos(5)
    logical :: consist_shape(5)
    character(TOKEN) :: pos_array(5)
    integer, allocatable :: mask_array(:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble5


  subroutine DCAssertEqualDouble6(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:,:,:,:,:)
    real(DP), intent(in):: check(:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(6), check_shape(6), pos(6)
    logical :: consist_shape(6)
    character(TOKEN) :: pos_array(6)
    integer, allocatable :: mask_array(:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble6


  subroutine DCAssertEqualDouble7(message, answer, check)
    use sysdep, only: AbortProgram
    use dc_types, only: STRING, TOKEN
    implicit none
    character(*), intent(in):: message
    real(DP), intent(in):: answer(:,:,:,:,:,:,:)
    real(DP), intent(in):: check(:,:,:,:,:,:,:)
    logical :: err_flag
    character(STRING) :: pos_str
    real(DP) :: wrong, right

                        integer :: answer_shape(7), check_shape(7), pos(7)
    logical :: consist_shape(7)
    character(TOKEN) :: pos_array(7)
    integer, allocatable :: mask_array(:,:,:,:,:,:,:)
    logical, allocatable :: judge(:,:,:,:,:,:,:)
    logical, allocatable :: judge_rev(:,:,:,:,:,:,:)
                    

                    

  continue
    err_flag = .false.

                    
    answer_shape = shape(answer)
    check_shape = shape(check)

    consist_shape = answer_shape == check_shape

    if (.not. all(consist_shape)) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  shape of check is (', check_shape, ')'
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct shape of answer is (', answer_shape, ')'

      call AbortProgram('')
    end if


    allocate( mask_array (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( judge_rev (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

                      
    judge = answer == check

                      

    judge_rev = .not. judge
    err_flag = any(judge_rev)
    mask_array = 1
    pos = maxloc(mask_array, judge_rev)

    if (err_flag) then

      wrong = check (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

      right = answer (&
                              &    pos(1), &
                      
        &    pos(2), &
                      
        &    pos(3), &
                      
        &    pos(4), &
                      
        &    pos(5), &
                      
        &    pos(6), &
                      
        &    pos(7)  )

                            write(unit=pos_array(1), fmt="(i20)") pos(1)
                      
      write(unit=pos_array(2), fmt="(i20)") pos(2)
                      
      write(unit=pos_array(3), fmt="(i20)") pos(3)
                      
      write(unit=pos_array(4), fmt="(i20)") pos(4)
                      
      write(unit=pos_array(5), fmt="(i20)") pos(5)
                      
      write(unit=pos_array(6), fmt="(i20)") pos(6)
                      
      write(unit=pos_array(7), fmt="(i20)") pos(7)
                      

      pos_str = '(' // &
                              &    trim(adjustl(pos_array(1))) // ',' // &
                      
        &    trim(adjustl(pos_array(2))) // ',' // &
                      
        &    trim(adjustl(pos_array(3))) // ',' // &
                      
        &    trim(adjustl(pos_array(4))) // ',' // &
                      
        &    trim(adjustl(pos_array(5))) // ',' // &
                      
        &    trim(adjustl(pos_array(6))) // ',' // &
                      
        &    trim(adjustl(pos_array(7))) // ')'

    end if
    deallocate(mask_array, judge, judge_rev)

                    


    if (err_flag) then
      write(*,*) ' *** Error [DCAssertEqual] *** Checking ' // trim(message) // ' FAILURE'
      write(*,*) ''
      write(*,*) '  check' // trim(pos_str) // ' = ', wrong
      write(*,*) '    is INCORRECT'
      write(*,*) '  Correct answer is answer' // trim(pos_str) // ' = ', right

      call AbortProgram('')
    else
      write(*,*) ' *** MESSAGE [DCAssertEqual] *** Checking ' // trim(message) // ' OK'
    end if


  end subroutine DCAssertEqualDouble7

  subroutine DCAssertEqualLogical0(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer
    logical, intent(in):: check

                        character(STRING) :: answer_str
    character(STRING) :: check_str
                    


  continue

                    
    if (answer) then
      answer_str = ".true."
    else
      answer_str = ".false."
    end if

    if (check) then
      check_str = ".true."
    else
      check_str = ".false."
    end if

                    

    call DCAssertEqualChar0(message, answer_str, check_str)

                                        

  end subroutine DCAssertEqualLogical0
  subroutine DCAssertEqualLogical1(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:)
    logical, intent(in):: check(:)

                        integer :: answer_shape(1), check_shape(1), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:)
    character(STRING), allocatable :: check_str(:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                      
      &    answer_shape(1)  )  &
      &  )

    allocate( check_str (&
                      
      &    check_shape(1)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar1(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical1
  subroutine DCAssertEqualLogical2(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:)
    logical, intent(in):: check(:,:)

                        integer :: answer_shape(2), check_shape(2), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:)
    character(STRING), allocatable :: check_str(:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar2(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical2
  subroutine DCAssertEqualLogical3(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:,:)
    logical, intent(in):: check(:,:,:)

                        integer :: answer_shape(3), check_shape(3), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:,:)
    character(STRING), allocatable :: check_str(:,:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2), &
                      
      &    check_shape(3)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar3(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical3
  subroutine DCAssertEqualLogical4(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:,:,:)
    logical, intent(in):: check(:,:,:,:)

                        integer :: answer_shape(4), check_shape(4), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:,:,:)
    character(STRING), allocatable :: check_str(:,:,:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2), &
                      
      &    check_shape(3), &
                      
      &    check_shape(4)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar4(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical4
  subroutine DCAssertEqualLogical5(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:,:,:,:)
    logical, intent(in):: check(:,:,:,:,:)

                        integer :: answer_shape(5), check_shape(5), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:,:,:,:)
    character(STRING), allocatable :: check_str(:,:,:,:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2), &
                      
      &    check_shape(3), &
                      
      &    check_shape(4), &
                      
      &    check_shape(5)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar5(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical5
  subroutine DCAssertEqualLogical6(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:,:,:,:,:)
    logical, intent(in):: check(:,:,:,:,:,:)

                        integer :: answer_shape(6), check_shape(6), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:,:,:,:,:)
    character(STRING), allocatable :: check_str(:,:,:,:,:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2), &
                      
      &    check_shape(3), &
                      
      &    check_shape(4), &
                      
      &    check_shape(5), &
                      
      &    check_shape(6)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar6(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical6
  subroutine DCAssertEqualLogical7(message, answer, check)
    use dc_types, only: STRING
    implicit none
    character(*), intent(in):: message
    logical, intent(in):: answer(:,:,:,:,:,:,:)
    logical, intent(in):: check(:,:,:,:,:,:,:)

                        integer :: answer_shape(7), check_shape(7), i
    logical, allocatable :: answer_tmp(:), check_tmp(:)
    character(STRING), allocatable :: answer_str_tmp(:), check_str_tmp(:)
    character(STRING), allocatable :: answer_str(:,:,:,:,:,:,:)
    character(STRING), allocatable :: check_str(:,:,:,:,:,:,:)
                    


  continue

                    
    allocate(answer_tmp(size(answer)))
    allocate(check_tmp(size(check)))
    allocate(answer_str_tmp(size(answer)))
    allocate(check_str_tmp(size(check)))
    answer_tmp = pack(answer, .true.)
    check_tmp = pack(check, .true.)

    do i = 1, size(answer_tmp)
      if (answer_tmp(i)) then
        answer_str_tmp(i) = '.true.'
      else
        answer_str_tmp(i) = '.false.'
      end if
    end do

    do i = 1, size(check_tmp)
      if (check_tmp(i)) then
        check_str_tmp(i) = '.true.'
      else
        check_str_tmp(i) = '.false.'
      end if
    end do

    answer_shape = shape(answer)
    check_shape = shape(check)

    allocate( answer_str (&
                            &    answer_shape(1), &
                      
      &    answer_shape(2), &
                      
      &    answer_shape(3), &
                      
      &    answer_shape(4), &
                      
      &    answer_shape(5), &
                      
      &    answer_shape(6), &
                      
      &    answer_shape(7)  )  &
      &  )

    allocate( check_str (&
                            &    check_shape(1), &
                      
      &    check_shape(2), &
                      
      &    check_shape(3), &
                      
      &    check_shape(4), &
                      
      &    check_shape(5), &
                      
      &    check_shape(6), &
                      
      &    check_shape(7)  )  &
      &  )

    answer_str = reshape(answer_str_tmp, answer_shape)
    check_str = reshape(check_str_tmp, check_shape)

                    

    call DCAssertEqualChar7(message, answer_str, check_str)

                        deallocate(answer_str, answer_tmp, answer_str_tmp)
    deallocate(check_str, check_tmp, check_str_tmp)
                    

  end subroutine DCAssertEqualLogical7
end module dc_test

!--
! vi:set readonly sw=4 ts=8:
!
!Local Variables:
!mode: f90
!buffer-read-only: t
!End:
!
!++
