test_node_reset Subroutine

public subroutine test_node_reset()

Arguments

None

Calls

proc~~test_node_reset~~CallsGraph proc~test_node_reset test_node_reset add_cycle add_cycle proc~test_node_reset->add_cycle assertequal assertequal proc~test_node_reset->assertequal none~add_child~5 MeterNode%add_child proc~test_node_reset->none~add_child~5 none~get_child~21 MeterNode%get_child proc~test_node_reset->none~get_child~21 none~get_inclusive~2 MeterNode%get_inclusive proc~test_node_reset->none~get_inclusive~2 none~get_meter~4 MeterNode%get_meter proc~test_node_reset->none~get_meter~4 none~reset~68 MeterNode%reset proc~test_node_reset->none~reset~68 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 get_total get_total none~get_inclusive~2->get_total none~begin~107 MeterNodeVector%begin none~reset~68->none~begin~107 none~get~187 MeterNodeVectorIterator%get none~reset~68->none~get~187 none~next~106 MeterNodeVectorIterator%next none~reset~68->none~next~106 reset reset none~reset~68->reset 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_node_reset()
      type (MeterNode) :: node

      class (AbstractMeter), pointer :: root_meter
      class (AbstractMeter), pointer :: submeter
      class (AbstractMeterNode), pointer :: child, grandchild

      node = MeterNode('all', AdvancedMeter(MpiTimerGauge()))
      call node%add_child('A', AdvancedMeter(MpiTimerGauge()))

      root_meter => node%get_meter()
      child => node%get_child('A')
      submeter => child%get_meter()

      call submeter%add_cycle(10.0_REAL64)
      
      call child%add_child('A1', AdvancedMeter(MpiTimerGauge()))
      call child%add_child('A2', AdvancedMeter(MpiTimerGauge()))

      grandchild => child%get_child('A1')
      submeter => grandchild%get_meter()
      call submeter%add_cycle(2.0_REAL64)

      grandchild => child%get_child('A2')
      submeter => grandchild%get_meter()
      call submeter%add_cycle(3.0_REAL64)
      
      call node%reset()

      @assertEqual(0, node%get_inclusive())
      @assertEqual(0, child%get_inclusive())
      @assertEqual(0, grandchild%get_inclusive())

   end subroutine test_node_reset