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