Changeset 167 for ruby/branches/0.5.0/lib/models/tests/rm/test_support.rb
- Timestamp:
- Aug 6, 2009, 1:20:05 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5.0/lib/models/tests/rm/test_support.rb
r158 r167 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 assert_nothing_raised(Exception){@object_id = OpenE HR::RM::Support::Identification::Object_ID.new("0.0.3")}16 assert_nothing_raised(Exception){@object_ref = OpenE HR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)}17 assert_nothing_raised(Exception){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}18 assert_nothing_raised(Exception){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new('ICD10(2003)')}19 assert_nothing_raised(Exception){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("0.0.3", "openehr")}20 assert_nothing_raised(Exception){@uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.3')}21 assert_nothing_raised(Exception){@hier_object_id = OpenE HR::RM::Support::Identification::Hier_Object_ID.new('0.0.4')}22 assert_nothing_raised(Exception){@locatable_ref = OpenE HR::RM::Support::Identification::Locatable_Ref.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')}23 assert_nothing_raised(Exception){@party_ref = OpenE HR::RM::Support::Identification::Party_Ref.new('unknown', 'ORGANISATION', @object_id)}24 assert_nothing_raised(Exception){@access_group_ref = OpenE HR::RM::Support::Identification::Access_Group_Ref.new('unknown', 'ACCESS_GROUP', @object_id)}25 assert_nothing_raised(Exception){@version_tree_id = OpenE HR::RM::Support::Identification::Version_Tree_ID.new('1.2.3')}26 assert_nothing_raised(Exception){@object_version_id = OpenE HR::RM::Support::Identification::Object_Version_ID.new('ABC::DEF::1.2.3')}15 assert_nothing_raised(Exception){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.3")} 16 assert_nothing_raised(Exception){@object_ref = OpenEhr::RM::Support::Identification::ObjectRef.new('local', 'ANY', @object_id)} 17 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")} 18 assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10(2003)')} 19 assert_nothing_raised(Exception){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "openehr")} 20 assert_nothing_raised(Exception){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.3')} 21 assert_nothing_raised(Exception){@hier_object_id = OpenEhr::RM::Support::Identification::HierObjectId.new('0.0.4')} 22 assert_nothing_raised(Exception){@locatable_ref = OpenEhr::RM::Support::Identification::LocatableRef.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')} 23 assert_nothing_raised(Exception){@party_ref = OpenEhr::RM::Support::Identification::PartyRef.new('unknown', 'ORGANISATION', @object_id)} 24 assert_nothing_raised(Exception){@access_group_ref = OpenEhr::RM::Support::Identification::AccessGroupRef.new('unknown', 'ACCESS_GROUP', @object_id)} 25 assert_nothing_raised(Exception){@version_tree_id = OpenEhr::RM::Support::Identification::VersionTreeId.new('1.2.3')} 26 assert_nothing_raised(Exception){@object_version_id = OpenEhr::RM::Support::Identification::ObjectVersionId.new('ABC::DEF::1.2.3')} 27 27 end 28 28 29 29 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_id30 assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id 31 assert_instance_of OpenEhr::RM::Support::Identification::ObjectRef, @object_ref 32 assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeId, @archetype_id 33 assert_instance_of OpenEhr::RM::Support::Identification::TerminologyId, @terminology_id 34 assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id 35 assert_instance_of OpenEhr::RM::Support::Identification::GenericId, @generic_id 36 assert_instance_of OpenEhr::RM::Support::Identification::UidBasedId, @uid_based_id 37 assert_instance_of OpenEhr::RM::Support::Identification::HierObjectId, @hier_object_id 38 assert_instance_of OpenEhr::RM::Support::Identification::LocatableRef, @locatable_ref 39 assert_instance_of OpenEhr::RM::Support::Identification::PartyRef, @party_ref 40 assert_instance_of OpenEhr::RM::Support::Identification::AccessGroupRef, @access_group_ref 41 assert_instance_of OpenEhr::RM::Support::Identification::VersionTreeId, @version_tree_id 42 assert_instance_of OpenEhr::RM::Support::Identification::ObjectVersionId, @object_version_id 43 43 end 44 44 … … 49 49 assert_raise(ArgumentError){@object_id.value=nil} 50 50 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")51 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new} 52 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new(nil)} 53 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("")} 54 assert_equal @object_id, OpenEhr::RM::Support::Identification::ObjectId.new("0.0.4") 55 55 end 56 56 … … 60 60 assert_equal @object_id, @object_ref.id 61 61 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)}62 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new} 63 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, 'ANY', @object_id)} 64 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('', 'ANY', @object_id)} 65 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', nil, @object_id)} 66 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', '', @object_id)} 67 assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', 'ANY', nil)} 68 68 69 69 assert_nothing_raised(Exception){@object_ref.namespace = 'terminology'} … … 79 79 assert_raise(ArgumentError){@object_ref.type = ''} 80 80 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.id81 assert_nothing_raised(Exception){@object_ref.id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5")} 82 assert_equal OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5"), @object_ref.id 83 83 assert_raise(ArgumentError){@object_ref.id = nil} 84 84 end … … 90 90 assert_raise(ArgumentError){@archetype_id.value=nil} 91 91 assert_raise(ArgumentError){@archetype_id.value=""} 92 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new}93 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}94 assert_raise(ArgumentError){@object_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}95 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}96 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}97 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", nil, "ehr_rm", "openehr","cholesterol","0.0.3")}98 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")}99 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")}100 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")}101 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", nil,"cholesterol","0.0.3")}102 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")}103 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr",nil ,"0.0.3")}104 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")}105 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)}106 assert_raise(ArgumentError){@archetype_id = OpenE HR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")}92 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new} 93 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 94 assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 95 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 96 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")} 97 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")} 98 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")} 99 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")} 100 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")} 101 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")} 102 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")} 103 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")} 104 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")} 105 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)} 106 assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")} 107 107 108 108 assert_equal "biochemistry result_cholesterol", @archetype_id.domain_concept … … 151 151 assert_raise(ArgumentError){@terminology_id.value = ""} 152 152 153 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new}154 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new(nil,'2008')}155 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new('','02008')}156 assert_raise(ArgumentError){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new("SNOMED", nil)}157 assert_nothing_raised(Exception){@terminology_id = OpenE HR::RM::Support::Identification::Terminology_ID.new("SNOMED")}153 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new} 154 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new(nil,'2008')} 155 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('','02008')} 156 assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED", nil)} 157 assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED")} 158 158 159 159 assert_equal "SNOMED", @terminology_id.name … … 175 175 assert_equal "openehr", @generic_id.scheme 176 176 177 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new(nil, "openehr")}178 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("", "openehr")}179 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("0.0.3", nil)}180 assert_raise(ArgumentError){@generic_id = OpenE HR::RM::Support::Identification::Generic_ID.new("0.0.3", "")}177 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new(nil, "openehr")} 178 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("", "openehr")} 179 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", nil)} 180 assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "")} 181 181 182 182 assert_raise(ArgumentError){@generic_id.value = nil} … … 197 197 assert @uid_based_id.has_extension? 198 198 199 assert_raise(ArgumentError){@uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new(nil)}200 assert_raise(ArgumentError){@uid_based_id = OpenE HR::RM::Support::Identification::UID_Based_ID.new('')}199 assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new(nil)} 200 assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('')} 201 201 assert_raise(ArgumentError){@uid_based_id.value = nil} 202 202 assert_raise(ArgumentError){@uid_based_id.value = ''}
Note:
See TracChangeset
for help on using the changeset viewer.