https://www.cdslab.org/paramonte/fortran/2
Current view: top level - test - test_pm_dateTime.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 30 30 100.0 %
Date: 2024-04-08 03:18:57 Functions: 1 1 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 procedure implementations of the tests of [pm_dateTime](@ref pm_dateTime).
      19             : !>
      20             : !>  \fintest
      21             : !>
      22             : !>  \author
      23             : !>  \AmirShahmoradi, March 22, 2012, 2:21 PM, National Institute for Fusion Studies, The University of Texas at Austin
      24             : 
      25             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      26             : 
      27             : module test_pm_dateTime
      28             : 
      29             :     use pm_dateTime
      30             :     use pm_kind, only: LK
      31             :     use pm_test, only: test_type
      32             : 
      33             :     implicit none
      34             : 
      35             :     private
      36             :     public :: setTest
      37             :     type(test_type) :: test
      38             : 
      39             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      40             : 
      41             :     interface
      42             :         module function test_constructDateTimeInt() result(assertion); logical(LK) :: assertion; end function
      43             :         module function test_constructDateTimeStr() result(assertion); logical(LK) :: assertion; end function
      44             :         module function test_getDateTimeShifted() result(assertion); logical(LK) :: assertion; end function
      45             :         module function test_getDateTimeNewZone() result(assertion); logical(LK) :: assertion; end function
      46             :         module function test_getCountLeapYears() result(assertion); logical(LK) :: assertion; end function
      47             :         module function test_isLastDayInMonth() result(assertion); logical(LK) :: assertion; end function
      48             :         module function test_getDateTimeDiff() result(assertion); logical(LK) :: assertion; end function
      49             :         module function test_isValidDateTime() result(assertion); logical(LK) :: assertion; end function
      50             :         module function test_getMillisecond() result(assertion); logical(LK) :: assertion; end function
      51             :         module function test_getDateTimeUTC() result(assertion); logical(LK) :: assertion; end function
      52             :         module function test_getDateTime_1() result(assertion); logical(LK) :: assertion; end function
      53             :         module function test_getDateTime_2() result(assertion); logical(LK) :: assertion; end function
      54             :         module function test_getDateBefore() result(assertion); logical(LK) :: assertion; end function
      55             :         module function test_getOrdinalDay() result(assertion); logical(LK) :: assertion; end function
      56             :         module function test_getWeekNumber() result(assertion); logical(LK) :: assertion; end function
      57             :         module function test_getCountWeeks() result(assertion); logical(LK) :: assertion; end function
      58             :         module function test_getWeekDayISO() result(assertion); logical(LK) :: assertion; end function
      59             :         module function test_getDateAfter() result(assertion); logical(LK) :: assertion; end function
      60             :         module function test_getCountDays() result(assertion); logical(LK) :: assertion; end function
      61             :         module function test_getJulianDay() result(assertion); logical(LK) :: assertion; end function
      62             :         module function test_getWeekDate() result(assertion); logical(LK) :: assertion; end function
      63             :         module function test_isValidZone() result(assertion); logical(LK) :: assertion; end function
      64             :         module function test_getWeekYear() result(assertion); logical(LK) :: assertion; end function
      65             :         module function test_getWeekDay() result(assertion); logical(LK) :: assertion; end function
      66             :         module function test_isMorning() result(assertion); logical(LK) :: assertion; end function
      67             :         module function test_getZone() result(assertion); logical(LK) :: assertion; end function
      68             :     end interface
      69             : 
      70             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      71             : 
      72             : contains
      73             : 
      74             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      75             : 
      76           1 :     subroutine setTest()
      77             : 
      78             :         implicit none
      79             : 
      80           1 :         test = test_type(MODULE_NAME)
      81           1 :         call test%run(test_constructDateTimeInt, SK_"test_constructDateTimeInt")
      82           1 :         call test%run(test_constructDateTimeStr, SK_"test_constructDateTimeStr")
      83           1 :         call test%run(test_getDateTimeShifted, SK_"test_getDateTimeShifted")
      84           1 :         call test%run(test_getDateTimeNewZone, SK_"test_getDateTimeNewZone")
      85           1 :         call test%run(test_getCountLeapYears, SK_"test_getCountLeapYears")
      86           1 :         call test%run(test_isLastDayInMonth, SK_"test_isLastDayInMonth")
      87           1 :         call test%run(test_getDateTimeDiff, SK_"test_getDateTimeDiff")
      88           1 :         call test%run(test_isValidDateTime, SK_"test_isValidDateTime")
      89           1 :         call test%run(test_getMillisecond, SK_"test_getMillisecond")
      90           1 :         call test%run(test_getDateTimeUTC, SK_"test_getDateTimeUTC")
      91           1 :         call test%run(test_getDateTime_1, SK_"test_getDateTime_1")
      92           1 :         call test%run(test_getDateTime_2, SK_"test_getDateTime_2")
      93           1 :         call test%run(test_getDateAfter, SK_"test_getDateAfter")
      94           1 :         call test%run(test_getDateBefore, SK_"test_getDateBefore")
      95           1 :         call test%run(test_getWeekNumber, SK_"test_getWeekNumber")
      96           1 :         call test%run(test_getCountWeeks, SK_"test_getCountWeeks")
      97           1 :         call test%run(test_getWeekDayISO, SK_"test_getWeekDayISO")
      98           1 :         call test%run(test_getOrdinalDay, SK_"test_getOrdinalDay")
      99           1 :         call test%run(test_getCountDays, SK_"test_getCountDays")
     100           1 :         call test%run(test_getJulianDay, SK_"test_getJulianDay")
     101           1 :         call test%run(test_getWeekDate, SK_"test_getWeekDate")
     102           1 :         call test%run(test_getWeekYear, SK_"test_getWeekYear")
     103           1 :         call test%run(test_isValidZone, SK_"test_isValidZone")
     104           1 :         call test%run(test_getWeekDay, SK_"test_getWeekDay")
     105           1 :         call test%run(test_isMorning, SK_"test_isMorning")
     106           1 :         call test%run(test_getZone, SK_"test_getZone")
     107           1 :         call test%summarize()
     108             : 
     109           1 :     end subroutine setTest
     110             : 
     111             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     112             : 
     113             : !    function test_queryDateTime() result(assertion)
     114             : !
     115             : !        implicit none
     116             : !        logical(LK)         :: assertion
     117             : !        type(DateTime_type) :: DateTime
     118             : !
     119             : !        assertion = .true._LK
     120             : !
     121             : !        call DateTime%query()
     122             : !
     123             : !        if (test%traceable .and. .not. assertion) then
     124             : !            ! LCOV_EXCL_START
     125             : !            write(test%disp%unit,"(*(g0,:,' '))")
     126             : !            write(test%disp%unit,"(*(g0,:,' '))") "           date:", DateTime%date
     127             : !            write(test%disp%unit,"(*(g0,:,' '))") "           time:", DateTime%time
     128             : !            write(test%disp%unit,"(*(g0,:,' '))") "           zone:", DateTime%zone
     129             : !            write(test%disp%unit,"(*(g0,:,' '))") "        century:", DateTime%century
     130             : !            write(test%disp%unit,"(*(g0,:,' '))") "           year:", DateTime%year
     131             : !            write(test%disp%unit,"(*(g0,:,' '))") "          month:", DateTime%month
     132             : !            write(test%disp%unit,"(*(g0,:,' '))") "            day:", DateTime%day
     133             : !            write(test%disp%unit,"(*(g0,:,' '))") "           hour:", DateTime%hour
     134             : !            write(test%disp%unit,"(*(g0,:,' '))") "         minute:", DateTime%minute
     135             : !            write(test%disp%unit,"(*(g0,:,' '))") "         second:", DateTime%second
     136             : !            write(test%disp%unit,"(*(g0,:,' '))") "    millisecond:", DateTime%millisecond
     137             : !            write(test%disp%unit,"(*(g0,:,' '))") "         values:", DateTime%vals
     138             : !            write(test%disp%unit,"(*(g0,:,' '))") "fancyStyleBasic:", DateTime%fancyStyleBasic
     139             : !            write(test%disp%unit,"(*(g0,:,' '))") "     fancyStyle:", DateTime%fancyStyle
     140             : !            write(test%disp%unit,"(*(g0,:,' '))") 
     141             : !            ! LCOV_EXCL_STOP
     142             : !        end if
     143             : !
     144             : !    end function test_queryDateTime
     145             : !
     146             : !!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     147             : !
     148             : !    ! Test the equivalence of [getNiceDateTime()](@ref pm_dateTime::getnicedatetime) with
     149             : !    ! the output of the `fancyStyleBasic()` method of [DateTime_type](@ref pm_dateTime::dateTime_type).
     150             : !    function test_getNiceDateTime() result(assertion)
     151             : !
     152             : !        implicit none
     153             : !        logical(LK)                     :: assertion
     154             : !        type(DateTime_type)             :: DateTime
     155             : !        character(:, SK), allocatable   :: niceDateTime
     156             : !
     157             : !        call DateTime%query()
     158             : !        niceDateTime = getNiceDateTime()
     159             : !        assertion = niceDateTime == DateTime%fancyStyleBasic
     160             : !
     161             : !        if (test%traceable .and. .not. assertion) then
     162             : !        ! LCOV_EXCL_START
     163             : !            write(test%disp%unit,"(*(g0,:,' '))")
     164             : !            write(test%disp%unit,"(*(g0,:,' '))") "       getNiceDateTime():", niceDateTime
     165             : !            write(test%disp%unit,"(*(g0,:,' '))") "DateTime%fancyStyleBasic:", DateTime%fancyStyleBasic
     166             : !            write(test%disp%unit,"(*(g0,:,' '))")
     167             : !        end if
     168             : !        ! LCOV_EXCL_STOP
     169             : !
     170             : !#if !CODECOV_ENABLED
     171             : !        assertion = .true._LK
     172             : !#endif
     173             : !    end function test_getNiceDateTime
     174             : 
     175             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     176             : 
     177             : end module test_pm_dateTime ! LCOV_EXCL_LINE

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