test_equal_diff_attributes Subroutine

public subroutine test_equal_diff_attributes()

Arguments

None

Calls

proc~~test_equal_diff_attributes~2~~CallsGraph proc~test_equal_diff_attributes~2 test_equal_diff_attributes assertfalse assertfalse proc~test_equal_diff_attributes~2->assertfalse asserttrue asserttrue proc~test_equal_diff_attributes~2->asserttrue none~add_attribute~2 Variable%add_attribute proc~test_equal_diff_attributes~2->none~add_attribute~2 none~add_attribute_1d Variable%add_attribute_1d none~add_attribute~2->none~add_attribute_1d none~insert~76 StringAttributeMap%insert none~add_attribute_1d->none~insert~76 proc~mapl_return MAPL_Return none~add_attribute_1d->proc~mapl_return none~insert_pair~5 StringAttributeMap%insert_pair none~insert~76->none~insert_pair~5 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

Source Code

   subroutine test_equal_diff_attributes()
      type (Variable)  :: v1, v2
      type (UnlimitedEntity) :: const

      ! no init equal?
      @assertTrue(v1 == v2)

      const = UnlimitedEntity([0,1])
      v1 = Variable(type=pFIO_INT32, dimensions='x', const_value = const)
      v2 = v1

      call v1%add_attribute('attr1', 1)
      @assertFalse(v1 == v2)
      ! guard against missing extra items in v2
      @assertFalse(v2 == v1)

      call v1%add_attribute('attr2', 2.)
      call v2%add_attribute('attr2', 2.)
      call v2%add_attribute('attr1', 1)
      @assertTrue(v1 == v2)

      call v1%add_attribute('attr3', 'cat')
      call v2%add_attribute('attr3', 'dog')
      @assertFalse(v1 == v2)

   end subroutine test_equal_diff_attributes