The ParaMonte Documentation Website
Current view: top level - kernel/tests - Test_ParaMCMCRefinedChain_mod.f90 (source / functions) Hit Total Coverage
Test: ParaMonte 1.5.1 :: Serial Kernel - Code Coverage Report Lines: 32 32 100.0 %
Date: 2021-01-08 13:03:42 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!
       4             : !!!!   MIT License
       5             : !!!!
       6             : !!!!   ParaMonte: plain powerful parallel Monte Carlo library.
       7             : !!!!
       8             : !!!!   Copyright (C) 2012-present, The Computational Data Science Lab
       9             : !!!!
      10             : !!!!   This file is part of the ParaMonte library.
      11             : !!!!
      12             : !!!!   Permission is hereby granted, free of charge, to any person obtaining a
      13             : !!!!   copy of this software and associated documentation files (the "Software"),
      14             : !!!!   to deal in the Software without restriction, including without limitation
      15             : !!!!   the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16             : !!!!   and/or sell copies of the Software, and to permit persons to whom the
      17             : !!!!   Software is furnished to do so, subject to the following conditions:
      18             : !!!!
      19             : !!!!   The above copyright notice and this permission notice shall be
      20             : !!!!   included in all copies or substantial portions of the Software.
      21             : !!!!
      22             : !!!!   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      23             : !!!!   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      24             : !!!!   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
      25             : !!!!   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
      26             : !!!!   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
      27             : !!!!   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
      28             : !!!!   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      29             : !!!!
      30             : !!!!   ACKNOWLEDGMENT
      31             : !!!!
      32             : !!!!   ParaMonte is an honor-ware and its currency is acknowledgment and citations.
      33             : !!!!   As per the ParaMonte library license agreement terms, if you use any parts of
      34             : !!!!   this library for any purposes, kindly acknowledge the use of ParaMonte in your
      35             : !!!!   work (education/research/industry/development/...) by citing the ParaMonte
      36             : !!!!   library as described on this page:
      37             : !!!!
      38             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/ACKNOWLEDGMENT.md
      39             : !!!!
      40             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      41             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      42             : 
      43             : !>  \brief This module contains tests of the module [ParaMCMCRefinedChain_mod](@ref paramcmcrefinedchain_mod).
      44             : !>  \author Amir Shahmoradi
      45             : 
      46             : module Test_ParaMCMCRefinedChain_mod
      47             : 
      48             :     use Test_mod, only: Test_type, getLogFuncMVN
      49             :     use ParaMCMCRefinedChain_mod
      50             :     implicit none
      51             : 
      52             :     private
      53             :     public :: test_ParaMCMCRefinedChain
      54             : 
      55             :     type(Test_type) :: Test
      56             : 
      57             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      58             : 
      59             : contains
      60             : 
      61             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      62             : 
      63           1 :     subroutine test_ParaMCMCRefinedChain()
      64             :         implicit none
      65           1 :         Test = Test_type(moduleName=MODULE_NAME)
      66           1 :         call Test%run(test_getSkip4NewSampleSize_1, "test_getSkip4NewSampleSize_1")
      67           1 :         call Test%run(test_getSkip4NewSampleSize_2, "test_getSkip4NewSampleSize_2")
      68           1 :         call Test%run(test_getSkip4NewSampleSize_3, "test_getSkip4NewSampleSize_3")
      69           1 :         call Test%run(test_getSkip4NewSampleSize_4, "test_getSkip4NewSampleSize_4")
      70           1 :         call Test%finalize()
      71           1 :     end subroutine test_ParaMCMCRefinedChain
      72             : 
      73             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      74             : 
      75           1 :     function test_getSkip4NewSampleSize_1() result(assertion)
      76           1 :         use Constants_mod, only: IK
      77             :         implicit none
      78             :         logical                     :: assertion
      79             :         integer(IK), parameter      :: oldSampleSize = 10_IK
      80             :         integer(IK), parameter      :: newSampleSize = 3_IK
      81             :         integer(IK), parameter      :: skip4NewSampleSize_ref = 4_IK
      82             :         integer(IK)                 :: skip4NewSampleSize
      83           1 :         skip4NewSampleSize = getSkip4NewSampleSize(oldSampleSize,newSampleSize)
      84           1 :         assertion = skip4NewSampleSize == skip4NewSampleSize_ref
      85           1 :         if (Test%isDebugMode .and. .not. assertion) then
      86             :         ! LCOV_EXCL_START
      87             :             write(*,"(10(g0,:,', '))")
      88             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize_ref  ", skip4NewSampleSize_ref
      89             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize      ", skip4NewSampleSize
      90             :             write(*,"(10(g0,:,', '))")
      91             :             return
      92             :         end if
      93             :         ! LCOV_EXCL_STOP
      94           1 :     end function test_getSkip4NewSampleSize_1
      95             : 
      96             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      97             : 
      98           1 :     function test_getSkip4NewSampleSize_2() result(assertion)
      99           1 :         use Constants_mod, only: IK
     100             :         implicit none
     101             :         logical                     :: assertion
     102             :         integer(IK), parameter      :: oldSampleSize = 6_IK
     103             :         integer(IK), parameter      :: newSampleSize = 3_IK
     104             :         integer(IK), parameter      :: skip4NewSampleSize_ref = 2_IK
     105             :         integer(IK)                 :: skip4NewSampleSize
     106           1 :         skip4NewSampleSize = getSkip4NewSampleSize(oldSampleSize,newSampleSize)
     107           1 :         assertion = skip4NewSampleSize == skip4NewSampleSize_ref
     108           1 :         if (Test%isDebugMode .and. .not. assertion) then
     109             :         ! LCOV_EXCL_START
     110             :             write(*,"(10(g0,:,', '))")
     111             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize_ref  ", skip4NewSampleSize_ref
     112             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize      ", skip4NewSampleSize
     113             :             write(*,"(10(g0,:,', '))")
     114             :             return
     115             :         end if
     116             :         ! LCOV_EXCL_STOP
     117           1 :     end function test_getSkip4NewSampleSize_2
     118             : 
     119             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     120             : 
     121           1 :     function test_getSkip4NewSampleSize_3() result(assertion)
     122           1 :         use Constants_mod, only: IK
     123             :         implicit none
     124             :         logical                     :: assertion
     125             :         integer(IK), parameter      :: oldSampleSize = 3_IK
     126             :         integer(IK), parameter      :: newSampleSize = 3_IK
     127             :         integer(IK), parameter      :: skip4NewSampleSize_ref = 1_IK
     128             :         integer(IK)                 :: skip4NewSampleSize
     129           1 :         skip4NewSampleSize = getSkip4NewSampleSize(oldSampleSize,newSampleSize)
     130           1 :         assertion = skip4NewSampleSize == skip4NewSampleSize_ref
     131           1 :         if (Test%isDebugMode .and. .not. assertion) then
     132             :         ! LCOV_EXCL_START
     133             :             write(*,"(10(g0,:,', '))")
     134             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize_ref  ", skip4NewSampleSize_ref
     135             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize      ", skip4NewSampleSize
     136             :             write(*,"(10(g0,:,', '))")
     137             :             return
     138             :         end if
     139             :         ! LCOV_EXCL_STOP
     140           1 :     end function test_getSkip4NewSampleSize_3
     141             : 
     142             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     143             : 
     144           1 :     function test_getSkip4NewSampleSize_4() result(assertion)
     145           1 :         use Constants_mod, only: IK
     146             :         implicit none
     147             :         logical                     :: assertion
     148             :         integer(IK), parameter      :: oldSampleSize = 2_IK
     149             :         integer(IK), parameter      :: newSampleSize = 3_IK
     150             :         integer(IK)                 :: skip4NewSampleSize
     151           1 :         skip4NewSampleSize = getSkip4NewSampleSize(oldSampleSize,newSampleSize)
     152           1 :         assertion = skip4NewSampleSize < 0_IK
     153           1 :         if (Test%isDebugMode .and. .not. assertion) then
     154             :         ! LCOV_EXCL_START
     155             :             write(*,"(10(g0,:,', '))")
     156             :             write(*,"(10(g0,:,', '))") "skip4NewSampleSize      ", skip4NewSampleSize
     157             :             write(*,"(10(g0,:,', '))")
     158             :             return
     159             :         end if
     160             :         ! LCOV_EXCL_STOP
     161           1 :     end function test_getSkip4NewSampleSize_4
     162             : 
     163             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     164             : 
     165             : end module Test_ParaMCMCRefinedChain_mod

ParaMonte: Plain Powerful Parallel Monte Carlo Library 
The Computational Data Science Lab
© Copyright 2012 - 2021