1 | require 'test/unit'
|
---|
2 | require 'set'
|
---|
3 | require 'rm'
|
---|
4 |
|
---|
5 | class RM_Common_Resource_Test < Test::Unit::TestCase
|
---|
6 | def setup
|
---|
7 | @authored_resource = OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
|
---|
8 | :translations => "en",
|
---|
9 | :description => "test")
|
---|
10 | @translation_details = OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
|
---|
11 | end
|
---|
12 | def test_init
|
---|
13 | assert_instance_of OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
|
---|
14 | assert_instance_of OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
|
---|
15 | end
|
---|
16 |
|
---|
17 | end
|
---|
18 |
|
---|
19 | class RM_Common_Archetyped_Test < Test::Unit::TestCase
|
---|
20 | def setup
|
---|
21 | @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('Test')
|
---|
22 | @uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.5')
|
---|
23 | @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
|
---|
24 | @template_id = OpenEHR::RM::Support::Identification::Template_ID.new('1.0.1')
|
---|
25 | assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
|
---|
26 | 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"))}
|
---|
27 | end
|
---|
28 |
|
---|
29 | def test_init
|
---|
30 | assert_instance_of OpenEHR::RM::Common::Archetyped::Archetyped, @archetyped
|
---|
31 | assert_instance_of OpenEHR::RM::Common::Archetyped::Link, @link
|
---|
32 | end
|
---|
33 |
|
---|
34 | def test_archetyped
|
---|
35 | assert_equal @archetype_id, @archetyped.archetype_id
|
---|
36 | assert_equal '1.0.1', @archetyped.rm_version
|
---|
37 | assert_raise(ArgumentError){@archetyped.archetype_id = nil}
|
---|
38 | assert_raise(ArgumentError){@archetyped.rm_version = nil}
|
---|
39 | assert_raise(ArgumentError){@archetyped.rm_version = ''}
|
---|
40 | assert_nothing_raised(Exception){@archetyped.template_id = @template_id}
|
---|
41 | assert_equal @template_id, @archetyped.template_id
|
---|
42 | archetype_id2 = OpenEHR::RM::Support::Identification::Archetype_ID.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
|
---|
43 | assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2}
|
---|
44 | assert_equal archetype_id2, @archetyped.archetype_id
|
---|
45 | assert_nothing_raised(ArgumentError){@archetyped.rm_version = '1.0.2'}
|
---|
46 | assert_equal '1.0.2', @archetyped.rm_version
|
---|
47 | end
|
---|
48 |
|
---|
49 | def test_link
|
---|
50 | # test constructor
|
---|
51 | assert_equal 'generic', @link.meaning.value
|
---|
52 | assert_equal 'ehr://test/', @link.target.value
|
---|
53 | assert_equal 'problem', @link.type.value
|
---|
54 | # test meaning
|
---|
55 | assert_nothing_raised(Exception){@link.meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('clinical')}
|
---|
56 | assert_equal 'clinical', @link.meaning.value
|
---|
57 | assert_raise(ArgumentError){@link.meaning = nil}
|
---|
58 | # test target
|
---|
59 | assert_nothing_raised(Exception){@link.target = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://try/")}
|
---|
60 | assert_equal 'ehr://try/', @link.target.value
|
---|
61 | assert_raise(ArgumentError){@link.target = nil}
|
---|
62 | # test type
|
---|
63 | assert_nothing_raised(Exception){@link.type = OpenEHR::RM::Data_Types::Text::DV_Text.new("issue")}
|
---|
64 | assert_equal 'issue', @link.type.value
|
---|
65 | assert_raise(ArgumentError){@link.type = nil}
|
---|
66 | end
|
---|
67 | end
|
---|
68 |
|
---|
69 | class RM_Common_Generic_Test < Test::Unit::TestCase
|
---|
70 | def setup
|
---|
71 | # assert_nothing_raised(Exception){@party_proxy = OpenEHR::RM::Common::Generic::Party_Proxy.new}
|
---|
72 | # change_type = OpenEHR::RM::Data_Types::Text::DV_Text.new('audit_type')
|
---|
73 | # time_committed = OpenEHR::RM::Data_Types::Quantity::Date_Time::DV_Date_Time.new(2008)
|
---|
74 | # assert_nothing_raised(Exception){@audit_details = OpenEHR::RM::Common::Generic::Audit_Details.new('rails',@party_proxy, change_type, time_committed)}
|
---|
75 | end
|
---|
76 | def test_init
|
---|
77 | end
|
---|
78 | end
|
---|
79 |
|
---|
80 | class RM_Common_Directory_Test < Test::Unit::TestCase
|
---|
81 | def setup
|
---|
82 | dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('root')
|
---|
83 | assert_nothing_raised(Exception){@folder = OpenEHR::RM::Common::Directory::Folder.new('at0000', dv_text, nil)}
|
---|
84 | end
|
---|
85 |
|
---|
86 | def test_init
|
---|
87 | assert_instance_of OpenEHR::RM::Common::Directory::Folder, @folder
|
---|
88 | end
|
---|
89 |
|
---|
90 | def test_folder
|
---|
91 | assert_equal 'at0000', @folder.archetype_node_id
|
---|
92 | assert_equal 'root', @folder.name.value
|
---|
93 | end
|
---|
94 | end
|
---|
95 |
|
---|
96 | class RM_Common_Change_Control_Test < Test::Unit::TestCase
|
---|
97 | def setup
|
---|
98 | hier_object_id = OpenEHR::RM::Support::Identification::Hier_Object_ID.new('0.0.4')
|
---|
99 | object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")
|
---|
100 | object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', object_id)
|
---|
101 | versions = Set.new [object_ref]
|
---|
102 | # audit_detail = OpenEHR::RM::Generic::Audit_Detail.new()
|
---|
103 | # assert_nothing_raised(Exception){@version = OpenEHR::RM::Common::Change_Control::Version.new(hier_object_id, versions)}
|
---|
104 | # assert_nothing_raised(Exception){@contribution = OpenEHR::RM::Common::Change_Control::Contribution.new(hier_object_id, versions, audit_detail)}
|
---|
105 | end
|
---|
106 | def test_init
|
---|
107 | # assert_instace_of OpenEHR::RM::Common::Change_Control::Contribution @contribution
|
---|
108 | # assert_instace_of OpenEHR::RM::Common::Change_Control::Version @version
|
---|
109 | end
|
---|
110 | def test_version
|
---|
111 | end
|
---|
112 | def test_contribution
|
---|
113 | # assert_equal @contribution.uid
|
---|
114 | end
|
---|
115 | end
|
---|