test_add_extension_spec Subroutine

public subroutine test_add_extension_spec()

Arguments

None

Calls

proc~~test_add_extension_spec~~CallsGraph proc~test_add_extension_spec test_add_extension_spec anyexceptions anyexceptions proc~test_add_extension_spec->anyexceptions assert_that assert_that proc~test_add_extension_spec->assert_that false false proc~test_add_extension_spec->false none~add_spec StateRegistry%add_spec proc~test_add_extension_spec->none~add_spec none~add_virtual_pt StateRegistry%add_virtual_pt proc~test_add_extension_spec->none~add_virtual_pt none~get_extension_family StateRegistry%get_extension_family proc~test_add_extension_spec->none~get_extension_family none~get_extensions~2 ExtensionFamily%get_extensions proc~test_add_extension_spec->none~get_extensions~2 none~get_spec StateItemExtension%get_spec proc~test_add_extension_spec->none~get_spec none~has_primary ExtensionFamily%has_primary proc~test_add_extension_spec->none~has_primary none~num_owned_items StateRegistry%num_owned_items proc~test_add_extension_spec->none~num_owned_items none~of~45 StateItemExtensionPtrVector%of proc~test_add_extension_spec->none~of~45 sourcelocation sourcelocation proc~test_add_extension_spec->sourcelocation true true proc~test_add_extension_spec->true interface~mapl_assert MAPL_Assert none~add_spec->interface~mapl_assert none~back~74 StateItemExtensionVector%back none~add_spec->none~back~74 none~has_virtual_pt StateRegistry%has_virtual_pt none~add_spec->none~has_virtual_pt none~link_extension StateRegistry%link_extension none~add_spec->none~link_extension none~push_back~67 StateItemExtensionVector%push_back none~add_spec->none~push_back~67 proc~mapl_return MAPL_Return none~add_spec->proc~mapl_return proc~mapl_verify MAPL_Verify none~add_spec->proc~mapl_verify none~add_virtual_pt->interface~mapl_assert none~add_virtual_pt->none~has_virtual_pt none~insert~321 VirtualPtFamilyMap%insert none~add_virtual_pt->none~insert~321 none~add_virtual_pt->proc~mapl_return none~at~337 VirtualPtFamilyMap%at none~get_extension_family->none~at~337 none~get_extension_family->proc~mapl_return none~get_extension_family->proc~mapl_verify none~of_size_kind~5 StateItemExtensionPtrVector%of_size_kind none~of~45->none~of_size_kind~5 none~at_rc~13 VirtualPtFamilyMap%at_rc none~at~337->none~at_rc~13 none~insert_pair~29 VirtualPtFamilyMap%insert_pair none~insert~321->none~insert_pair~29 none~link_extension->interface~mapl_assert none~link_extension->none~at~337 none~link_extension->none~has_virtual_pt none~link_extension->proc~mapl_return none~link_extension->proc~mapl_verify none~add_extension~2 ExtensionFamily%add_extension none~link_extension->none~add_extension~2 none~capacity~397 StateItemExtensionVector%capacity none~push_back~67->none~capacity~397 none~resize~134 StateItemExtensionVector%resize none~push_back~67->none~resize~134 at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

   subroutine test_add_extension_spec()
      type(StateRegistry), target :: r
      type(VirtualConnectionPt) :: x
      integer :: status
      type(ExtensionFamily), pointer :: family
      type(StateItemExtensionPtr), pointer :: wrapper
      class(StateItemSpec), pointer :: spec
      type(StateItemExtension), pointer :: extension
      type(StateItemExtensionPtrVector) :: extensions

      r = StateRegistry('A')
      x = VirtualConnectionPt(state_intent='import', short_name='x')
      call r%add_virtual_pt(x, _RC)

      call r%add_spec(x, MockItemSpec('x'), _RC)
      @assert_that(r%num_owned_items(), is(1))

      family => r%get_extension_family(x, _RC)
      @assert_that(associated(family), is(true()))
      @assert_that(family%has_primary(), is(false()))
      extensions = family%get_extensions()
      @assert_that(int(extensions%size()), is(1))
      wrapper => extensions%of(1)
      extension => wrapper%ptr
      spec => extension%get_spec()
      select type (spec)
      type is (MockItemSpec)
         @assert_that(spec%name, is('x'))
      class default
         @assert_that(1, is(0))
      end select

      call r%add_spec(x, MockItemSpec('y'), _RC)
      @assert_that(r%num_owned_items(), is(2))
      @assert_that(family%has_primary(), is(false()))
      extensions = family%get_extensions()
      @assert_that(int(extensions%size()), is(2))
      wrapper => extensions%of(2)
      extension => wrapper%ptr
      spec => extension%get_spec()
      select type (spec)
      type is (MockItemSpec)
         @assert_that(spec%name, is('y'))
      class default
         @assert_that(1, is(0))
      end select

   end subroutine test_add_extension_spec