open_ehr 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/README.rdoc +3 -3
- data/VERSION +1 -1
- data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +61 -34
- data/lib/open_ehr/am/openehr_profile/data_types/basic.rb +27 -0
- data/lib/open_ehr/am/openehr_profile/data_types/quantity.rb +18 -0
- data/lib/open_ehr/am/openehr_profile/data_types/text.rb +22 -0
- data/lib/open_ehr/am/openehr_profile/data_types.rb +12 -0
- data/lib/open_ehr/am/openehr_profile.rb +10 -0
- data/lib/open_ehr/am.rb +2 -0
- data/lib/open_ehr/assumed_library_types.rb +30 -25
- data/lib/open_ehr/parser/cadl_grammar.tt +479 -163
- data/lib/open_ehr/parser/shared_token_grammar.tt +63 -43
- data/lib/open_ehr/rm/data_types/quantity/date_time.rb +27 -14
- data/lib/open_ehr.rb +1 -1
- data/open_ehr.gemspec +17 -6
- data/spec/lib/open_ehr/am/archetype/assertion/operator_kind_spec.rb +4 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_spec.rb +20 -48
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +33 -8
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +19 -52
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +2 -3
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +27 -7
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +0 -1
- data/spec/lib/open_ehr/am/openehr_profile/data_types/text/c_code_phrase_spec.rb +35 -0
- data/spec/lib/open_ehr/parser/adl14/adl-test-SOME_TYPE.generic_type_basic.draft.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test2.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.basic_types.test.adl +3 -3
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_code_phrase.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.datetime.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.durations.test.adl +2 -4
- data/spec/lib/open_ehr/parser/adl_archetype_internal_ref_with_generics_spec.rb +6 -6
- data/spec/lib/open_ehr/parser/adl_archetype_slot_cluster_spec.rb +101 -0
- data/spec/lib/open_ehr/parser/adl_archetype_slot_spec.rb +193 -0
- data/spec/lib/open_ehr/parser/adl_archetype_uncommon_term_keys_spec.rb +25 -0
- data/spec/lib/open_ehr/parser/adl_parser_spec.rb +6 -6
- data/spec/lib/open_ehr/parser/basic_generic_type_spec.rb +18 -0
- data/spec/lib/open_ehr/parser/basic_type_spec.rb +2922 -0
- data/spec/lib/open_ehr/parser/code_phrase_spec.rb +91 -0
- data/spec/lib/open_ehr/parser/date_time_spec.rb +1953 -0
- data/spec/lib/open_ehr/parser/duration_spec.rb +475 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_duration_spec.rb +44 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb +6 -2
- data/spec/spec_helper.rb +3 -2
- metadata +52 -41
- data/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb +0 -21
- data/lib/open_ehr/am/open_ehr_profile/data_types/basic.rb +0 -29
- data/lib/open_ehr/am/open_ehr_profile/data_types/quantity.rb +0 -19
- data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +0 -15
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
|
2
|
-
include OpenEHR::AssumedLibraryTypes
|
|
3
2
|
include OpenEHR::AM::Archetype
|
|
4
3
|
include OpenEHR::AM::Archetype::ConstraintModel::Primitive
|
|
4
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
|
5
5
|
|
|
6
6
|
describe CDateTime do
|
|
7
7
|
before(:each) do
|
|
8
|
-
default_value =
|
|
9
|
-
assumed_value =
|
|
10
|
-
range = Interval.new(:lower =>
|
|
11
|
-
:upper =>
|
|
8
|
+
default_value = DvDateTime.new(:value => '2010-01-25T01:23:45.1')
|
|
9
|
+
assumed_value = DvDateTime.new(:value => '2001-12-23T22:02:33.2')
|
|
10
|
+
range = Interval.new(:lower => DvDateTime.new(:value =>'1995-04-19T01:01:22'),
|
|
11
|
+
:upper => DvDateTime.new(:value => '2022-12-31T23:55:59'))
|
|
12
12
|
@c_date_time =
|
|
13
13
|
CDateTime.new(:default_value => default_value,
|
|
14
14
|
:assumed_value => assumed_value,
|
|
15
|
-
:type => 'Boolean',
|
|
16
15
|
:range => range,
|
|
17
16
|
:month_validity => ValidityKind::MANDATORY,
|
|
18
17
|
:day_validity => ValidityKind::MANDATORY,
|
|
@@ -27,8 +26,8 @@ describe CDateTime do
|
|
|
27
26
|
@c_date_time.should be_an_instance_of CDateTime
|
|
28
27
|
end
|
|
29
28
|
|
|
30
|
-
it 'type is
|
|
31
|
-
@c_date_time.type.should == '
|
|
29
|
+
it 'type is ISO8601_DATE_TIME' do
|
|
30
|
+
@c_date_time.type.should == 'ISO8601_DATE_TIME'
|
|
32
31
|
end
|
|
33
32
|
|
|
34
33
|
it 'hour_validity should be assigned properly' do
|
|
@@ -41,6 +40,11 @@ describe CDateTime do
|
|
|
41
40
|
}.should raise_error ArgumentError
|
|
42
41
|
end
|
|
43
42
|
|
|
43
|
+
it 'range is properly assigned, lower value is 1995-04-19T01:01:22' do
|
|
44
|
+
@c_date_time.range.lower.value.should == '1995-04-19T01:01:22'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
44
48
|
it 'should not raise ArgumentError if hour_validity is DISALLOWED and minute_validity is DISALLOWED' do
|
|
45
49
|
@c_date_time.second_validity = ValidityKind::DISALLOWED
|
|
46
50
|
@c_date_time.minute_validity = ValidityKind::DISALLOWED
|
|
@@ -108,4 +112,25 @@ describe CDateTime do
|
|
|
108
112
|
@c_date_time.day_validity = ValidityKind::OPTIONAL
|
|
109
113
|
}.should_not raise_error ArgumentError
|
|
110
114
|
end
|
|
115
|
+
|
|
116
|
+
describe 'pattern constraint' do
|
|
117
|
+
before(:all) do
|
|
118
|
+
@c_date_timep = CDateTime.new(:pattern => 'yyyy-mm-dd hh:mm:ss')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'pattern is yyyy-mm-dd hh:mm:ss' do
|
|
122
|
+
@c_date_timep.pattern.should == 'yyyy-mm-dd hh:mm:ss'
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
describe 'list constraint' do
|
|
127
|
+
before(:all) do
|
|
128
|
+
@c_date_timel = CDateTime.new(:list =>
|
|
129
|
+
[DvDateTime.new(:value => '2010-01-25T01:23:45.1')])
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'first item of list is 2010-01-25T01:23:45.1' do
|
|
133
|
+
@c_date_timel.list[0].value.should == '2010-01-25T01:23:45.1'
|
|
134
|
+
end
|
|
135
|
+
end
|
|
111
136
|
end
|
|
@@ -1,74 +1,41 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
|
2
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
|
2
3
|
include OpenEHR::AssumedLibraryTypes
|
|
3
|
-
include OpenEHR::AM::Archetype
|
|
4
4
|
include OpenEHR::AM::Archetype::ConstraintModel::Primitive
|
|
5
5
|
|
|
6
6
|
describe CDuration do
|
|
7
|
-
before(:
|
|
8
|
-
assumed_value =
|
|
9
|
-
default_value =
|
|
10
|
-
range =
|
|
7
|
+
before(:all) do
|
|
8
|
+
assumed_value = DvDuration.new(:value => 'P2Y')
|
|
9
|
+
default_value = DvDuration.new(:value => 'P3M')
|
|
10
|
+
range = Interval.new(:upper => assumed_value, :lower => default_value)
|
|
11
11
|
@c_duration = CDuration.new(:assumed_value => assumed_value,
|
|
12
12
|
:default_value => default_value,
|
|
13
|
-
:
|
|
14
|
-
:range => range,
|
|
15
|
-
:years_allowed => true,
|
|
16
|
-
:months_allowed => false,
|
|
17
|
-
:weeks_allowed => true,
|
|
18
|
-
:days_allowed => false,
|
|
19
|
-
:hours_allowed => true,
|
|
20
|
-
:minutes_allowed => false,
|
|
21
|
-
:seconds_allowed => true,
|
|
22
|
-
:fractional_seconds_allowed => false)
|
|
13
|
+
:range => range)
|
|
23
14
|
end
|
|
24
15
|
|
|
25
16
|
it 'should be an instance of CDuration' do
|
|
26
17
|
@c_duration.should be_an_instance_of CDuration
|
|
27
18
|
end
|
|
28
19
|
|
|
29
|
-
it 'type is
|
|
30
|
-
@c_duration.type.should == '
|
|
20
|
+
it 'type is ISO8601_DURATION' do
|
|
21
|
+
@c_duration.type.should == 'ISO8601_DURATION'
|
|
31
22
|
end
|
|
32
23
|
|
|
33
|
-
it '
|
|
34
|
-
@c_duration.
|
|
24
|
+
it 'upper range is 2 years' do
|
|
25
|
+
@c_duration.range.upper.value.should == 'P2Y'
|
|
35
26
|
end
|
|
36
27
|
|
|
37
|
-
it '
|
|
38
|
-
@c_duration.
|
|
28
|
+
it 'lower range is 3 months year' do
|
|
29
|
+
@c_duration.range.lower.value.should == 'P3M'
|
|
39
30
|
end
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
it 'days_allowed should be assigned properly' do
|
|
46
|
-
@c_duration.days_allowed.should be_false
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it 'hours_allowed should be assigned properly' do
|
|
50
|
-
@c_duration.hours_allowed.should be_true
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'minutes_allowed should be assigned properly' do
|
|
54
|
-
@c_duration.minutes_allowed.should be_false
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'seconds_allowed should be assigned properly' do
|
|
58
|
-
@c_duration.seconds_allowed.should be_true
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'fractional_seconds_allowed should be assigned properly' do
|
|
62
|
-
@c_duration.fractional_seconds_allowed.should be_false
|
|
63
|
-
end
|
|
32
|
+
context 'list constraint' do
|
|
33
|
+
before(:all) do
|
|
34
|
+
@c_duration = CDuration.new(:list => [DvDuration.new(:value => 'PT0s')])
|
|
35
|
+
end
|
|
64
36
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@c_duration.hours_allowed = false
|
|
69
|
-
@c_duration.seconds_allowed = false
|
|
70
|
-
lambda {
|
|
71
|
-
@c_duration.range = nil
|
|
72
|
-
}.should raise_error ArgumentError
|
|
37
|
+
it '1st item of the list value is PT0s' do
|
|
38
|
+
@c_duration.list[0].value.should == 'PT0s'
|
|
39
|
+
end
|
|
73
40
|
end
|
|
74
41
|
end
|
|
@@ -6,7 +6,6 @@ describe CString do
|
|
|
6
6
|
before(:each) do
|
|
7
7
|
@default_value = DvText.new(:value => 'default')
|
|
8
8
|
@c_string = CString.new(:default_value => @default_value,
|
|
9
|
-
:type => 'Boolean',
|
|
10
9
|
:assumed_value => 'assumed',
|
|
11
10
|
:pattern => 't[a-z]st')
|
|
12
11
|
end
|
|
@@ -15,8 +14,8 @@ describe CString do
|
|
|
15
14
|
@c_string.should be_an_instance_of CString
|
|
16
15
|
end
|
|
17
16
|
|
|
18
|
-
it 'type is
|
|
19
|
-
@c_string.type.should == '
|
|
17
|
+
it 'type is always String' do
|
|
18
|
+
@c_string.type.should == 'String'
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
it 'default should be assigned properly' do
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
|
2
|
-
include OpenEHR::
|
|
2
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
|
3
3
|
include OpenEHR::AM::Archetype
|
|
4
4
|
include OpenEHR::AM::Archetype::ConstraintModel::Primitive
|
|
5
5
|
|
|
6
6
|
describe CTime do
|
|
7
7
|
before(:each) do
|
|
8
|
-
default_value =
|
|
9
|
-
assumed_value =
|
|
10
|
-
range = Interval.new(:lower =>
|
|
11
|
-
:upper =>
|
|
8
|
+
default_value = DvTime.new(:value => '01:23:45')
|
|
9
|
+
assumed_value = DvTime.new(:value => '22:02:33')
|
|
10
|
+
range = Interval.new(:lower => DvTime.new(:value => '01:01:22'),
|
|
11
|
+
:upper => DvTime.new(:value => '23:55:59'))
|
|
12
12
|
@c_time = CTime.new(:default_value => default_value,
|
|
13
13
|
:assumed_value => assumed_value,
|
|
14
|
-
:type => 'Boolean',
|
|
15
14
|
:range => range,
|
|
16
15
|
:minute_validity => ValidityKind::MANDATORY,
|
|
17
16
|
:second_validity => ValidityKind::OPTIONAL,
|
|
@@ -23,7 +22,7 @@ describe CTime do
|
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
it 'type is DvTime' do
|
|
26
|
-
@c_time.type.should == '
|
|
25
|
+
@c_time.type.should == 'ISO8601_TIME'
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
it 'minute_validity should be assigned' do
|
|
@@ -81,4 +80,25 @@ describe CTime do
|
|
|
81
80
|
@c_time.second_validity = ValidityKind::DISALLOWED
|
|
82
81
|
}.should raise_error ArgumentError
|
|
83
82
|
end
|
|
83
|
+
|
|
84
|
+
describe 'pattern constraint' do
|
|
85
|
+
before(:all) do
|
|
86
|
+
@c_timep = CTime.new(:pattern => 'hh:mm:ss')
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'pattern is hh:mm:ss' do
|
|
90
|
+
@c_timep.pattern.should == 'hh:mm:ss'
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe 'list constraint' do
|
|
95
|
+
before(:all) do
|
|
96
|
+
time = DvTime.new(:value => '09:51:17')
|
|
97
|
+
@c_timel = CTime.new(:list => [time])
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it 'first item value is 09:51:17' do
|
|
101
|
+
@c_timel.list[0].value.should == '09:51:17'
|
|
102
|
+
end
|
|
103
|
+
end
|
|
84
104
|
end
|
|
@@ -42,7 +42,6 @@ describe ArchetypeOntology do
|
|
|
42
42
|
@archetype_ontology.languages_available.should == ['ja', 'en']
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
it 'term_definition should be assigned properly' do
|
|
47
46
|
@archetype_ontology.term_definition(:lang => 'ja', :code => 'at0000').items['text'].should == 'Archetype Concept'
|
|
48
47
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include ::OpenEHR::RM::DataTypes::Text
|
|
4
|
+
include ::OpenEHR::AssumedLibraryTypes
|
|
5
|
+
include ::OpenEHR::RM::Support::Identification
|
|
6
|
+
require 'open_ehr/am/openehr_profile/data_types/text'
|
|
7
|
+
include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Text
|
|
8
|
+
|
|
9
|
+
describe CCodePhrase do
|
|
10
|
+
before(:all) do
|
|
11
|
+
term_id = TerminologyID.new(:value => 'ICD10')
|
|
12
|
+
occurrences = Interval.new(:upper => 1)
|
|
13
|
+
@c_code_phrase = CCodePhrase.new(:terminology_id => term_id,
|
|
14
|
+
:code_list => ['C92', 'C93'],
|
|
15
|
+
:path => 'value/text',
|
|
16
|
+
:occurrences => occurrences,
|
|
17
|
+
:rm_type_name => 'CodePhrase')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'is an instance of CCodePhrase' do
|
|
21
|
+
@c_code_phrase.should be_an_instance_of CCodePhrase
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'terminology_id is ICD10' do
|
|
25
|
+
@c_code_phrase.terminology_id.value.should == 'ICD10'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'code_list is C92, C93' do
|
|
29
|
+
@c_code_phrase.code_list.should == ['C92', 'C93']
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'occurrences upper is 1' do
|
|
33
|
+
@c_code_phrase.occurrences.upper.should be 1
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
archetype
|
|
2
|
-
adl-test-ENTRY.
|
|
1
|
+
archetype
|
|
2
|
+
adl-test-ENTRY.basic_types.v1
|
|
3
3
|
|
|
4
4
|
concept
|
|
5
5
|
[at0000] -- basic data types test 1
|
|
@@ -115,7 +115,7 @@ definition
|
|
|
115
115
|
date_attr10 matches {|> 2004-09-20|}
|
|
116
116
|
date_attr11 matches {|>= 2004-09-20|}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
date_attr12 matches {2001-12-25, ...} -- Not currently in ADL syntax
|
|
119
119
|
|
|
120
120
|
-- with assumed values
|
|
121
121
|
date_attr13 matches {yyyy-mm-dd; 2000-01-01}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
archetype
|
|
2
|
-
adl-test-ENTRY.test.
|
|
2
|
+
adl-test-ENTRY.test.v1
|
|
3
3
|
|
|
4
4
|
concept
|
|
5
5
|
[at0000] -- basic data types test 1
|
|
@@ -54,9 +54,6 @@ definition
|
|
|
54
54
|
ELEMENT[at1013] matches { -- duration with fractional seconds
|
|
55
55
|
value matches {|PT1.1s|}
|
|
56
56
|
}
|
|
57
|
-
ELEMENT[at1014] matches { -- duration with mixed Pattern and Interval
|
|
58
|
-
value matches {PTS/|PT0S..PT120S|}
|
|
59
|
-
}
|
|
60
57
|
-- matches {PT30s, PT45s, PT1m0s, PT2m0s} -- Not currently in ADL syntax
|
|
61
58
|
-- matches {|P1d +/PT4h|}
|
|
62
59
|
}
|
|
@@ -80,6 +77,7 @@ definition
|
|
|
80
77
|
value matches {|<=PT1h|; P1d}
|
|
81
78
|
}
|
|
82
79
|
ELEMENT[at1006] matches { -- duration
|
|
80
|
+
|
|
83
81
|
value matches {PDTH; P1d}
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -97,15 +97,15 @@ describe ADLParser do
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
it 's lower is 37.0' do
|
|
100
|
-
@magnitude.children[0].lower.should == 37.0
|
|
100
|
+
@magnitude.children[0].range.lower.should == 37.0
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
it 'is lower included' do
|
|
104
|
-
@magnitude.children[0].should be_lower_included
|
|
104
|
+
@magnitude.children[0].range.should be_lower_included
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
it 'is upper unbounded' do
|
|
108
|
-
@magnitude.children[0].should be_upper_unbounded
|
|
108
|
+
@magnitude.children[0].range.should be_upper_unbounded
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
end
|
|
@@ -177,15 +177,15 @@ describe ADLParser do
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
it 's magnitude lower is 39.0' do
|
|
180
|
-
@magnitude.children[0].lower.should == 39.0
|
|
180
|
+
@magnitude.children[0].range.lower.should == 39.0
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
it 's magnitude lower included' do
|
|
184
|
-
@magnitude.children[0].should be_lower_included
|
|
184
|
+
@magnitude.children[0].range.should be_lower_included
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
it 's upper unbounded' do
|
|
188
|
-
@magnitude.children[0].should be_upper_unbounded
|
|
188
|
+
@magnitude.children[0].range.should be_upper_unbounded
|
|
189
189
|
end
|
|
190
190
|
end
|
|
191
191
|
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
|
3
|
+
include OpenEHR::AM::Archetype::ConstraintModel
|
|
4
|
+
include OpenEHR::AM::Archetype::ConstraintModel::Primitive
|
|
5
|
+
include OpenEHR::AM::Archetype::Assertion
|
|
6
|
+
|
|
7
|
+
# ticket 166
|
|
8
|
+
|
|
9
|
+
describe ADLParser do
|
|
10
|
+
context ArchetypeSlot do
|
|
11
|
+
before(:all) do
|
|
12
|
+
archetype = adl14_archetype('adl-test-entry.archetype_slot.test2.adl')
|
|
13
|
+
@slot = archetype.definition.attributes[0].children[0]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'is an instance of ArchetypeSlot' do
|
|
17
|
+
@slot.should be_an_instance_of ArchetypeSlot
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 's node id is at0001' do
|
|
21
|
+
@slot.node_id.should == 'at0001'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 's occurrences upper is 1' do
|
|
25
|
+
@slot.occurrences.upper.should be 1
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 's occurrences lower is 0' do
|
|
29
|
+
@slot.occurrences.lower.should be 0
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 's rm type name is SECTION' do
|
|
33
|
+
@slot.rm_type_name.should == 'SECTION'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 's path is /content[at0001]' do
|
|
37
|
+
@slot.path.should == '/content[at0001]'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'includes' do
|
|
41
|
+
before(:all) do
|
|
42
|
+
@includes = @slot.includes
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 's size is 1' do
|
|
46
|
+
@includes.size.should be 1
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 's string_expression is archetype_id/value matches {/openEHR-EHR-CLUSTER\.device\.v1/}' do
|
|
50
|
+
@includes[0].string_expression.should ==
|
|
51
|
+
'archetype_id/value matches {/openEHR-EHR-CLUSTER\.device\.v1/}'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'item' do
|
|
55
|
+
before(:all) do
|
|
56
|
+
@item = @includes[0].expression
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'is an instance of ExprBooleanExpression' do
|
|
60
|
+
@item.should be_an_instance_of ExprBinaryOperator
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 's operator is OP_MATCHES' do
|
|
64
|
+
@item.operator.should == OperatorKind::OP_MATCHES
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context 'left operand' do
|
|
68
|
+
before(:all) do
|
|
69
|
+
@left_operand = @item.left_operand
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'is an instance of ExprLeaf' do
|
|
73
|
+
@left_operand.should be_an_instance_of ExprLeaf
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 's item is archetype_id/value' do
|
|
77
|
+
@left_operand.item.should == 'archetype_id/value'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context 'right operand' do
|
|
82
|
+
before(:all) do
|
|
83
|
+
@right_operand = @item.right_operand
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'is an intance of ExprLeaf' do
|
|
87
|
+
@right_operand.should be_an_instance_of ExprLeaf
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 's item type is CString' do
|
|
91
|
+
@right_operand.item.should be_an_instance_of CString
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 's item pattern is /openEHR-EHR-CLUSTER\.device\.v1/' do
|
|
95
|
+
@right_operand.item.pattern.should == '/openEHR-EHR-CLUSTER\.device\.v1/'
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|