Index: ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl	(revision 290)
@@ -10,5 +10,5 @@
 		["name"] = <"Thomas Beale">
 		["organisation"] = <"Ocean Informatics">
-		["date"] = <"2005-10-10">
+		["date"] = <"10/10/2005">
 	>
 	details = <
Index: ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl	(revision 290)
@@ -25,5 +25,5 @@
         ["name"] = <"Sam Heard">
         ["organisation"] = <"Ocean Informatics">
-        ["date"] = <"2004-05-18">
+        ["date"] = <"18/05/2004">
         ["email"] = <"sam.heard@oceaninformatics.biz">
     >
@@ -45,8 +45,8 @@
         ["de"] = <
             language = <[ISO_639-1::de]>
-            purpose = <"Zur Dokumentation des Apgar Wertes oder Beurteilung f%Gï¿½%@r Neugeborene. Der zu Grunde liegende Zeitpunkt der Ereignisreihe ist immer die Geburt.">
-            use = <"Erm%Gï¿½%@glicht die Dokumentation des Wohlergehens des S%Gï¿½%@uglings 1, 2, 5 und/ oder 10 Minuten nach der Geburt. Die Summe kann einzeln dokumentiert werden - falls nur diese verf%Gï¿½%@gbar ist - es sollten aber alle f%Gï¿½%@nf Zahlenwerte vervollst%Gï¿½%@ndigt werden, damit die Summe errechnet werden kann. Die Gesamtsumme ist die Summe der f%Gï¿½%@nf Zahlenwerte (minimal 0, maximal 10).">
+            purpose = <"Zur Dokumentation des Apgar Wertes oder Beurteilung f%G�%@r Neugeborene. Der zu Grunde liegende Zeitpunkt der Ereignisreihe ist immer die Geburt.">
+            use = <"Erm%G�%@glicht die Dokumentation des Wohlergehens des S%G�%@uglings 1, 2, 5 und/ oder 10 Minuten nach der Geburt. Die Summe kann einzeln dokumentiert werden - falls nur diese verf%G�%@gbar ist - es sollten aber alle f%G�%@nf Zahlenwerte vervollst%G�%@ndigt werden, damit die Summe errechnet werden kann. Die Gesamtsumme ist die Summe der f%G�%@nf Zahlenwerte (minimal 0, maximal 10).">
             keywords = <"Apgar", "Neugeborenes", "Index", "Wert">
-            misuse = <"Nur teilweise Vervollst%Gï¿½%@ndigung der Werte und Addieren von weniger als f%Gï¿½%@nf Werten zur Gesamtsumme.">
+            misuse = <"Nur teilweise Vervollst%G�%@ndigung der Werte und Addieren von weniger als f%G�%@nf Werten zur Gesamtsumme.">
         >
     >
@@ -414,5 +414,5 @@
             items = <
                 ["at0000"] = <
-                    description = <"Klinischer Wert, abgeleitet von der Beurteilung der Atmung, der Hautfarbe, dem Muskeltonus, der Herzfrequenz und der Reaktion von Reflexen, %Gï¿½%@blicherweise 1, 5 und 10 Minuten nach der Geburt erhoben">
+                    description = <"Klinischer Wert, abgeleitet von der Beurteilung der Atmung, der Hautfarbe, dem Muskeltonus, der Herzfrequenz und der Reaktion von Reflexen, %G�%@blicherweise 1, 5 und 10 Minuten nach der Geburt erhoben">
                     text = <"Apgar Wert">
                 >
@@ -438,10 +438,10 @@
                 >
                 ["at0007"] = <
-                    description = <"Herzfrequenz von weniger als 100 Schl%Gï¿½%@gen pro Minute">
-                    text = <"Weniger als 100 Schl%Gï¿½%@ge pro Minute">
+                    description = <"Herzfrequenz von weniger als 100 Schl%G�%@gen pro Minute">
+                    text = <"Weniger als 100 Schl%G�%@ge pro Minute">
                 >
                 ["at0008"] = <
-                    description = <"Herzfrequenz von mehr als oder genau 100 Schl%Gï¿½%@gen pro Minute">
-                    text = <"Mehr als oder genau 100 Schl%Gï¿½%@ge pro Minute">
+                    description = <"Herzfrequenz von mehr als oder genau 100 Schl%G�%@gen pro Minute">
+                    text = <"Mehr als oder genau 100 Schl%G�%@ge pro Minute">
                 >
                 ["at0009"] = <
@@ -478,34 +478,34 @@
                 >
                 ["at0017"] = <
-                    description = <"Beurteilung der Reaktion des Neugeborenen auf die Absaugung der Nasenl%Gï¿½%@cher">
+                    description = <"Beurteilung der Reaktion des Neugeborenen auf die Absaugung der Nasenl%G�%@cher">
                     text = <"Reflexantwort">
                 >
                 ["at0018"] = <
-                    description = <"kein W%Gï¿½%@rgen oder keine Reaktion auf das Absaugen der Atemwege">
+                    description = <"kein W%G�%@rgen oder keine Reaktion auf das Absaugen der Atemwege">
                     text = <"Keine Reaktion auf die Absaugung der Atemwege">
                 >
                 ["at0019"] = <
                     description = <"Grimasse als einzige Reaktion auf das Absaugen der Atemwege">
-                    text = <"Grimasse w%Gï¿½%@hrend der Absaugung der Atemwege">
+                    text = <"Grimasse w%G�%@hrend der Absaugung der Atemwege">
                 >
                 ["at0020"] = <
-                    description = <"Grimasse und husten, niesen oder w%Gï¿½%@rgen als Reaktion auf die Absaugung der Atemwege">
-                    text = <"Grimasse und Husten/Niesen w%Gï¿½%@hrend der Absaugung der Atemwege ">
+                    description = <"Grimasse und husten, niesen oder w%G�%@rgen als Reaktion auf die Absaugung der Atemwege">
+                    text = <"Grimasse und Husten/Niesen w%G�%@hrend der Absaugung der Atemwege ">
                 >
                 ["at0021"] = <
-                    description = <"Die Farbe der Haut am K%Gï¿½%@rper, am Rumpf und an den Gliedern">
+                    description = <"Die Farbe der Haut am K%G�%@rper, am Rumpf und an den Gliedern">
                     text = <"Hautfarbe">
                 >
                 ["at0022"] = <
-                    description = <"Der K%Gï¿½%@rper ist blass oder blau gef%Gï¿½%@rbt">
-                    text = <"Gesamter K%Gï¿½%@rper ist blau oder blass">
+                    description = <"Der K%G�%@rper ist blass oder blau gef%G�%@rbt">
+                    text = <"Gesamter K%G�%@rper ist blau oder blass">
                 >
                 ["at0023"] = <
-                    description = <"Der K%Gï¿½%@rper ist rosig, H%Gï¿½%@nde und F%Gï¿½ï¿½%@e sind blass oder blau">
-                    text = <"Gesunde K%Gï¿½%@rperfarbe, blaue H%Gï¿½%@nde oder F%Gï¿½ï¿½%@e">
+                    description = <"Der K%G�%@rper ist rosig, H%G�%@nde und F%G��%@e sind blass oder blau">
+                    text = <"Gesunde K%G�%@rperfarbe, blaue H%G�%@nde oder F%G��%@e">
                 >
                 ["at0024"] = <
-                    description = <"Rosige oder gesunde F%Gï¿½%@rbung des gesamten K%Gï¿½%@rpers">
-                    text = <"Vollst%Gï¿½%@ndig gesunde oder rosige Farbe">
+                    description = <"Rosige oder gesunde F%G�%@rbung des gesamten K%G�%@rpers">
+                    text = <"Vollst%G�%@ndig gesunde oder rosige Farbe">
                 >
                 ["at0025"] = <
Index: ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl	(revision 290)
+++ ruby/branches/0.5/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl	(revision 290)
@@ -0,0 +1,162 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-OBSERVATION.body_mass_index.v1
+
+concept
+	[at0000]	-- Body mass index
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["email"] = <"sam.heard@oceaninformatics.com">
+		["date"] = <"22/03/2006">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To record the Body Mass Index (BMI) of a person.
+Body Mass Index is a calculated ratio describing how an individual's body weight relates to the weight that is regarded as normal, or desirable, for the individual's height. ">
+			use = <"Use to record the Body Mass Index of both adults and children.  
+Use to enter the Body Mass Index either manually (ie calculated and directly entered by the clinician), or automatically (ie calculation and entry is done automatically by a software application, based on separate height and weight measurements).
+Formulas: Body Mass Index is commonly calculated as weight (kg) / [height (m) squared]. This is the assumed formula unless otherwise specified in the Formula element within Protocol. Alternatively estimate Body Mass Index using pounds and inches: weight (lb) / [height (in) squared] x 703 (with ounces (oz) and fractions changed to decimal values).
+In some situations the Body Mass Index formula is corrected eg for use in amputees - this specific formula can be recorded as part of the protocol.  Alternatively the common Body Mass Index calculation can be used with amputees and similar injuries or disabilities if using adjusted height and/or adjusted weight, as appropriate, rather than actual height and weight.   See openEHR-EHR-OBSERVATION.height-adjusted and openEHR-EHR-OBSERVATION.body_weight-adjusted.
+See WHO reference re adjusting height/length for Body Mass Index in paediatrics. 
+In children and teens, BMI needs to be assessed using age-related reference charts. 
+">
+			keywords = <"obesity", "index", "body mass", "BMI", "anorexia", "Quetelet", "malnutrition", "failure to thrive", "bulimia">
+			misuse = <"Not intended to record information regarding Body Mass Index percentiles - these will be recorded in separate archetypes.">
+			copyright = <"copyright (c) 2009 openEHR Foundation">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <"Marja Buur, Medisch Centrum Alkmaar, Netherlands", "Rong Chen, Cambio Healthcare Systems, Sweden", "Angela de Zwart, Orion Health, New Zealand", "Paul Donaldson, Nursing Informatics Australia, Australia", "Sebastian Garde, Ocean Informatics, Germany", "Heather Grain, Llewelyn Grain Informatics, Australia", "Anne Harbison, CPCER, Australia", "Sam Heard, Ocean Informatics, Australia", "Andrew James, University of Toronto, Canada", "Shinji Kobayashi, Ehime University, Japan", "Heather Leslie, Ocean Informatics, Australia (Editor)", "Rikard Lovstrom, Swedish Medical Association, Sweden", "Ian McNicoll, Ocean Informatics, United Kingdom", "Jeroen Meintjens, Medisch Centrum Alkmaar, Netherlands", "Arturo Romero, SESCAM, Spain", "Soon Ghee Yap, Singapore Health Services Pte Ltd, Singapore">
+	other_details = <
+		["MD5-CAM-1.0.1"] = <"1605E211E9BFB4093A72CCE7A9792FF9">
+		["references"] = <"Clinical Guidelines on the Identification, Evaluation, and Treatment of Overweight and Obesity in Adults: The Evidence Report [Internet]. Bethesda (MD): National Heart, Lung, and Blood Institute; NIH Publication No. 98-4083, Sep 1998, [cited 2009 July 02]. Available from: http://www.nhlbi.nih.gov/guidelines/obesity/
+
+About BMI for Children and Teens [Internet]. Atlanta (GA): Division of Nutrition, Physical Activity and Obesity, Centers for Disease Control and Prevention; 2009 Jan 27 [cited 2009 Jul 28 ]. Available from: http://www.cdc.gov/healthyweight/assessing/bmi/childrens_BMI/about_childrens_BMI.html
+
+WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. [Internet] Geneva, Switzerland: WHO Multicentre Growth Reference Study Group, World Health Organization; 2006 [cited 2009 July 02].  Chapter 6, BMI-for-age standards. Available from: http://www.who.int/childgrowth/standards/Chap_6.pdf.
+
+Obesity: Preventing and Managing the Global Epidemic: Report of a WHO Consultation [Internet]. Geneva, Switzerland: World Health Organisation; 2000 [cited 2009 Jul 28]. Available from: http://www.who.int/nutrition/publications/obesity/WHO_TRS_894/en/index.html
+
+Tzamaloukas AH, Patron A, Malhotra D. Body Mass Index in Amputees. Journal of Parenteral and Enteral Nutrition [Internet]. 1994 [cited 2009 Jul 28]; 18 (4): 355. Available from: http://pen.sagepub.com/cgi/content/abstract/18/4/355">
+       >
+
+definition
+	OBSERVATION[at0000] matches {	-- Body mass index
+		data matches {
+			HISTORY[at0001] matches {	-- history
+				events cardinality matches {1..*; unordered} matches {
+					EVENT[at0002] occurrences matches {1..*} matches {	-- Any event
+						data matches {
+							ITEM_TREE[at0003] matches {	-- Single
+								items cardinality matches {1..*; unordered} matches {
+									ELEMENT[at0004] matches {	-- Body Mass Index
+										value matches {
+											C_DV_QUANTITY <
+												property = <[openehr::349]>
+												list = <
+													["1"] = <
+														units = <"kg/m2">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|1|>
+													>
+													["2"] = <
+														units = <"lb/in2">
+														magnitude = <|0.0..<1000.0|>
+														precision = <|1|>
+													>
+												>
+											>
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		protocol matches {
+			ITEM_LIST[at0005] matches {	-- List
+				items cardinality matches {0..*; ordered} matches {
+					ELEMENT[at0006] occurrences matches {0..1} matches {	-- Method
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0007, 	-- Automatic entry
+									at0008]	-- Direct entry
+								}
+							}
+						}
+					}
+					ELEMENT[at0010] occurrences matches {0..1} matches {	-- Formula
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0011] occurrences matches {0..1} matches {	-- Comment
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					text = <"Body mass index">
+					description = <"Calculated measurement which compares a person's weight and height.">
+				>
+				["at0001"] = <
+					text = <"history">
+					description = <"@ internal @">
+				>
+				["at0002"] = <
+					text = <"Any event">
+					description = <"Any timed recording of Body Mass Index.">
+				>
+				["at0003"] = <
+					text = <"Single">
+					description = <"@ internal @">
+				>
+				["at0004"] = <
+					text = <"Body Mass Index">
+					description = <"Index describing ratio of weight to height.">
+				>
+				["at0005"] = <
+					text = <"List">
+					description = <"@ internal @">
+				>
+				["at0006"] = <
+					text = <"Method">
+					description = <"The method of entering the Body Mass Index.">
+				>
+				["at0007"] = <
+					text = <"Automatic entry">
+					description = <"Body Mass Index calculated and entered automatically without user intervention.">
+				>
+				["at0008"] = <
+					text = <"Direct entry">
+					description = <"Body Mass Index calculated and entered directly by user.">
+				>
+				["at0010"] = <
+					text = <"Formula">
+					description = <"Formula used to derive the Body Mass Index.">
+				>
+				["at0011"] = <
+					text = <"Comment">
+					description = <"Comment about the Body Mass Index measurement eg noting that the measurements used were adjusted weight/height.">
+				>
+			>
+		>
+	>
Index: ruby/branches/0.5/lib/adl_parser/test/dparser_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/dparser_test.rb	(revision 169)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#$:.unshift File.join(File.dirname(__FILE__))
-
-require 'lib/dparser.rb'
-require 'test/unit'
-
-class DADLParserTest < Test::Unit::TestCase
-  def setup
-    @parser = ::OpenEHR::DADLParser.new
-  end
-
-  def test_init
-    assert_instance_of ::OpenEHR::DADLParser,@parser
-  end
-
-  def test_parse
-    dadl_line_break = File.read('tests/dadl_line_break.dadl')
-    assert_nothing_raised do
-      @parser.parse(dadl_line_break, 'dadl_line_break')
-    end
-  end
-
-end
Index: ruby/branches/0.5/lib/adl_parser/test/parser_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/parser_test.rb	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/parser_test.rb	(revision 290)
@@ -1,5 +1,3 @@
-#require 'lib/parser.rb'
-require 'lib/adl_parser.rb'
-require 'test/unit'
+require File.dirname(__FILE__) + '/test_helper.rb'
 
 class ADLParserTest < Test::Unit::TestCase
@@ -8,145 +6,228 @@
   end
 
-  def test_init
+  must "assert parser instance" do
     assert_instance_of ::OpenEHR::ADL::Parser,@parser
   end
 
-  def test_parse
-    laboratory_request = File.read('test/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
-    assert_nothing_raised do
-      result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
-      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
-      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
-      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
-#      assert_equal '', result.definition
-    end
-
-    apgar = File.read('test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl')
-    assert_nothing_raised do
-      result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
-      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
-      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
-      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
-    end
-
-    evaluation = File.read('test/adl/openEHR-EHR-EVALUATION.adverse.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(evaluation, 'openEHR-EHR-EVALUATION.adverse.v1.adl')
-    end
-
-
-
-    referral = File.read('test/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(referral, 'openEHR-EHR-ITEM_TREE.referral.v1.adl')
-    end
-
-    exam_fetus = File.read('test/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_fetus, 'openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
-    end
-
-    exam_uterine_cervix = File.read('test/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
-    end
-
-    imaging = File.read('test/adl/openEHR-EHR-ACTION.imaging.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1.adl')
-    end
-
-    exam_nervous_system = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
-    end
-    exam_generic = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_generic, 'openEHR-EHR-CLUSTER.exam-generic.v1.adl')
-    end
-    exam_generic_mass = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_generic_mass, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
-    end
-    exam_generic_lymphnode = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_generic_lymphnode, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
-    end
-    exam_generic_joint = File.read('test/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_generic_joint, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
-    end
-    exam_chest = File.read('test/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_chest, 'openEHR-EHR-CLUSTER.exam-chest.v1.adl')
-    end
-    exam_abdomen = File.read('test/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(exam_abdomen, 'openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
-    end
-    cluster_auscultation = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(cluster_auscultation, 'openEHR-EHR-CLUSTER.auscultation.v1.adl')
-    end
-    cluster_auscultation_chest = File.read('test/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(cluster_auscultation_chest, 'openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
-    end
-    vital_signs = File.read('test/adl/openEHR-EHR-SECTION.vital_signs.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(vital_signs, 'openEHR-EHR-SECTION.vital_signs.v1')
-    end
-    summary = File.read('test/adl/openEHR-EHR-SECTION.summary.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(summary, 'openEHR-EHR-SECTION.summary.v1.adl')
-    end
-
-    findings = File.read('test/adl/openEHR-EHR-SECTION.findings.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(findings, 'openEHR-EHR-SECTION.findings.v1.adl')
-    end
-
-    reason_for_encounter = File.read('test/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(reason_for_encounter, 'openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
-    end
-
-    imaging = File.read('test/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(imaging, 'openEHR-EHR-ITEM_TREE.imaging.v1.adl')
-    end
-    instruction_referral = File.read('test/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(instruction_referral, 'openEHR-EHR-INSTRUCTION.referral.v1.adl')
-    end
-    instruction_medication = File.read('test/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(instruction_medication, 'openEHR-EHR-INSTRUCTION.medication.v1.adl')
-    end
-    action_referral = File.read('test/adl/openEHR-EHR-ACTION.referral.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(action_referral, 'openEHR-EHR-ACTION.referral.v1.adl')
-    end
-
-    dimensions_circumference = File.read('test/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl')
-    assert_nothing_raised do
-      @parser.parse(dimensions_circumference, 'openEHR-EHR-CLUSTER.dimensions.v1.adl')
-    end
-
-    discharge = File.read('test/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
-    assert_nothing_raised do
-      @parser.parse(discharge, 'openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
-    end
-
-    encounter = File.read('test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
-    assert_nothing_raised do
-      @parser.parse(encounter, 'openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
-    end
-
-
-#     medication = File.read('test/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl')
-#     assert_nothing_raised do
-#       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl')
-#     end
-  end
+  must "test_archetype_id.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/test_archetype_id.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-SECTION.summary.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-ACTION.imaging.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.imaging.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-ACTION.imaging.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-ACTION.referral.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ACTION.referral.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-ACTION.referral.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.auscultation-chest.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation-chest.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.auscultation.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.auscultation.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+
+  must "openEHR-EHR-CLUSTER.exam-abdomen.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-abdomen.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-chest.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-chest.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-generic.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-generic.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-COMPOSITION.discharge.v1draft.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.discharge.v1draft')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-COMPOSITION.encounter.v1draft.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-COMPOSITION.encounter.v1draft')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-INSTRUCTION.medication.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.medication.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-INSTRUCTION.referral.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-INSTRUCTION.referral.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+
+  must "openEHR-EHR-OBSERVATION.apgar.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.apgar.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-SECTION.findings.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.findings.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-SECTION.findings.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+  must "openEHR-EHR-SECTION.reason_for_encounter.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-SECTION.reason_for_encounter.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+
+  must "openEHR-EHR-SECTION.vital_signs.v1.adl be properly parsed" do
+    file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-SECTION.vital_signs.v1.adl")
+    assert_nothing_raised do
+      ast = @parser.parse(file, 'openEHR-EHR-SECTION.vital_signs.v1')
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+    end
+  end
+
+
+# C_DV_QUANTITY parse error
+#   must "openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions-circumference.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+
+#   must "openEHR-EHR-CLUSTER.dimensions.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.dimensions.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+
+#   must "openEHR-EHR-CLUSTER.exam-fetus.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-fetus.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+
+#   must "openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+
+#   must "openEHR-EHR-EVALUATION.adverse.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-EVALUATION.adverse.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-EVALUATION.adverse.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+#   must "openEHR-EHR-OBSERVATION.body_mass_index.v1.adl be properly parsed" do
+#     file =  File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl")
+#     assert_nothing_raised do
+#       ast = @parser.parse(file, 'openEHR-EHR-OBSERVATION.body_mass_index.v1')
+#       assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, ast.archetype_id
+#     end
+#   end
+
+
 end
Index: ruby/branches/0.5/lib/adl_parser/test/scanner_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/scanner_test.rb	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/scanner_test.rb	(revision 290)
@@ -1,113 +1,105 @@
-require 'lib/adl_parser.rb'
-#require 'lib/scanner.rb'
-require 'test/unit'
+require File.dirname(__FILE__) + '/test_helper.rb'
 
-class YaparcParserTest < Test::Unit::TestCase
-  def test_RootScanner
-    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
-    assert_instance_of OpenEhr::ADL::Scanner::DADL::RootScanner,parser
-    result = parser.parse('')
+class ADLScannerTest < Test::Unit::TestCase
+  def setup
+    @scanner = OpenEHR::ADL::Scanner::ADLScanner.new([:adl], "filename")
   end
 
-  def test_V_LOCAL_TERM_CODE_REF
-    parser = OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
-    assert_instance_of OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
-    result = parser.parse('[en-us]')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert OpenEHR::ADL::Scanner::ADLScanner scanner instance" do
+    assert_instance_of OpenEHR::ADL::Scanner::ADLScanner, @scanner
   end
 
-  def test_V_QUALIFIED_TERM_CODE_REF
-    parser = OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
-    assert_instance_of OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
-    result = parser.parse('[ISO_639::en]')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('[ISO_639::en-us]')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert ADLScanner scanner scan CR and lineno incremented" do
+    lineno = @scanner.lineno
+    @scanner.scan("\n")
+    assert_equal lineno+1, @scanner.lineno
   end
 
-  def test_V_STRING
-    parser = OpenEhr::ADL::Scanner::Common::V_STRING.new
-    assert_instance_of OpenEhr::ADL::Scanner::Common::V_STRING,parser
-    result = parser.parse('"this is a string"')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('"en-us"')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert ADLScanner scanner scan ARCHETYPE_ID" do
+    lineno = @scanner.lineno
+    @scanner.scan("openEHR-EHR-OBSERVATION.body_mass_index.v1") do |sym, val|
+      assert_equal :V_ARCHETYPE_ID,sym
+      assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID,val
+    end
   end
 
-  def test_V_REAL
-    parser = OpenEhr::ADL::Scanner::Common::V_REAL.new
-    assert_instance_of OpenEhr::ADL::Scanner::Common::V_REAL,parser
-    result = parser.parse('0.1')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('0.0..20000.0')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:V_REAL, "0.0"], result.value
-    assert_equal "..20000.0", result.input
+  must "assert ADLScanner scanner scan white space and lineno unchanged" do
+    lineno = @scanner.lineno
+    @scanner.scan(" ")
+    assert_equal lineno, @scanner.lineno
   end
 
-  def test_V_ISO8601_DURATION
-    parser = OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
-    assert_instance_of OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION,parser
-    result = parser.parse('PT1M')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('PYMWDTHMS')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
+  must "assert ADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
+    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
+      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
+      assert_equal "ICD10AM(1998)::F23",val
+    end
+  end
+end
+
+class CADLScannerTest < Test::Unit::TestCase
+  def setup
+    @scanner = OpenEHR::ADL::Scanner::CADLScanner.new([:cadl], "filename")
   end
 
-  def test_V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
-    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
-    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
-    result = parser.parse('yyyy-??-??T??:??:??')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert OpenEHR::ADL::Scanner::CADLScanner scanner instance" do
+    assert_instance_of OpenEHR::ADL::Scanner::CADLScanner, @scanner
   end
 
-  def test_V_ISO8601_DATE_CONSTRAINT_PATTERN
-    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
-    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
-    result = parser.parse('yyyy-mm-XX-dd')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert CADLScanner scanner scan V_ATTRIBUTE_IDENTIFIER" do
+    lineno = @scanner.lineno
+    @scanner.scan("identifier") do |sym, val|
+      assert_equal :V_ATTRIBUTE_IDENTIFIER, sym
+      assert_equal "identifier", val
+    end
+    assert_equal lineno, @scanner.lineno
   end
 
-  def test_V_ISO8601_TIME_CONSTRAINT_PATTERN
-    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
-    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
-    result = parser.parse('hh:mm:ss:??')
-    assert_instance_of Yaparc::Result::OK, result
+  must "assert CADLScanner scanner scan reserved words" do
+    lineno = @scanner.lineno
+    @scanner.scan("then") do |sym, val|
+      assert_equal :SYM_THEN, sym
+    end
   end
 
-  def test_dadl_reserved
-    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
-    result = parser.parse('then')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('infinity')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:SYM_INFINITY, :SYM_INFINITY], result.value
+  must "assert CADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
+    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
+      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
+      assert_equal "ICD10AM(1998)::F23",val
+    end
   end
 
-  def test_cadl
-    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
-    assert_instance_of OpenEhr::ADL::Scanner::CADL::RootScanner,parser
-    result = parser.parse('PT1M')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:V_ISO8601_DURATION, "PT1M"], result.value
-    result = parser.parse('PYMWDTHMS')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
+  must "assert CADLScanner scanner scan V_ISO8601_DURATION" do
+    @scanner.scan("PT1M") do |sym, val|
+      assert_equal :V_ISO8601_DURATION,sym
+      assert_equal "PT1M",val
+    end
+  end
+end
+
+class DADLScannerTest < Test::Unit::TestCase
+  def setup
+    @scanner = OpenEHR::ADL::Scanner::DADLScanner.new([:dadl], "filename")
   end
 
-  def test_cadl_reserved
-    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
-    result = parser.parse('then')
-    assert_instance_of Yaparc::Result::OK, result
-    result = parser.parse('cardinality')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal [:SYM_CARDINALITY, :SYM_CARDINALITY], result.value
-    result = parser.parse('ordered')
-    assert_instance_of Yaparc::Result::OK, result
-    assert_equal "", result.input
-    assert_equal [:SYM_ORDERED, :SYM_ORDERED], result.value
+  must "assert DADLScanner scanner scan V_QUALIFIED_TERM_CODE_REF" do
+    @scanner.scan("[ICD10AM(1998)::F23]") do |sym, val|
+      assert_equal :V_QUALIFIED_TERM_CODE_REF,sym
+      assert_equal "ICD10AM(1998)::F23",val
+    end
   end
 
-  
+  must "assert DADLScanner scanner scan V_ISO8601_EXTENDED_DATE" do
+    @scanner.scan("2005-10-10") do |sym, val|
+      assert_equal :V_ISO8601_EXTENDED_DATE,sym
+      assert_equal "2005-10-10",val
+    end
+  end
+
+  must "assert DADLScanner scanner scan V_STRING" do
+    @scanner.scan("\"string\"") do |sym, val|
+      assert_equal :V_STRING,sym
+      assert_equal "string",val
+    end
+  end
 end
Index: ruby/branches/0.5/lib/adl_parser/test/semantic_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/semantic_test.rb	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/semantic_test.rb	(revision 290)
@@ -1,4 +1,3 @@
-require 'lib/adl_parser.rb'
-require 'test/unit'
+require File.dirname(__FILE__) + '/test_helper.rb'
 
 class ADLSemanticTest < Test::Unit::TestCase
@@ -7,5 +6,5 @@
   end
 
-  def test_init
+  must "assert adl parser instance" do
     assert_instance_of ::OpenEHR::ADL::Parser,@parser
   end
Index: ruby/branches/0.5/lib/adl_parser/test/shell_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/shell_test.rb	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/shell_test.rb	(revision 290)
@@ -1,4 +1,3 @@
-require 'lib/adl_parser.rb'
-require 'test/unit'
+require File.dirname(__FILE__) + '/test_helper.rb'
 
 class ShellADLValidatorTest < Test::Unit::TestCase
@@ -7,19 +6,19 @@
   end
 
-  def test_init
+  must "assert application validator instance" do
     assert_instance_of ::OpenEHR::Application::ADLValidator,@adl_validator
   end
 
-  def test_run
+
+  must "validating openEHR-EHR-CLUSTER.exam-nervous_system.v1 using File.open not raised" do
     assert_nothing_raised do
-      adl_file = File.open('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+      adl_file = File.open("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
       @adl_validator.run(adl_file)
     end
+  end
+
+  must "validating openEHR-EHR-CLUSTER.exam-nervous_system.v1 using File.read not raised" do
     assert_nothing_raised do
-      adl_string = File.open('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
-      @adl_validator.run(adl_string)
-    end
-    assert_nothing_raised do
-      adl_string = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+      adl_string = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
       stringio = StringIO.new(adl_string)
       @adl_validator.run(stringio)
Index: ruby/branches/0.5/lib/adl_parser/test/test_helper.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/test_helper.rb	(revision 290)
+++ ruby/branches/0.5/lib/adl_parser/test/test_helper.rb	(revision 290)
@@ -0,0 +1,28 @@
+require 'test/unit'
+
+TEST_ROOT_DIR = File.dirname(__FILE__)
+$LOAD_PATH << File.join(TEST_ROOT_DIR, '..', 'lib')
+require "rubygems"
+require 'adl_parser.rb'
+require 'adl_scanner.rb'
+require 'rm.rb'
+require 'am.rb'
+
+
+# c.f. "Ruby Best Practice",p.75
+module Test::Unit
+  class TestCase
+    def self.must(name, &block)
+      test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
+      defined = instance_method(test_name) rescue false
+      raise "#{test_name} is already defined in #{self}" if defined
+      if block_given?
+        define_method(test_name, &block)
+      else
+        define_method(test_name) do
+          flunk "No implementation provided for #{name}"
+        end
+      end
+    end
+  end
+end
Index: ruby/branches/0.5/lib/adl_parser/test/validator_test.rb
===================================================================
--- ruby/branches/0.5/lib/adl_parser/test/validator_test.rb	(revision 169)
+++ ruby/branches/0.5/lib/adl_parser/test/validator_test.rb	(revision 290)
@@ -1,4 +1,4 @@
-require 'lib/adl_parser.rb'
-require 'test/unit'
+require File.dirname(__FILE__) + '/test_helper.rb'
+
 
 class ADLValidatorTest < Test::Unit::TestCase
@@ -7,19 +7,17 @@
   end
 
-  def test_init
+  must "assert adl validator instance" do
     assert_instance_of ::OpenEHR::ADL::Validator,@validator
   end
 
-  def test_validate
-    exam_nervous_system = File.read('test/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+  must "assert validation openEHR-EHR-CLUSTER.exam-nervous_system.v1" do
+    exam_nervous_system = File.read("#{TEST_ROOT_DIR}/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl")
     assert_nothing_raised do
-      @validator.validate(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+      @validator.validate(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1')
     end
-
+  end
 #     exam_uterine_cervix = File.read('tests/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
 # #    assert_raise(Racc::ParseError) do
 #    @validator.validate(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
 # #    end
-
-  end
 end
