aixm 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +33 -3
- data/README.md +166 -56
- data/exe/ckmid +14 -0
- data/exe/mkmid +14 -0
- data/lib/aixm.rb +16 -6
- data/lib/aixm/association.rb +369 -0
- data/lib/aixm/classes.rb +43 -0
- data/lib/aixm/component/fato.rb +45 -53
- data/lib/aixm/component/frequency.rb +11 -12
- data/lib/aixm/component/geometry.rb +36 -38
- data/lib/aixm/component/geometry/arc.rb +2 -2
- data/lib/aixm/component/geometry/border.rb +6 -3
- data/lib/aixm/component/geometry/circle.rb +8 -2
- data/lib/aixm/component/geometry/point.rb +8 -2
- data/lib/aixm/component/helipad.rb +30 -38
- data/lib/aixm/component/layer.rb +28 -19
- data/lib/aixm/component/lighting.rb +12 -13
- data/lib/aixm/component/runway.rb +44 -48
- data/lib/aixm/{feature → component}/service.rb +37 -36
- data/lib/aixm/component/surface.rb +3 -3
- data/lib/aixm/component/timetable.rb +2 -2
- data/lib/aixm/component/{vertical_limits.rb → vertical_limit.rb} +12 -6
- data/lib/aixm/config.rb +2 -1
- data/lib/aixm/document.rb +27 -50
- data/lib/aixm/executables.rb +85 -0
- data/lib/aixm/feature.rb +13 -3
- data/lib/aixm/feature/address.rb +12 -13
- data/lib/aixm/feature/airport.rb +103 -128
- data/lib/aixm/feature/airspace.rb +44 -17
- data/lib/aixm/feature/navigational_aid.rb +7 -9
- data/lib/aixm/feature/navigational_aid/designated_point.rb +13 -15
- data/lib/aixm/feature/navigational_aid/dme.rb +11 -12
- data/lib/aixm/feature/navigational_aid/marker.rb +7 -3
- data/lib/aixm/feature/navigational_aid/ndb.rb +7 -3
- data/lib/aixm/feature/navigational_aid/tacan.rb +7 -3
- data/lib/aixm/feature/navigational_aid/vor.rb +23 -15
- data/lib/aixm/feature/obstacle.rb +29 -43
- data/lib/aixm/feature/obstacle_group.rb +37 -34
- data/lib/aixm/feature/organisation.rb +21 -5
- data/lib/aixm/feature/unit.rb +36 -46
- data/lib/aixm/memoize.rb +89 -0
- data/lib/aixm/object.rb +9 -0
- data/lib/aixm/payload_hash.rb +114 -0
- data/lib/aixm/refinements.rb +29 -76
- data/lib/aixm/shortcuts.rb +5 -42
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +1 -1
- data/schemas/ofmx/0/OFMX-Features.xsd +152 -20
- data/schemas/ofmx/0/OFMX-Snapshot.xsd +0 -5
- metadata +107 -156
- metadata.gz.sig +2 -0
- data/.github/workflows/test.yml +0 -26
- data/.gitignore +0 -6
- data/.ruby-version +0 -1
- data/.yardopts +0 -3
- data/Guardfile +0 -8
- data/aixm.gemspec +0 -35
- data/gems.rb +0 -3
- data/lib/aixm/component.rb +0 -6
- data/rakefile.rb +0 -36
- data/spec/factory.rb +0 -559
- data/spec/lib/aixm/a_spec.rb +0 -203
- data/spec/lib/aixm/component/fato_spec.rb +0 -267
- data/spec/lib/aixm/component/frequency_spec.rb +0 -74
- data/spec/lib/aixm/component/geometry/arc_spec.rb +0 -73
- data/spec/lib/aixm/component/geometry/border_spec.rb +0 -38
- data/spec/lib/aixm/component/geometry/circle_spec.rb +0 -68
- data/spec/lib/aixm/component/geometry/point_spec.rb +0 -37
- data/spec/lib/aixm/component/geometry_spec.rb +0 -316
- data/spec/lib/aixm/component/helipad_spec.rb +0 -193
- data/spec/lib/aixm/component/layer_spec.rb +0 -135
- data/spec/lib/aixm/component/lighting_spec.rb +0 -94
- data/spec/lib/aixm/component/runway_spec.rb +0 -479
- data/spec/lib/aixm/component/surface_spec.rb +0 -124
- data/spec/lib/aixm/component/timetable_spec.rb +0 -47
- data/spec/lib/aixm/component/vertical_limits_spec.rb +0 -94
- data/spec/lib/aixm/config_spec.rb +0 -41
- data/spec/lib/aixm/d_spec.rb +0 -150
- data/spec/lib/aixm/document_spec.rb +0 -1884
- data/spec/lib/aixm/errors_spec.rb +0 -14
- data/spec/lib/aixm/f_spec.rb +0 -85
- data/spec/lib/aixm/feature/address_spec.rb +0 -60
- data/spec/lib/aixm/feature/airport_spec.rb +0 -776
- data/spec/lib/aixm/feature/airspace_spec.rb +0 -394
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +0 -103
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +0 -98
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +0 -85
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +0 -95
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +0 -94
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +0 -251
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +0 -52
- data/spec/lib/aixm/feature/obstacle_group_spec.rb +0 -330
- data/spec/lib/aixm/feature/obstacle_spec.rb +0 -284
- data/spec/lib/aixm/feature/organisation_spec.rb +0 -83
- data/spec/lib/aixm/feature/service_spec.rb +0 -59
- data/spec/lib/aixm/feature/unit_spec.rb +0 -238
- data/spec/lib/aixm/feature_spec.rb +0 -38
- data/spec/lib/aixm/p_spec.rb +0 -189
- data/spec/lib/aixm/refinements_spec.rb +0 -430
- data/spec/lib/aixm/version_spec.rb +0 -7
- data/spec/lib/aixm/w_spec.rb +0 -150
- data/spec/lib/aixm/xy_spec.rb +0 -180
- data/spec/lib/aixm/z_spec.rb +0 -94
- data/spec/macros/marking.rb +0 -12
- data/spec/macros/organisation.rb +0 -11
- data/spec/macros/remarks.rb +0 -12
- data/spec/macros/timetable.rb +0 -11
- data/spec/macros/xy.rb +0 -11
- data/spec/macros/z_qnh.rb +0 -11
- data/spec/sounds/failure.mp3 +0 -0
- data/spec/sounds/success.mp3 +0 -0
- data/spec/spec_helper.rb +0 -62
@@ -1,83 +0,0 @@
|
|
1
|
-
require_relative '../../../spec_helper'
|
2
|
-
|
3
|
-
describe AIXM::Feature::Organisation do
|
4
|
-
subject do
|
5
|
-
AIXM::Factory.organisation
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :name= do
|
9
|
-
it "fails on invalid values" do
|
10
|
-
_([nil, :foobar, 123]).wont_be_written_to subject, :name
|
11
|
-
end
|
12
|
-
|
13
|
-
it "upcases and transcodes valid values" do
|
14
|
-
_(subject.tap { |s| s.name = 'Nîmes-Alès' }.name).must_equal 'NIMES-ALES'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe :type= do
|
19
|
-
it "fails on invalid values" do
|
20
|
-
_([nil, :foobar, 123]).wont_be_written_to subject, :type
|
21
|
-
end
|
22
|
-
|
23
|
-
it "looks up valid values" do
|
24
|
-
_(subject.tap { |s| s.type = :state }.type).must_equal :state
|
25
|
-
_(subject.tap { |s| s.type = :IO }.type).must_equal :international_organisation
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe :id= do
|
30
|
-
it "fails on invalid values" do
|
31
|
-
_([:foobar, 123]).wont_be_written_to subject, :id
|
32
|
-
end
|
33
|
-
|
34
|
-
it "accepts nil value" do
|
35
|
-
_([nil]).must_be_written_to subject, :id
|
36
|
-
end
|
37
|
-
|
38
|
-
it "upcases valid values" do
|
39
|
-
_(subject.tap { |s| s.id = 'lf' }.id).must_equal 'LF'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe :remarks= do
|
44
|
-
macro :remarks
|
45
|
-
end
|
46
|
-
|
47
|
-
describe :to_xml do
|
48
|
-
it "builds correct complete OFMX" do
|
49
|
-
AIXM.ofmx!
|
50
|
-
_(subject.to_xml).must_equal <<~END
|
51
|
-
<!-- Organisation: FRANCE -->
|
52
|
-
<Org source="LF|GEN|0.0 FACTORY|0|0">
|
53
|
-
<OrgUid>
|
54
|
-
<txtName>FRANCE</txtName>
|
55
|
-
</OrgUid>
|
56
|
-
<codeId>LF</codeId>
|
57
|
-
<codeType>S</codeType>
|
58
|
-
<txtRmk>Oversea departments not included</txtRmk>
|
59
|
-
</Org>
|
60
|
-
END
|
61
|
-
end
|
62
|
-
|
63
|
-
it "builds correct minimal OFMX" do
|
64
|
-
AIXM.ofmx!
|
65
|
-
subject.id = subject.remarks = nil
|
66
|
-
_(subject.to_xml).must_equal <<~END
|
67
|
-
<!-- Organisation: FRANCE -->
|
68
|
-
<Org source="LF|GEN|0.0 FACTORY|0|0">
|
69
|
-
<OrgUid>
|
70
|
-
<txtName>FRANCE</txtName>
|
71
|
-
</OrgUid>
|
72
|
-
<codeType>S</codeType>
|
73
|
-
</Org>
|
74
|
-
END
|
75
|
-
end
|
76
|
-
|
77
|
-
it "builds OFMX with mid" do
|
78
|
-
AIXM.ofmx!
|
79
|
-
AIXM.config.mid_region = 'LF'
|
80
|
-
_(subject.to_xml).must_match /<OrgUid mid="b5fef8e2-ea45-7326-6b2f-38cb45cd21a8">/
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require_relative '../../../spec_helper'
|
2
|
-
|
3
|
-
describe AIXM::Feature::Service do
|
4
|
-
subject do
|
5
|
-
AIXM::Factory.service
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :initialize do
|
9
|
-
it "sets defaults" do
|
10
|
-
subject = AIXM::Feature::Service.new(
|
11
|
-
type: :approach_control_service
|
12
|
-
)
|
13
|
-
_(subject.frequencies).must_equal []
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe :type= do
|
18
|
-
it "fails on invalid values" do
|
19
|
-
_{ subject.type = :foobar }.must_raise ArgumentError
|
20
|
-
_{ subject.type = nil }.must_raise ArgumentError
|
21
|
-
end
|
22
|
-
|
23
|
-
it "looks up valid values" do
|
24
|
-
_(subject.tap { |s| s.type = :area_control_service }.type).must_equal :area_control_service
|
25
|
-
_(subject.tap { |s| s.type = :ATIS }.type).must_equal :automated_terminal_information_service
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe :timetable= do
|
30
|
-
macro :timetable
|
31
|
-
end
|
32
|
-
|
33
|
-
describe :remarks= do
|
34
|
-
macro :remarks
|
35
|
-
end
|
36
|
-
|
37
|
-
describe :add_frequency do
|
38
|
-
it "fails on invalid arguments" do
|
39
|
-
_{ subject.add_frequency nil }.must_raise ArgumentError
|
40
|
-
end
|
41
|
-
|
42
|
-
it "adds frequency to the array" do
|
43
|
-
count = subject.frequencies.count
|
44
|
-
subject.add_frequency(AIXM::Factory.frequency)
|
45
|
-
_(subject.frequencies.count).must_equal count + 1
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe :guess_unit_type do
|
50
|
-
it "finds the probably unit type for a matchable service" do
|
51
|
-
_(subject.tap { |s| s.type = :flight_information_service }.guessed_unit_type).must_equal :flight_information_centre
|
52
|
-
end
|
53
|
-
|
54
|
-
it "returns nil for an unmatchable service" do
|
55
|
-
_(subject.tap { |s| s.type = :aeronautical_mobile_satellite_service }.guessed_unit_type).must_be_nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
@@ -1,238 +0,0 @@
|
|
1
|
-
require_relative '../../../spec_helper'
|
2
|
-
|
3
|
-
describe AIXM::Feature::Unit do
|
4
|
-
subject do
|
5
|
-
AIXM::Factory.unit
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :organisation= do
|
9
|
-
macro :organisation
|
10
|
-
|
11
|
-
it "fails on nil value" do
|
12
|
-
_([nil]).wont_be_written_to subject, :organisation
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe :name= do
|
17
|
-
it "fails on invalid values" do
|
18
|
-
_([nil, :foobar, 123]).wont_be_written_to subject, :name
|
19
|
-
end
|
20
|
-
|
21
|
-
it "upcases and transcodes valid values" do
|
22
|
-
_(subject.tap { |s| s.name = 'Nîmes-Alès APP' }.name).must_equal 'NIMES-ALES APP'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe :type= do
|
27
|
-
it "fails on invalid values" do
|
28
|
-
_([nil, :foobar, 123]).wont_be_written_to subject, :type
|
29
|
-
end
|
30
|
-
|
31
|
-
it "looks up valid values" do
|
32
|
-
_(subject.tap { |s| s.type = :flight_information_centre }.type).must_equal :flight_information_centre
|
33
|
-
_(subject.tap { |s| s.type = :MET }.type).must_equal :meteorological_office
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe :class= do
|
38
|
-
it "fails on invalid values" do
|
39
|
-
_([nil, :foobar, 123]).wont_be_written_to subject, :class
|
40
|
-
end
|
41
|
-
|
42
|
-
it "looks up valid values" do
|
43
|
-
_(subject.tap { |s| s.class = :icao }.class).must_equal :icao
|
44
|
-
_(subject.tap { |s| s.class = :OTHER }.class).must_equal :other
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe :airport= do
|
49
|
-
it "fails on invalid values" do
|
50
|
-
_([:foobar, 123]).wont_be_written_to subject, :airport
|
51
|
-
end
|
52
|
-
|
53
|
-
it "accepts valid values" do
|
54
|
-
_([nil, AIXM::Factory.airport]).must_be_written_to subject, :airport
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe :remarks= do
|
59
|
-
macro :remarks
|
60
|
-
end
|
61
|
-
|
62
|
-
describe :to_xml do
|
63
|
-
let :service do
|
64
|
-
AIXM::Factory.service.tap do |service|
|
65
|
-
service.type = :AFIS
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
it "builds correct complete OFMX" do
|
70
|
-
2.times { subject.add_service(service) }
|
71
|
-
AIXM.ofmx!
|
72
|
-
_(subject.to_xml).must_equal <<~END
|
73
|
-
<!-- Unit: PUJAUT TWR -->
|
74
|
-
<Uni source="LF|GEN|0.0 FACTORY|0|0">
|
75
|
-
<UniUid>
|
76
|
-
<txtName>PUJAUT TWR</txtName>
|
77
|
-
</UniUid>
|
78
|
-
<OrgUid>
|
79
|
-
<txtName>FRANCE</txtName>
|
80
|
-
</OrgUid>
|
81
|
-
<AhpUid>
|
82
|
-
<codeId>LFNT</codeId>
|
83
|
-
</AhpUid>
|
84
|
-
<codeType>TWR</codeType>
|
85
|
-
<codeClass>ICAO</codeClass>
|
86
|
-
<txtRmk>FR only</txtRmk>
|
87
|
-
</Uni>
|
88
|
-
<!-- Service: AFIS by PUJAUT TWR -->
|
89
|
-
<Ser source="LF|GEN|0.0 FACTORY|0|0">
|
90
|
-
<SerUid>
|
91
|
-
<UniUid>
|
92
|
-
<txtName>PUJAUT TWR</txtName>
|
93
|
-
</UniUid>
|
94
|
-
<codeType>AFIS</codeType>
|
95
|
-
<noSeq>1</noSeq>
|
96
|
-
</SerUid>
|
97
|
-
<Stt>
|
98
|
-
<codeWorkHr>H24</codeWorkHr>
|
99
|
-
</Stt>
|
100
|
-
<txtRmk>service remarks</txtRmk>
|
101
|
-
</Ser>
|
102
|
-
<Fqy>
|
103
|
-
<FqyUid>
|
104
|
-
<SerUid>
|
105
|
-
<UniUid>
|
106
|
-
<txtName>PUJAUT TWR</txtName>
|
107
|
-
</UniUid>
|
108
|
-
<codeType>AFIS</codeType>
|
109
|
-
<noSeq>1</noSeq>
|
110
|
-
</SerUid>
|
111
|
-
<valFreqTrans>123.35</valFreqTrans>
|
112
|
-
</FqyUid>
|
113
|
-
<valFreqRec>124.1</valFreqRec>
|
114
|
-
<uomFreq>MHZ</uomFreq>
|
115
|
-
<Ftt>
|
116
|
-
<codeWorkHr>H24</codeWorkHr>
|
117
|
-
</Ftt>
|
118
|
-
<txtRmk>frequency remarks</txtRmk>
|
119
|
-
<Cdl>
|
120
|
-
<txtCallSign>PUJAUT CONTROL</txtCallSign>
|
121
|
-
<codeLang>EN</codeLang>
|
122
|
-
</Cdl>
|
123
|
-
<Cdl>
|
124
|
-
<txtCallSign>PUJAUT CONTROLE</txtCallSign>
|
125
|
-
<codeLang>FR</codeLang>
|
126
|
-
</Cdl>
|
127
|
-
</Fqy>
|
128
|
-
<!-- Service: AFIS by PUJAUT TWR -->
|
129
|
-
<Ser source="LF|GEN|0.0 FACTORY|0|0">
|
130
|
-
<SerUid>
|
131
|
-
<UniUid>
|
132
|
-
<txtName>PUJAUT TWR</txtName>
|
133
|
-
</UniUid>
|
134
|
-
<codeType>AFIS</codeType>
|
135
|
-
<noSeq>2</noSeq>
|
136
|
-
</SerUid>
|
137
|
-
<Stt>
|
138
|
-
<codeWorkHr>H24</codeWorkHr>
|
139
|
-
</Stt>
|
140
|
-
<txtRmk>service remarks</txtRmk>
|
141
|
-
</Ser>
|
142
|
-
<Fqy>
|
143
|
-
<FqyUid>
|
144
|
-
<SerUid>
|
145
|
-
<UniUid>
|
146
|
-
<txtName>PUJAUT TWR</txtName>
|
147
|
-
</UniUid>
|
148
|
-
<codeType>AFIS</codeType>
|
149
|
-
<noSeq>2</noSeq>
|
150
|
-
</SerUid>
|
151
|
-
<valFreqTrans>123.35</valFreqTrans>
|
152
|
-
</FqyUid>
|
153
|
-
<valFreqRec>124.1</valFreqRec>
|
154
|
-
<uomFreq>MHZ</uomFreq>
|
155
|
-
<Ftt>
|
156
|
-
<codeWorkHr>H24</codeWorkHr>
|
157
|
-
</Ftt>
|
158
|
-
<txtRmk>frequency remarks</txtRmk>
|
159
|
-
<Cdl>
|
160
|
-
<txtCallSign>PUJAUT CONTROL</txtCallSign>
|
161
|
-
<codeLang>EN</codeLang>
|
162
|
-
</Cdl>
|
163
|
-
<Cdl>
|
164
|
-
<txtCallSign>PUJAUT CONTROLE</txtCallSign>
|
165
|
-
<codeLang>FR</codeLang>
|
166
|
-
</Cdl>
|
167
|
-
</Fqy>
|
168
|
-
<!-- Service: APP by PUJAUT TWR -->
|
169
|
-
<Ser source="LF|GEN|0.0 FACTORY|0|0">
|
170
|
-
<SerUid>
|
171
|
-
<UniUid>
|
172
|
-
<txtName>PUJAUT TWR</txtName>
|
173
|
-
</UniUid>
|
174
|
-
<codeType>APP</codeType>
|
175
|
-
<noSeq>1</noSeq>
|
176
|
-
</SerUid>
|
177
|
-
<Stt>
|
178
|
-
<codeWorkHr>H24</codeWorkHr>
|
179
|
-
</Stt>
|
180
|
-
<txtRmk>service remarks</txtRmk>
|
181
|
-
</Ser>
|
182
|
-
<Fqy>
|
183
|
-
<FqyUid>
|
184
|
-
<SerUid>
|
185
|
-
<UniUid>
|
186
|
-
<txtName>PUJAUT TWR</txtName>
|
187
|
-
</UniUid>
|
188
|
-
<codeType>APP</codeType>
|
189
|
-
<noSeq>1</noSeq>
|
190
|
-
</SerUid>
|
191
|
-
<valFreqTrans>123.35</valFreqTrans>
|
192
|
-
</FqyUid>
|
193
|
-
<valFreqRec>124.1</valFreqRec>
|
194
|
-
<uomFreq>MHZ</uomFreq>
|
195
|
-
<Ftt>
|
196
|
-
<codeWorkHr>H24</codeWorkHr>
|
197
|
-
</Ftt>
|
198
|
-
<txtRmk>frequency remarks</txtRmk>
|
199
|
-
<Cdl>
|
200
|
-
<txtCallSign>PUJAUT CONTROL</txtCallSign>
|
201
|
-
<codeLang>EN</codeLang>
|
202
|
-
</Cdl>
|
203
|
-
<Cdl>
|
204
|
-
<txtCallSign>PUJAUT CONTROLE</txtCallSign>
|
205
|
-
<codeLang>FR</codeLang>
|
206
|
-
</Cdl>
|
207
|
-
</Fqy>
|
208
|
-
END
|
209
|
-
end
|
210
|
-
|
211
|
-
it "builds correct minimal OFMX" do
|
212
|
-
AIXM.ofmx!
|
213
|
-
subject.airport = subject.remarks = nil
|
214
|
-
subject.instance_variable_set(:'@services', [])
|
215
|
-
_(subject.to_xml).must_equal <<~END
|
216
|
-
<!-- Unit: PUJAUT TWR -->
|
217
|
-
<Uni source="LF|GEN|0.0 FACTORY|0|0">
|
218
|
-
<UniUid>
|
219
|
-
<txtName>PUJAUT TWR</txtName>
|
220
|
-
</UniUid>
|
221
|
-
<OrgUid>
|
222
|
-
<txtName>FRANCE</txtName>
|
223
|
-
</OrgUid>
|
224
|
-
<codeType>TWR</codeType>
|
225
|
-
<codeClass>ICAO</codeClass>
|
226
|
-
</Uni>
|
227
|
-
END
|
228
|
-
end
|
229
|
-
|
230
|
-
it "builds OFMX with mid" do
|
231
|
-
AIXM.ofmx!
|
232
|
-
AIXM.config.mid_region = 'LF'
|
233
|
-
_(subject.to_xml).must_match /<UniUid mid="92534b75-1c12-edc5-351b-740cb82e87dd">/
|
234
|
-
_(subject.to_xml).must_match /<SerUid mid="9240cf80-9cba-7ea5-ae39-6b682305db78">/
|
235
|
-
_(subject.to_xml).must_match /<FqyUid mid="48d8e7db-88b1-8e2f-2f27-2c2521e7ac27">/
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe AIXM::Feature do
|
4
|
-
subject do
|
5
|
-
AIXM::Feature.send(:new)
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :source= do
|
9
|
-
it "fails on invalid values" do
|
10
|
-
_([:foobar, 123]).wont_be_written_to subject, :source
|
11
|
-
end
|
12
|
-
|
13
|
-
it "accepts nil value" do
|
14
|
-
_([nil]).must_be_written_to subject, :source
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe :== do
|
19
|
-
it "recognizes features with identical UID as equal" do
|
20
|
-
a = AIXM::Factory.organisation
|
21
|
-
b = AIXM::Factory.organisation
|
22
|
-
_(a).must_equal b
|
23
|
-
end
|
24
|
-
|
25
|
-
it "recognizes features with different UID as unequal" do
|
26
|
-
a = AIXM::Factory.polygon_airspace
|
27
|
-
b = AIXM::Factory.circle_airspace
|
28
|
-
_(a).wont_equal b
|
29
|
-
end
|
30
|
-
|
31
|
-
it "recognizes objects of different class as unequal" do
|
32
|
-
a = AIXM::Factory.organisation
|
33
|
-
b = :oggy
|
34
|
-
_(a).wont_equal b
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/spec/lib/aixm/p_spec.rb
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
describe AIXM::P do
|
4
|
-
subject do
|
5
|
-
AIXM::Factory.p
|
6
|
-
end
|
7
|
-
|
8
|
-
describe :pres= do
|
9
|
-
it "fails on invalid values" do
|
10
|
-
_([:foobar, -1]).wont_be_written_to subject, :pres
|
11
|
-
end
|
12
|
-
|
13
|
-
it "converts Numeric to Float" do
|
14
|
-
_(subject.tap { |s| s.pres = 5 }.pres).must_equal 5.0
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe :unit= do
|
19
|
-
it "fails on invalid values" do
|
20
|
-
_([:foobar, 123]).wont_be_written_to subject, :unit
|
21
|
-
end
|
22
|
-
|
23
|
-
it "symbolizes and downcases values" do
|
24
|
-
_(subject.tap { |s| s.unit = "P" }.unit).must_equal :p
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe :to_p do
|
29
|
-
it "leaves pascal untouched" do
|
30
|
-
subject = AIXM.p(2, :p)
|
31
|
-
_(subject.to_p).must_be_same_as subject
|
32
|
-
end
|
33
|
-
|
34
|
-
it "converts megapascal to pascal" do
|
35
|
-
_(AIXM.p(0.01, :mpa).to_p).must_equal AIXM.p(10_000, :p)
|
36
|
-
end
|
37
|
-
|
38
|
-
it "converts psi to pascal" do
|
39
|
-
_(AIXM.p(0.03, :psi).to_p).must_equal AIXM.p(206.8427187, :p)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "converts bar to pascal" do
|
43
|
-
_(AIXM.p(0.02, :bar).to_p).must_equal AIXM.p(2000, :p)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "converts mmhg to pascal" do
|
47
|
-
_(AIXM.p(0.02, :torr).to_p).must_equal AIXM.p(2.66644, :p)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe :to_mpa do
|
52
|
-
it "leaves megapascal untouched" do
|
53
|
-
subject = AIXM.p(2, :mpa)
|
54
|
-
_(subject.to_mpa).must_be_same_as subject
|
55
|
-
end
|
56
|
-
|
57
|
-
it "converts pascal to megapascal" do
|
58
|
-
_(AIXM.p(10_000, :p).to_mpa).must_equal AIXM.p(0.01, :mpa)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "converts psi to megapascal" do
|
62
|
-
_(AIXM.p(300, :psi).to_mpa).must_equal AIXM.p(2.06842719, :mpa)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "converts bar to megapascal" do
|
66
|
-
_(AIXM.p(22, :bar).to_mpa).must_equal AIXM.p(2.2, :mpa)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "converts mmhg to megapascal" do
|
70
|
-
_(AIXM.p(205, :torr).to_mpa).must_equal AIXM.p(0.02733101, :mpa)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe :to_psi do
|
75
|
-
it "leaves psi untouched" do
|
76
|
-
subject = AIXM.p(2, :psi)
|
77
|
-
_(subject.to_psi).must_be_same_as subject
|
78
|
-
end
|
79
|
-
|
80
|
-
it "converts pascal to psi" do
|
81
|
-
_(AIXM.p(500, :p).to_psi).must_equal AIXM.p(0.07251887, :psi)
|
82
|
-
end
|
83
|
-
|
84
|
-
it "converts megapascal to psi" do
|
85
|
-
_(AIXM.p(0.1, :mpa).to_psi).must_equal AIXM.p(14.5037738, :psi)
|
86
|
-
end
|
87
|
-
|
88
|
-
it "converts bar to psi" do
|
89
|
-
_(AIXM.p(30, :bar).to_psi).must_equal AIXM.p(435.113214, :psi)
|
90
|
-
end
|
91
|
-
|
92
|
-
it "converts mmhg to psi" do
|
93
|
-
_(AIXM.p(20, :torr).to_psi).must_equal AIXM.p(0.38673443, :psi)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe :to_bar do
|
98
|
-
it "leaves bars untouched" do
|
99
|
-
subject = AIXM.p(2, :bar)
|
100
|
-
_(subject.to_bar).must_be_same_as subject
|
101
|
-
end
|
102
|
-
|
103
|
-
it "converts pascal to bars" do
|
104
|
-
_(AIXM.p(10_000, :p).to_bar).must_equal AIXM.p(0.1, :bar)
|
105
|
-
end
|
106
|
-
|
107
|
-
it "converts megapascal to bars" do
|
108
|
-
_(AIXM.p(0.1, :mpa).to_bar).must_equal AIXM.p(1, :bar)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "converts psi to bars" do
|
112
|
-
_(AIXM.p(90, :psi).to_bar).must_equal AIXM.p(6.20528156, :bar)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "converts mmhg to bars" do
|
116
|
-
_(AIXM.p(7000, :torr).to_bar).must_equal AIXM.p(9.33254, :bar)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe :to_torr do
|
121
|
-
it "leaves mmhg untouched" do
|
122
|
-
subject = AIXM.p(2, :torr)
|
123
|
-
_(subject.to_torr).must_be_same_as subject
|
124
|
-
end
|
125
|
-
|
126
|
-
it "converts pascal to mmhg" do
|
127
|
-
_(AIXM.p(12_000, :p).to_torr).must_equal AIXM.p(90.0072, :torr)
|
128
|
-
end
|
129
|
-
|
130
|
-
it "converts megapascal to mmhg" do
|
131
|
-
_(AIXM.p(0.1, :mpa).to_torr).must_equal AIXM.p(750.06, :torr)
|
132
|
-
end
|
133
|
-
|
134
|
-
it "converts psi to mmhg" do
|
135
|
-
_(AIXM.p(2, :psi).to_torr).must_equal AIXM.p(103.42963306, :torr)
|
136
|
-
end
|
137
|
-
|
138
|
-
it "converts bar to mmhg" do
|
139
|
-
_(AIXM.p(0.35, :bar).to_torr).must_equal AIXM.p(262.521, :torr)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe :<=> do
|
144
|
-
it "recognizes objects with identical unit and pressure as equal" do
|
145
|
-
a = AIXM.p(12, :bar)
|
146
|
-
b = AIXM.p(12.0, 'BAR')
|
147
|
-
_(a).must_equal b
|
148
|
-
end
|
149
|
-
|
150
|
-
it "recognizes objects with different units and converted pressure as equal" do
|
151
|
-
a = AIXM.p(12, :bar)
|
152
|
-
b = AIXM.p(174.0452856, 'PSI')
|
153
|
-
_(a).must_equal b
|
154
|
-
end
|
155
|
-
|
156
|
-
it "recognizes objects with different units and identical pressure as unequal" do
|
157
|
-
a = AIXM.p(12, :bar)
|
158
|
-
b = AIXM.p(12, :p)
|
159
|
-
_(a).wont_equal b
|
160
|
-
end
|
161
|
-
|
162
|
-
it "recognizes objects of different class as unequal" do
|
163
|
-
a = AIXM.p(12, :bar)
|
164
|
-
b = :oggy
|
165
|
-
_(a).wont_equal b
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
describe :hash do
|
170
|
-
it "returns an integer" do
|
171
|
-
_(subject.hash).must_be_instance_of Integer
|
172
|
-
end
|
173
|
-
|
174
|
-
it "allows for the use of instances as hash keys" do
|
175
|
-
dupe = subject.dup
|
176
|
-
_({ subject => true }[dupe]).must_equal true
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe :zero? do
|
181
|
-
it "returns true for zero pressure" do
|
182
|
-
_(subject.tap { |s| s.pres = 0 }).must_be :zero?
|
183
|
-
end
|
184
|
-
|
185
|
-
it "returns false for non-zero pressure" do
|
186
|
-
_(subject.tap { |s| s.pres = 1 }).wont_be :zero?
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|