Changeset 291 for ruby/trunk/lib/models/tests/rm/test_support.rb
- Timestamp:
- Sep 24, 2009, 10:37:13 AM (15 years ago)
- Location:
- ruby/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/ruby/branches/0.5 merged eligible /ruby/branches/0.5.0 165-168
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
ruby/trunk/lib/models/tests/rm/test_support.rb
r268 r291 5 5 class RM_Support_Definition_Test < Test::Unit::TestCase 6 6 def test_constant 7 assert_equal("\r", OpenE HR::RM::Support::Definition::OpenEHR_Definitions::CR)8 assert_equal("\n", OpenE HR::RM::Support::Definition::OpenEHR_Definitions::LF)7 assert_equal("\r", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::CR) 8 assert_equal("\n", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::LF) 9 9 end 10 10 end … … 13 13 class RM_Support_Identification_Test < Test::Unit::TestCase 14 14 def setup 15 <<<<<<< .working 15 16 assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")} 16 17 assert_nothing_raised(Exception){@object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)} … … 25 26 assert_nothing_raised(Exception){@version_tree_id = OpenEHR::RM::Support::Identification::Version_Tree_ID.new('1.2.3')} 26 27 assert_nothing_raised(Exception){@object_version_id = OpenEHR::RM::Support::Identification::Object_Version_ID.new('ABC::DEF::1.2.3')} 28 ======= 29 assert_nothing_raised(Exception){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.3")} 30 assert_nothing_raised(Exception){@object_ref = OpenEhr::RM::Support::Identification::ObjectRef.new('local', 'ANY', @object_id)} 31 assert_nothing_raised(Exception){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 32 assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10(2003)')} 33 assert_nothing_raised(Exception){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "openehr")} 34 assert_nothing_raised(Exception){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.3')} 35 assert_nothing_raised(Exception){@hier_object_id = OpenEhr::RM::Support::Identification::HierObjectId.new('0.0.4')} 36 assert_nothing_raised(Exception){@locatable_ref = OpenEhr::RM::Support::Identification::LocatableRef.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')} 37 assert_nothing_raised(Exception){@party_ref = OpenEhr::RM::Support::Identification::PartyRef.new('unknown', 'ORGANISATION', @object_id)} 38 assert_nothing_raised(Exception){@access_group_ref = OpenEhr::RM::Support::Identification::AccessGroupRef.new('unknown', 'ACCESS_GROUP', @object_id)} 39 assert_nothing_raised(Exception){@version_tree_id = OpenEhr::RM::Support::Identification::VersionTreeId.new('1.2.3')} 40 assert_nothing_raised(Exception){@object_version_id = OpenEhr::RM::Support::Identification::ObjectVersionId.new('ABC::DEF::1.2.3')} 41 >>>>>>> .merge-right.r168 27 42 end 28 43 29 44 def test_init 30 assert_instance_of OpenE HR::RM::Support::Identification::Object_ID, @object_id31 assert_instance_of OpenE HR::RM::Support::Identification::Object_Ref, @object_ref32 assert_instance_of OpenE HR::RM::Support::Identification::Archetype_ID, @archetype_id33 assert_instance_of OpenE HR::RM::Support::Identification::Terminology_ID, @terminology_id34 assert_instance_of OpenE HR::RM::Support::Identification::Object_ID, @object_id35 assert_instance_of OpenE HR::RM::Support::Identification::Generic_ID, @generic_id36 assert_instance_of OpenE HR::RM::Support::Identification::UID_Based_ID, @uid_based_id37 assert_instance_of OpenE HR::RM::Support::Identification::Hier_Object_ID, @hier_object_id38 assert_instance_of OpenE HR::RM::Support::Identification::Locatable_Ref, @locatable_ref39 assert_instance_of OpenE HR::RM::Support::Identification::Party_Ref, @party_ref40 assert_instance_of OpenE HR::RM::Support::Identification::Access_Group_Ref, @access_group_ref41 assert_instance_of OpenE HR::RM::Support::Identification::Version_Tree_ID, @version_tree_id42 assert_instance_of OpenE HR::RM::Support::Identification::Object_Version_ID, @object_version_id45 assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id 46 assert_instance_of OpenEhr::RM::Support::Identification::ObjectRef, @object_ref 47 assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeId, @archetype_id 48 assert_instance_of OpenEhr::RM::Support::Identification::TerminologyId, @terminology_id 49 assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id 50 assert_instance_of OpenEhr::RM::Support::Identification::GenericId, @generic_id 51 assert_instance_of OpenEhr::RM::Support::Identification::UidBasedId, @uid_based_id 52 assert_instance_of OpenEhr::RM::Support::Identification::HierObjectId, @hier_object_id 53 assert_instance_of OpenEhr::RM::Support::Identification::LocatableRef, @locatable_ref 54 assert_instance_of OpenEhr::RM::Support::Identification::PartyRef, @party_ref 55 assert_instance_of OpenEhr::RM::Support::Identification::AccessGroupRef, @access_group_ref 56 assert_instance_of OpenEhr::RM::Support::Identification::VersionTreeId, @version_tree_id 57 assert_instance_of OpenEhr::RM::Support::Identification::ObjectVersionId, @object_version_id 43 58 end 44 59 … … 49 64 assert_raise(ArgumentError){@object_id.value=nil} 50 65 assert_raise(ArgumentError){@object_id.value=""} 51 assert_raise(ArgumentError){@object_id = OpenE HR::RM::Support::Identification::Object_ID.new}52 assert_raise(ArgumentError){@object_id = OpenE HR::RM::Support::Identification::Object_ID.new(nil)}53 assert_raise(ArgumentError){@object_id = OpenE HR::RM::Support::Identification::Object_ID.new("")}54 assert_equal @object_id, OpenE HR::RM::Support::Identification::Object_ID.new("0.0.4")66 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new} 67 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new(nil)} 68 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("")} 69 assert_equal @object_id, OpenEhr::RM::Support::Identification::ObjectId.new("0.0.4") 55 70 end 56 71 … … 60 75 assert_equal @object_id, @object_ref.id 61 76 62 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new}63 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new(nil, 'ANY', @object_id)}64 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new('', 'ANY', @object_id)}65 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new('local', nil, @object_id)}66 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new('local', '', @object_id)}67 assert_raise(ArgumentError){@object_ref = OpenE HR::RM::Support::Identification::Archetype_ID.new('local', 'ANY', nil)}77 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new} 78 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, 'ANY', @object_id)} 79 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('', 'ANY', @object_id)} 80 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', nil, @object_id)} 81 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', '', @object_id)} 82 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', 'ANY', nil)} 68 83 69 84 assert_nothing_raised(Exception){@object_ref.namespace = 'terminology'} … … 79 94 assert_raise(ArgumentError){@object_ref.type = ''} 80 95 81 assert_nothing_raised(Exception){@object_ref.id = OpenE HR::RM::Support::Identification::Object_ID.new("0.0.5")}82 assert_equal OpenE HR::RM::Support::Identification::Object_ID.new("0.0.5"), @object_ref.id96 assert_nothing_raised(Exception){@object_ref.id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5")} 97 assert_equal OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5"), @object_ref.id 83 98 assert_raise(ArgumentError){@object_ref.id = nil} 84 99 end 85 100 86 101 def test_archetype_id 102 <<<<<<< .working 87 103 assert_equal 'openEHR-EHR-SECTION.physical_examination-prenatal.v2', @archetype_id.value 88 104 assert_equal 'openEHR-EHR-SECTION', @archetype_id.qualified_rm_entity … … 93 109 assert_equal 'prenatal', @archetype_id.specialisation 94 110 assert_equal 'v2', @archetype_id.version_id 111 ======= 112 assert_equal "0.0.5", @archetype_id.value 113 assert_nothing_raised(Exception){@archetype_id.value = "0.0.6"} 114 assert_equal "0.0.6", @archetype_id.value 115 assert_raise(ArgumentError){@archetype_id.value=nil} 116 assert_raise(ArgumentError){@archetype_id.value=""} 117 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new} 118 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 119 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 120 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 121 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 122 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", nil, "ehr_rm", "openehr","cholesterol","0.0.3")} 123 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")} 124 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")} 125 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")} 126 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", nil,"cholesterol","0.0.3")} 127 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")} 128 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr",nil ,"0.0.3")} 129 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")} 130 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)} 131 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")} 132 133 assert_equal "biochemistry result_cholesterol", @archetype_id.domain_concept 134 assert_nothing_raised(Exception){(@archetype_id.domain_concept = "biochemistry result_triglyceride")} 135 assert_equal "biochemistry result_triglyceride", @archetype_id.domain_concept 136 assert_raise(ArgumentError){@archetype_id.domain_concept = nil} 137 assert_raise(ArgumentError){@archetype_id.domain_concept = ""} 138 139 assert_equal "entry", @archetype_id.rm_name 140 assert_nothing_raised(Exception){@archetype_id.rm_name = "section"} 141 assert_equal "section", @archetype_id.rm_name 142 assert_raise(ArgumentError){@archetype_id.rm_name = nil} 143 assert_raise(ArgumentError){@archetype_id.rm_name = ""} 144 145 assert_equal "ehr_rm", @archetype_id.rm_entity 146 assert_nothing_raised(Exception){@archetype_id.rm_entity = "13606"} 147 assert_equal "13606", @archetype_id.rm_entity 148 assert_raise(ArgumentError){@archetype_id.rm_entity = nil} 149 assert_raise(ArgumentError){@archetype_id.rm_entity = ""} 150 151 assert_equal "openehr", @archetype_id.rm_originator 152 assert_nothing_raised(Exception){@archetype_id.rm_originator = "cen"} 153 assert_equal "cen", @archetype_id.rm_originator 154 assert_raise(ArgumentError){@archetype_id.rm_originator = nil} 155 assert_raise(ArgumentError){@archetype_id.rm_originator = ""} 156 157 assert_equal "cholesterol", @archetype_id.specialisation 158 assert_nothing_raised(Exception){@archetype_id.specialisation = "triglyceride"} 159 assert_equal "triglyceride", @archetype_id.specialisation 160 assert_raise(ArgumentError){@archetype_id.specialisation = nil} 161 assert_raise(ArgumentError){@archetype_id.specialisation = ""} 162 163 assert_equal "0.0.3", @archetype_id.version_id 164 assert_nothing_raised(Exception){@archetype_id.version_id = "0.0.7"} 165 assert_equal "0.0.7", @archetype_id.version_id 166 assert_raise(ArgumentError){@archetype_id.version_id = nil} 167 assert_raise(ArgumentError){@archetype_id.version_id = ""} 168 >>>>>>> .merge-right.r168 95 169 end 96 170 … … 103 177 assert_raise(ArgumentError){@terminology_id.value = ""} 104 178 105 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new}106 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new(nil,'2008')}107 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new('','02008')}108 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new("SNOMED", nil)}109 assert_nothing_raised(Exception){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new("SNOMED")}179 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new} 180 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new(nil,'2008')} 181 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('','02008')} 182 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED", nil)} 183 assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED")} 110 184 111 185 assert_equal "SNOMED", @terminology_id.name … … 127 201 assert_equal "openehr", @generic_id.scheme 128 202 129 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new(nil, "openehr")}130 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("", "openehr")}131 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("0.0.3", nil)}132 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("0.0.3", "")}203 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new(nil, "openehr")} 204 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("", "openehr")} 205 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", nil)} 206 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "")} 133 207 134 208 assert_raise(ArgumentError){@generic_id.value = nil} … … 149 223 assert @uid_based_id.has_extension? 150 224 151 assert_raise(ArgumentError){@uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new(nil)}152 assert_raise(ArgumentError){@uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new('')}225 assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new(nil)} 226 assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('')} 153 227 assert_raise(ArgumentError){@uid_based_id.value = nil} 154 228 assert_raise(ArgumentError){@uid_based_id.value = ''}
Note:
See TracChangeset
for help on using the changeset viewer.