aixm 0.3.5 → 0.3.6
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +4 -0
- data/CHANGELOG.md +15 -0
- data/README.md +7 -7
- data/aixm.gemspec +1 -0
- data/{Gemfile → gems.rb} +0 -0
- data/lib/aixm.rb +4 -0
- data/lib/aixm/component/fato.rb +255 -0
- data/lib/aixm/component/helipad.rb +59 -4
- data/lib/aixm/component/layer.rb +2 -2
- data/lib/aixm/component/lighting.rb +133 -0
- data/lib/aixm/component/runway.rb +31 -6
- data/lib/aixm/component/surface.rb +45 -2
- data/lib/aixm/d.rb +3 -3
- data/lib/aixm/document.rb +3 -1
- data/lib/aixm/feature/airport.rb +39 -5
- data/lib/aixm/feature/airspace.rb +7 -1
- data/lib/aixm/feature/unit.rb +3 -1
- data/lib/aixm/p.rb +88 -0
- data/lib/aixm/refinements.rb +15 -15
- data/lib/aixm/shortcuts.rb +4 -0
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/w.rb +86 -0
- data/lib/aixm/xy.rb +6 -0
- data/{Rakefile → rakefile.rb} +10 -0
- data/spec/factory.rb +64 -6
- data/spec/lib/aixm/component/fato_spec.rb +260 -0
- data/spec/lib/aixm/component/helipad_spec.rb +68 -3
- data/spec/lib/aixm/component/lighting_spec.rb +88 -0
- data/spec/lib/aixm/component/runway_spec.rb +63 -3
- data/spec/lib/aixm/component/surface_spec.rb +36 -0
- data/spec/lib/aixm/d_spec.rb +2 -2
- data/spec/lib/aixm/document_spec.rb +280 -2
- data/spec/lib/aixm/feature/airport_spec.rb +161 -8
- data/spec/lib/aixm/p_spec.rb +189 -0
- data/spec/lib/aixm/refinements_spec.rb +16 -16
- data/spec/lib/aixm/w_spec.rb +150 -0
- data/spec/lib/aixm/xy_spec.rb +11 -0
- data/spec/macros/marking.rb +12 -0
- metadata +32 -4
@@ -0,0 +1,150 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe AIXM::W do
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.w
|
6
|
+
end
|
7
|
+
|
8
|
+
describe :wgt= do
|
9
|
+
it "fails on invalid values" do
|
10
|
+
[:foobar, -1].wont_be_written_to subject, :wgt
|
11
|
+
end
|
12
|
+
|
13
|
+
it "converts Numeric to Float" do
|
14
|
+
subject.tap { |s| s.wgt = 5 }.wgt.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 = "KG" }.unit.must_equal :kg
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe :to_kg do
|
29
|
+
it "leaves kilograms untouched" do
|
30
|
+
subject = AIXM.w(2, :kg)
|
31
|
+
subject.to_kg.must_be_same_as subject
|
32
|
+
end
|
33
|
+
|
34
|
+
it "converts metric tonnes to kilograms" do
|
35
|
+
AIXM.w(0.5, :t).to_kg.must_equal AIXM.w(500, :kg)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "converts pound to kilograms" do
|
39
|
+
AIXM.w(200, :lb).to_kg.must_equal AIXM.w(90.718474, :kg)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "converts US tons to kilograms" do
|
43
|
+
AIXM.w(0.5, :ton).to_kg.must_equal AIXM.w(453.59237, :kg)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe :to_t do
|
48
|
+
it "leaves metric tonnes untouched" do
|
49
|
+
subject = AIXM.w(2, :t)
|
50
|
+
subject.to_t.must_be_same_as subject
|
51
|
+
end
|
52
|
+
|
53
|
+
it "converts kilograms to metric tonnes" do
|
54
|
+
AIXM.w(10_000, :kg).to_t.must_equal AIXM.w(10, :t)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "converts pound to metric tonnes" do
|
58
|
+
AIXM.w(1000, :lb).to_t.must_equal AIXM.w(0.45359237, :t)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "converts US tons to metric tonnes" do
|
62
|
+
AIXM.w(1, :ton).to_t.must_equal AIXM.w(0.90718474, :t)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe :to_lb do
|
67
|
+
it "leaves pound untouched" do
|
68
|
+
subject = AIXM.w(2, :lb)
|
69
|
+
subject.to_lb.must_be_same_as subject
|
70
|
+
end
|
71
|
+
|
72
|
+
it "converts kilograms to pound" do
|
73
|
+
AIXM.w(50, :kg).to_lb.must_equal AIXM.w(110.2311311, :lb)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "converts metric tonnes to pound" do
|
77
|
+
AIXM.w(0.5, :t).to_lb.must_equal AIXM.w(1102.311311, :lb)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "converts US tons to pound" do
|
81
|
+
AIXM.w(0.5, :ton).to_lb.must_equal AIXM.w(1000.00000007, :lb)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe :to_ton do
|
86
|
+
it "leaves US tons untouched" do
|
87
|
+
subject = AIXM.w(2, :ton)
|
88
|
+
subject.to_ton.must_be_same_as subject
|
89
|
+
end
|
90
|
+
|
91
|
+
it "converts kilograms to US tons" do
|
92
|
+
AIXM.w(1000, :kg).to_ton.must_equal AIXM.w(1.10231131, :ton)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "converts metrical tons to US tons" do
|
96
|
+
AIXM.w(0.5, :t).to_ton.must_equal AIXM.w(0.55115566, :ton)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "converts pound to US tons" do
|
100
|
+
AIXM.w(3000, :lb).to_ton.must_equal AIXM.w(1.5, :ton)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe :<=> do
|
105
|
+
it "recognizes objects with identical unit and weight as equal" do
|
106
|
+
a = AIXM.w(123, :kg)
|
107
|
+
b = AIXM.w(123.0, 'KG')
|
108
|
+
a.must_equal b
|
109
|
+
end
|
110
|
+
|
111
|
+
it "recognizes objects with different units and converted weight as equal" do
|
112
|
+
a = AIXM.w(123, :kg)
|
113
|
+
b = AIXM.w(271.16858251, 'LB')
|
114
|
+
a.must_equal b
|
115
|
+
end
|
116
|
+
|
117
|
+
it "recognizes objects with different units and identical weight as unequal" do
|
118
|
+
a = AIXM.w(123, :kg)
|
119
|
+
b = AIXM.w(123, :lb)
|
120
|
+
a.wont_equal b
|
121
|
+
end
|
122
|
+
|
123
|
+
it "recognizes objects of different class as unequal" do
|
124
|
+
a = AIXM.w(123, :kg)
|
125
|
+
b = :oggy
|
126
|
+
a.wont_equal b
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe :hash do
|
131
|
+
it "returns an integer" do
|
132
|
+
subject.hash.must_be_instance_of Integer
|
133
|
+
end
|
134
|
+
|
135
|
+
it "allows for the use of instances as hash keys" do
|
136
|
+
dupe = subject.dup
|
137
|
+
{ subject => true }[dupe].must_equal true
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe :zero? do
|
142
|
+
it "returns true for zero weight" do
|
143
|
+
subject.tap { |s| s.wgt = 0 }.must_be :zero?
|
144
|
+
end
|
145
|
+
|
146
|
+
it "returns false for non-zero weight" do
|
147
|
+
subject.tap { |s| s.wgt = 1 }.wont_be :zero?
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
data/spec/lib/aixm/xy_spec.rb
CHANGED
@@ -111,6 +111,17 @@ describe AIXM::XY do
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
+
describe :seconds? do
|
115
|
+
it "must detect coordinates with zero DMS seconds" do
|
116
|
+
AIXM.xy(lat: %q(44°33'00"N), long: %q(004°03'00"E)).wont_be :seconds?
|
117
|
+
AIXM.xy(lat: %q(44°33'00.01"N), long: %q(004°03'00"E)).must_be :seconds?
|
118
|
+
AIXM.xy(lat: %q(44°33'00"N), long: %q(004°03'00.01"E)).must_be :seconds?
|
119
|
+
AIXM.xy(lat: %q(47°29'10"N), long: %q(000°33'15"W)).must_be :seconds?
|
120
|
+
AIXM.xy(lat: %q(44°36'50"N), long: %q(004°23'50"E)).must_be :seconds?
|
121
|
+
AIXM.xy(lat: %q(44°48'00"N), long: %q(000°34'27"W)).must_be :seconds?
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
114
125
|
describe :to_point do
|
115
126
|
subject do
|
116
127
|
AIXM.xy(lat: %q(44°00'07.63"N), long: %q(004°45'07.81"E))
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe nil do
|
2
|
+
|
3
|
+
it "accepts nil value" do
|
4
|
+
[nil].must_be_written_to subject, :marking
|
5
|
+
end
|
6
|
+
|
7
|
+
it "stringifies valid values" do
|
8
|
+
subject.tap { |s| s.marking = 'foobar' }.marking.must_equal 'foobar'
|
9
|
+
subject.tap { |s| s.marking = 123 }.marking.must_equal '123'
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aixm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Schwyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: builder
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,15 +162,15 @@ files:
|
|
148
162
|
- ".travis.yml"
|
149
163
|
- ".yardopts"
|
150
164
|
- CHANGELOG.md
|
151
|
-
- Gemfile
|
152
165
|
- Guardfile
|
153
166
|
- LICENSE.txt
|
154
167
|
- README.md
|
155
|
-
- Rakefile
|
156
168
|
- aixm.gemspec
|
169
|
+
- gems.rb
|
157
170
|
- lib/aixm.rb
|
158
171
|
- lib/aixm/a.rb
|
159
172
|
- lib/aixm/component.rb
|
173
|
+
- lib/aixm/component/fato.rb
|
160
174
|
- lib/aixm/component/frequency.rb
|
161
175
|
- lib/aixm/component/geometry.rb
|
162
176
|
- lib/aixm/component/geometry/arc.rb
|
@@ -165,6 +179,7 @@ files:
|
|
165
179
|
- lib/aixm/component/geometry/point.rb
|
166
180
|
- lib/aixm/component/helipad.rb
|
167
181
|
- lib/aixm/component/layer.rb
|
182
|
+
- lib/aixm/component/lighting.rb
|
168
183
|
- lib/aixm/component/runway.rb
|
169
184
|
- lib/aixm/component/surface.rb
|
170
185
|
- lib/aixm/component/timetable.rb
|
@@ -191,11 +206,14 @@ files:
|
|
191
206
|
- lib/aixm/feature/organisation.rb
|
192
207
|
- lib/aixm/feature/service.rb
|
193
208
|
- lib/aixm/feature/unit.rb
|
209
|
+
- lib/aixm/p.rb
|
194
210
|
- lib/aixm/refinements.rb
|
195
211
|
- lib/aixm/shortcuts.rb
|
196
212
|
- lib/aixm/version.rb
|
213
|
+
- lib/aixm/w.rb
|
197
214
|
- lib/aixm/xy.rb
|
198
215
|
- lib/aixm/z.rb
|
216
|
+
- rakefile.rb
|
199
217
|
- schemas/aixm/4.5/AIXM-DataTypes.xsd
|
200
218
|
- schemas/aixm/4.5/AIXM-Features.xsd
|
201
219
|
- schemas/aixm/4.5/AIXM-Snapshot.xsd
|
@@ -206,6 +224,7 @@ files:
|
|
206
224
|
- schemas/ofmx/0/OFMX-Snapshot.xsd
|
207
225
|
- spec/factory.rb
|
208
226
|
- spec/lib/aixm/a_spec.rb
|
227
|
+
- spec/lib/aixm/component/fato_spec.rb
|
209
228
|
- spec/lib/aixm/component/frequency_spec.rb
|
210
229
|
- spec/lib/aixm/component/geometry/arc_spec.rb
|
211
230
|
- spec/lib/aixm/component/geometry/border_spec.rb
|
@@ -214,6 +233,7 @@ files:
|
|
214
233
|
- spec/lib/aixm/component/geometry_spec.rb
|
215
234
|
- spec/lib/aixm/component/helipad_spec.rb
|
216
235
|
- spec/lib/aixm/component/layer_spec.rb
|
236
|
+
- spec/lib/aixm/component/lighting_spec.rb
|
217
237
|
- spec/lib/aixm/component/runway_spec.rb
|
218
238
|
- spec/lib/aixm/component/surface_spec.rb
|
219
239
|
- spec/lib/aixm/component/timetable_spec.rb
|
@@ -239,10 +259,13 @@ files:
|
|
239
259
|
- spec/lib/aixm/feature/service_spec.rb
|
240
260
|
- spec/lib/aixm/feature/unit_spec.rb
|
241
261
|
- spec/lib/aixm/feature_spec.rb
|
262
|
+
- spec/lib/aixm/p_spec.rb
|
242
263
|
- spec/lib/aixm/refinements_spec.rb
|
243
264
|
- spec/lib/aixm/version_spec.rb
|
265
|
+
- spec/lib/aixm/w_spec.rb
|
244
266
|
- spec/lib/aixm/xy_spec.rb
|
245
267
|
- spec/lib/aixm/z_spec.rb
|
268
|
+
- spec/macros/marking.rb
|
246
269
|
- spec/macros/organisation.rb
|
247
270
|
- spec/macros/remarks.rb
|
248
271
|
- spec/macros/timetable.rb
|
@@ -277,6 +300,7 @@ summary: Aeronautical Information Exchange Model (AIXM 4.5).
|
|
277
300
|
test_files:
|
278
301
|
- spec/factory.rb
|
279
302
|
- spec/lib/aixm/a_spec.rb
|
303
|
+
- spec/lib/aixm/component/fato_spec.rb
|
280
304
|
- spec/lib/aixm/component/frequency_spec.rb
|
281
305
|
- spec/lib/aixm/component/geometry/arc_spec.rb
|
282
306
|
- spec/lib/aixm/component/geometry/border_spec.rb
|
@@ -285,6 +309,7 @@ test_files:
|
|
285
309
|
- spec/lib/aixm/component/geometry_spec.rb
|
286
310
|
- spec/lib/aixm/component/helipad_spec.rb
|
287
311
|
- spec/lib/aixm/component/layer_spec.rb
|
312
|
+
- spec/lib/aixm/component/lighting_spec.rb
|
288
313
|
- spec/lib/aixm/component/runway_spec.rb
|
289
314
|
- spec/lib/aixm/component/surface_spec.rb
|
290
315
|
- spec/lib/aixm/component/timetable_spec.rb
|
@@ -310,10 +335,13 @@ test_files:
|
|
310
335
|
- spec/lib/aixm/feature/service_spec.rb
|
311
336
|
- spec/lib/aixm/feature/unit_spec.rb
|
312
337
|
- spec/lib/aixm/feature_spec.rb
|
338
|
+
- spec/lib/aixm/p_spec.rb
|
313
339
|
- spec/lib/aixm/refinements_spec.rb
|
314
340
|
- spec/lib/aixm/version_spec.rb
|
341
|
+
- spec/lib/aixm/w_spec.rb
|
315
342
|
- spec/lib/aixm/xy_spec.rb
|
316
343
|
- spec/lib/aixm/z_spec.rb
|
344
|
+
- spec/macros/marking.rb
|
317
345
|
- spec/macros/organisation.rb
|
318
346
|
- spec/macros/remarks.rb
|
319
347
|
- spec/macros/timetable.rb
|