Sha256: bbab3f47e75aa596690556b27c77683ff0928591b9b7521f5f8573c26a1e75c4

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

require 'simplecov'
SimpleCov.start do
	add_filter "/test/"	
end

require 'codemodels/java'
require 'json'
require 'test/unit'

include CodeModels

module TestHelper

def assert_class(expected_class,node)
	assert node.class==expected_class, "Node expected to have class #{expected_class} instead it has class #{node.class}"
end

def relative_path(path)
	File.join(File.dirname(__FILE__),path)
end

def read_test_data(filename)
	dir = File.dirname(__FILE__)
	dir = File.join(dir,'data')
	path = File.join(dir,filename)
	IO.read(path)
end

def assert_all_attrs(expected,c)
	actual = c.ecore.eAllAttributes
	assert_equal expected.count,actual.count,"Expected #{expected.count} attrs, found #{actual.count}"
	expected.each do |e|
		assert actual.find {|a| a.name==e}, "Attribute #{e} not found"	
	end
end

def assert_all_refs(expected,c)
	actual = c.ecore.eAllReferences
	assert_equal expected.count,actual.count,"Expected #{expected.count} refs, found #{actual.count}"
	expected.each do |e|
		assert actual.find {|a| a.name==e}, "Reference #{e} not found"	
	end
end

def assert_ref(c,name,type,many=false)
	ref = c.ecore.eAllReferences.find {|r| r.name==name}	
	assert_equal type.ecore.name,ref.eType.name
	assert_equal many, ref.many
end

def assert_attr(c,name,type,many=false)
	att = c.ecore.eAllAttributes.find {|a| a.name==name}	
	assert_equal type.name,att.eType.name
	assert_equal many, att.many
end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codemodels-java-0.2.3-java test/test_helper.rb
codemodels-java-0.2.2-java test/test_helper.rb
codemodels-java-0.2.1-java test/test_helper.rb
codemodels-java-0.2.0-java test/test_helper.rb