Class: ODDB::MedData::EanFactoryTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/meddata/test/test_ean_factory.rb

Instance Method Summary collapse

Instance Method Details

#test_clarifyObject



19
20
21
22
23
24
25
26
27
28
# File 'ext/meddata/test/test_ean_factory.rb', line 19

def test_clarify
	factory = EanFactory.new('7601001', 10)
	assert_equal('7601001', factory.next)
	assert_equal('76010010', factory.clarify)
	assert_equal('760100100', factory.clarify)
	## add checksum
	assert_equal('7601001001', factory.clarify)
	## call next
	assert_equal('760100101', factory.clarify)
end

#test_clarify__next_levelObject



29
30
31
32
33
34
35
36
# File 'ext/meddata/test/test_ean_factory.rb', line 29

def test_clarify__next_level
	factory = EanFactory.new('7601001')
	assert_equal('7601001', factory.next)
	assert_equal('76010010', factory.clarify)
	8.times { factory.next }
	assert_equal('76010019', factory.next)
	assert_equal('7601002', factory.next)
end

#test_nextObject



13
14
15
16
17
18
# File 'ext/meddata/test/test_ean_factory.rb', line 13

def test_next
	factory = EanFactory.new('7601001')
	assert_equal('7601001', factory.next)
	assert_equal('7601002', factory.next)
	assert_equal('7601003', factory.next)
end