https://www.cdslab.org/paramonte/fortran/2
Current view: top level - test - test_pm_complexCompareAny@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 28 28 100.0 %
Date: 2024-04-08 03:18:57 Functions: 24 24 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This include file contains the implementations of the tests of procedures of [test_pm_complexCompareAny](@ref test_pm_complexCompareAny).
      19             : !>
      20             : !>  \author
      21             : !>  \AmirShahmoradi, Sunday 4:33 PM, September 19, 2021, Dallas, TX
      22             : 
      23             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      24             : 
      25             :         use pm_distUnif, only: setUnifRand
      26             :         use pm_kind, only: SK, IK, LK
      27             :         use pm_val2str, only: getStr
      28             : 
      29             : #if isanyless_CK_ENABLED
      30             : #define COMPARES_WITH_DEF <
      31             : #define COMPARES_WITH <
      32             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanyless()"
      33             : #elif isanyleq_CK_ENABLED
      34             : #define COMPARES_WITH_DEF <=
      35             : #define COMPARES_WITH <=
      36             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanyleq()"
      37             : #elif isanyneq_CK_ENABLED
      38             : #define COMPARES_WITH_DEF /=
      39             : #define COMPARES_WITH .anyneq.
      40             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanyneq()"
      41             : #elif isanyeq_CK_ENABLED
      42             : #define COMPARES_WITH_DEF ==
      43             : #define COMPARES_WITH .anyeq.
      44             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanyeq()"
      45             : #elif isanymeq_CK_ENABLED
      46             : #define COMPARES_WITH_DEF >=
      47             : #define COMPARES_WITH >=
      48             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanymeq()"
      49             : #elif isanymore_CK_ENABLED
      50             : #define COMPARES_WITH_DEF >
      51             : #define COMPARES_WITH >
      52             :         character(*, SK), parameter :: PROCEDURE_NAME = "isanymore()"
      53             : #else
      54             : #error "Unrecognized interface."
      55             : #endif
      56             : 
      57             :         integer(IK)     , parameter :: NP = 5_IK
      58             :         integer(IK)     :: i, j
      59             :         logical(LK)     :: result(NP,NP), result_def(NP,NP)
      60             :         complex(CKC)    :: mat1(NP,NP)
      61             :         complex(CKC)    :: mat2(NP,NP)
      62             : 
      63          24 :         assertion = .true._LK
      64             : 
      65             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      66             : 
      67             : 
      68         144 :         do j = 1, NP
      69         744 :             do i = 1, NP
      70         600 :                 call setUnifRand(mat1(i,j))
      71         600 :                 call setUnifRand(mat2(i,j))
      72         600 :                 result(i,j) = mat1(i,j) COMPARES_WITH mat2(i,j)
      73         600 :                 result_def(i,j) = mat1(i,j)%re COMPARES_WITH_DEF mat2(i,j)%re .or. mat1(i,j)%im COMPARES_WITH_DEF mat2(i,j)%im
      74         720 :                 assertion = assertion .and. (result(i,j) .eqv. result_def(i,j))
      75             :             end do
      76             :         end do
      77          24 :         call report()
      78          24 :         call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare scalar complex values.")
      79             : 
      80             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      81             : 
      82         144 :         do j = 1, NP
      83         720 :             call setUnifRand(mat1(:,j))
      84         720 :             call setUnifRand(mat2(:,j))
      85        1320 :             result(:,j) = mat1(:,j) COMPARES_WITH mat2(:,j)
      86         720 :             result_def(:,j) = mat1(:,j)%re COMPARES_WITH_DEF mat2(:,j)%re .or. mat1(:,j)%im COMPARES_WITH_DEF mat2(:,j)%im
      87         744 :             assertion = assertion .and. all(result(:,j) .eqv. result_def(:,j))
      88             :         end do
      89          24 :         call report()
      90          24 :         call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare vector complex values.")
      91             : 
      92             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      93             : 
      94         744 :         call setUnifRand(mat1(:,:))
      95         744 :         call setUnifRand(mat2(:,:))
      96        1464 :         result(:,:) = mat1(:,:) COMPARES_WITH mat2(:,:)
      97         744 :         result_def(:,:) = mat1(:,:)%re COMPARES_WITH_DEF mat2(:,:)%re .or. mat1(:,:)%im COMPARES_WITH_DEF mat2(:,:)%im
      98         744 :         assertion = assertion .and. all(result(:,:) .eqv. result_def(:,:))
      99          24 :         call report()
     100          24 :         call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare matrix complex values.")
     101             : 
     102             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     103             : 
     104             :     contains
     105             : 
     106             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     107             : 
     108          72 :         subroutine report()
     109          72 :             if (test%traceable .and. .not. assertion) then
     110             :                 ! LCOV_EXCL_START
     111             :                 loopOverRows: do j = 1, NP
     112             :                     do i = 1, NP
     113             :                         if (result(i,j) .neqv. result_def(i,j)) then
     114             :                             write(test%disp%unit,"(*(g0,:,', '))")
     115             :                             write(test%disp%unit,"(*(g0,:,', '))") "mat1(i,j)   ", mat1(i,j)
     116             :                             write(test%disp%unit,"(*(g0,:,', '))") "mat2(i,j)   ", mat2(i,j)
     117             :                             write(test%disp%unit,"(*(g0,:,', '))")
     118             :                             exit loopOverRows
     119             :                         end if
     120             :                     end do
     121             :                 end do loopOverRows
     122             :                 ! LCOV_EXCL_STOP
     123             :             end if
     124          72 :         end subroutine
     125             : 
     126             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     127             : 
     128             : #undef COMPARES_WITH_DEF
     129             : #undef COMPARES_WITH

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024