Changeset 291


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

merged branches/0.5 to trunk

Location:
ruby/trunk
Files:
19 deleted
33 edited
74 copied

Legend:

Unmodified
Added
Removed
  • ruby/trunk

  • ruby/trunk/CHANGELOG

    r164 r291  
     12009/08/28 Moving from Test::Unit to Rspec
     22009/08/04 branch 0.5 adjust on rails
    132009/07/22 Almost half of the specifications of the openEHR
    24           are implemented
  • ruby/trunk/COPYING

    r42 r291  
    11openEHR Open Source Software License
    22
    3 The openEHR Foundation uses the Mozilla Tri-license 1.1 on all software copyrighted to the Foundation. This licence essentially provides the user a choice of licence conditions under which to operate with any given piece of software, being: the Mozilla Public licence (MPL), and the Free Software Foundation GNU General Public Licence (GPL) and Lesser GNU Public Licence (LGPL). See the Mozilla relicensing FAQ for details of this license. This in no way constrains the way in which software created by other organisations is licenced.
     3The openEHR Foundation uses the Mozilla Tri-license 1.1 on all software
     4copyrighted to the Foundation. This licence essentially provides the user
     5a choice of licence conditions under which to operate with any given piece
     6of software, being: the Mozilla Public licence (MPL), and the Free Software
     7Foundation GNU General Public Licence (GPL) and Lesser GNU Public Licence
     8(LGPL). See the Mozilla relicensing FAQ for details of this license.
     9This in no way constrains the way in which software created by other
     10organisations is licenced.
  • ruby/trunk/bin/adl_validator.rb

    r49 r291  
    66require 'net/http'
    77
    8 module OpenEHR
     8module OpenEhr
    99  module CommandLine
    1010    class Arguments < Hash
     
    3939            when /\A(http:\/\/.*)/
    4040              name = $1
    41               input = case response = Net::HTTP.get_response(URI.parse($1))
     41              input = case response = Net::HTTP.get_response(Uri.parse($1))
    4242                      when Net::HTTPSuccess   
    4343                        response.body
     
    7373if __FILE__ == $0
    7474  begin
    75     arguments = OpenEHR::CommandLine::Arguments.new(ARGV)
    76     validator = OpenEHR::CommandLine::ADLValidator.new(arguments)
     75    arguments = OpenEhr::CommandLine::Arguments.new(ARGV)
     76    validator = OpenEhr::CommandLine::ADLValidator.new(arguments)
    7777    validator.run
    7878  end
  • ruby/trunk/lib/adl_parser/lib/adl_parser.rb

    r283 r291  
    1111require 'adl_exception.rb'
    1212
    13 module OpenEHR
     13module OpenEhr
    1414
    1515  if $DEBUG
  • ruby/trunk/lib/adl_parser/lib/adl_scanner.rb

  • ruby/trunk/lib/adl_parser/lib/parser.rb

    r283 r291  
    2020
    2121
    22 module OpenEHR
     22module OpenEhr
    2323  module ADL
    2424    class Parser < Racc::Parser
  • ruby/trunk/lib/adl_parser/lib/shell.rb

    r164 r291  
    33require 'stringio'
    44
    5 module OpenEHR
     5module OpenEhr
    66  module Application
    77    class Shell
  • ruby/trunk/lib/adl_parser/lib/validator.rb

    r49 r291  
    33
    44
    5 module OpenEHR
     5module OpenEhr
    66  module ADL
    77
  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-ACTION.imaging.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl

  • ruby/trunk/lib/adl_parser/test/adl/openEHR-EHR-SECTION.vital_signs.v1.adl

  • ruby/trunk/lib/models/rm

  • ruby/trunk/lib/models/rm/common/directory.rb

  • ruby/trunk/lib/models/rm/support/measurement.rb

  • ruby/trunk/lib/models/tests/rm/quantity/ts_date_time.rb

    r151 r291  
    11require 'test/unit'
    22require 'rm'
    3 include OpenEHR::RM::Data_Types::Quantity::Date_Time
     3include OpenEhr::RM::DataTypes::Quantity::DateTime
    44
    55class DateTimeTest < Test::Unit::TestCase
    66  def setup
    77    assert_nothing_raised(Exception){
    8       @dv_temporal = DV_Temporal.new('2008')}
     8      @dv_temporal = DvTemporal.new('2008')}
    99    assert_nothing_raised(Exception){
    10       @dv_date = DV_Date.new('2009-06-29')}
     10      @dv_date = DvDate.new('2009-06-29')}
    1111    assert_nothing_raised(Exception){
    12       @dv_time = DV_Time.new('12:34:56.78')}
     12      @dv_time = DvTime.new('12:34:56.78')}
    1313    assert_nothing_raised(Exception){
    14       @dv_date_time = DV_Date_Time.new('2009-06-29T12:34:56.78')}
     14      @dv_date_time = DvDateTime.new('2009-06-29T12:34:56.78')}
    1515    assert_nothing_raised(Exception){
    16       @dv_duration = DV_Duration.new('P1Y2M3W4DT5H6M7.8S')}
     16      @dv_duration = DvDuration.new('P1Y2M3W4DT5H6M7.8S')}
    1717  end
    1818
    1919  def test_init
    20     assert_instance_of DV_Temporal, @dv_temporal
    21     assert_instance_of DV_Date, @dv_date
    22     assert_instance_of DV_Time, @dv_time
    23     assert_instance_of DV_Date_Time, @dv_date_time
    24     assert_instance_of DV_Duration, @dv_duration
     20    assert_instance_of DvTemporal, @dv_temporal
     21    assert_instance_of DvDate, @dv_date
     22    assert_instance_of DvTime, @dv_time
     23    assert_instance_of DvDateTime, @dv_date_time
     24    assert_instance_of DvDuration, @dv_duration
    2525  end
    2626
     
    3636    assert_equal 29, @dv_date.day
    3737    assert_equal 733954, @dv_date.magnitude
    38     date2 = DV_Date.new('2009-07-08')
     38    date2 = DvDate.new('2009-07-08')
    3939    assert_equal 'P0Y0M1W9D',@dv_date.diff(date2).value
    40     date2 = DV_Date.new('2004-02-28')
    41     date3 = DV_Date.new('2004-03-01')
     40    date2 = DvDate.new('2004-02-28')
     41    date3 = DvDate.new('2004-03-01')
    4242    assert_equal 'P0Y0M0W2D', date2.diff(date3).value
    43     date4 = DV_Date.new('2003-12-31')
     43    date4 = DvDate.new('2003-12-31')
    4444    assert_equal 'P0Y1M4W28D', date2.diff(date4).value
    45     birthday = DV_Date.new('1970-04-19')
    46     assert_equal 'P39Y2M1W11D', birthday.diff(DV_Date.new('2009-06-30')).value
     45    birthday = DvDate.new('1970-04-19')
     46    assert_equal 'P39Y2M1W11D', birthday.diff(DvDate.new('2009-06-30')).value
    4747  end
    4848
     
    5454    assert_equal 0.78, @dv_time.fractional_second
    5555    assert_equal((12*60*60 + 34 * 60 + 56 + 0.78), @dv_time.magnitude)
    56     dv_time2 = DV_Time.new('15:36:48.05')
     56    dv_time2 = DvTime.new('15:36:48.05')
    5757    assert_equal 'P0Y0M0W0DT3H1M51.27S', @dv_time.diff(dv_time2).value
    5858  end
     
    6767    assert_equal 56, @dv_date_time.second
    6868    assert_equal 0.78, @dv_date_time.fractional_second
    69     dv_date_time2 = DV_Date_Time.new('1970-04-19T13:55:30.12')
     69    dv_date_time2 = DvDateTime.new('1970-04-19T13:55:30.12')
    7070    assert_equal 'P39Y2M1W9DT22H39M26.66S', @dv_date_time.diff(dv_date_time2).value
    7171  end
  • ruby/trunk/lib/models/tests/rm/test_common.rb

    r268 r291  
    33require 'rm'
    44
    5 include OpenEHR::RM::Data_Types::Text
    6 include OpenEHR::RM::Common::Resource
    7 include OpenEHR::RM::Common::Archetyped
    8 include OpenEHR::RM::Common::Generic
    9 include OpenEHR::RM::Common::Change_Control
    10 include OpenEHR::RM::Common::Directory
    11 include OpenEHR::RM::Support::Identification
    12 include OpenEHR::RM::Data_Types::Basic
    13 include OpenEHR::RM::Data_Types::Quantity
    14 include OpenEHR::RM::Data_Types::URI
     5include OpenEhr::RM::DataTypes::Text
     6include OpenEhr::RM::Common::Resource
     7include OpenEhr::RM::Common::Archetyped
     8include OpenEhr::RM::Common::Generic
     9include OpenEhr::RM::Common::ChangeControl
     10include OpenEhr::RM::Common::Directory
     11include OpenEhr::RM::Support::Identification
     12include OpenEhr::RM::DataTypes::Basic
     13include OpenEhr::RM::DataTypes::Quantity
     14include OpenEhr::RM::DataTypes::Uri
    1515
    1616class RM_Common_Resource_Test < Test::Unit::TestCase
    1717  def setup
    18     terminology_id = Terminology_ID.new('openehr')
    19     code_phrase = Code_Phrase.new('ja', terminology_id)   
    20     @translation_details = OpenEHR::RM::Common::Resource::Translation_Details.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'},
     18    terminology_id = TerminologyId.new('openehr')
     19    code_phrase = CodePhrase.new('ja', terminology_id)
     20    @translation_details = OpenEhr::RM::Common::Resource::TranslationDetails.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'},
    2121  :accreditation => 'jp', :other_details => {'ruby', 'test'})
    22     @authored_resource = OpenEHR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test")
    23     @resource_description_item = OpenEHR::RM::Common::Resource::Resource_Description_Item.new(:language => code_phrase,
     22    @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test")
     23    @resource_description_item = OpenEhr::RM::Common::Resource::ResourceDescriptionItem.new(:language => code_phrase,
    2424              :purpose => 'test',
    2525              :keywords => %w[test ruby],
     
    2929              :original_resource_uri => {'issuer', 'http://openehr.jp/'},
    3030              :other_details => {'samos', 'icicth7'})
    31     @resource_description = OpenEHR::RM::Common::Resource::Resource_Description.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'},
     31    @resource_description = OpenEhr::RM::Common::Resource::ResourceDescription.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'},
    3232    :lifecycle_state => 'experimental',
    3333    :details => {'ja', @resource_description_item},
     
    3636    :other_details => {'ja', 'shikoku'},
    3737    :parent_resource => @authored_resource)
    38     @authored_resource = OpenEHR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description)
     38    @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description)
    3939  end
    4040
    4141  def test_init
    42     assert_instance_of OpenEHR::RM::Common::Resource::Authored_Resource, @authored_resource
    43     assert_instance_of OpenEHR::RM::Common::Resource::Translation_Details, @translation_details
    44     assert_instance_of OpenEHR::RM::Common::Resource::Resource_Description_Item, @resource_description_item
    45     assert_instance_of OpenEHR::RM::Common::Resource::Resource_Description, @resource_description
     42    assert_instance_of OpenEhr::RM::Common::Resource::AuthoredResource, @authored_resource
     43    assert_instance_of OpenEhr::RM::Common::Resource::TranslationDetails, @translation_details
     44    assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescriptionItem, @resource_description_item
     45    assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescription, @resource_description
    4646  end
    4747
     
    8686class RM_Common_Archetyped_Test < Test::Unit::TestCase
    8787  def setup
     88<<<<<<< .working
    8889    @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('Test')
    8990    @uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.5')
     
    9293    assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
    9394    assert_nothing_raised(Exception){@link = OpenEHR::RM::Common::Archetyped::Link.new(OpenEHR::RM::Data_Types::Text::DV_Text.new("generic"), OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://test/"),OpenEHR::RM::Data_Types::Text::DV_Text.new("problem"))}
    94     assert_nothing_raised(Exception){
    95       @pathable = OpenEHR::RM::Common::Archetyped::Pathable.new }
    96     name = OpenEHR::RM::Data_Types::Text::DV_Text.new('blood')
     95=======
     96    @dv_text = OpenEhr::RM::DataTypes::Text::DvText.new('Test')
     97    @uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.5')
     98    @archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     99    @template_id = OpenEhr::RM::Support::Identification::TemplateId.new('1.0.1')
     100    assert_nothing_raised(Exception){@archetyped = OpenEhr::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
     101    assert_nothing_raised(Exception){@link = OpenEhr::RM::Common::Archetyped::Link.new(OpenEhr::RM::DataTypes::Text::DvText.new("generic"), OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://test/"),OpenEhr::RM::DataTypes::Text::DvText.new("problem"))}
     102>>>>>>> .merge-right.r168
     103    assert_nothing_raised(Exception){
     104      @pathable = OpenEhr::RM::Common::Archetyped::Pathable.new }
     105    name = OpenEhr::RM::DataTypes::Text::DvText.new('blood')
    97106    links = Set.new([@uid_based_id])
    98107    assert_nothing_raised(Exception){
     
    100109                                 :name => name,
    101110                                 :links => links)}
    102     provider = Party_Identified.new(:name => 'NERV')
    103     location = Party_Identified.new(:name => 'GEOFRONT')
    104     object_version_id = Object_Version_ID.new('ABC::DEF::1.3.4')
    105     party_ref = Party_Ref.new('local', 'ORGANISATION', object_id)
    106     assert_nothing_raised(Exception){
    107       @feeder_audit_details = Feeder_Audit_Details.new(:system_id => 'MAGI',
     111    provider = PartyIdentified.new(:name => 'NERV')
     112    location = PartyIdentified.new(:name => 'GEOFRONT')
     113    object_version_id = ObjectVersionId.new('ABC::DEF::1.3.4')
     114    party_ref = PartyRef.new('local', 'ORGANISATION', object_id)
     115    assert_nothing_raised(Exception){
     116      @feeder_audit_details = FeederAuditDetails.new(:system_id => 'MAGI',
    108117                                                       :provider => provider,
    109118                                                       :location => location,
    110                                                        :time => DV_Date_Time.new('2009-07-03T12:16:31'),
    111                                                        :subject => Party_Proxy.new(:external_ref => party_ref),
     119                                                       :time => DvDateTime.new('2009-07-03T12:16:31'),
     120                                                       :subject => PartyProxy.new(:external_ref => party_ref),
    112121                                                       :version_id => '0.0.4')}
    113     feeder_audit_details = Feeder_Audit_Details.new(:system_id => 'AKAGI')
    114     dv_identifier = DV_Identifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER')
    115     feeder_audit_details2 = Feeder_Audit_Details.new(:system_id => 'KATSURAGI')
    116     dv_identifier2 = DV_Identifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION')
    117     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    118     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    119 
    120     dv_encapsulated = OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated.new(charset, language, 10)
    121     assert_nothing_raised(Exception){
    122       @feeder_audit = Feeder_Audit.new(:originating_system_audit => feeder_audit_details,
     122    feeder_audit_details = FeederAuditDetails.new(:system_id => 'AKAGI')
     123    dv_identifier = DvIdentifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER')
     124    feeder_audit_details2 = FeederAuditDetails.new(:system_id => 'KATSURAGI')
     125    dv_identifier2 = DvIdentifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION')
     126    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     127    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     128
     129    dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)
     130    assert_nothing_raised(Exception){
     131      @feeder_audit = FeederAudit.new(:originating_system_audit => feeder_audit_details,
    123132                                       :originating_system_item_ids => [dv_identifier],
    124133                                       :feeder_system_audit => feeder_audit_details2,
     
    128137
    129138  def test_init
    130     assert_instance_of OpenEHR::RM::Common::Archetyped::Archetyped, @archetyped
    131     assert_instance_of OpenEHR::RM::Common::Archetyped::Link, @link
    132     assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable
    133     assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable
    134     assert_instance_of Feeder_Audit_Details, @feeder_audit_details
    135     assert_instance_of Feeder_Audit, @feeder_audit
     139    assert_instance_of OpenEhr::RM::Common::Archetyped::Archetyped, @archetyped
     140    assert_instance_of OpenEhr::RM::Common::Archetyped::Link, @link
     141    assert_instance_of OpenEhr::RM::Common::Archetyped::Pathable, @pathable
     142    assert_instance_of OpenEhr::RM::Common::Archetyped::Locatable, @locatable
     143    assert_instance_of FeederAuditDetails, @feeder_audit_details
     144    assert_instance_of FeederAudit, @feeder_audit
    136145  end
    137146
     
    144153    assert_nothing_raised(Exception){@archetyped.template_id = @template_id}
    145154    assert_equal @template_id, @archetyped.template_id
     155<<<<<<< .working
    146156    archetype_id2 = OpenEHR::RM::Support::Identification::Archetype_ID.new('openEHR-EHR-SECTION.physical_examination-prenatal.v2')
     157=======
     158    archetype_id2 = OpenEhr::RM::Support::Identification::ArchetypeId.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     159>>>>>>> .merge-right.r168
    147160    assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2}
    148161    assert_equal archetype_id2, @archetyped.archetype_id
     
    157170    assert_equal 'problem', @link.type.value
    158171    # test meaning
    159     assert_nothing_raised(Exception){@link.meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('clinical')}
     172    assert_nothing_raised(Exception){@link.meaning = OpenEhr::RM::DataTypes::Text::DvText.new('clinical')}
    160173    assert_equal 'clinical', @link.meaning.value
    161174    assert_raise(ArgumentError){@link.meaning = nil}
    162175    # test target
    163     assert_nothing_raised(Exception){@link.target = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://try/")}
     176    assert_nothing_raised(Exception){@link.target = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://try/")}
    164177    assert_equal 'ehr://try/', @link.target.value
    165178    assert_raise(ArgumentError){@link.target = nil}
    166179    # test type
    167     assert_nothing_raised(Exception){@link.type = OpenEHR::RM::Data_Types::Text::DV_Text.new("issue")}
     180    assert_nothing_raised(Exception){@link.type = OpenEhr::RM::DataTypes::Text::DvText.new("issue")}
    168181    assert_equal 'issue', @link.type.value
    169182    assert_raise(ArgumentError){@link.type = nil}
     
    190203class RM_Common_Generic_Test < Test::Unit::TestCase
    191204  def setup
    192     assert_nothing_raised(Exception){party_proxy = Party_Proxy.new}
    193     object_id = Object_ID.new('0.0.4')
    194     party_ref = Party_Ref.new('unknown', 'ORGANISATION', object_id)
    195     assert_nothing_raised(Exception){
    196       @party_proxy = Party_Proxy.new(:external_ref => party_ref)}
    197     assert_nothing_raised(Exception){party_self = Party_Self.new}
    198     assert_nothing_raised(Exception){
    199       @party_self = Party_Self.new(:external_ref => party_ref)}
     205    assert_nothing_raised(Exception){party_proxy = PartyProxy.new}
     206    object_id = ObjectId.new('0.0.4')
     207    party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id)
     208    assert_nothing_raised(Exception){
     209      @party_proxy = PartyProxy.new(:external_ref => party_ref)}
     210    assert_nothing_raised(Exception){party_self = PartySelf.new}
     211    assert_nothing_raised(Exception){
     212      @party_self = PartySelf.new(:external_ref => party_ref)}
    200213    assert_raise(ArgumentError){
    201       party_identified = Party_Identified.new}
     214      party_identified = PartyIdentified.new}
    202215
    203216    identifiers = []
    204     identifiers << DV_Identifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER')
    205     identifiers << DV_Identifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER')
    206     identifiers << DV_Identifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER')
    207     assert_nothing_raised(Exception){
    208       @party_identified = Party_Identified.new(:name => 'NERV',
     217    identifiers << DvIdentifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER')
     218    identifiers << DvIdentifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER')
     219    identifiers << DvIdentifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER')
     220    assert_nothing_raised(Exception){
     221      @party_identified = PartyIdentified.new(:name => 'NERV',
    209222                                               :external_ref => party_ref,
    210223                                               :identifier => identifiers)}
    211224
    212     terminology_id = Terminology_ID.new('test(0.04)')
    213     code_phrase = Code_Phrase.new('self', terminology_id)
    214     dv_coded_text = DV_Coded_Text.new('Seele',code_phrase)
    215     assert_nothing_raised(Exception){
    216       @party_related = Party_Related.new(:name => 'GEHIRN',
     225    terminology_id = TerminologyId.new('test(0.04)')
     226    code_phrase = CodePhrase.new('self', terminology_id)
     227    dv_coded_text = DvCodedText.new('Seele',code_phrase)
     228    assert_nothing_raised(Exception){
     229      @party_related = PartyRelated.new(:name => 'GEHIRN',
    217230                                         :relationship => dv_coded_text)}
    218     dv_text = DV_Text.new('commiter')
    219     dv_coded_text = DV_Coded_Text.new('present',terminology_id)
    220     dv_date_time1 = DV_Date_Time.new('2009-07-04T16:30:00')
    221     dv_date_time2 = DV_Date_Time.new('2009-07-14T00:00:00')
    222     dv_interval = DV_Interval.new(dv_date_time1, dv_date_time2)
     231    dv_text = DvText.new('commiter')
     232    dv_coded_text = DvCodedText.new('present',terminology_id)
     233    dv_date_time1 = DvDateTime.new('2009-07-04T16:30:00')
     234    dv_date_time2 = DvDateTime.new('2009-07-14T00:00:00')
     235    dv_interval = DvInterval.new(dv_date_time1, dv_date_time2)
    223236    assert_nothing_raised(Exception){
    224237      @participation = Participation.new(:performer => @party_proxy,
     
    226239                                         :mode => dv_coded_text,
    227240                                         :time => dv_interval)}
    228     dv_date_time = DV_Date_Time.new('2009-07-04T18:56:00')
    229     terminology_id = Terminology_ID.new('openehr(1.0.2)')
    230     code_phrase = Code_Phrase.new('249', terminology_id)
    231     dv_coded_text = DV_Coded_Text.new('creation', code_phrase)
    232     dv_text = DV_Text.new('test environment')
    233     assert_nothing_raised(Exception){
    234       @audit_details = Audit_Details.new(:system_id => 'MAGI',
     241    dv_date_time = DvDateTime.new('2009-07-04T18:56:00')
     242    terminology_id = TerminologyId.new('openehr(1.0.2)')
     243    code_phrase = CodePhrase.new('249', terminology_id)
     244    dv_coded_text = DvCodedText.new('creation', code_phrase)
     245    dv_text = DvText.new('test environment')
     246    assert_nothing_raised(Exception){
     247      @audit_details = AuditDetails.new(:system_id => 'MAGI',
    235248                                         :committer => @party_proxy,
    236249                                         :time_committed => dv_date_time,
    237250                                         :change_type => dv_coded_text,
    238251                                         :description => dv_text)}
    239     dv_text = DV_Text.new('authorisation')
    240     dv_ehr_uri = DV_EHR_URI.new('ehr://test/')
     252    dv_text = DvText.new('authorisation')
     253    dv_ehr_uri = DvEhrUri.new('ehr://test/')
    241254    assert_nothing_raised(Exception){
    242255      @attestation = Attestation.new(:system_id => 'NERV',
     
    248261                                     :proof => 'hashedstring',
    249262                                     :items => Set[dv_ehr_uri])}
    250     object_version_id = Object_Version_ID.new('SHOGOUKI::NERV::1.1.1')
    251     audit_details2 = Audit_Details.new(:system_id => 'MAGI',
     263    object_version_id = ObjectVersionId.new('SHOGOUKI::NERV::1.1.1')
     264    audit_details2 = AuditDetails.new(:system_id => 'MAGI',
    252265                                       :committer => @party_proxy,
    253266                                       :time_committed => dv_date_time2,
    254267                                       :change_type => dv_coded_text)
    255268    assert_nothing_raised(Exception){
    256       @revision_history_item = Revision_History_Item.new(:audits => [@audit_details, audit_details2],
     269      @revision_history_item = RevisionHistoryItem.new(:audits => [@audit_details, audit_details2],
    257270                                                         :version_id => object_version_id)}
    258     dv_date_time3 = DV_Date_Time.new('2009-07-14T12:00:00')
    259     dv_date_time4 = DV_Date_Time.new('2009-07-15T00:00:00')
    260     audit_details3 = Audit_Details.new(:system_id => 'MAGI',
     271    dv_date_time3 = DvDateTime.new('2009-07-14T12:00:00')
     272    dv_date_time4 = DvDateTime.new('2009-07-15T00:00:00')
     273    audit_details3 = AuditDetails.new(:system_id => 'MAGI',
    261274                                     :committer => @party_proxy,
    262275                                     :time_committed => dv_date_time3,
    263276                                     :change_type => dv_coded_text)
    264     audit_details4 = Audit_Details.new(:system_id => 'MAGI',
     277    audit_details4 = AuditDetails.new(:system_id => 'MAGI',
    265278                                     :committer => @party_proxy,
    266279                                     :time_committed => dv_date_time4,
    267280                                     :change_type => dv_coded_text)
    268     object_version_id = Object_Version_ID.new('NIGOUKI::NERV::2.2.2')
    269     revision_history_item2 = Revision_History_Item.new(:audits => [audit_details3, audit_details4],
     281    object_version_id = ObjectVersionId.new('NIGOUKI::NERV::2.2.2')
     282    revision_history_item2 = RevisionHistoryItem.new(:audits => [audit_details3, audit_details4],
    270283                                                      :version_id => object_version_id)
    271284    assert_nothing_raised(Exception){
    272       @revision_history = Revision_History.new([@revision_history_item, revision_history_item2])}
     285      @revision_history = RevisionHistory.new([@revision_history_item, revision_history_item2])}
    273286  end
    274287
    275288  def test_init
    276     assert_instance_of Party_Proxy, @party_proxy
    277     assert_instance_of Party_Self, @party_self
    278     assert_instance_of Party_Identified, @party_identified
     289    assert_instance_of PartyProxy, @party_proxy
     290    assert_instance_of PartySelf, @party_self
     291    assert_instance_of PartyIdentified, @party_identified
    279292    assert_instance_of Participation, @participation
    280     assert_instance_of Audit_Details, @audit_details
     293    assert_instance_of AuditDetails, @audit_details
    281294    assert_instance_of Attestation, @attestation
    282     assert_instance_of Revision_History_Item, @revision_history_item
    283     assert_instance_of Revision_History, @revision_history
     295    assert_instance_of RevisionHistoryItem, @revision_history_item
     296    assert_instance_of RevisionHistory, @revision_history
    284297  end
    285298
     
    347360  def setup
    348361    archetype_node_id = 'at0001'
    349     name = DV_Text.new('folder_test')
    350     object_id = Object_ID.new('1.1.1')
    351     object_ref = Object_Ref.new('local', 'PARTY', object_id)
     362    name = DvText.new('folder_test')
     363    object_id = ObjectId.new('1.1.1')
     364    object_ref = ObjectRef.new('local', 'PARTY', object_id)
    352365    assert_nothing_raised(Exception){
    353366      @folder = Folder.new(:archetype_node_id => archetype_node_id,
     
    359372 
    360373  def test_init
    361     assert_instance_of OpenEHR::RM::Common::Directory::Folder, @folder
     374    assert_instance_of OpenEhr::RM::Common::Directory::Folder, @folder
    362375  end
    363376
     
    370383class RM_Common_Change_Control_Test < Test::Unit::TestCase
    371384  def setup
    372     object_version_id1 = Object_Version_ID.new('ABC::DEF::2.2.3')
    373     object_version_id2 = Object_Version_ID.new('GHI::JKL::4.5.6')
    374     object_id = Object_ID.new('ehr://uniqueid1020')
    375     dv_date_time = DV_Date_Time.new('2009-07-06T21:10:12')
    376     party_ref = Party_Ref.new('unknown', 'ORGANISATION', object_id)
    377     party_proxy = Party_Proxy.new(:external_ref => party_ref)
    378     terminology_id = Terminology_ID.new('openehr(1.0.2)')
    379     code_phrase = Code_Phrase.new('249', terminology_id)
    380     dv_coded_text = DV_Coded_Text.new('creation', code_phrase)
    381     audit_details = Audit_Details.new(:system_id => 'MAGI',
     385    object_version_id1 = ObjectVersionId.new('ABC::DEF::2.2.3')
     386    object_version_id2 = ObjectVersionId.new('GHI::JKL::4.5.6')
     387    object_id = ObjectId.new('ehr://uniqueid1020')
     388    dv_date_time = DvDateTime.new('2009-07-06T21:10:12')
     389    party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id)
     390    party_proxy = PartyProxy.new(:external_ref => party_ref)
     391    terminology_id = TerminologyId.new('openehr(1.0.2)')
     392    code_phrase = CodePhrase.new('249', terminology_id)
     393    dv_coded_text = DvCodedText.new('creation', code_phrase)
     394    audit_details = AuditDetails.new(:system_id => 'MAGI',
    382395                                      :committer => party_proxy,
    383396                                      :time_committed => dv_date_time,
    384397                                      :change_type => dv_coded_text)
    385     code_phrase = Code_Phrase.new('532', terminology_id)
    386     dv_coded_text = DV_Coded_Text.new('complete', code_phrase)
    387     object_id = Object_ID.new('ehr://test_location')
    388     object_ref = Object_Ref.new('local', 'PARTY', object_id)
    389     hier_object_id = Hier_Object_ID.new('ABC')
     398    code_phrase = CodePhrase.new('532', terminology_id)
     399    dv_coded_text = DvCodedText.new('complete', code_phrase)
     400    object_id = ObjectId.new('ehr://test_location')
     401    object_ref = ObjectRef.new('local', 'PARTY', object_id)
     402    hier_object_id = HierObjectId.new('ABC')
    390403    assert_nothing_raised(Exception){
    391404      @version = Version.new(:uid => object_version_id1,
     
    396409                             :signature => 'test_version',
    397410                             :data => 'data')}
    398     object_version_id3 = Object_Version_ID.new('MNO::PQR::7.8.9')
    399     object_version_id4 = Object_Version_ID.new('STU::VWX::1.2.3')
    400     code_phrase = Code_Phrase.new('240', terminology_id)
    401     dv_coded_text2 = DV_Coded_Text.new('signed', code_phrase)
     411    object_version_id3 = ObjectVersionId.new('MNO::PQR::7.8.9')
     412    object_version_id4 = ObjectVersionId.new('STU::VWX::1.2.3')
     413    code_phrase = CodePhrase.new('240', terminology_id)
     414    dv_coded_text2 = DvCodedText.new('signed', code_phrase)
    402415    attestation = Attestation.new(:system_id => 'NERV',
    403416                                  :committer => party_proxy,
    404417                                  :time_committed => dv_date_time,
    405418                                  :change_type => dv_coded_text,
    406                                   :reason => DV_Text.new('signed'))
    407     dv_date_time = DV_Date_Time.new('2009-07-07T21:10:12')
    408     audit_details = Audit_Details.new(:system_id => 'MAGI',
     419                                  :reason => DvText.new('signed'))
     420    dv_date_time = DvDateTime.new('2009-07-07T21:10:12')
     421    audit_details = AuditDetails.new(:system_id => 'MAGI',
    409422                                      :committer => party_proxy,
    410423                                      :time_committed => dv_date_time,
    411424                                      :change_type => dv_coded_text)
    412425    assert_nothing_raised(Exception){
    413       @original_version = Original_Version.new(:uid => object_version_id3,
     426      @original_version = OriginalVersion.new(:uid => object_version_id3,
    414427                                               :preceding_version_uid => object_version_id4,
    415428                                               :other_input_version_uids => Set[object_version_id1, object_version_id2],
     
    419432                                               :data => 'data',
    420433                                               :lifecycle_state => dv_coded_text)}
    421     dv_date_time = DV_Date_Time.new('2009-07-08T21:10:12')
    422     audit_details = Audit_Details.new(:system_id => 'CASPER',
     434    dv_date_time = DvDateTime.new('2009-07-08T21:10:12')
     435    audit_details = AuditDetails.new(:system_id => 'CASPER',
    423436                                      :committer => party_proxy,
    424437                                      :time_committed => dv_date_time,
    425438                                      :change_type => dv_coded_text,
    426439                                      :description => 'for contribution')
    427     object_ref = Object_Ref.new('unknown', 'PARTY', object_id)
    428     assert_nothing_raised(Exception){
    429       @imported_version = Imported_Version.new(:item => @original_version,
     440    object_ref = ObjectRef.new('unknown', 'PARTY', object_id)
     441    assert_nothing_raised(Exception){
     442      @imported_version = ImportedVersion.new(:item => @original_version,
    430443                                               :commit_audit => audit_details,
    431444                                               :contribution => object_ref,
     
    435448                                       :versions => Set[object_ref],
    436449                                       :audit => audit_details)}
    437     dv_date_time = DV_Date_Time.new('2009-07-08T18:10:12')
    438     audit_details = Audit_Details.new(:system_id => 'MAGI',
     450    dv_date_time = DvDateTime.new('2009-07-08T18:10:12')
     451    audit_details = AuditDetails.new(:system_id => 'MAGI',
    439452                                      :committer => party_proxy,
    440453                                      :time_committed => dv_date_time,
     
    446459                                :change_type => dv_coded_text)
    447460    assert_nothing_raised(Exception){
    448       @versioned_object = Versioned_Object.new(:uid => hier_object_id,
     461      @versioned_object = VersionedObject.new(:uid => hier_object_id,
    449462                                               :owner_id => object_ref,
    450463                                               :time_created => dv_date_time,
     
    453466
    454467  def test_init
    455     assert_instance_of OpenEHR::RM::Common::Change_Control::Version, @version
    456     assert_instance_of Original_Version, @original_version
    457     assert_instance_of Imported_Version, @imported_version
    458     assert_instance_of OpenEHR::RM::Common::Change_Control::Contribution, @contribution
    459     assert_instance_of Versioned_Object, @versioned_object
     468    assert_instance_of OpenEhr::RM::Common::ChangeControl::Version, @version
     469    assert_instance_of OriginalVersion, @original_version
     470    assert_instance_of ImportedVersion, @imported_version
     471    assert_instance_of OpenEhr::RM::Common::ChangeControl::Contribution, @contribution
     472    assert_instance_of VersionedObject, @versioned_object
    460473  end
    461474
     
    505518    assert !@versioned_object.is_original_version?(@version.uid)
    506519    assert @versioned_object.is_original_version?(@original_version.uid)
    507     assert @versioned_object.has_version_at_time?(DV_Date_Time.new('2009-07-06T21:10:12'))
     520    assert @versioned_object.has_version_at_time?(DvDateTime.new('2009-07-06T21:10:12'))
    508521    assert_equal @version, @versioned_object.version_with_id(@version.uid)
    509522    assert_equal @version, @versioned_object.version_at_time(@version.commit_audit.time_committed)
     
    538551                                                :item => @imported_version.item)}
    539552    assert_equal 7, @versioned_object.version_count
    540     dv_date_time = DV_Date_Time.new('2009-07-07T22:11:31')
     553    dv_date_time = DvDateTime.new('2009-07-07T22:11:31')
    541554    attestation = Attestation.new(:system_id => 'NERV2',
    542555                                  :committer => @version.contribution,
    543556                                  :time_committed => dv_date_time,
    544557                                  :change_type => @original_version.commit_audit.change_type,
    545                                   :reason => DV_Text.new('signed'))
     558                                  :reason => DvText.new('signed'))
    546559    assert_nothing_raised(Exception){
    547560      @versioned_object.commit_attestation(:attestation => attestation,
  • ruby/trunk/lib/models/tests/rm/test_data_structure.rb

    r268 r291  
    33require 'rm'
    44
     5<<<<<<< .working
    56include OpenEHR::RM::Data_Structures
     7=======
     8include OpenEHR::RM::Data_Structures
     9include OpenEHR::RM::Data_Structures::Item_Structure
     10>>>>>>> .merge-right.r168
    611
    712class RmDataStructureTest < Test::Unit::TestCase
     
    2429  end
    2530end
     31
     32class RmDataStructureItemStructureTest < Test::Unit::TestCase
     33  def setup
     34    assert_nothing_raised(Exception){
     35     
     36  end
     37
     38  def test_init
     39  end
     40end
  • ruby/trunk/lib/models/tests/rm/test_data_types.rb

    r158 r291  
    66class RM_Data_Types_Basic_Test < Test::Unit::TestCase
    77  def setup
    8     assert_nothing_raised(Exception){@dv_boolean = OpenEHR::RM::Data_Types::Basic::DV_Boolean.new("TRUE")}
    9     @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('openEHR(1.0.2)')
    10     @code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('PROPOSED', @terminology_id)
    11     @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("Blood examination", @code_phrase)
    12     assert_nothing_raised(Exception){@dv_state = OpenEHR::RM::Data_Types::Basic::DV_State.new(@dv_coded_text, false)}
    13     assert_nothing_raised(Exception){@dv_identifier = OpenEHR::RM::Data_Types::Basic::DV_Identifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")}
     8    assert_nothing_raised(Exception){@dv_boolean = OpenEhr::RM::DataTypes::Basic::DvBoolean.new("TRUE")}
     9    @terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('openEHR(1.0.2)')
     10    @code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('PROPOSED', @terminology_id)
     11    @dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("Blood examination", @code_phrase)
     12    assert_nothing_raised(Exception){@dv_state = OpenEhr::RM::DataTypes::Basic::DvState.new(@dv_coded_text, false)}
     13    assert_nothing_raised(Exception){@dv_identifier = OpenEhr::RM::DataTypes::Basic::DvIdentifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")}
    1414  end
    1515
    1616  def test_init
    17     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Boolean, @dv_boolean
    18     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_State, @dv_state
    19     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Identifier, @dv_identifier
     17    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvBoolean, @dv_boolean
     18    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvState, @dv_state
     19    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvIdentifier, @dv_identifier
    2020  end
    2121
    2222  def test_constant
    23     assert_equal("\r", OpenEHR::RM::Data_Types::Basic::Data_Value::CR)
    24     assert_equal("\n", OpenEHR::RM::Data_Types::Basic::Data_Value::LF)
     23    assert_equal("\r", OpenEhr::RM::DataTypes::Basic::DataValue::CR)
     24    assert_equal("\n", OpenEhr::RM::DataTypes::Basic::DataValue::LF)
    2525  end
    2626
     
    3131    # inv: Value_exists
    3232    assert_raise(ArgumentError){@dv_boolean.value=nil}
    33     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Basic::DV_Boolean.new(nil)}
     33    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Basic::DvBoolean.new(nil)}
    3434  end
    3535
     
    4444    assert_equal 'COMPLETED', @dv_state.value.defining_code.code_string
    4545    assert @dv_state.is_terminal?
    46     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_State.new(nil,nil)}
     46    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvState.new(nil,nil)}
    4747    assert_raise(ArgumentError) {@dv_state.value=nil}
    4848    assert_raise(ArgumentError) {@dv_state.is_terminal=nil}
     
    6262    @dv_identifier.type = "test id"
    6363    assert_equal("test id", @dv_identifier.type)
    64     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_Identifier.new(nil, nil, nil, nil)}
     64    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
    6565  end
    6666end
     
    6969class RM_Data_Types_URI_Test < Test::Unit::TestCase
    7070  def setup
    71     @dv_uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    72     @dv_ehr_uri = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
     71    @dv_uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     72    @dv_ehr_uri = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
    7373  end
    7474
    7575  def test_init
    76     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_URI, @dv_uri
    77     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_EHR_URI, @dv_ehr_uri   
     76    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvUri, @dv_uri
     77    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
    7878  end
    7979
     
    9898class RM_Data_Types_Text_Test < Test::Unit::TestCase
    9999  def setup
    100     assert_nothing_raised(Exception){@dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new("valid value")}
    101     @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('ICD10')
     100    assert_nothing_raised(Exception){@dv_text = OpenEhr::RM::DataTypes::Text::DvText.new("valid value")}
     101    @terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10')
    102102   
    103     assert_nothing_raised(Exception){@code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('C92.0', @terminology_id)}
    104     assert_nothing_raised(Exception){@dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("Acute Myeloid Leukemia", @code_phrase)}
    105     @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"]))
    106     @term_mapping = OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text,"TEST")
     103    assert_nothing_raised(Exception){@code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('C92.0', @terminology_id)}
     104    assert_nothing_raised(Exception){@dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("Acute Myeloid Leukemia", @code_phrase)}
     105    @dv_paragraph = OpenEhr::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
     106    @term_mapping = OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text,"TEST")
    107107  end
    108108
    109109  def test_init
    110     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text
    111     assert_instance_of OpenEHR::RM::Data_Types::Text::Code_Phrase, @code_phrase
    112     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
    113     assert_instance_of OpenEHR::RM::Data_Types::Text::Term_Mapping, @term_mapping
     110    assert_instance_of OpenEhr::RM::DataTypes::Text::DvText, @dv_text
     111    assert_instance_of OpenEhr::RM::DataTypes::Text::CodePhrase, @code_phrase
     112    assert_instance_of OpenEhr::RM::DataTypes::Text::DvCodedText, @dv_coded_text
     113    assert_instance_of OpenEhr::RM::DataTypes::Text::TermMapping, @term_mapping
    114114  end
    115115
     
    147147  def test_term_mapping
    148148    assert_equal '=', @term_mapping.match
    149     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('>')
    150     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('=')
    151     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('<')
    152     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('?')
    153     assert !OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('!')
     149    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('>')
     150    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('=')
     151    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('<')
     152    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('?')
     153    assert !OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('!')
    154154    assert_equal @dv_coded_text, @term_mapping.purpose
    155155    assert_equal "TEST", @term_mapping.target
    156     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new}
    157     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('!',@dv_coded_text, "invalid case")}
    158     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',nil , "invalid case")}
    159     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text, nil)}
     156    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new}
     157    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('!',@dv_coded_text, "invalid case")}
     158    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',nil , "invalid case")}
     159    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text, nil)}
    160160  end
    161161end
     
    164164  def setup
    165165    assert_nothing_raised(Exception){
    166       @dv_ordered = OpenEHR::RM::Data_Types::Quantity::DV_Ordered.new }
    167     assert_nothing_raised(Exception){
    168       terminology = OpenEHR::RM::Support::Identification::Terminology_ID.new('urine')
    169       code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    170       urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('+', code_phrase)
    171       @dv_ordinal1 = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(1, urinary_protein)
    172       code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    173       urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('+++', code_phrase)
    174       @dv_ordinal2 = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(3, urinary_protein)}
    175     assert_nothing_raised(Exception){
    176       @dv_interval = OpenEHR::RM::Data_Types::Quantity::DV_Interval.new(@dv_ordinal1, @dv_ordinal2)}
    177     meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('normal')
    178     assert_nothing_raised(Exception){
    179       @reference_range = OpenEHR::RM::Data_Types::Quantity::Reference_Range.new(meaning, @dv_interval)}
    180     assert_nothing_raised(Exception){
    181       @dv_quantified = OpenEHR::RM::Data_Types::Quantity::DV_Quantified.new(1,'=')}
    182     assert_nothing_raised(Exception){
    183       @dv_amount = OpenEHR::RM::Data_Types::Quantity::DV_Amount.new(2,'<')}
    184     assert_nothing_raised(Exception){
    185       @dv_quantity = OpenEHR::RM::Data_Types::Quantity::DV_Quantity.new(3, 'mg', '~')}
    186     assert_nothing_raised(Exception){
    187       @dv_count = OpenEHR::RM::Data_Types::Quantity::DV_Count.new(1)}
    188     assert_nothing_raised(Exception){
    189       @dv_proportion = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(2,3,0)}
    190     assert_nothing_raised(Exception){
    191       @dv_absolute_quantity = OpenEHR::RM::Data_Types::Quantity::DV_Absolute_Quantity.new(7,'=')}
     166      @dv_ordered = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new }
     167    assert_nothing_raised(Exception){
     168      terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
     169      code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     170      urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+', code_phrase)
     171      @dv_ordinal1 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(1, urinary_protein)
     172      code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     173      urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+++', code_phrase)
     174      @dv_ordinal2 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(3, urinary_protein)}
     175    assert_nothing_raised(Exception){
     176      @dv_interval = OpenEhr::RM::DataTypes::Quantity::DvInterval.new(@dv_ordinal1, @dv_ordinal2)}
     177    meaning = OpenEhr::RM::DataTypes::Text::DvText.new('normal')
     178    assert_nothing_raised(Exception){
     179      @reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)}
     180    assert_nothing_raised(Exception){
     181      @dv_quantified = OpenEhr::RM::DataTypes::Quantity::DvQuantified.new(1,'=')}
     182    assert_nothing_raised(Exception){
     183      @dv_amount = OpenEhr::RM::DataTypes::Quantity::DvAmount.new(2,'<')}
     184    assert_nothing_raised(Exception){
     185      @dv_quantity = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(3, 'mg', '~')}
     186    assert_nothing_raised(Exception){
     187      @dv_count = OpenEhr::RM::DataTypes::Quantity::DvCount.new(1)}
     188    assert_nothing_raised(Exception){
     189      @dv_proportion = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(2,3,0)}
     190    assert_nothing_raised(Exception){
     191      @dv_absolute_quantity = OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity.new(7,'=')}
    192192   end
    193193
    194194   def test_init
    195      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordered, @dv_ordered
    196      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantified, @dv_quantified
    197      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Interval, @dv_interval
    198      assert_instance_of OpenEHR::RM::Data_Types::Quantity::Reference_Range, @reference_range
    199      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordinal, @dv_ordinal1
    200      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordinal, @dv_ordinal2
    201      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantified, @dv_quantified
    202      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Amount, @dv_amount
    203      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantity, @dv_quantity
    204      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Count, @dv_count
    205      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Proportion, @dv_proportion
    206      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Absolute_Quantity, @dv_absolute_quantity
     195     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdered, @dv_ordered
     196     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     197     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvInterval, @dv_interval
     198     assert_instance_of OpenEhr::RM::DataTypes::Quantity::ReferenceRange, @reference_range
     199     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal1
     200     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal2
     201     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     202     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAmount, @dv_amount
     203     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantity, @dv_quantity
     204     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvCount, @dv_count
     205     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvProportion, @dv_proportion
     206     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity, @dv_absolute_quantity
    207207  end
    208208
     
    214214    assert @dv_ordered.is_simple?
    215215    assert_raise(NotImplementedError){@dv_ordered<=>1}
    216     openehr_terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('openEHR')
    217     normal_code = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('N', openehr_terminology_id)
     216    openehr_terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('openEHR')
     217    normal_code = OpenEhr::RM::DataTypes::Text::CodePhrase.new('N', openehr_terminology_id)
    218218    assert_equal 'N', normal_code.code_string
    219219    assert_nothing_raised(Exception){
    220220      @dv_ordered.normal_status = normal_code }
    221221    assert @dv_ordered.is_normal?
    222     other = OpenEHR::RM::Data_Types::Quantity::DV_Ordered.new
     222    other = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new
    223223    assert_raise(NotImplementedError){
    224224      @dv_ordered.is_strictly_comparable_to?(other)}
     
    232232    assert_equal 'normal', @reference_range.meaning.value
    233233    assert_equal 1, @reference_range.range.lower.value
    234     terminology = OpenEHR::RM::Support::Identification::Terminology_ID.new('urine')
    235     code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    236     urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('++', code_phrase)
    237     dv_ordinal = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(2, urinary_protein)
     234    terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
     235    code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     236    urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('++', code_phrase)
     237    dv_ordinal = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(2, urinary_protein)
    238238    assert @reference_range.is_in_range?(dv_ordinal)
    239239    dv_ordinal.value = 6
     
    244244    assert_equal 1, @dv_quantified.magnitude
    245245    assert_equal '=', @dv_quantified.magnitude_status
    246     assert !OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('*')
    247     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('>')
    248     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('<')
    249     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('>=')
    250     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('<=')
    251     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('~')
     246    assert !OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('*')
     247    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('>')
     248    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('<')
     249    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('>=')
     250    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('<=')
     251    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('~')
    252252    assert_nothing_raised(Exception){@dv_quantified.magnitude = 0}
    253253    assert_equal 0, @dv_quantified.magnitude
     
    289289    assert @dv_ordinal1 > @dv_ordinal2
    290290    assert_raise(ArgumentError){@dv_ordinal1.limits = @reference_range}
    291     meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('limits')
    292     limit_reference_range = OpenEHR::RM::Data_Types::Quantity::Reference_Range.new(meaning, @dv_interval)
     291    meaning = OpenEhr::RM::DataTypes::Text::DvText.new('limits')
     292    limit_reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)
    293293    assert_nothing_raised(Exception){@dv_ordinal1.limits = limit_reference_range}
    294294    assert_equal 'limits', @dv_ordinal1.limits.meaning.value
     
    299299    assert_equal 'mg', @dv_quantity.units
    300300    assert_equal '~', @dv_quantity.magnitude_status
    301     dv_quantity2 = OpenEHR::RM::Data_Types::Quantity::DV_Quantity.new(4, 'mg', '~')
     301    dv_quantity2 = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(4, 'mg', '~')
    302302    assert_equal 'mg', dv_quantity2.units
    303303    assert @dv_quantity.is_strictly_comparable_to?(dv_quantity2)
     
    318318  def test_dv_count
    319319    assert_equal 1, @dv_count.magnitude
    320     dv_count2 = OpenEHR::RM::Data_Types::Quantity::DV_Count.new(2)
     320    dv_count2 = OpenEhr::RM::DataTypes::Quantity::DvCount.new(2)
    321321    dv_count3 = @dv_count + dv_count2
    322322    assert 3, dv_count3.magnitude
     
    326326
    327327  def test_proportion_kind
    328     assert_equal 0, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_RATIO
    329     assert_equal 1, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_UNITARY
    330     assert_equal 2, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_PERCENT
    331     assert_equal 3, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_FRACTION
    332     assert_equal 4, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_INTEGER_FRACTION
    333     assert OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(0)
    334     assert OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(4)
    335     assert !OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(-1)
    336     assert !OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(5)
     328    assert_equal 0, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_RATIO
     329    assert_equal 1, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_UNITARY
     330    assert_equal 2, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_PERCENT
     331    assert_equal 3, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_FRACTION
     332    assert_equal 4, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_INTEGER_FRACTION
     333    assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(0)
     334    assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(4)
     335    assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(-1)
     336    assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(5)
    337337  end
    338338
     
    343343    assert_equal 2.0/3.0, @dv_proportion.magnitude
    344344    assert @dv_proportion.is_integral?
    345     dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1,3,0)
     345    dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,0)
    346346    assert @dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    347     dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1,3,4)
     347    dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,4)
    348348    assert !@dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    349349    assert_raise(ArgumentError){
    350       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1.5,2.3,3)}
    351     assert_raise(ArgumentError){
    352       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,10,1)}
    353     assert_nothing_raised(Exception){
    354       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,1,1)}
    355     assert_raise(ArgumentError){
    356       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,10,2)}
    357     assert_nothing_raised(Exception){
    358       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,100,2)}
     350      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1.5,2.3,3)}
     351    assert_raise(ArgumentError){
     352      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,1)}
     353    assert_nothing_raised(Exception){
     354      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,1,1)}
     355    assert_raise(ArgumentError){
     356      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,2)}
     357    assert_nothing_raised(Exception){
     358      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,100,2)}
    359359  end
    360360
     
    363363class EncapsulatedTest < Test::Unit::TestCase
    364364  def setup
    365     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    366     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    367     assert_nothing_raised(Exception){
    368       @dv_encapsulated = OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated.new(charset, language, 10)}
    369     assert_nothing_raised(Exception){
    370       @dv_parsable = OpenEHR::RM::Data_Types::Encapsulated::DV_Parsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
    371     media_type = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('text/html', 'media-types')
    372     uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    373     assert_nothing_raised(Exception){
    374       @dv_multimedia = OpenEHR::RM::Data_Types::Encapsulated::DV_Multimedia.new(charset, language, 10, media_type, uri)}
     365    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     366    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     367    assert_nothing_raised(Exception){
     368      @dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)}
     369    assert_nothing_raised(Exception){
     370      @dv_parsable = OpenEhr::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
     371    media_type = OpenEhr::RM::DataTypes::Text::CodePhrase.new('text/html', 'media-types')
     372    uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     373    assert_nothing_raised(Exception){
     374      @dv_multimedia = OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia.new(charset, language, 10, media_type, uri)}
    375375  end
    376376
    377377  def test_init
    378     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated, @dv_encapsulated
    379     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Parsable, @dv_parsable
    380     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Multimedia, @dv_multimedia
     378    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated, @dv_encapsulated
     379    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvParsable, @dv_parsable
     380    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia, @dv_multimedia
    381381  end
    382382
     
    385385    assert_equal 'ja', @dv_encapsulated.language.code_string
    386386    assert_equal 10, @dv_encapsulated.size
    387     wrong_charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('USO8000', 'character-sets')
     387    wrong_charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('USO8000', 'character-sets')
    388388    assert_raise(ArgumentError){@dv_encapsulated.charset = wrong_charset}
    389     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('EUC-JP', 'character-sets')
     389    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('EUC-JP', 'character-sets')
    390390    assert_nothing_raised(Exception){@dv_encapsulated.charset = charset}
    391391    assert_equal 'EUC-JP', @dv_encapsulated.charset.code_string
    392     wrong_language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('jpg', 'language')
     392    wrong_language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('jpg', 'language')
    393393    assert_raise(ArgumentError){@dv_encapsulated.language = wrong_language}
    394     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('eng', 'language')
     394    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('eng', 'language')
    395395    assert_nothing_raised(Exception){@dv_encapsulated.language = language}
    396396    assert_equal 'eng', @dv_encapsulated.language.code_string
     
    429429
    430430class TestDvTimeSpecification < Test::Unit::TestCase
    431   include OpenEHR::RM::Data_Types::Time_Specification
    432   include OpenEHR::RM::Data_Types::Encapsulated
    433   def setup
    434     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    435     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    436     assert_nothing_raised(Exception){
    437       dv_parsable = DV_Parsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
    438       @dv_time_specification = DV_Time_Specification.new(dv_parsable)}
     431  include OpenEhr::RM::DataTypes::TimeSpecification
     432  include OpenEhr::RM::DataTypes::Encapsulated
     433  def setup
     434    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     435    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     436    assert_nothing_raised(Exception){
     437      dv_parsable = DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
     438      @dv_time_specification = DvTimeSpecification.new(dv_parsable)}
    439439#    assert_nothing_raised(Exception){
    440440#      @dv_periodic_time_specification = DV_Periodic_Time_Specification.new('[200004181100;200004181110]/(7d)@DWIST', charset, language, 10, 'HL7:PIVL')}
     
    442442
    443443  def test_init
    444     assert_instance_of DV_Time_Specification, @dv_time_specification
     444    assert_instance_of DvTimeSpecification, @dv_time_specification
    445445  end
    446446
  • ruby/trunk/lib/models/tests/rm/test_security.rb

    r140 r291  
    55  def setup
    66    assert_nothing_raised(Exception){
    7       @access_control_setting = OpenEHR::RM::Security::Access_Control_Settings.new}
     7      @access_control_setting = OpenEhr::RM::Security::AccessControlSettings.new}
    88  end
    99
    1010  def test_init
    11     assert_instance_of OpenEHR::RM::Security::Access_Control_Settings, @access_control_setting
     11    assert_instance_of OpenEhr::RM::Security::AccessControlSettings, @access_control_setting
    1212  end
    1313end
  • 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 = ''}
  • ruby/trunk/lib/models/tests/test_archetype_model.rb

    r66 r291  
    55class ArchetypeModelTest < Test::Unit::TestCase
    66  def setup
    7     @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new
    8     @validity_kind = OpenEHR::AM::Archetype::VALIDITY_KIND.new
     7    @archetype = OpenEhr::AM::Archetype::ARCHETYPE.new
     8    @validity_kind = OpenEhr::AM::Archetype::VALIDITY_KIND.new
    99
    10     @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
    11     @archetype_description_item = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
     10    @archetype_description = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
     11    @archetype_description_item = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
    1212  end
    1313 
    1414  def test_init
    15     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
    16     assert_instance_of OpenEHR::AM::Archetype::VALIDITY_KIND, @validity_kind
    17     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
    18     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
    19     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
     15    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
     16    assert_instance_of OpenEhr::AM::Archetype::VALIDITY_KIND, @validity_kind
     17    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
     18    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
     19    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
    2020  end
    2121
    2222  def test_create
    23     archetype_instance = OpenEHR::AM::Archetype::ARCHETYPE.create() do |archetype|
     23    archetype_instance = OpenEhr::AM::Archetype::ARCHETYPE.create() do |archetype|
    2424      archetype.adl_version = '1.4'
    2525    end
    2626
    27     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, archetype_instance
     27    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, archetype_instance
    2828  end
    2929end
     
    3131class ArchetypeModelConstraintTest < Test::Unit::TestCase
    3232  def setup
    33     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    34     @cardinality = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new   
     33    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     34    @cardinality = OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY.new
    3535   
    36     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    37     @c_object = OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT.new
    38     @c_defined_object = OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
    39     @c_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
    40     @c_single_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
    41     @c_multiple_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
    42     @c_primitive_object = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
    43     @c_reference_object =  OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
    44     @archetype_internal_ref =  OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
    45     @archetype_slot = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
    46     @constraint_ref = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
    47     @c_domain_type = OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
    48     @c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
     36    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     37    @c_object = OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT.new
     38    @c_defined_object = OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
     39    @c_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
     40    @c_single_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
     41    @c_multiple_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
     42    @c_primitive_object = OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
     43    @c_reference_object =  OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
     44    @archetype_internal_ref =  OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
     45    @archetype_slot = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
     46    @constraint_ref = OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
     47    @c_domain_type = OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
     48    @c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
    4949  end
    5050
    5151  def test_init
    52     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    53     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
    54     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
    55     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
    56     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
    57     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
     52    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     53    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
     54    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
     55    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
     56    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
     57    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
    5858    assert_equal 'attribute_name', @c_multiple_attribute.rm_attribute_name
    59     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
    60     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
    61     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
    62     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
    63     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
    64     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
    65     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
    66     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
     59    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
     60    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
     61    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
     62    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
     63    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
     64    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
     65    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
     66    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
    6767    assert_instance_of Array, @c_complex_object.attributes
    68     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    69     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
     68    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     69    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
    7070  end
    7171
    7272  def test_create
    73     c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
     73    c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
    7474                                                                                         :attributes => [1,2],
    7575                                                                                         :assumed_value => Array
    7676                                                                                         )
    77     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
     77    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
    7878    assert_equal 'test_node', c_complex_object.node_id
    7979  end
     
    8383  def setup
    8484    #@c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
    85     @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
     85    @c_boolean = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
    8686                                                                                    :false_valid => true,
    8787                                                                                    :assumed_value => true)
    88     @c_string = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    89     @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
    90     @c_real = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    91     @c_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    92     @c_date = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    93     @c_date_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    94     @c_duration = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
     88    @c_string = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
     89    @c_integer = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
     90    @c_real = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
     91    @c_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
     92    @c_date = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
     93    @c_date_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
     94    @c_duration = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    9595  end
    9696
    9797  def test_init
    9898    #assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
    99     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
    100     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
    101     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
    102     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
    103     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
    104     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
    105     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
    106     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
     99    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
     100    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
     101    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
     102    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
     103    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
     104    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
     105    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
     106    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
    107107  end
    108108
     
    119119    end
    120120    assert_raise(ArgumentError) do
    121       OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
     121      OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
    122122                                                                         :false_valid => false,
    123123                                                                         :assumed_value => false)
     
    129129class ArchetypeModelOntologyTest < Test::Unit::TestCase
    130130  def setup
    131     @archetype_ontology = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    132     @archetype_term = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
     131    @archetype_ontology = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
     132    @archetype_term = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
    133133  end
    134134
    135135  def test_init
    136     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
    137     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
     136    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
     137    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
    138138  end
    139139end
     
    141141class ArchetypeModelAssertionTest < Test::Unit::TestCase
    142142  def setup
    143     @assertion = OpenEHR::AM::Archetype::Assertion::ASSERTION.new
    144     @assertion_variable = OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
    145     @operator_kind = OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND.new
    146     @expr_item = OpenEHR::AM::Archetype::Assertion::EXPR_ITEM.new
    147     @expr_leaf = OpenEHR::AM::Archetype::Assertion::EXPR_LEAF.new
    148     @expr_operator = OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR.new
    149     @expr_unary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
    150     @expr_binary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
     143    @assertion = OpenEhr::AM::Archetype::Assertion::ASSERTION.new
     144    @assertion_variable = OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
     145    @operator_kind = OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND.new
     146    @expr_item = OpenEhr::AM::Archetype::Assertion::EXPR_ITEM.new
     147    @expr_leaf = OpenEhr::AM::Archetype::Assertion::EXPR_LEAF.new
     148    @expr_operator = OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR.new
     149    @expr_unary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
     150    @expr_binary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
    151151  end
    152152
    153153  def test_init
    154     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION, @assertion
    155     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
    156     assert_instance_of OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
    157     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
    158     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
    159     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
    160     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
    161     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
     154    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION, @assertion
     155    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
     156    assert_instance_of OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
     157    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
     158    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
     159    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
     160    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
     161    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
    162162  end
    163163end
     
    165165class ArchetypeModelProfileTest < Test::Unit::TestCase
    166166  def setup
    167     @c_dv_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE.new
    168     @state_machine = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE.new
    169     @state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE.new
    170     @terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE.new
    171     @non_terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE.new
    172     @transition = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION.new
     167    @c_dv_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE.new
     168    @state_machine = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE.new
     169    @state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE.new
     170    @terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE.new
     171    @non_terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE.new
     172    @transition = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION.new
    173173
    174     @c_code_phase = OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE.new
     174    @c_code_phase = OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE.new
    175175
    176     @c_dv_quantity = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY.new
    177     @c_dv_ordinal = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL.new
    178     @c_quantity_item = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM.new
     176    @c_dv_quantity = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY.new
     177    @c_dv_ordinal = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL.new
     178    @c_quantity_item = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM.new
    179179  end
    180180
    181181  def test_init
    182     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE, @c_dv_state
    183     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE, @state_machine
    184     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE, @state
    185     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE, @terminal_state
    186     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE, @non_terminal_state
    187     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION, @transition
    188     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE, @c_code_phase
    189     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY, @c_dv_quantity
    190     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL, @c_dv_ordinal
    191     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM, @c_quantity_item
     182    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE, @c_dv_state
     183    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE, @state_machine
     184    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE, @state
     185    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE, @terminal_state
     186    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE, @non_terminal_state
     187    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION, @transition
     188    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE, @c_code_phase
     189    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY, @c_dv_quantity
     190    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL, @c_dv_ordinal
     191    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM, @c_quantity_item
    192192  end
    193193end
  • ruby/trunk/lib/models/tests/test_assumed_library_types.rb

    r151 r291  
    22require 'assumed_library_types.rb'
    33
    4 include OpenEHR::Assumed_Library_Types
     4include OpenEhr::AssumedLibraryTypes
    55
    66class Assumed_Library_Test < Test::Unit::TestCase
    77  def setup
    8     assert_nothing_raised(Exception){@interval = OpenEHR::Assumed_Library_Types::Interval.new(1,2)}
    9     assert_nothing_raised(Exception){@iso8601_date = OpenEHR::Assumed_Library_Types::ISO8601_DATE.new('2009-04-27')}
    10     assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('15:55:37.32+0900')}
    11     assert_nothing_raised(Exception){@iso8601_date_time = OpenEHR::Assumed_Library_Types::ISO8601_DATE_TIME.new('2009-04-27T15:55:37.32+0900')}
    12     assert_nothing_raised(Exception){@iso8601_duration = OpenEHR::Assumed_Library_Types::ISO8601_DURATION.new('P1Y2M3W4DT5H6M7.8S')}
    13     assert_nothing_raised(Exception){@iso8601_timezone = OpenEHR::Assumed_Library_Types::ISO8601_TIMEZONE.new}
     8    assert_nothing_raised(Exception){@interval = OpenEhr::AssumedLibraryTypes::Interval.new(1,2)}
     9    assert_nothing_raised(Exception){@iso8601_date = OpenEhr::AssumedLibraryTypes::ISO8601_DATE.new('2009-04-27')}
     10    assert_nothing_raised(Exception){@iso8601_time = OpenEhr::AssumedLibraryTypes::ISO8601_TIME.new('15:55:37.32+0900')}
     11    assert_nothing_raised(Exception){@iso8601_date_time = OpenEhr::AssumedLibraryTypes::ISO8601_DATE_TIME.new('2009-04-27T15:55:37.32+0900')}
     12    assert_nothing_raised(Exception){@iso8601_duration = OpenEhr::AssumedLibraryTypes::ISO8601_DURATION.new('P1Y2M3W4DT5H6M7.8S')}
     13    assert_nothing_raised(Exception){@iso8601_timezone = OpenEhr::AssumedLibraryTypes::ISO8601_TIMEZONE.new}
    1414  end
    1515
    1616  def test_initialize
    17     assert_instance_of OpenEHR::Assumed_Library_Types::Interval, @interval
    18     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DATE, @iso8601_date
    19     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_TIME, @iso8601_time
    20     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DATE_TIME, @iso8601_date_time
    21     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DURATION, @iso8601_duration
    22     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_TIMEZONE, @iso8601_timezone
     17    assert_instance_of OpenEhr::AssumedLibraryTypes::Interval, @interval
     18    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DATE, @iso8601_date
     19    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_TIME, @iso8601_time
     20    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DATE_TIME, @iso8601_date_time
     21    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DURATION, @iso8601_duration
     22    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_TIMEZONE, @iso8601_timezone
    2323  end
    2424
     
    5858
    5959  def test_time_definitions
    60     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_LEAP_YEAR, 366
    61     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_WEEK, 7
    62     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_YEAR, 365
    63     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::HOURS_IN_DAY, 24
    64     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MAX_DAYS_IN_MONTH, 31
    65     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MAX_DAYS_IN_YEAR, 366
    66     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MINUTES_IN_HOUR, 60
    67     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MONTH_IN_YEAR, 12
    68     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::NOMINAL_DAYS_IN_MONTH, 30.42
    69     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::NOMINAL_DAYS_IN_YEAR, 365.24
    70     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::SECONDS_IN_MINUTE, 60
     60    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_LEAP_YEAR, 366
     61    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_WEEK, 7
     62    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_YEAR, 365
     63    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::HOURS_IN_DAY, 24
     64    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MAX_DAYS_IN_MONTH, 31
     65    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MAX_DAYS_IN_YEAR, 366
     66    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MINUTES_IN_HOUR, 60
     67    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MONTH_IN_YEAR, 12
     68    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::NOMINAL_DAYS_IN_MONTH, 30.42
     69    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::NOMINAL_DAYS_IN_YEAR, 365.24
     70    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::SECONDS_IN_MINUTE, 60
    7171  end
    7272
    7373  def test_time_definition_validity
    74     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(2008)
    75     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(-20)
    76     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(0)
     74    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(2008)
     75    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(-20)
     76    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(0)
    7777# today
    78     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,19)
     78    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,19)
    7979# test valid_day lower limit
    80     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,0,0)
    81     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,1,1)
    82     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(-1,1,1)
    83     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,1,0)
     80    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,0,0)
     81    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,1,1)
     82    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(-1,1,1)
     83    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,1,0)
    8484# test valid_day upper and lowerlimit of each month
    85     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,0,1)
    86     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,1)
    87     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,0)
    88     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,0,1)
    89     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,31)
    90     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,32)
    91     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,1)
    92     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,0)
    93     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,31)
    94     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,1)
    95     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,0)
    96     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,31)
    97     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,32)
    98     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,1)
    99     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,0)
    100     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,30)
    101     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,31)
    102     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,1)
    103     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,0)
    104     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,31)
    105     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,32)
    106     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,1)
    107     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,0)
    108     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,30)
    109     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,31)
    110     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,1)
    111     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,0)
    112     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,31)
    113     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,32)
    114     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,1)
    115     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,0)
    116     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,31)
    117     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,32)
    118     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,1)
    119     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,0)
    120     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,30)
    121     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,31)
    122     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,1)
    123     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,0)
    124     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,31)
    125     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,32)
    126     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,1)
    127     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,0)
    128     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,30)
    129     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,31)
    130     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,1)
    131     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,0)
    132     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,31)
    133     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,32)
     85    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,0,1)
     86    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,1)
     87    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,0)
     88    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,0,1)
     89    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,31)
     90    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,32)
     91    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,1)
     92    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,0)
     93    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,31)
     94    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,1)
     95    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,0)
     96    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,31)
     97    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,32)
     98    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,1)
     99    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,0)
     100    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,30)
     101    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,31)
     102    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,1)
     103    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,0)
     104    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,31)
     105    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,32)
     106    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,1)
     107    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,0)
     108    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,30)
     109    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,31)
     110    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,1)
     111    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,0)
     112    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,31)
     113    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,32)
     114    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,1)
     115    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,0)
     116    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,31)
     117    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,32)
     118    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,1)
     119    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,0)
     120    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,30)
     121    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,31)
     122    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,1)
     123    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,0)
     124    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,31)
     125    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,32)
     126    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,1)
     127    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,0)
     128    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,30)
     129    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,31)
     130    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,1)
     131    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,0)
     132    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,31)
     133    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,32)
    134134# test valid_day leap year
    135     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(1900,2,28)
    136     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(1900,2,29)
    137     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2000,2,29)
    138     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,29)
     135    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(1900,2,28)
     136    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(1900,2,29)
     137    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2000,2,29)
     138    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,29)
    139139# test valid_hour lower limit
    140     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,0)
    141     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(-1,0,0)
    142     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,-1,0)
    143     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,-1)
     140    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,0)
     141    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(-1,0,0)
     142    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,-1,0)
     143    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,-1)
    144144# test valid_hour upper limit
    145     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,59,0)
    146     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,60,0)
    147     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,59)
    148     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,60)
    149     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,0,0)
    150     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,0,1)
    151     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,1,0)
     145    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,59,0)
     146    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,60,0)
     147    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,59)
     148    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,60)
     149    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,0,0)
     150    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,0,1)
     151    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,1,0)
    152152# test valid_minute method lower limit
    153     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(0)
    154     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(-1)
     153    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(0)
     154    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(-1)
    155155# test valid_minute method upper limit
    156     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(59)
    157     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(60)
     156    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(59)
     157    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(60)
    158158# test valid_second method lower limit
    159     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(0)
    160     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(-1)
     159    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(0)
     160    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(-1)
    161161# test valid_second method upper limit
    162     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(59)
    163     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(60)
     162    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(59)
     163    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(60)
    164164# test valid_month method lower limit
    165     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(1)
    166     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(0)
     165    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(1)
     166    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(0)
    167167# test valid_month method upper limit
    168     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(12)
    169     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(13)
     168    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(12)
     169    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(13)
    170170  end
    171171  def test_iso8601_date
     
    173173    assert_equal 4,@iso8601_date.month
    174174    assert_equal 27,@iso8601_date.day
    175     assert_nothing_raised(Exception){@iso8601_date = OpenEHR::Assumed_Library_Types::ISO8601_DATE.new('2008')}
     175    assert_nothing_raised(Exception){@iso8601_date = OpenEhr::AssumedLibraryTypes::ISO8601_DATE.new('2008')}
    176176    assert @iso8601_date.day_unknown?
    177177    assert @iso8601_date.month_unknown?
     
    194194    assert !@iso8601_date.is_partial?
    195195    assert_equal "2008-06-14", @iso8601_date.as_string
    196     assert OpenEHR::Assumed_Library_Types::ISO8601_DATE.valid_iso8601_date?("2006-06-14")
    197     assert !OpenEHR::Assumed_Library_Types::ISO8601_DATE.valid_iso8601_date?("ABCDEFG")
     196    assert OpenEhr::AssumedLibraryTypes::ISO8601_DATE.valid_iso8601_date?("2006-06-14")
     197    assert !OpenEhr::AssumedLibraryTypes::ISO8601_DATE.valid_iso8601_date?("ABCDEFG")
    198198  end
    199199
     
    207207#    assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('15:55:37.32+0900')}
    208208
    209     assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('01')}
     209    assert_nothing_raised(Exception){@iso8601_time = OpenEhr::AssumedLibraryTypes::ISO8601_TIME.new('01')}
    210210    assert_equal 1, @iso8601_time.hour
    211211    assert @iso8601_time.is_partial?
     
    253253    assert @iso8601_time.is_extended?
    254254    assert !@iso8601_time.is_decimal_sign_comma?
    255     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("012345Z")
    256     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("012345.67+0900")
    257     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
    258     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
    259     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000")
    260     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000Z")
    261     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000.011Z")
     255    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("012345Z")
     256    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("012345.67+0900")
     257    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
     258    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
     259    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000")
     260    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000Z")
     261    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000.011Z")
    262262  end
    263263
  • ruby/trunk/log

    • Property svn:ignore set to
      *
  • ruby/trunk/tests/models/test_archetype_model.rb

    r64 r291  
    55class ArchetypeModelTest < Test::Unit::TestCase
    66  def setup
    7     @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new
    8     @validity_kind = OpenEHR::AM::Archetype::VALIDITY_KIND.new
     7    @archetype = OpenEhr::AM::Archetype::ARCHETYPE.new
     8    @validity_kind = OpenEhr::AM::Archetype::VALIDITY_KIND.new
    99
    10     @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
    11     @archetype_description_item = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
     10    @archetype_description = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
     11    @archetype_description_item = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
    1212  end
    1313 
    1414  def test_init
    15     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
    16     assert_instance_of OpenEHR::AM::Archetype::VALIDITY_KIND, @validity_kind
    17     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
    18     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
    19     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
     15    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
     16    assert_instance_of OpenEhr::AM::Archetype::VALIDITY_KIND, @validity_kind
     17    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
     18    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
     19    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
    2020  end
    2121
    2222  def test_create
    23     archetype_instance = OpenEHR::AM::Archetype::ARCHETYPE.create() do |archetype|
     23    archetype_instance = OpenEhr::AM::Archetype::ARCHETYPE.create() do |archetype|
    2424      archetype.adl_version = '1.4'
    2525    end
    2626
    27     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, archetype_instance
     27    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, archetype_instance
    2828  end
    2929end
     
    3131class ArchetypeModelConstraintTest < Test::Unit::TestCase
    3232  def setup
    33     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    34     @cardinality = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new   
     33    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     34    @cardinality = OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY.new
    3535   
    36     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    37     @c_object = OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT.new
    38     @c_defined_object = OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
    39     @c_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
    40     @c_single_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
    41     @c_multiple_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
    42     @c_primitive_object = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
    43     @c_reference_object =  OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
    44     @archetype_internal_ref =  OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
    45     @archetype_slot = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
    46     @constraint_ref = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
    47     @c_domain_type = OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
    48     @c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
     36    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     37    @c_object = OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT.new
     38    @c_defined_object = OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
     39    @c_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
     40    @c_single_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
     41    @c_multiple_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
     42    @c_primitive_object = OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
     43    @c_reference_object =  OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
     44    @archetype_internal_ref =  OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
     45    @archetype_slot = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
     46    @constraint_ref = OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
     47    @c_domain_type = OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
     48    @c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
    4949  end
    5050
    5151  def test_init
    52     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    53     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
    54     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
    55     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
    56     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
    57     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
     52    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     53    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
     54    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
     55    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
     56    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
     57    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
    5858    assert_equal 'attribute_name', @c_multiple_attribute.rm_attribute_name
    59     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
    60     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
    61     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
    62     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
    63     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
    64     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
    65     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
    66     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
     59    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
     60    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
     61    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
     62    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
     63    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
     64    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
     65    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
     66    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
    6767    assert_instance_of Array, @c_complex_object.attributes
    68     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    69     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
     68    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     69    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
    7070  end
    7171
    7272  def test_create
    73     c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
     73    c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
    7474                                                                                         :attributes => [1,2],
    7575                                                                                         :assumed_value => Array
    7676                                                                                         )
    77     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
     77    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
    7878    assert_equal 'test_node', c_complex_object.node_id
    7979  end
     
    8383  def setup
    8484    #@c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
    85     @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
     85    @c_boolean = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
    8686                                                                                    :false_valid => true,
    8787                                                                                    :assumed_value => true)
    88     @c_string = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    89     @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
    90     @c_real = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    91     @c_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    92     @c_date = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    93     @c_date_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    94     @c_duration = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
     88    @c_string = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
     89    @c_integer = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
     90    @c_real = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
     91    @c_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
     92    @c_date = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
     93    @c_date_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
     94    @c_duration = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    9595  end
    9696
    9797  def test_init
    9898    #assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
    99     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
    100     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
    101     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
    102     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
    103     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
    104     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
    105     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
    106     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
     99    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
     100    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
     101    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
     102    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
     103    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
     104    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
     105    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
     106    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
    107107  end
    108108
     
    119119    end
    120120    assert_raise(ArgumentError) do
    121       OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
     121      OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
    122122                                                                         :false_valid => false,
    123123                                                                         :assumed_value => false)
     
    129129class ArchetypeModelOntologyTest < Test::Unit::TestCase
    130130  def setup
    131     @archetype_ontology = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    132     @archetype_term = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
     131    @archetype_ontology = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
     132    @archetype_term = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
    133133  end
    134134
    135135  def test_init
    136     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
    137     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
     136    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
     137    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
    138138  end
    139139end
     
    141141class ArchetypeModelAssertionTest < Test::Unit::TestCase
    142142  def setup
    143     @assertion = OpenEHR::AM::Archetype::Assertion::ASSERTION.new
    144     @assertion_variable = OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
    145     @operator_kind = OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND.new
    146     @expr_item = OpenEHR::AM::Archetype::Assertion::EXPR_ITEM.new
    147     @expr_leaf = OpenEHR::AM::Archetype::Assertion::EXPR_LEAF.new
    148     @expr_operator = OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR.new
    149     @expr_unary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
    150     @expr_binary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
     143    @assertion = OpenEhr::AM::Archetype::Assertion::ASSERTION.new
     144    @assertion_variable = OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
     145    @operator_kind = OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND.new
     146    @expr_item = OpenEhr::AM::Archetype::Assertion::EXPR_ITEM.new
     147    @expr_leaf = OpenEhr::AM::Archetype::Assertion::EXPR_LEAF.new
     148    @expr_operator = OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR.new
     149    @expr_unary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
     150    @expr_binary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
    151151  end
    152152
    153153  def test_init
    154     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION, @assertion
    155     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
    156     assert_instance_of OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
    157     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
    158     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
    159     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
    160     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
    161     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
     154    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION, @assertion
     155    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
     156    assert_instance_of OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
     157    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
     158    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
     159    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
     160    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
     161    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
    162162  end
    163163end
     
    165165class ArchetypeModelProfileTest < Test::Unit::TestCase
    166166  def setup
    167     @c_dv_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE.new
    168     @state_machine = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE.new
    169     @state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE.new
    170     @terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE.new
    171     @non_terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE.new
    172     @transition = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION.new
     167    @c_dv_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE.new
     168    @state_machine = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE.new
     169    @state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE.new
     170    @terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE.new
     171    @non_terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE.new
     172    @transition = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION.new
    173173
    174     @c_code_phase = OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE.new
     174    @c_code_phase = OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE.new
    175175
    176     @c_dv_quantity = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY.new
    177     @c_dv_ordinal = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL.new
    178     @c_quantity_item = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM.new
     176    @c_dv_quantity = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY.new
     177    @c_dv_ordinal = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL.new
     178    @c_quantity_item = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM.new
    179179  end
    180180
    181181  def test_init
    182     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE, @c_dv_state
    183     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE, @state_machine
    184     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE, @state
    185     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE, @terminal_state
    186     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE, @non_terminal_state
    187     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION, @transition
    188     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE, @c_code_phase
    189     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY, @c_dv_quantity
    190     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL, @c_dv_ordinal
    191     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM, @c_quantity_item
     182    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE, @c_dv_state
     183    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE, @state_machine
     184    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE, @state
     185    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE, @terminal_state
     186    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE, @non_terminal_state
     187    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION, @transition
     188    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE, @c_code_phase
     189    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY, @c_dv_quantity
     190    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL, @c_dv_ordinal
     191    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM, @c_quantity_item
    192192  end
    193193end
  • ruby/trunk/tests/models/test_assumed_library_types.rb

    r64 r291  
    44class Assumed_Library_Test < Test::Unit::TestCase
    55  def setup
    6     @interval = OpenEHR::Assumed_Library_Types::Interval.new(1,2)
     6    @interval = OpenEhr::AssumedLibraryTypes::Interval.new(1,2)
    77  end
    88  def test_initialize
    9     assert_instance_of OpenEHR::Assumed_Library_Types::Interval, @interval
     9    assert_instance_of OpenEhr::AssumedLibraryTypes::Interval, @interval
    1010  end
    1111  def test_limits_comparable
  • ruby/trunk/tests/models/test_reference_model.rb

    r64 r291  
    55class ReferenceModelTest < Test::Unit::TestCase
    66  def setup
    7     @authored_resource = OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
     7    @authored_resource = OpenEhr::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
    88                                                                              :translations => "en",
    99                                                                              :description => "test")
    10     @translation_details = OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
     10    @translation_details = OpenEhr::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
    1111#    @openehr_definitions = OpenEHR::RM::Support::Definition::OpenEHR_Definitions.new
    12     @dv_boolean = OpenEHR::RM::Data_Types::Basic::DV_Boolean.new("TRUE")
    13     @dv_state = OpenEHR::RM::Data_Types::Basic::DV_State.new("code1",true)
    14     @dv_identifier = OpenEHR::RM::Data_Types::Basic::DV_Identifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")
    15     @dv_uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    16     @dv_ehr_uri = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
    17     @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new("valid value")
    18     @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("valid value", "AT1000")
    19     @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"]))
     12    @dv_boolean = OpenEhr::RM::DataTypes::Basic::DvBoolean.new("TRUE")
     13    @dv_state = OpenEhr::RM::DataTypes::Basic::DvState.new("code1",true)
     14    @dv_identifier = OpenEhr::RM::DataTypes::Basic::DvIdentifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")
     15    @dv_uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     16    @dv_ehr_uri = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
     17    @dv_text = OpenEhr::RM::DataTypes::Text::DvText.new("valid value")
     18    @dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("valid value", "AT1000")
     19    @dv_paragraph = OpenEhr::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
    2020  end
    2121 
    2222  def test_init
    23     assert_instance_of OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
    24     assert_instance_of OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
    25     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Boolean, @dv_boolean
    26     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_State, @dv_state
    27     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Identifier, @dv_identifier
    28     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_URI, @dv_uri
    29     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_EHR_URI, @dv_ehr_uri
    30     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text
    31     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
     23    assert_instance_of OpenEhr::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
     24    assert_instance_of OpenEhr::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
     25    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvBoolean, @dv_boolean
     26    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvState, @dv_state
     27    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvIdentifier, @dv_identifier
     28    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvUri, @dv_uri
     29    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
     30    assert_instance_of OpenEhr::RM::DataTypes::Text::DvText, @dv_text
     31    assert_instance_of OpenEhr::RM::DataTypes::Text::DvCodedText, @dv_coded_text
    3232  end
    3333
    3434  def test_constant
    35     assert_equal("\r", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::CR)
    36     assert_equal("\n", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::LF)
    37     assert_equal("\r", OpenEHR::RM::Data_Types::Basic::Data_Value::CR)
    38     assert_equal("\n", OpenEHR::RM::Data_Types::Basic::Data_Value::LF)
     35    assert_equal("\r", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::CR)
     36    assert_equal("\n", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::LF)
     37    assert_equal("\r", OpenEhr::RM::DataTypes::Basic::DataValue::CR)
     38    assert_equal("\n", OpenEhr::RM::DataTypes::Basic::DataValue::LF)
    3939  end
    4040
     
    4545    # Constraints Value_exists
    4646    assert_raise(ArgumentError){@dv_boolean.value=nil}
    47     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Basic::DV_Boolean.new(nil)}
     47    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Basic::DvBoolean.new(nil)}
    4848  end
    4949
     
    5555    @dv_state.terminal = false
    5656    assert !@dv_state.is_terminal?
    57     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_State.new(nil,nil)}
     57    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvState.new(nil,nil)}
    5858  end
    5959
     
    7171    @dv_identifier.type = "test id"
    7272    assert_equal("test id", @dv_identifier.type)
    73     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_Identifier.new(nil, nil, nil, nil)}
     73    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
    7474  end
    7575
     
    123123class ReferenceModelSupportIdentificationTest < Test::Unit::TestCase
    124124  def setup
    125     @object_id = OpenEHR::RM::Support::Identification::OBJECT_ID.new
    126     @terminology_id = OpenEHR::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
    127     @archetype_id = OpenEHR::RM::Support::Identification::ARCHETYPE_ID.new
     125    @object_id = OpenEhr::RM::Support::Identification::OBJECT_ID.new
     126    @terminology_id = OpenEhr::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
     127    @archetype_id = OpenEhr::RM::Support::Identification::ARCHETYPE_ID.new
    128128  end
    129129 
    130130  def test_init
    131     assert_instance_of OpenEHR::RM::Support::Identification::OBJECT_ID, @object_id
    132     assert_instance_of OpenEHR::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
    133     assert_instance_of OpenEHR::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
     131    assert_instance_of OpenEhr::RM::Support::Identification::OBJECT_ID, @object_id
     132    assert_instance_of OpenEhr::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
     133    assert_instance_of OpenEhr::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
    134134
    135135  end
Note: See TracChangeset for help on using the changeset viewer.