test_NameColumn.pf Source File


This file depends on

sourcefile~~test_namecolumn.pf~~EfferentGraph sourcefile~test_namecolumn.pf test_NameColumn.pf sourcefile~mapl_profiler.f90~2 MAPL_Profiler.F90 sourcefile~test_namecolumn.pf->sourcefile~mapl_profiler.f90~2

Source Code

module test_NameColumn
   use, intrinsic :: iso_fortran_env, only: REAL64
   use MAPL_Profiler
   use funit

contains


   @test
   subroutine test_one_timer()
      type (NameColumn) :: column
      type (MeterNode), target :: node
      integer, parameter :: WIDTH = 10
      character(:), allocatable :: header(:)

      node = MeterNode('all', AdvancedMeter(MpiTimerGauge()))
      column = NameColumn(width=WIDTH)

      ! Check proper padding.
      call column%get_header(header)
      @assertEqual(WIDTH, len(header))
      @assertEqual(WIDTH, len(column%get_row(node)))
      @assertEqual('Name      ',header(1))
      @assertEqual('all       ',column%get_row(node))
      
   end subroutine test_one_timer

   @test
   subroutine test_get_rows()
!C$      type (NameColumn) :: column
!C$      type (MeterNode), target :: node
!C$      integer, parameter :: WIDTH = 10
!C$      character(len=WIDTH) :: expected(3)
!C$      character(:), allocatable :: found(:)
!C$
!C$      node = MeterNode('all', AdvancedMeter(MpiTimerGauge()))
!C$      call node%add_child('t1', AdvancedMeter(MpiTimerGauge()))
!C$      call node%add_child('t2', AdvancedMeter(MpiTimerGauge()))
!C$
!C$      column = NameColumn(width=WIDTH)
!C$
!C$      expected(1) = 'all'
!C$      expected(2) = '--t1'
!C$      expected(3) = '--t2'
!C$
!C$      call column%get_rows(node, found)
!C$      do i = 1, 3
!C$         @assertEqual(expected(i), found(i))
!C$      end do
      
   end subroutine test_get_rows

end module test_NameColumn