1 | require File.dirname(__FILE__) + '/test_helper.rb'
|
---|
2 |
|
---|
3 | class ADLParserTest < Test::Unit::TestCase
|
---|
4 | def setup
|
---|
5 | @parser = ::OpenEhr::ADL::Parser.new
|
---|
6 | end
|
---|
7 |
|
---|
8 | must "assert parser instance" do
|
---|
9 | assert_instance_of ::OpenEhr::ADL::Parser,@parser
|
---|
10 | end
|
---|
11 |
|
---|
12 |
|
---|
13 | must "openEHR-EHR-SECTION.reason_for_encounter.v1.adl be properly parsed" do
|
---|
14 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl")
|
---|
15 | assert_nothing_raised do
|
---|
16 | ast = @parser.parse(file, 'openEHR-EHR-SECTION.reason_for_encounter.v1')
|
---|
17 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
18 | assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, ast.ontology
|
---|
19 | end
|
---|
20 | end
|
---|
21 |
|
---|
22 | must "openEHR-EHR-CLUSTER.exam-uterus.v1.adl be properly parsed" do
|
---|
23 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-uterus.v1.adl")
|
---|
24 | assert_nothing_raised do
|
---|
25 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-uterus.v11')
|
---|
26 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
27 | end
|
---|
28 | end
|
---|
29 |
|
---|
30 | must "openEHR-EHR-SECTION.summary.v1.adl be properly parsed" do
|
---|
31 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.summary.v1.adl")
|
---|
32 | assert_nothing_raised do
|
---|
33 | ast = @parser.parse(file, 'openEHR-EHR-SECTION.summary.v1')
|
---|
34 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
35 | end
|
---|
36 | end
|
---|
37 |
|
---|
38 |
|
---|
39 | must "openEHR-EHR-ACTION.referral.v1.adl be properly parsed" do
|
---|
40 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.referral.v1.adl")
|
---|
41 | assert_nothing_raised do
|
---|
42 | ast = @parser.parse(file, 'openEHR-EHR-ACTION.referral.v1')
|
---|
43 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
44 | end
|
---|
45 | end
|
---|
46 |
|
---|
47 | must "openEHR-EHR-CLUSTER.auscultation-chest.v1.adl be properly parsed" do
|
---|
48 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl")
|
---|
49 | assert_nothing_raised do
|
---|
50 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation-chest.v1')
|
---|
51 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
52 | end
|
---|
53 | end
|
---|
54 |
|
---|
55 | must "openEHR-EHR-CLUSTER.auscultation.v1.adl be properly parsed" do
|
---|
56 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl")
|
---|
57 | assert_nothing_raised do
|
---|
58 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation.v1')
|
---|
59 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
60 | end
|
---|
61 | end
|
---|
62 |
|
---|
63 |
|
---|
64 | must "openEHR-EHR-CLUSTER.exam-abdomen.v1.adl be properly parsed" do
|
---|
65 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl")
|
---|
66 | assert_nothing_raised do
|
---|
67 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-abdomen.v1')
|
---|
68 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
69 | end
|
---|
70 | end
|
---|
71 |
|
---|
72 | must "openEHR-EHR-CLUSTER.exam-chest.v1.adl be properly parsed" do
|
---|
73 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl")
|
---|
74 | assert_nothing_raised do
|
---|
75 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-chest.v1')
|
---|
76 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
77 | end
|
---|
78 | end
|
---|
79 |
|
---|
80 | must "openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl be properly parsed" do
|
---|
81 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl")
|
---|
82 | assert_nothing_raised do
|
---|
83 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1')
|
---|
84 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
85 | end
|
---|
86 | end
|
---|
87 |
|
---|
88 | must "openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl be properly parsed" do
|
---|
89 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl")
|
---|
90 | assert_nothing_raised do
|
---|
91 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1')
|
---|
92 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
93 | end
|
---|
94 | end
|
---|
95 |
|
---|
96 | must "openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl be properly parsed" do
|
---|
97 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl")
|
---|
98 | assert_nothing_raised do
|
---|
99 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1')
|
---|
100 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
101 | end
|
---|
102 | end
|
---|
103 |
|
---|
104 | must "openEHR-EHR-CLUSTER.exam-generic.v1.adl be properly parsed" do
|
---|
105 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl")
|
---|
106 | assert_nothing_raised do
|
---|
107 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic.v1')
|
---|
108 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
109 | end
|
---|
110 | end
|
---|
111 |
|
---|
112 | must "openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl be properly parsed" do
|
---|
113 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
|
---|
114 | assert_nothing_raised do
|
---|
115 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
|
---|
116 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
117 | end
|
---|
118 | end
|
---|
119 |
|
---|
120 | must "openEHR-EHR-COMPOSITION.discharge.v1draft.adl be properly parsed" do
|
---|
121 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl")
|
---|
122 | assert_nothing_raised do
|
---|
123 | ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.discharge.v1draft')
|
---|
124 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
125 | end
|
---|
126 | end
|
---|
127 |
|
---|
128 |
|
---|
129 | must "openEHR-EHR-INSTRUCTION.medication.v1.adl be properly parsed" do
|
---|
130 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl")
|
---|
131 | assert_nothing_raised do
|
---|
132 | ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.medication.v1')
|
---|
133 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
134 | end
|
---|
135 | end
|
---|
136 |
|
---|
137 | must "openEHR-EHR-INSTRUCTION.referral.v1.adl be properly parsed" do
|
---|
138 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl")
|
---|
139 | assert_nothing_raised do
|
---|
140 | ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.referral.v1')
|
---|
141 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
142 | end
|
---|
143 | end
|
---|
144 |
|
---|
145 | must "openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl be properly parsed" do
|
---|
146 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl")
|
---|
147 | assert_nothing_raised do
|
---|
148 | ast = @parser.parse(file, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1')
|
---|
149 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
150 | end
|
---|
151 | end
|
---|
152 |
|
---|
153 |
|
---|
154 | must "openEHR-EHR-OBSERVATION.apgar.v1.adl be properly parsed" do
|
---|
155 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl")
|
---|
156 | assert_nothing_raised do
|
---|
157 | ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.apgar.v1')
|
---|
158 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
159 | end
|
---|
160 | end
|
---|
161 |
|
---|
162 | must "openEHR-EHR-SECTION.findings.v1.adl be properly parsed" do
|
---|
163 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.findings.v1.adl")
|
---|
164 | assert_nothing_raised do
|
---|
165 | ast = @parser.parse(file, 'openEHR-EHR-SECTION.findings.v1')
|
---|
166 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
167 | end
|
---|
168 | end
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 | # C_DV_QUANTITY parse error
|
---|
173 | must "openEHR-EHR-EVALUATION.adverse.v1.adl be properly parsed" do
|
---|
174 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-EVALUATION.adverse.v1.adl")
|
---|
175 | assert_nothing_raised do
|
---|
176 | ast = @parser.parse(file, 'openEHR-EHR-EVALUATION.adverse.v1')
|
---|
177 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
178 | end
|
---|
179 | end
|
---|
180 |
|
---|
181 | must "openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl be properly parsed" do
|
---|
182 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl")
|
---|
183 | assert_nothing_raised do
|
---|
184 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions-circumference.v1')
|
---|
185 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
186 | end
|
---|
187 | end
|
---|
188 |
|
---|
189 | must "openEHR-EHR-CLUSTER.dimensions.v1.adl be properly parsed" do
|
---|
190 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl")
|
---|
191 | assert_nothing_raised do
|
---|
192 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions.v1')
|
---|
193 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
194 | end
|
---|
195 | end
|
---|
196 |
|
---|
197 | must "openEHR-EHR-CLUSTER.exam-fetus.v1.adl be properly parsed" do
|
---|
198 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl")
|
---|
199 | assert_nothing_raised do
|
---|
200 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-fetus.v1')
|
---|
201 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
202 | end
|
---|
203 | end
|
---|
204 |
|
---|
205 | must "openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl be properly parsed" do
|
---|
206 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl")
|
---|
207 | assert_nothing_raised do
|
---|
208 | ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1')
|
---|
209 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
210 | end
|
---|
211 | end
|
---|
212 |
|
---|
213 | must "openEHR-EHR-OBSERVATION.body_mass_index.v1.adl be properly parsed" do
|
---|
214 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl")
|
---|
215 | assert_nothing_raised do
|
---|
216 | ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.body_mass_index.v1')
|
---|
217 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
218 | end
|
---|
219 | end
|
---|
220 |
|
---|
221 | must "openEHR-EHR-ACTION.imaging.v1.adl be properly parsed" do
|
---|
222 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.imaging.v1.adl")
|
---|
223 | assert_nothing_raised do
|
---|
224 | ast = @parser.parse(file, 'openEHR-EHR-ACTION.imaging.v1')
|
---|
225 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
226 | end
|
---|
227 | end
|
---|
228 |
|
---|
229 | must "openEHR-EHR-COMPOSITION.encounter.v1draft.adl be properly parsed" do
|
---|
230 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl")
|
---|
231 | assert_nothing_raised do
|
---|
232 | ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.encounter.v1draft')
|
---|
233 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
234 | end
|
---|
235 | end
|
---|
236 |
|
---|
237 | must "openEHR-EHR-ITEM_TREE.follow_up.v1draft.adl be properly parsed" do
|
---|
238 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.follow_up.v1draft.adl")
|
---|
239 | assert_nothing_raised do
|
---|
240 | ast = @parser.parse(file, 'openEHR-EHR-ITEM_TREE.follow_up.v1draft')
|
---|
241 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
242 | end
|
---|
243 | end
|
---|
244 |
|
---|
245 | must "openEHR-EHR-SECTION.vital_signs.v1.adl be properly parsed" do
|
---|
246 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.vital_signs.v1.adl")
|
---|
247 | assert_nothing_raised do
|
---|
248 | ast = @parser.parse(file, 'openEHR-EHR-SECTION.vital_signs.v1')
|
---|
249 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
250 | end
|
---|
251 | end
|
---|
252 |
|
---|
253 | must "openEHR-EHR-ITEM_TREE.medication-formulation.v1.adl be properly parsed" do
|
---|
254 | file = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.medication-formulation.v1.adl")
|
---|
255 | assert_nothing_raised do
|
---|
256 | ast = @parser.parse(file, 'openEHR-EHR-ITEM_TREE.medication-formulation.v1')
|
---|
257 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
258 | end
|
---|
259 | end
|
---|
260 |
|
---|
261 | must "adl-test-ENTRY.assumed_types.v1.adl be properly parsed" do
|
---|
262 | file = File.read("#{TEST_ROOT_DIR}/adl/adl-test-ENTRY.assumed_types.v1.adl")
|
---|
263 | assert_nothing_raised do
|
---|
264 | ast = @parser.parse(file, 'adl-test-ENTRY.assumed_types.v1')
|
---|
265 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
266 | end
|
---|
267 | end
|
---|
268 |
|
---|
269 | must "adl-test-ENTRY.basic_types.v1.adl be properly parsed" do
|
---|
270 | file = File.read("#{TEST_ROOT_DIR}/adl/adl-test-ENTRY.basic_types.v1.adl")
|
---|
271 | assert_nothing_raised do
|
---|
272 | ast = @parser.parse(file, 'adl-test-ENTRY.basic_types.v1')
|
---|
273 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
274 | end
|
---|
275 | end
|
---|
276 |
|
---|
277 |
|
---|
278 | must "adl-test-ENTRY.basic_types_fail.v1.adl be properly parsed" do
|
---|
279 | file = File.read("#{TEST_ROOT_DIR}/adl/adl-test-ENTRY.basic_types_fail.v1.adl")
|
---|
280 | assert_raise Racc::ParseError do
|
---|
281 | ast = @parser.parse(file, 'adl-test-ENTRY.basic_types_fail.v1')
|
---|
282 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
283 | end
|
---|
284 | end
|
---|
285 |
|
---|
286 | must "adl-test-ENTRY.most_minimal.v1.adl be properly parsed" do
|
---|
287 | file = File.read("#{TEST_ROOT_DIR}/adl/adl-test-ENTRY.most_minimal.v1.adl")
|
---|
288 | assert_nothing_raised do
|
---|
289 | ast = @parser.parse(file, 'adl-test-ENTRY.most_minimal.v1')
|
---|
290 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
291 | end
|
---|
292 | end
|
---|
293 |
|
---|
294 | must "adl-test-ENTRY.structure_test1.v1.adl be properly parsed" do
|
---|
295 | file = File.read("#{TEST_ROOT_DIR}/adl/adl-test-ENTRY.structure_test1.v1.adl")
|
---|
296 | assert_nothing_raised do
|
---|
297 | ast = @parser.parse(file, 'adl-test-ENTRY.structure_test1.v1')
|
---|
298 | assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeID, ast.archetype_id
|
---|
299 | end
|
---|
300 | end
|
---|
301 | end
|
---|