Ignore:
Timestamp:
Sep 24, 2009, 10:37:13 AM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

merged branches/0.5 to trunk

Location:
ruby/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk

  • ruby/trunk/lib/models/tests/rm/test_support.rb

    r268 r291  
    55class RM_Support_Definition_Test < Test::Unit::TestCase
    66    def test_constant
    7     assert_equal("\r", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::CR)
    8     assert_equal("\n", OpenEHR::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)
    99  end
    1010end
     
    1313class RM_Support_Identification_Test < Test::Unit::TestCase
    1414  def setup
     15<<<<<<< .working
    1516    assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")}
    1617    assert_nothing_raised(Exception){@object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)}
     
    2526    assert_nothing_raised(Exception){@version_tree_id = OpenEHR::RM::Support::Identification::Version_Tree_ID.new('1.2.3')}
    2627    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
    2742  end
    2843 
    2944  def test_init
    30     assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
    31     assert_instance_of OpenEHR::RM::Support::Identification::Object_Ref, @object_ref
    32     assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, @archetype_id
    33     assert_instance_of OpenEHR::RM::Support::Identification::Terminology_ID, @terminology_id
    34     assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
    35     assert_instance_of OpenEHR::RM::Support::Identification::Generic_ID, @generic_id
    36     assert_instance_of OpenEHR::RM::Support::Identification::UID_Based_ID, @uid_based_id
    37     assert_instance_of OpenEHR::RM::Support::Identification::Hier_Object_ID, @hier_object_id
    38     assert_instance_of OpenEHR::RM::Support::Identification::Locatable_Ref, @locatable_ref
    39     assert_instance_of OpenEHR::RM::Support::Identification::Party_Ref, @party_ref
    40     assert_instance_of OpenEHR::RM::Support::Identification::Access_Group_Ref, @access_group_ref
    41     assert_instance_of OpenEHR::RM::Support::Identification::Version_Tree_ID, @version_tree_id
    42     assert_instance_of OpenEHR::RM::Support::Identification::Object_Version_ID, @object_version_id
     45    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
    4358  end
    4459
     
    4964    assert_raise(ArgumentError){@object_id.value=nil}
    5065    assert_raise(ArgumentError){@object_id.value=""}
    51     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new}
    52     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new(nil)}
    53     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("")}
    54     assert_equal @object_id, OpenEHR::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")
    5570  end
    5671
     
    6075    assert_equal @object_id, @object_ref.id
    6176
    62     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new}
    63     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new(nil, 'ANY', @object_id)}
    64     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('', 'ANY', @object_id)}
    65     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', nil, @object_id)}
    66     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', '', @object_id)}
    67     assert_raise(ArgumentError){@object_ref = OpenEHR::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)}
    6883
    6984    assert_nothing_raised(Exception){@object_ref.namespace = 'terminology'}
     
    7994    assert_raise(ArgumentError){@object_ref.type = ''}
    8095
    81     assert_nothing_raised(Exception){@object_ref.id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5")}
    82     assert_equal OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5"), @object_ref.id
     96    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
    8398    assert_raise(ArgumentError){@object_ref.id = nil}
    8499  end
    85100
    86101  def test_archetype_id
     102<<<<<<< .working
    87103    assert_equal 'openEHR-EHR-SECTION.physical_examination-prenatal.v2', @archetype_id.value
    88104    assert_equal 'openEHR-EHR-SECTION', @archetype_id.qualified_rm_entity
     
    93109    assert_equal 'prenatal', @archetype_id.specialisation
    94110    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
    95169  end
    96170
     
    103177    assert_raise(ArgumentError){@terminology_id.value = ""}
    104178
    105     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new}
    106     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new(nil,'2008')}
    107     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('','02008')}
    108     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new("SNOMED", nil)}
    109     assert_nothing_raised(Exception){@terminology_id = OpenEHR::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")}
    110184
    111185    assert_equal "SNOMED", @terminology_id.name
     
    127201    assert_equal "openehr", @generic_id.scheme
    128202
    129     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new(nil, "openehr")}
    130     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("", "openehr")}
    131     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", nil)}
    132     assert_raise(ArgumentError){@generic_id = OpenEHR::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", "")}
    133207
    134208    assert_raise(ArgumentError){@generic_id.value = nil}
     
    149223    assert @uid_based_id.has_extension?
    150224
    151     assert_raise(ArgumentError){@uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new(nil)}
    152     assert_raise(ArgumentError){@uid_based_id = OpenEHR::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('')}
    153227    assert_raise(ArgumentError){@uid_based_id.value = nil}
    154228    assert_raise(ArgumentError){@uid_based_id.value = ''}
Note: See TracChangeset for help on using the changeset viewer.