Changeset 216


Ignore:
Timestamp:
Aug 20, 2009, 8:16:53 PM (11 years ago)
Author:
KOBAYASHI, Shinji
Message:

move from Test:Unit to RSpec

Location:
ruby/branches/0.5
Files:
1 added
26 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb

    r167 r216  
    33require 'time'
    44
    5 module OpenEhr
     5module OpenEHR
    66  module AssumedLibraryTypes
    77    class Any < Object
  • ruby/branches/0.5/lib/open_ehr/rm/common/archetyped.rb

    r186 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109318114715_211173_0Report.html
    33# Ticket refs #65
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module Common
  • ruby/branches/0.5/lib/open_ehr/rm/common/change_control.rb

    r192 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109326589721_134411_997Report.html
    33# Ticket refs #64
    4 include OpenEhr::RM::Common::Generic
    5 module OpenEhr
     4include OpenEHR::RM::Common::Generic
     5module OpenEHR
    66  module RM
    77    module Common
  • ruby/branches/0.5/lib/open_ehr/rm/common/directory.rb

    r167 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140536622627_218703_7149Report.html
    33# Ticket refs #63
    4 include OpenEhr::RM::DataTypes::Text
    5 module OpenEhr
     4include OpenEHR::RM::DataTypes::Text
     5module OpenEHR
    66  module RM
    77    module Common
    88      module Directory
    9         class Folder < OpenEhr::RM::Common::Archetyped::Locatable
     9        class Folder < OpenEHR::RM::Common::Archetyped::Locatable
    1010          attr_accessor :items
    1111          attr_reader :folders
     
    2222          end
    2323        end       
    24         class VersionedFolder < OpenEhr::RM::Common::ChangeControl::VersionedObject
     24        class VersionedFolder < OpenEHR::RM::Common::ChangeControl::VersionedObject
    2525        end
    2626      end # of Directory
  • ruby/branches/0.5/lib/open_ehr/rm/common/generic.rb

    r167 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140169202660_257304_813Report.html
    33# Related to the ticket #62
    4 include OpenEhr::RM::Support::Identification
    5 include OpenEhr::RM::DataTypes::Basic
    6 module OpenEhr
     4include OpenEHR::RM::Support::Identification
     5include OpenEHR::RM::DataTypes::Basic
     6module OpenEHR
    77  module RM
    88    module Common
  • ruby/branches/0.5/lib/open_ehr/rm/common/resource.rb

    r167 r216  
    11require 'set'
    2 module OpenEhr
     2module OpenEHR
    33  module RM
    44    module Common
  • ruby/branches/0.5/lib/open_ehr/rm/composition/content/entry.rb

    r167 r216  
    1 module OpenEhr
     1module OpenEHR
    22  module RM
    33    module Content
  • ruby/branches/0.5/lib/open_ehr/rm/data_structures.rb

    r175 r216  
    44# refs #59
    55
    6 module OpenEhr
     6module OpenEHR
    77  module RM
    88    module DataStructures
    9       class DataStructure < OpenEhr::RM::Common::Archetyped::Locatable
     9      class DataStructure < OpenEHR::RM::Common::Archetyped::Locatable
    1010        def initialize(args = { })
    1111          super(args)
  • ruby/branches/0.5/lib/open_ehr/rm/data_structures/item_structure.rb

    r215 r216  
    44# refs #54
    55require 'set'
    6 include OpenEhr::RM::DataStructures
    7 module OpenEhr
     6include OpenEHR::RM::DataStructures
     7module OpenEHR
    88  module RM
    99    module DataStructures
     
    195195    end # of DataStructures
    196196  end # of RM
    197 end # of OpenEhr
     197end # of OpenEHR
  • ruby/branches/0.5/lib/open_ehr/rm/data_structures/item_structure/representation.rb

    r189 r216  
    33# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109066789167_738055_2581Report.html
    44# refs #53
    5 module OpenEhr
     5module OpenEHR
    66  module RM
    77    module DataStructures
    88      module ItemStructure
    99        module Representation
    10           class Item < OpenEhr::RM::Common::Archetyped::Locatable
     10          class Item < OpenEHR::RM::Common::Archetyped::Locatable
    1111            def initialize(args = {})
    1212              super(args)
     
    6161    end # of DataStructures
    6262  end # of RM
    63 end # of OpenEhr
     63end # of OpenEHR
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/basic.rb

    r195 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
    33# Ticket refs #52
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module DataTypes
     
    1010
    1111        class DataValue
    12           include OpenEhr::RM::Support::Definition::BasicDefinition
     12          include OpenEHR::RM::Support::Definition::BasicDefinition
     13          attr_accessor :value
     14          alias :v :value
     15
     16          def initialize(args = {})
     17            self.value = args[:value]
     18          end
     19
    1320          def ==(other)
    1421            return self.value == other.value
     
    1724
    1825        class DvBoolean < DataValue
    19           def initialize(value)
    20             self.value = value
     26          def initialize(args)
     27            super(args)
    2128          end
     29
    2230          def value=(value)
    2331            raise ArgumentError, "value must not be nil" if value.nil?
     
    3543
    3644        class DvState < DataValue
    37           attr_reader :value
     45          attr_reader :is_terminal
    3846
    39           def initialize(value, is_terminal)
    40             self.value=value
    41             self.is_terminal=is_terminal
     47          def initialize(args)           
     48            super(args)
     49            self.is_terminal = args[:is_terminal]
    4250          end
     51
    4352          def value=(v)
    4453            raise ArgumentError, "value should not be nil" if v.nil?
    4554            @value = v
    4655          end
     56
    4757          def is_terminal?
    4858            @is_terminal
    4959          end
     60
    5061          def is_terminal=(s)
    5162            raise ArgumentError, "terminal should not be nil" if s.nil?
     
    5566
    5667        class DvIdentifier
    57           attr_accessor :issuer, :assigner, :id, :type
    58           def initialize(assigner, id, issuer, type)
     68          attr_reader :issuer, :assigner, :id, :type
     69
     70          def initialize(args = {})
    5971            if assigner.nil? or assigner.empty?\
    6072              or id.nil? or id.empty? or issuer.nil? or issuer.empty?\
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/encapsulated.rb

    r174 r216  
    55require 'locale/info'
    66
    7 module OpenEhr
     7module OpenEHR
    88  module RM
    99    module DataTypes
    1010      module Encapsulated
    11         class DvEncapsulated  < OpenEhr::RM::DataTypes::Basic::DataValue
     11        class DvEncapsulated  < OpenEHR::RM::DataTypes::Basic::DataValue
    1212          attr_reader :language, :charset, :size
    1313          def initialize(charset, language, size)
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/quantity.rb

    r175 r216  
    33# Ticket refs #50
    44#require 'assumed_library_types'
    5 module OpenEhr
     5module OpenEHR
    66  module RM
    77    module DataTypes
    88      module Quantity
    9 
    10 #        autoload :Date_Time, "rm/data_types/quantity/date_time.rb"
    11 
    12         class DvOrdered < OpenEhr::RM::DataTypes::Basic::DataValue
     9        class DvOrdered < OpenEHR::RM::DataTypes::Basic::DataValue
    1310          include Comparable
    1411          attr_accessor :normal_range, :other_refference_ranges, :normal_status
    1512
    16           def initialize(normal_range=nil, normal_status = nil,
    17                          other_reference_ranges=nil)
    18             self.normal_range = normal_range
    19             self.normal_status = normal_status
    20             self.other_reference_ranges = other_reference_ranges
     13          def initialize(args = {})
     14            self.normal_range = args[:normal_range]
     15            self.normal_status = args[:normal_status]
     16            self.other_reference_ranges = args[:other_reference_ranges]
    2117          end         
    2218
     
    5147        end
    5248
    53         class DvInterval < OpenEhr::AssumedLibraryTypes::Interval
     49        class DvInterval < OpenEHR::AssumedLibraryTypes::Interval
    5450
    5551        end
     
    121117
    122118          def is_strictly_comparable_to?(others)
    123             unless others.instance_of? OpenEhr::RM::DataTypes::Quantity::DvOrdinal
     119            unless others.instance_of? OpenEHR::RM::DataTypes::Quantity::DvOrdinal
    124120              return false
    125121            end
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/text.rb

    r167 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067605961_209522_3179Report.html
    33# Ticket refs #48
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module DataTypes
     
    6262        end # of CodePhrase
    6363
    64         class DvText < OpenEhr::RM::DataTypes::Basic::DataValue
     64        class DvText < OpenEHR::RM::DataTypes::Basic::DataValue
    6565          attr_reader :value, :formatting, :hyperlink, :mappings
    6666          attr_reader :language, :encoding
     
    146146        end
    147147
    148         class DvParagraph < OpenEhr::RM::DataTypes::Basic::DataValue
     148        class DvParagraph < OpenEHR::RM::DataTypes::Basic::DataValue
    149149          attr_reader :items
    150150          def initialize(items)
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/time_specification.rb

    r167 r216  
    11# This module is related to the ticket #47
    22
    3 module OpenEhr
     3module OpenEHR
    44  module RM
    55    module DataTypes
    66      module TimeSpecification
    7         class DvTimeSpecification < OpenEhr::RM::DataTypes::Basic::DataValue
     7        class DvTimeSpecification < OpenEHR::RM::DataTypes::Basic::DataValue
    88          attr_reader :value
    99
  • ruby/branches/0.5/lib/open_ehr/rm/data_types/uri.rb

    r173 r216  
    2424end
    2525
    26 module OpenEhr
     26module OpenEHR
    2727  module RM
    2828    module DataTypes
    2929      module Uri
    30         class DvUri < OpenEhr::RM::DataTypes::Basic::DataValue
     30        class DvUri < OpenEHR::RM::DataTypes::Basic::DataValue
    3131          def initialize(value)
    3232            self.value = value
  • ruby/branches/0.5/lib/open_ehr/rm/security.rb

    r167 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1155650882301_836618_5314Report.html
    33# Ticket refs #41
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module Security
  • ruby/branches/0.5/lib/open_ehr/rm/support/assumed_types.rb

    r167 r216  
    22# and am, I will integrated to /lib/models/assumed_types.rb.
    33# By Shinji KOBAYASHI, 2008-07-20
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module Support
  • ruby/branches/0.5/lib/open_ehr/rm/support/definition.rb

    r167 r216  
    1 module OpenEhr
     1module OpenEHR
    22  module RM
    33    module Support
  • ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb

    r167 r216  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109331021343_528780_2066Report.html
    33# Ticket refs #39
    4 module OpenEhr
     4module OpenEHR
    55  module RM
    66    module Support
  • ruby/branches/0.5/lib/open_ehr/rm/support/measurement.rb

    r167 r216  
    1 module OpenEhr
     1module OpenEHR
    22  module RM
    33    module Support
  • ruby/branches/0.5/lib/open_ehr/rm/support/terminology.rb

    r167 r216  
    11
    2 module OpenEhr
     2module OpenEHR
    33  module RM
    44    module Support
     
    1818          end
    1919        end
    20         module OpenEhrCodeSetIdentifier
     20        module OpenEHRCodeSetIdentifier
    2121          CODE_SET_ID_CHARACER_SETS = "character sets".freeze
    2222          CODE_SET_ID_COMPRESSION_ALGORITHMS = "compression algorithms".freeze
     
    2929          end
    3030        end
    31         module OpenEhrTerminologyGroupIdentifiers
     31        module OpenEHRTerminologyGroupIdentifiers
    3232          GROUP_ID_ATTESTATION_REASON = "attestation reason".freeze
    3333          GROUP_ID_AUDIT_CHANGE_TYPE = "audit change type".freeze
     
    7575        end
    7676        class TerminologyService
    77           include OpenEhrCodeSetIdentifier, OpenEhrTerminologyGroupIdentifiers
     77          include OpenEHRCodeSetIdentifier, OpenEHRTerminologyGroupIdentifiers
    7878          def code_set(name)
    7979            raise NotImplementedError, "code_set is not implemented"
  • ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb

    r207 r216  
    11require File.dirname(__FILE__) + '/../../../../../spec_helper'
    2 include OpenEhr::RM::DataStructures::ItemStructure
    3 include OpenEhr::RM::DataStructures::ItemStructure::Representation
    4 include OpenEhr::RM::DataTypes::Text
     2include OpenEHR::RM::DataStructures::ItemStructure
     3include OpenEHR::RM::DataStructures::ItemStructure::Representation
     4include OpenEHR::RM::DataTypes::Text
    55
    66describe ItemList do
  • ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb

    r212 r216  
    11require File.dirname(__FILE__) + '/../../../../../spec_helper'
    22
    3 include OpenEhr::RM::DataStructures::ItemStructure
    4 include OpenEhr::RM::DataStructures::ItemStructure::Representation
    5 include OpenEhr::RM::DataTypes::Text
     3include OpenEHR::RM::DataStructures::ItemStructure
     4include OpenEHR::RM::DataStructures::ItemStructure::Representation
     5include OpenEHR::RM::DataTypes::Text
    66
    77def row(args)
  • ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb

    r215 r216  
    11require File.dirname(__FILE__) + '/../../../../../spec_helper'
    22
    3 include OpenEhr::RM::DataStructures::ItemStructure
    4 include OpenEhr::RM::DataStructures::ItemStructure::Representation
    5 include OpenEhr::RM::DataTypes::Text
     3include OpenEHR::RM::DataStructures::ItemStructure
     4include OpenEHR::RM::DataStructures::ItemStructure::Representation
     5include OpenEHR::RM::DataTypes::Text
    66
    77describe ItemTree do
     
    2121  end
    2222
    23   it 'fist item name should be one' do
     23  it 'first item name should be one' do
    2424    @item_tree.items[0].name.value.should == 'one'
    2525  end
     26
     27  it 'has valid element path' do
     28  end
    2629end
  • ruby/branches/0.5/test/unit/open_ehr/rm/data_types_test.rb

    r191 r216  
    4242    assert_equal 'COMPLETED', @dv_state.value.defining_code.code_string
    4343    assert @dv_state.is_terminal?
    44     assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvState.new(nil,nil)}
     44    assert_raise(ArgumentError) {OpenEHR::RM::DataTypes::Basic::DvState.new(nil,nil)}
    4545    assert_raise(ArgumentError) {@dv_state.value=nil}
    4646    assert_raise(ArgumentError) {@dv_state.is_terminal=nil}
     
    6060    @dv_identifier.type = "test id"
    6161    assert_equal("test id", @dv_identifier.type)
    62     assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
     62    assert_raise(ArgumentError) {OpenEHR::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
    6363  end
    6464end
     
    6767class RM_Data_Types_URI_Test < Test::Unit::TestCase
    6868  def setup
    69     @dv_uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    70     @dv_ehr_uri = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
     69    @dv_uri = OpenEHR::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     70    @dv_ehr_uri = OpenEHR::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
    7171  end
    7272
    7373  def test_init
    74     assert_instance_of OpenEhr::RM::DataTypes::Uri::DvUri, @dv_uri
    75     assert_instance_of OpenEhr::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
     74    assert_instance_of OpenEHR::RM::DataTypes::Uri::DvUri, @dv_uri
     75    assert_instance_of OpenEHR::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
    7676  end
    7777
     
    9696class RM_Data_Types_Text_Test < Test::Unit::TestCase
    9797  def setup
    98     assert_nothing_raised(Exception){@dv_text = OpenEhr::RM::DataTypes::Text::DvText.new("valid value")}
    99     @terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10')
     98    assert_nothing_raised(Exception){@dv_text = OpenEHR::RM::DataTypes::Text::DvText.new("valid value")}
     99    @terminology_id = OpenEHR::RM::Support::Identification::TerminologyId.new('ICD10')
    100100   
    101     assert_nothing_raised(Exception){@code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('C92.0', @terminology_id)}
    102     assert_nothing_raised(Exception){@dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("Acute Myeloid Leukemia", @code_phrase)}
    103     @dv_paragraph = OpenEhr::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
    104     @term_mapping = OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text,"TEST")
     101    assert_nothing_raised(Exception){@code_phrase = OpenEHR::RM::DataTypes::Text::CodePhrase.new('C92.0', @terminology_id)}
     102    assert_nothing_raised(Exception){@dv_coded_text = OpenEHR::RM::DataTypes::Text::DvCodedText.new("Acute Myeloid Leukemia", @code_phrase)}
     103    @dv_paragraph = OpenEHR::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
     104    @term_mapping = OpenEHR::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text,"TEST")
    105105  end
    106106
    107107  def test_init
    108     assert_instance_of OpenEhr::RM::DataTypes::Text::DvText, @dv_text
    109     assert_instance_of OpenEhr::RM::DataTypes::Text::CodePhrase, @code_phrase
    110     assert_instance_of OpenEhr::RM::DataTypes::Text::DvCodedText, @dv_coded_text
    111     assert_instance_of OpenEhr::RM::DataTypes::Text::TermMapping, @term_mapping
     108    assert_instance_of OpenEHR::RM::DataTypes::Text::DvText, @dv_text
     109    assert_instance_of OpenEHR::RM::DataTypes::Text::CodePhrase, @code_phrase
     110    assert_instance_of OpenEHR::RM::DataTypes::Text::DvCodedText, @dv_coded_text
     111    assert_instance_of OpenEHR::RM::DataTypes::Text::TermMapping, @term_mapping
    112112  end
    113113
     
    145145  def test_term_mapping
    146146    assert_equal '=', @term_mapping.match
    147     assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('>')
    148     assert OpenEhr::RM::DataTypes::Text::TermMapping.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?('!')
     147    assert OpenEHR::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('>')
     148    assert OpenEHR::RM::DataTypes::Text::TermMapping.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?('!')
    152152    assert_equal @dv_coded_text, @term_mapping.purpose
    153153    assert_equal "TEST", @term_mapping.target
    154     assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new}
    155     assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('!',@dv_coded_text, "invalid case")}
    156     assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',nil , "invalid case")}
    157     assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text, nil)}
     154    assert_raise(ArgumentError){OpenEHR::RM::DataTypes::Text::TermMapping.new}
     155    assert_raise(ArgumentError){OpenEHR::RM::DataTypes::Text::TermMapping.new('!',@dv_coded_text, "invalid case")}
     156    assert_raise(ArgumentError){OpenEHR::RM::DataTypes::Text::TermMapping.new('=',nil , "invalid case")}
     157    assert_raise(ArgumentError){OpenEHR::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text, nil)}
    158158  end
    159159end
     
    162162  def setup
    163163    assert_nothing_raised(Exception){
    164       @dv_ordered = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new }
    165     assert_nothing_raised(Exception){
    166       terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
    167       code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
    168       urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+', code_phrase)
    169       @dv_ordinal1 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(1, urinary_protein)
    170       code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
    171       urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+++', code_phrase)
    172       @dv_ordinal2 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(3, urinary_protein)}
    173     assert_nothing_raised(Exception){
    174       @dv_interval = OpenEhr::RM::DataTypes::Quantity::DvInterval.new(@dv_ordinal1, @dv_ordinal2)}
    175     meaning = OpenEhr::RM::DataTypes::Text::DvText.new('normal')
    176     assert_nothing_raised(Exception){
    177       @reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)}
    178     assert_nothing_raised(Exception){
    179       @dv_quantified = OpenEhr::RM::DataTypes::Quantity::DvQuantified.new(1,'=')}
    180     assert_nothing_raised(Exception){
    181       @dv_amount = OpenEhr::RM::DataTypes::Quantity::DvAmount.new(2,'<')}
    182     assert_nothing_raised(Exception){
    183       @dv_quantity = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(3, 'mg', '~')}
    184     assert_nothing_raised(Exception){
    185       @dv_count = OpenEhr::RM::DataTypes::Quantity::DvCount.new(1)}
    186     assert_nothing_raised(Exception){
    187       @dv_proportion = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(2,3,0)}
    188     assert_nothing_raised(Exception){
    189       @dv_absolute_quantity = OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity.new(7,'=')}
     164      @dv_ordered = OpenEHR::RM::DataTypes::Quantity::DvOrdered.new }
     165    assert_nothing_raised(Exception){
     166      terminology = OpenEHR::RM::Support::Identification::TerminologyId.new('urine')
     167      code_phrase = OpenEHR::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     168      urinary_protein = OpenEHR::RM::DataTypes::Text::DvCodedText.new('+', code_phrase)
     169      @dv_ordinal1 = OpenEHR::RM::DataTypes::Quantity::DvOrdinal.new(1, urinary_protein)
     170      code_phrase = OpenEHR::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     171      urinary_protein = OpenEHR::RM::DataTypes::Text::DvCodedText.new('+++', code_phrase)
     172      @dv_ordinal2 = OpenEHR::RM::DataTypes::Quantity::DvOrdinal.new(3, urinary_protein)}
     173    assert_nothing_raised(Exception){
     174      @dv_interval = OpenEHR::RM::DataTypes::Quantity::DvInterval.new(@dv_ordinal1, @dv_ordinal2)}
     175    meaning = OpenEHR::RM::DataTypes::Text::DvText.new('normal')
     176    assert_nothing_raised(Exception){
     177      @reference_range = OpenEHR::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)}
     178    assert_nothing_raised(Exception){
     179      @dv_quantified = OpenEHR::RM::DataTypes::Quantity::DvQuantified.new(1,'=')}
     180    assert_nothing_raised(Exception){
     181      @dv_amount = OpenEHR::RM::DataTypes::Quantity::DvAmount.new(2,'<')}
     182    assert_nothing_raised(Exception){
     183      @dv_quantity = OpenEHR::RM::DataTypes::Quantity::DvQuantity.new(3, 'mg', '~')}
     184    assert_nothing_raised(Exception){
     185      @dv_count = OpenEHR::RM::DataTypes::Quantity::DvCount.new(1)}
     186    assert_nothing_raised(Exception){
     187      @dv_proportion = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(2,3,0)}
     188    assert_nothing_raised(Exception){
     189      @dv_absolute_quantity = OpenEHR::RM::DataTypes::Quantity::DvAbsoluteQuantity.new(7,'=')}
    190190   end
    191191
    192192   def test_init
    193      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdered, @dv_ordered
    194      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
    195      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvInterval, @dv_interval
    196      assert_instance_of OpenEhr::RM::DataTypes::Quantity::ReferenceRange, @reference_range
    197      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal1
    198      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal2
    199      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
    200      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAmount, @dv_amount
    201      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantity, @dv_quantity
    202      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvCount, @dv_count
    203      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvProportion, @dv_proportion
    204      assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity, @dv_absolute_quantity
     193     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvOrdered, @dv_ordered
     194     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     195     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvInterval, @dv_interval
     196     assert_instance_of OpenEHR::RM::DataTypes::Quantity::ReferenceRange, @reference_range
     197     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal1
     198     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal2
     199     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     200     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvAmount, @dv_amount
     201     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvQuantity, @dv_quantity
     202     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvCount, @dv_count
     203     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvProportion, @dv_proportion
     204     assert_instance_of OpenEHR::RM::DataTypes::Quantity::DvAbsoluteQuantity, @dv_absolute_quantity
    205205  end
    206206
     
    212212    assert @dv_ordered.is_simple?
    213213    assert_raise(NotImplementedError){@dv_ordered<=>1}
    214     openehr_terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('openEHR')
    215     normal_code = OpenEhr::RM::DataTypes::Text::CodePhrase.new('N', openehr_terminology_id)
     214    openehr_terminology_id = OpenEHR::RM::Support::Identification::TerminologyId.new('openEHR')
     215    normal_code = OpenEHR::RM::DataTypes::Text::CodePhrase.new('N', openehr_terminology_id)
    216216    assert_equal 'N', normal_code.code_string
    217217    assert_nothing_raised(Exception){
    218218      @dv_ordered.normal_status = normal_code }
    219219    assert @dv_ordered.is_normal?
    220     other = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new
     220    other = OpenEHR::RM::DataTypes::Quantity::DvOrdered.new
    221221    assert_raise(NotImplementedError){
    222222      @dv_ordered.is_strictly_comparable_to?(other)}
     
    230230    assert_equal 'normal', @reference_range.meaning.value
    231231    assert_equal 1, @reference_range.range.lower.value
    232     terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
    233     code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
    234     urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('++', code_phrase)
    235     dv_ordinal = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(2, urinary_protein)
     232    terminology = OpenEHR::RM::Support::Identification::TerminologyId.new('urine')
     233    code_phrase = OpenEHR::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     234    urinary_protein = OpenEHR::RM::DataTypes::Text::DvCodedText.new('++', code_phrase)
     235    dv_ordinal = OpenEHR::RM::DataTypes::Quantity::DvOrdinal.new(2, urinary_protein)
    236236    assert @reference_range.is_in_range?(dv_ordinal)
    237237    dv_ordinal.value = 6
     
    242242    assert_equal 1, @dv_quantified.magnitude
    243243    assert_equal '=', @dv_quantified.magnitude_status
    244     assert !OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('*')
    245     assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.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?('~')
     244    assert !OpenEHR::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('*')
     245    assert OpenEHR::RM::DataTypes::Quantity::DvQuantified.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?('~')
    250250    assert_nothing_raised(Exception){@dv_quantified.magnitude = 0}
    251251    assert_equal 0, @dv_quantified.magnitude
     
    287287    assert @dv_ordinal1 > @dv_ordinal2
    288288    assert_raise(ArgumentError){@dv_ordinal1.limits = @reference_range}
    289     meaning = OpenEhr::RM::DataTypes::Text::DvText.new('limits')
    290     limit_reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)
     289    meaning = OpenEHR::RM::DataTypes::Text::DvText.new('limits')
     290    limit_reference_range = OpenEHR::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)
    291291    assert_nothing_raised(Exception){@dv_ordinal1.limits = limit_reference_range}
    292292    assert_equal 'limits', @dv_ordinal1.limits.meaning.value
     
    297297    assert_equal 'mg', @dv_quantity.units
    298298    assert_equal '~', @dv_quantity.magnitude_status
    299     dv_quantity2 = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(4, 'mg', '~')
     299    dv_quantity2 = OpenEHR::RM::DataTypes::Quantity::DvQuantity.new(4, 'mg', '~')
    300300    assert_equal 'mg', dv_quantity2.units
    301301    assert @dv_quantity.is_strictly_comparable_to?(dv_quantity2)
     
    316316  def test_dv_count
    317317    assert_equal 1, @dv_count.magnitude
    318     dv_count2 = OpenEhr::RM::DataTypes::Quantity::DvCount.new(2)
     318    dv_count2 = OpenEHR::RM::DataTypes::Quantity::DvCount.new(2)
    319319    dv_count3 = @dv_count + dv_count2
    320320    assert 3, dv_count3.magnitude
     
    324324
    325325  def test_proportion_kind
    326     assert_equal 0, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_RATIO
    327     assert_equal 1, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_UNITARY
    328     assert_equal 2, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_PERCENT
    329     assert_equal 3, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_FRACTION
    330     assert_equal 4, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_INTEGER_FRACTION
    331     assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(0)
    332     assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(4)
    333     assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(-1)
    334     assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(5)
     326    assert_equal 0, OpenEHR::RM::DataTypes::Quantity::ProportionKind::PK_RATIO
     327    assert_equal 1, OpenEHR::RM::DataTypes::Quantity::ProportionKind::PK_UNITARY
     328    assert_equal 2, OpenEHR::RM::DataTypes::Quantity::ProportionKind::PK_PERCENT
     329    assert_equal 3, OpenEHR::RM::DataTypes::Quantity::ProportionKind::PK_FRACTION
     330    assert_equal 4, OpenEHR::RM::DataTypes::Quantity::ProportionKind::PK_INTEGER_FRACTION
     331    assert OpenEHR::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(0)
     332    assert OpenEHR::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(4)
     333    assert !OpenEHR::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(-1)
     334    assert !OpenEHR::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(5)
    335335  end
    336336
     
    341341    assert_equal 2.0/3.0, @dv_proportion.magnitude
    342342    assert @dv_proportion.is_integral?
    343     dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,0)
     343    dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(1,3,0)
    344344    assert @dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    345     dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,4)
     345    dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(1,3,4)
    346346    assert !@dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    347347    assert_raise(ArgumentError){
    348       dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1.5,2.3,3)}
    349     assert_raise(ArgumentError){
    350       dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,1)}
    351     assert_nothing_raised(Exception){
    352       dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,1,1)}
    353     assert_raise(ArgumentError){
    354       dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,2)}
    355     assert_nothing_raised(Exception){
    356       dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,100,2)}
     348      dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(1.5,2.3,3)}
     349    assert_raise(ArgumentError){
     350      dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(10,10,1)}
     351    assert_nothing_raised(Exception){
     352      dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(10,1,1)}
     353    assert_raise(ArgumentError){
     354      dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(10,10,2)}
     355    assert_nothing_raised(Exception){
     356      dv_proportion2 = OpenEHR::RM::DataTypes::Quantity::DvProportion.new(10,100,2)}
    357357  end
    358358
     
    361361class EncapsulatedTest < Test::Unit::TestCase
    362362  def setup
    363     charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
    364     language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
    365     assert_nothing_raised(Exception){
    366       @dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)}
    367     assert_nothing_raised(Exception){
    368       @dv_parsable = OpenEhr::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
    369     media_type = OpenEhr::RM::DataTypes::Text::CodePhrase.new('text/html', 'media-types')
    370     uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    371     assert_nothing_raised(Exception){
    372       @dv_multimedia = OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia.new(charset, language, 10, media_type, uri)}
     363    charset = OpenEHR::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     364    language = OpenEHR::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     365    assert_nothing_raised(Exception){
     366      @dv_encapsulated = OpenEHR::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)}
     367    assert_nothing_raised(Exception){
     368      @dv_parsable = OpenEHR::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
     369    media_type = OpenEHR::RM::DataTypes::Text::CodePhrase.new('text/html', 'media-types')
     370    uri = OpenEHR::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     371    assert_nothing_raised(Exception){
     372      @dv_multimedia = OpenEHR::RM::DataTypes::Encapsulated::DvMultimedia.new(charset, language, 10, media_type, uri)}
    373373  end
    374374
    375375  def test_init
    376     assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated, @dv_encapsulated
    377     assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvParsable, @dv_parsable
    378     assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia, @dv_multimedia
     376    assert_instance_of OpenEHR::RM::DataTypes::Encapsulated::DvEncapsulated, @dv_encapsulated
     377    assert_instance_of OpenEHR::RM::DataTypes::Encapsulated::DvParsable, @dv_parsable
     378    assert_instance_of OpenEHR::RM::DataTypes::Encapsulated::DvMultimedia, @dv_multimedia
    379379  end
    380380
     
    383383    assert_equal 'ja', @dv_encapsulated.language.code_string
    384384    assert_equal 10, @dv_encapsulated.size
    385     wrong_charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('USO8000', 'character-sets')
     385    wrong_charset = OpenEHR::RM::DataTypes::Text::CodePhrase.new('USO8000', 'character-sets')
    386386    assert_raise(ArgumentError){@dv_encapsulated.charset = wrong_charset}
    387     charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('EUC-JP', 'character-sets')
     387    charset = OpenEHR::RM::DataTypes::Text::CodePhrase.new('EUC-JP', 'character-sets')
    388388    assert_nothing_raised(Exception){@dv_encapsulated.charset = charset}
    389389    assert_equal 'EUC-JP', @dv_encapsulated.charset.code_string
    390     wrong_language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('jpg', 'language')
     390    wrong_language = OpenEHR::RM::DataTypes::Text::CodePhrase.new('jpg', 'language')
    391391    assert_raise(ArgumentError){@dv_encapsulated.language = wrong_language}
    392     language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('eng', 'language')
     392    language = OpenEHR::RM::DataTypes::Text::CodePhrase.new('eng', 'language')
    393393    assert_nothing_raised(Exception){@dv_encapsulated.language = language}
    394394    assert_equal 'eng', @dv_encapsulated.language.code_string
     
    428428class TestDvTimeSpecification < Test::Unit::TestCase
    429429  def setup
    430     charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
    431     language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
    432     assert_nothing_raised(Exception){
    433       dv_parsable = OpenEhr::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
    434       @dv_time_specification = OpenEhr::RM::DataTypes::TimeSpecification::DvTimeSpecification.new(dv_parsable)}
     430    charset = OpenEHR::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     431    language = OpenEHR::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     432    assert_nothing_raised(Exception){
     433      dv_parsable = OpenEHR::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
     434      @dv_time_specification = OpenEHR::RM::DataTypes::TimeSpecification::DvTimeSpecification.new(dv_parsable)}
    435435#    assert_nothing_raised(Exception){
    436436#      @dv_periodic_time_specification = DV_Periodic_Time_Specification.new('[200004181100;200004181110]/(7d)@DWIST', charset, language, 10, 'HL7:PIVL')}
     
    438438
    439439  def test_init
    440     assert_instance_of OpenEhr::RM::DataTypes::TimeSpecification::DvTimeSpecification, @dv_time_specification
     440    assert_instance_of OpenEHR::RM::DataTypes::TimeSpecification::DvTimeSpecification, @dv_time_specification
    441441  end
    442442
Note: See TracChangeset for help on using the changeset viewer.