Class: TestFachinfoDocParser11

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



1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1082

def setup
  @filename = File.expand_path('data/doc/Yakona_d.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_composition11



1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1100

def test_composition11
  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_form11



1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1112

def test_galenic_form11
  writer = @text_handler.writers.first
  chapter = writer.galenic_form
  assert_instance_of(ODDB::Text::Chapter, chapter)
  assert_equal("Galenische Form und Wirkstoffmenge pro Einheit", 
               chapter.heading)
  assert_equal(1, chapter.sections.size)
  section = chapter.sections.first
  assert_instance_of(ODDB::Text::Section, section)
  assert_equal("1 Kapsel\n", section.subheading)
  assert_equal(1, section.paragraphs.size)
end

- (Object) test_iksnrs11



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1131

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

- (Object) test_indications11



1124
1125
1126
1127
1128
1129
1130
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1124

def test_indications11
  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_name11



1095
1096
1097
1098
1099
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1095

def test_name11
  assert_equal(1, @text_handler.writers.size)
  writer = @text_handler.writers.first
  assert_equal("Yakona-Hypericum\n", writer.name)
end

- (Object) test_registration_owner11



1141
1142
1143
1144
1145
1146
# File 'ext/fiparse/test/test_fachinfo_doc_parser.rb', line 1141

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