test_next_trivial Subroutine

public subroutine test_next_trivial()

Arguments

None

Calls

proc~~test_next_trivial~~CallsGraph proc~test_next_trivial test_next_trivial assertfalse assertfalse proc~test_next_trivial->assertfalse asserttrue asserttrue proc~test_next_trivial->asserttrue next next proc~test_next_trivial->next none~begin~73 MeterNode%begin proc~test_next_trivial->none~begin~73

Source Code

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

      class (AbstractMeterNodeIterator), allocatable :: iter_1
      class (AbstractMeterNodeIterator), allocatable :: iter_2
      node = MeterNode('all', AdvancedMeter(MpiTimerGauge()))

      allocate(iter_1, source=node%begin())
      allocate(iter_2, source=node%begin())

      @assertTrue(iter_1 == iter_2)
      @assertFalse(iter_1 /= iter_2)
      @assertTrue(iter_1 /= node%end())
      @assertFalse(iter_1 == node%end())

      call iter_1%next()
      @assertTrue(iter_1 == node%end())
      @assertFalse(iter_1 == iter_2)
      @assertFalse(iter_1 == iter_2)
      @assertFalse(iter_2 == iter_1)
      @assertTrue(iter_1 /= iter_2)
      @assertTrue(iter_2 /= iter_1)
      
      call iter_2%next()
      @assertTrue(iter_2 == node%end())
      @assertFalse(iter_2 /= node%end())
      @assertTrue(iter_1 == iter_2)
      @assertFalse(iter_1 /= iter_2)

   end subroutine test_next_trivial