!----------------------------------------------------------------------
! Copyright (c) 2019 SPMODEL Development Group. All rights reserved.
!----------------------------------------------------------------------
!
!表題  w_base_module テストプログラム :: 基本変換関数のテスト
!
!履歴  2019/03/13  竹広真一
!     2020/11/06  竹広真一 セクター計算テスト
!
program w_base_module_mint_test
  use dc_types, only: DP
  use dc_message, only : MessageNotify
  use dc_test, only : AssertEqual
  use w_module_mint
  use spml_utils, only: pi
  implicit none

!  integer, parameter :: im=32, jm=16, nm=10, mint=1
  integer, parameter :: im=32, jm=16, nm=10, mint=2
  integer, parameter :: nc=(nm/mint+1)*(2*(nm+1)-nm/mint*mint)
  
  real(DP), dimension(nc)            ::  w_data
  real(DP), dimension(0:im-1,1:jm)   ::  xy_data
  real(DP), dimension(0:im-1,1:jm)   ::  xy_Ddata

  ! 判定誤差設定
  integer, parameter :: check_digits = 11
  integer, parameter :: ignore = -12

  call MessageNotify('M','w_base_module', &
                         'w_base_module functions tests')

  call w_Initial( nm, im, jm, mint=mint )

  !==================== Y_1^0 のテスト ====================
  xy_data = sqrt(3.0D0)*sin(xy_Lat)                      ! Y_1^0
  w_data= 0.0D0 ; w_data(l_nm(1,0))=1.0D0

  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_1^0 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_1^0 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = 0.0D0
  call AssertEqual(&
    message='Y_1^0 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_1^0 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = sqrt(3.0D0) * ( cos(xy_Lat)**2 - 2*sin(xy_Lat)**2 )
  call AssertEqual(&      ! (1/\cos\phi)d/\phi(f\cos^2\phi)
    message='Y_1^0 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = sqrt(3.0D0)*cos(xy_Lat)
  call AssertEqual(&      ! df/\phi
    message='Y_1^0 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(3.0D0) * sin(xy_Lat)**2
  call AssertEqual(&
    message='Y_1^0 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_1^0 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_1^0','Test of Y_1^0 succeeded!')


  !==================== Y_2^0 のテスト ====================
  xy_data = sqrt(5.0D0)*(3.0/2*sin(xy_Lat)**2-1/2.0)                 ! Y_2^0
  w_data= 0.0D0 ; w_data(l_nm(2,0))=1.0D0

  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_2^0 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = 0.0D0
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = sqrt(5.0D0)*(   3.0*sin(xy_Lat)*cos(xy_Lat)**2  &
                           - 3.0*sin(xy_Lat)**3 + sin(xy_Lat)  )
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = sqrt(5.0D0)*3.0*sin(xy_Lat)*cos(xy_Lat)
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(5.0D0)*(3.0/2*sin(xy_Lat)**2-1/2.0)*sin(xy_Lat)
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^0 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_2^0','Test of Y_2^0 succeeded!')


  !==================== Y_2^2 のテスト ====================
  xy_data = sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2*cos(2*xy_Lon)         ! Y_2^2
  w_data= 0.0D0 ; w_data(l_nm(2,2))=1.0D0/2.0D0
  
  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_2^2 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2* (-2)* sin(2*xy_Lon)  ! Y_2^2
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = - sqrt(5.0D0/24)*3.0*4*sin(xy_Lat)*cos(xy_Lat)**2*cos(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = -sqrt(5.0D0/24)*3.0*2*cos(xy_Lat)*sin(xy_Lat)*cos(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2*sin(xy_Lat)*cos(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^2 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_2^2','Test of Y_2^2 succeeded!')

  !==================== Y_2^-2 のテスト ====================
  xy_data = -sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2*sin(2*xy_Lon)         ! Y_2^-2
  w_data= 0.0D0 ; w_data(l_nm(2,-2))=1.0D0/2.0D0

  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_2^-2 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data))',                 &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = -sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2* 2*cos(2*xy_Lon)  ! Y_2^2
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data,iflag=-1))',        &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data),iflag=-1)',        &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = sqrt(5.0D0/24)*3.0*4*sin(xy_Lat)*cos(xy_Lat)**2*sin(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',  &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = sqrt(5.0D0/24)*3.0*2*cos(xy_Lat)*sin(xy_Lat)*sin(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',  &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = -sqrt(5.0D0/24)*3.0*cos(xy_Lat)**2*sin(xy_Lat)*sin(2*xy_Lon)
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data,iflag=2))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_2^-2 Test of xy_w(w_xy(xy_data),iflag=2)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_2^-2','Test of Y_2^-2 succeeded!')

  !==================== Y_4^0 のテスト ====================
  xy_data = sqrt(9.0D0)*(35.0/8*sin(xy_Lat)**4-30.0/8*sin(xy_Lat)**2+3.0/8) ! Y_4^0
  w_data= 0.0D0 ; w_data(l_nm(4,0))=1.0D0

  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_4^0 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = 0.0D0
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = -2*sin(xy_Lat)*xy_data &
       + sqrt(9.0D0)*(35.0/2*sin(xy_Lat)**3-30.0/4*sin(xy_Lat))*cos(xy_Lat)**2
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = sqrt(9.0D0)*(35.0/2*sin(xy_Lat)**3-30.0/4*sin(xy_Lat))*cos(xy_Lat)
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(9.0D0)*(35.0/8*sin(xy_Lat)**4-30.0/8*sin(xy_Lat)**2+3.0/8)*sin(xy_Lat)

  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^0 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_4^0','Test of Y_4^0 succeeded!')


  !==================== Y_4^2 のテスト ====================
  xy_data = sqrt(9.0D0/360)*15.0/2*cos(xy_Lat)**2*(7*sin(xy_Lat)**2-1)*cos(2*xy_Lon)         ! Y_4^2
  w_data= 0.0D0 ; w_data(l_nm(4,2))=1.0D0/2.0D0
  
  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_4^2 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = sqrt(9.0D0/360)*15.0/2*cos(xy_Lat)**2*(7*sin(xy_Lat)**2-1) &
       * (-2)*sin(2*xy_Lon)
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = -2*sin(xy_Lat)*xy_data &
       + sqrt(9.0D0/360)*( &
             - 15.0*sin(xy_Lat)*cos(xy_Lat)*(7*sin(xy_Lat)**2-1)  &
             + 15.0/2*cos(xy_Lat)**2*14*sin(xy_Lat)*cos(xy_Lat)  )&
          *cos(xy_Lat)*cos(2*xy_Lon)
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = sqrt(9.0D0/360) &
       * ( -15.0*sin(xy_Lat)*cos(xy_Lat)*(7*sin(xy_Lat)**2-1)    &
           +15.0/2*cos(xy_Lat)**2*14*sin(xy_Lat)*cos(xy_Lat)   ) &
       *cos(2*xy_Lon)
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(9.0D0/360)*15.0/2*cos(xy_Lat)**2*(7*sin(xy_Lat)**2-1)*sin(xy_Lat)*cos(2*xy_Lon)         ! Y_4^2
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^2 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_4^2','Test of Y_4^2 succeeded!')

  !==================== Y_4^4 のテスト ====================
  xy_data = sqrt(9.0D0/40320)*105.0*cos(xy_Lat)**4*cos(4*xy_Lon)         ! Y_4^4
  w_data= 0.0D0 ; w_data(l_nm(4,4))=1.0D0/2.0D0
  
  !---- 通常変換 ----
  call AssertEqual(&
    message='Y_4^4 Test of w_xy(xy_data)',                        &
    answer = w_data,                                              &
    check = w_xy(xy_data),                                        &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data))',                  &
    answer = xy_data,                                             &
    check = xy_w(w_xy(xy_data)),                                  &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- X 微分変換 ----
  xy_Ddata = sqrt(9.0D0/40320)*105.0*cos(xy_Lat)**4 *(-4)*sin(4*xy_Lon)
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data,iflag=-1))',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=-1)),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data),iflag=-1)',         &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=-1),                         &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- Y 微分変換 ----
  xy_Ddata = -sqrt(9.0D0/40320)*105.0*6*cos(xy_Lat)**4*sin(xy_Lat)*cos(4*xy_Lon) 
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data,iflag=1,ipow=0))',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=1,ipow=0)),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  xy_Ddata = -sqrt(9.0D0/40320)*105.0*4*cos(xy_Lat)**3*sin(xy_Lat)*cos(4*xy_Lon)
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data),iflag=1,ipow=1)',   &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=1,ipow=1),                   &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  !---- SIN 掛け算変換 ----
  xy_Ddata = sqrt(9.0D0/40320)*105.0*cos(xy_Lat)**4*cos(4*xy_Lon)*sin(xy_Lat)
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data,iflag=2))',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data,iflag=2)),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )
  call AssertEqual(&
    message='Y_4^4 Test of xy_w(w_xy(xy_data),iflag=2)',          &
    answer = xy_Ddata,                                            &
    check = xy_w(w_xy(xy_data),iflag=2),                          &
    significant_digits = check_digits, ignore_digits = ignore     &
    )

  call MessageNotify('M','Test of Y_4^4','Test of Y_4^4 succeeded!')

  
  call MessageNotify('M','Test of genral function', &
       'Test of general function succeeded!')

end program w_base_module_mint_test
