Changeset 90
- Timestamp:
- Jul 27, 2008, 7:45:35 PM (16 years ago)
- Location:
- ruby/trunk/lib/models
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/models/rm.rb
r26 r90 20 20 module Support 21 21 autoload :Definition, "rm/support/definition.rb" 22 23 module Identification 24 autoload :OBJECT_ID, "rm/support/identification.rb" 25 end 26 27 module Terminology 28 autoload :Terminology, "rm/support/terminology.rb" 29 end 22 autoload :Identification, "rm/support/identification.rb" 23 autoload :Terminology, "rm/support/terminology.rb" 30 24 end 31 25 -
ruby/trunk/lib/models/rm/data_types/text.rb
r89 r90 30 30 end 31 31 private 32 def match_valid(ma ch)33 raise ArgumentError, "match is not valid" if self.is_valid_mach_code? match32 def match_valid(match) 33 raise ArgumentError, "match is not valid" if !Term_Mapping.is_valid_mach_code? match 34 34 end 35 35 def purpose_valid(purpose) 36 if !purpose.nil? and!purpose.instance_of? DV_Coded_Text36 if purpose.nil? or !purpose.instance_of? DV_Coded_Text 37 37 raise ArgumentError, "purpose is not valid" 38 38 end -
ruby/trunk/lib/models/rm/support/identification.rb
r26 r90 1 # This module is an implementation of this UML: 2 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109331021343_528780_2066Report.html 3 # Ticket refs #39 1 4 module OpenEHR 2 5 module RM … … 4 7 module Identification 5 8 6 class O BJECT_ID7 attr_ accessor :value9 class Object_ID 10 attr_reader :value 8 11 9 def initiallize(value) 10 raise "empty value" unless value 11 @value = value 12 def initialize(value) 13 self.value=value 14 end 15 16 def value=(value) 17 raise "empty value" if value.nil? or value.empty? 18 @value = value 12 19 end 13 20 end # of ObjectID 14 15 class A RCHETYPE_ID < OBJECT_ID21 22 class Archetype_ID < Object_ID 16 23 end 17 24 18 class T ERMINOLOGY_ID < OBJECT_ID25 class Terminology_ID < Object_ID 19 26 attr_reader :name 20 27 21 28 def initialize(name , version_id) 22 29 @name , @version_id = name , version_id 23 # if arg1 == nil24 # super(arg0)25 # else26 # super(toValue(arg0, arg1))27 # @name = arg028 # @version = arg129 # end30 30 end 31 31 … … 57 57 name + (version == nil ? "" : "(" + version + ")") 58 58 end 59 end # of Terminology ID59 end # of Terminology_ID 60 60 end # of Definition 61 61 end # of Support -
ruby/trunk/lib/models/tests/test_reference_model.rb
r89 r90 18 18 @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("valid value", "AT1000") 19 19 @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"])) 20 @term_mapping = OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text,"TEST") 21 # @code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new 20 22 # @agent = OpenEHR::RM::Demogrphic::Agent.new 21 23 # @organisation = OpenEHR::RM::Demogrphic::Organisation.new … … 34 36 assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text 35 37 assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text 38 assert_instance_of OpenEHR::RM::Data_Types::Text::Term_Mapping, @term_mapping 36 39 # assert_instance_of OpenEHR::RM::Demogrphic::Agent, @agent 37 40 # assert_instance_of OpenEHR::RM::Demogrphic::Organisation, @organisation … … 125 128 end 126 129 127 def test_terminology_mapping 128 130 def test_term_mapping 131 assert_equal '=', @term_mapping.match 132 assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('>') 133 assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('=') 134 assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('<') 135 assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('?') 136 assert !OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('!') 137 assert_equal @dv_coded_text, @term_mapping.purpose 138 assert_equal "TEST", @term_mapping.target 139 assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new} 140 assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('!',@dv_coded_text, "invalid case")} 141 assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',nil , "invalid case")} 142 assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text, nil)} 129 143 end 130 144 end 131 145 132 133 146 class ReferenceModelSupportIdentificationTest < Test::Unit::TestCase 134 147 def setup 135 @object_id = OpenEHR::RM::Support::Identification::OBJECT_ID.new136 @terminology_id = OpenEHR::RM::Support::Identification::T ERMINOLOGY_ID.new('terminology','version')137 @archetype_id = OpenEHR::RM::Support::Identification::A RCHETYPE_ID.new148 assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")} 149 @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('terminology','version') 150 @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.3") 138 151 end 139 152 140 153 def test_init 141 assert_instance_of OpenEHR::RM::Support::Identification::OBJECT_ID, @object_id 142 assert_instance_of OpenEHR::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id 143 assert_instance_of OpenEHR::RM::Support::Identification::ARCHETYPE_ID, @archetype_id 154 assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id 155 assert_instance_of OpenEHR::RM::Support::Identification::Terminology_ID, @terminology_id 156 assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, @archetype_id 157 end 144 158 145 end146 159 end
Note:
See TracChangeset
for help on using the changeset viewer.