Test_BaseItemSpec.pf Source File


This file depends on

sourcefile~~test_baseitemspec.pf~~EfferentGraph sourcefile~test_baseitemspec.pf Test_BaseItemSpec.pf sourcefile~mockitemspec.f90 MockItemSpec.F90 sourcefile~test_baseitemspec.pf->sourcefile~mockitemspec.f90 sourcefile~abstractactionspec.f90 AbstractActionSpec.F90 sourcefile~mockitemspec.f90->sourcefile~abstractactionspec.f90 sourcefile~actualconnectionpt.f90 ActualConnectionPt.F90 sourcefile~mockitemspec.f90->sourcefile~actualconnectionpt.f90 sourcefile~actualptvector.f90 ActualPtVector.F90 sourcefile~mockitemspec.f90->sourcefile~actualptvector.f90 sourcefile~aspectcollection.f90 AspectCollection.F90 sourcefile~mockitemspec.f90->sourcefile~aspectcollection.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~mockitemspec.f90->sourcefile~errorhandling.f90 sourcefile~extensionaction.f90 ExtensionAction.F90 sourcefile~mockitemspec.f90->sourcefile~extensionaction.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~mockitemspec.f90->sourcefile~keywordenforcer.f90 sourcefile~multistate.f90 MultiState.F90 sourcefile~mockitemspec.f90->sourcefile~multistate.f90 sourcefile~nullaction.f90 NullAction.F90 sourcefile~mockitemspec.f90->sourcefile~nullaction.f90 sourcefile~stateitemaspect.f90 StateItemAspect.F90 sourcefile~mockitemspec.f90->sourcefile~stateitemaspect.f90 sourcefile~stateitemspec.f90 StateItemSpec.F90 sourcefile~mockitemspec.f90->sourcefile~stateitemspec.f90 sourcefile~typekindaspect.f90 TypekindAspect.F90 sourcefile~mockitemspec.f90->sourcefile~typekindaspect.f90 sourcefile~unitsaspect.f90 UnitsAspect.F90 sourcefile~mockitemspec.f90->sourcefile~unitsaspect.f90 sourcefile~variablespec.f90 VariableSpec.F90 sourcefile~mockitemspec.f90->sourcefile~variablespec.f90 sourcefile~verticalgrid.f90 VerticalGrid.F90 sourcefile~mockitemspec.f90->sourcefile~verticalgrid.f90

Source Code

! Test suite that focuses on methods implemented in base class StateItemSpec

! The tests made more sense in the previous adapter scheme.  With
! StateItemAspect, the tests are almost trivial.

module Test_BaseItemSpec
   use MockItemSpecMod
   use gftl2_StringVector
   use funit
   implicit none

contains

   @test
   ! Just needed for bootstrapping from older adapters => aspects
   subroutine get_aspect_empty()
      type(StringVector) :: aspect_names
      type(MockItemSpec) :: spec, goal

      spec = MockItemSpec(name='0')
      goal = MockItemSpec(name='0')

      aspect_names = spec%get_aspect_order(goal)
      associate ( expected => aspect_names%size() ) ! returns INT64
        @assert_that(int(expected), is(0))
      end associate

   end subroutine get_aspect_empty

   @test
   subroutine get_aspect_one()
      type(StringVector) :: aspect_names
      type(MockItemSpec) :: spec, goal

      spec = MockItemSpec(name='1')
      goal = MockItemSpec(name='0')

      aspect_names = spec%get_aspect_order(goal)
      associate ( expected => aspect_names%size() ) ! returns INT64
        @assert_that(int(expected), is(1))
      end associate

      @assertEqual(aspect_names%of(1), 'TYPEKIND')

   end subroutine get_aspect_one

   @test
   subroutine get_aspect_multi()
      type(StringVector) :: aspect_names
      type(MockItemSpec) :: spec, goal

      spec = MockItemSpec(name='3')
      goal = MockItemSpec(name='0')

      aspect_names = spec%get_aspect_order(goal)
      associate ( expected => aspect_names%size() ) ! returns INT64
        @assert_that(int(expected), is(2))
      end associate

      @assertEqual(aspect_names%of(1), 'TYPEKIND')
      @assertEqual(aspect_names%of(2), 'UNITS')

   end subroutine get_aspect_multi

end module Test_BaseItemSpec