Sha256: 0a7df43a275412c3b9343e0115eb78cb005956f7a5551301aa150b75a654a9f4

Contents?: true

Size: 1.97 KB

Versions: 219

Compression:

Stored size: 1.97 KB

Contents

$:.unshift File.join(File.dirname(__FILE__),"..","lib")

require 'test/unit'
require 'rgen/ecore/ecore'
require 'rgen/array_extensions'

class ECoreSelfTest < Test::Unit::TestCase
  include RGen::ECore
  
  def test_simple
    assert_equal \
      %w(lowerBound ordered unique upperBound many required eType).sort,
      ETypedElement.ecore.eStructuralFeatures.name.sort
      
    assert_equal \
      EClassifier.ecore,
      ETypedElement.ecore.eStructuralFeatures.find{|f| f.name=="eType"}.eType
    assert_equal %w(ENamedElement), ETypedElement.ecore.eSuperTypes.name

    assert_equal \
      EModelElement.ecore,
      EModelElement.ecore.eStructuralFeatures.find{|f| f.name=="eAnnotations"}.eOpposite.eType

    assert_equal \
      %w(eType),
      ETypedElement.ecore.eReferences.name
      
    assert_equal \
      %w(lowerBound ordered unique upperBound many required).sort,
      ETypedElement.ecore.eAttributes.name.sort
      
    assert RGen::ECore.ecore.is_a?(EPackage)
    assert_equal "ECore", RGen::ECore.ecore.name
    assert_equal "RGen", RGen::ECore.ecore.eSuperPackage.name
    assert_equal %w(ECore), RGen.ecore.eSubpackages.name
    assert_equal\
      %w(EObject EModelElement EAnnotation ENamedElement ETypedElement 
        EStructuralFeature EAttribute EClassifier EDataType EEnum EEnumLiteral EFactory
        EOperation EPackage EParameter EReference EStringToStringMapEntry EClass 
        ETypeArgument EGenericType).sort,
      RGen::ECore.ecore.eClassifiers.name.sort
      
    assert_equal "false", EAttribute.ecore.eAllAttributes.
      find{|a|a.name == "derived"}.defaultValueLiteral
    assert_equal false, EAttribute.ecore.eAllAttributes.
      find{|a|a.name == "derived"}.defaultValue

    assert_nil EAttribute.ecore.eAllAttributes.
      find{|a|a.name == "defaultValueLiteral"}.defaultValueLiteral
    assert_nil EAttribute.ecore.eAllAttributes.
      find{|a|a.name == "defaultValueLiteral"}.defaultValue

  end
end

Version data entries

219 entries across 219 versions & 3 rubygems

Version Path
puppet-4.10.8-universal-darwin lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.7 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.7-x86-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.7-x64-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.7-universal-darwin lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.6 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.6-x86-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.6-x64-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.6-universal-darwin lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.5 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.5-x86-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.5-x64-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.5-universal-darwin lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.4 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.4-x86-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.4-x64-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.4-universal-darwin lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-retrospec-1.4.1 vendor/gems/puppet-4.5.2/lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.1 lib/puppet/vendor/rgen/test/ecore_self_test.rb
puppet-4.10.1-x86-mingw32 lib/puppet/vendor/rgen/test/ecore_self_test.rb