Class: TestFachinfoDocParser10

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

Defined Under Namespace

Classes: ReplHandler

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1009

def setup
  #@filename = File.expand_path('data/doc/test.doc', 
  @filename = File.expand_path('data/doc/Tendro.doc', 
    File.dirname(__FILE__))
  @text_handler = ODDB::FiParse::FachinfoTextHandler.new
  @parser = Rwv2.create_parser(@filename)
  @parser.set_text_handler(@text_handler)
  @table_handler = @text_handler.table_handler
  @parser.set_table_handler(@table_handler)
  @parser.set_inline_replacement_handler(ReplHandler.new)
  @parser.parse
  #@text_handler.cutoff_fontsize = @text_handler.max_fontsize
  #@parser.parse
end

- (Object) test_composition10



1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1028

def test_composition10
  writer = @text_handler.writers.first
  chapter = writer.composition
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zusammensetzung', chapter.heading)
  assert_equal(2, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal(1, section.paragraphs.size)
  paragraph = section.paragraphs.first
  assert_instance_of(ODDB::Text::Paragraph, paragraph)
end

- (Object) test_galenic_form10



1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1040

def test_galenic_form10
  writer = @text_handler.writers.first
  chapter = writer.galenic_form
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal("Galenische Form und Wirkstoffmengen pro Einheit", 
               chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_match(/Tropfen\. 1 ml enth.*lt\:\n/, section.subheading)
  assert_equal(1, section.paragraphs.size)
end

- (Object) test_iksnrs10



1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1059

def test_iksnrs10
  writer = @text_handler.writers.first
  chapter = writer.iksnrs
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zulassungsnummer', chapter.heading)
  assert_equal(1, chapter.sections.size)
  assert_equal(1, chapter.sections.first.paragraphs.size)
  paragraph = chapter.sections.first.paragraphs.first
  assert_equal("47831  (Swissmedic)", paragraph.text)
end

- (Object) test_indications10



1052
1053
1054
1055
1056
1057
1058
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1052

def test_indications10
  writer = @text_handler.writers.first
  chapter = writer.indications
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_match(/Indikationen\/Anwendungsm.*glichkeiten/, chapter.heading)
  assert_equal(1, chapter.sections.size)
end

- (Object) test_name10



1023
1024
1025
1026
1027
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1023

def test_name10
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_equal("Tendro, Augentropfen\n", writer.name)
end

- (Object) test_registration_owner10



1069
1070
1071
1072
1073
1074
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1069

def test_registration_owner10
  writer = @text_handler.writers.first
  chapter = writer.registration_owner
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal('Zulassungsinhaberin', chapter.heading)
end