test_accumulate Subroutine

public subroutine test_accumulate()

Arguments

None

Calls

proc~~test_accumulate~2~~CallsGraph proc~test_accumulate~2 test_accumulate assertequal assertequal proc~test_accumulate~2->assertequal none~accumulate~4 AdvancedMeter%accumulate proc~test_accumulate~2->none~accumulate~4 none~add_cycle AdvancedMeter%add_cycle proc~test_accumulate~2->none~add_cycle none~get_num_cycles AdvancedMeter%get_num_cycles proc~test_accumulate~2->none~get_num_cycles none~get_standard_deviation AdvancedMeter%get_standard_deviation proc~test_accumulate~2->none~get_standard_deviation none~get_total AdvancedMeter%get_total proc~test_accumulate~2->none~get_total none~reset~62 AdvancedMeter%reset proc~test_accumulate~2->none~reset~62 none~get_mean_cycle AdvancedMeter%get_mean_cycle none~add_cycle->none~get_mean_cycle none~get_mean_cycle->none~get_num_cycles

Source Code

   subroutine test_accumulate()
      type (AdvancedMeter) :: t, lap

      t = AdvancedMeter(MpiTimerGauge())
      lap = t

      call lap%add_cycle(increment=1._REAL64)
      call lap%add_cycle(increment=3._REAL64)

      ! Copy lap and verify state is as expected
      t = lap
      call lap%reset()
      @assertEqual(4., t%get_total())
      @assertEqual(1., t%get_standard_deviation())

      ! Use lap again and accumulate
      call lap%add_cycle(increment=2._REAL64)
      call lap%add_cycle(increment=4._REAL64)

      call t%accumulate(lap)
      @assertEqual(9., t%get_total())
      @assertEqual(4, t%get_num_cycles())

   end subroutine test_accumulate