test_depth_2 Subroutine

public subroutine test_depth_2()

Arguments

None

Calls

proc~~test_depth_2~~CallsGraph proc~test_depth_2 test_depth_2 add_cycle add_cycle proc~test_depth_2->add_cycle assertequal assertequal proc~test_depth_2->assertequal get_total get_total proc~test_depth_2->get_total next next proc~test_depth_2->next none~add_child~5 MeterNode%add_child proc~test_depth_2->none~add_child~5 none~begin~106 MeterNode%begin proc~test_depth_2->none~begin~106 none~get_child~21 MeterNode%get_child proc~test_depth_2->none~get_child~21 none~get_meter~4 MeterNode%get_meter proc~test_depth_2->none~get_meter~4 none~find_child MeterNode%find_child none~add_child~5->none~find_child none~get_depth~3 MeterNode%get_depth none~add_child~5->none~get_depth~3 none~push_back~62 MeterNodeVector%push_back none~add_child~5->none~push_back~62 none~at~304 MeterNodeVector%at none~get_child~21->none~at~304 none~get_child~21->none~find_child none~at_32~56 MeterNodeVector%at_32 none~at~304->none~at_32~56 none~find_child->none~at~304 none~capacity~367 MeterNodeVector%capacity none~push_back~62->none~capacity~367 none~resize~124 MeterNodeVector%resize none~push_back~62->none~resize~124 none~at_size_kind~62 MeterNodeVector%at_size_kind none~at_32~56->none~at_size_kind~62 none~resize_32~56 MeterNodeVector%resize_32 none~resize~124->none~resize_32~56

Source Code

   subroutine test_depth_2()
      type (MeterNode), target :: node

      class (AbstractMeterNodeIterator), allocatable :: iter
      class (AbstractMeterNode), pointer :: child, child_2
      class (AbstractMeter), pointer :: t
      integer :: count

      node = MeterNode('all', AdvancedMeter(MpiTimerGauge()))
      t => node%get_meter()
      call t%add_cycle(1.0_REAL64)

      call node%add_child('a', AdvancedMeter(MpiTimerGauge()))
      child => node%get_child('a')
      t => child%get_meter()
      call t%add_cycle(2.0_REAL64)

      call child%add_child('a_1', AdvancedMeter(MpiTimerGauge()))
      child_2 => child%get_child('a_1')
      t => child_2%get_meter()
      call t%add_cycle(3.0_REAL64)

      call child%add_child('a_2', AdvancedMeter(MpiTimerGauge()))
      child_2 => child%get_child('a_2')
      t => child_2%get_meter()
      call t%add_cycle(4.0_REAL64)

      call node%add_child('b', AdvancedMeter(MpiTimerGauge()))
      child => node%get_child('b')
      t => child%get_meter()
      call t%add_cycle(5.0_REAL64)

      call child%add_child('b_1', AdvancedMeter(MpiTimerGauge()))
      child_2 => child%get_child('b_1')
      t => child_2%get_meter()
      call t%add_cycle(6.0_REAL64)

      call child%add_child('b_2', AdvancedMeter(MpiTimerGauge()))
      child_2 => child%get_child('b_2')
      t => child_2%get_meter()
      call t%add_cycle(7.0_REAL64)

      call node%add_child('c', AdvancedMeter(MpiTimerGauge()))
      child => node%get_child('c')
      t => child%get_meter()
      call t%add_cycle(8.0_REAL64)


      count = 0
      allocate(iter, source=node%begin())
      do while (iter /= node%end())
         count = count + 1
         t => iter%get_meter()
         @assertEqual(count, t%get_total())
         call iter%next()
      end do

      @assertEqual(8, count)
      
   end subroutine test_depth_2