aixm 0.3.4 → 0.3.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.
@@ -50,11 +50,11 @@ describe AIXM::Feature::Obstacle do
50
50
 
51
51
  describe :radius= do
52
52
  it "fails on invalid values" do
53
- [nil, :foobar, 123, AIXM.d(0, :m)].wont_be_written_to subject, :radius
53
+ [:foobar, 123, AIXM.d(0, :m)].wont_be_written_to subject, :radius
54
54
  end
55
55
 
56
56
  it "accepts valid values" do
57
- [AIXM::Factory.d].must_be_written_to subject, :radius
57
+ [AIXM::Factory.d, nil].must_be_written_to subject, :radius
58
58
  end
59
59
  end
60
60
 
@@ -182,23 +182,24 @@ describe AIXM::Feature::Obstacle do
182
182
  macro :remarks
183
183
  end
184
184
 
185
- describe :clustered? do
186
- it "returns false if no height is set" do
187
- subject.tap { |s| s.height = nil }.wont_be :clustered?
185
+ describe :grouped? do
186
+ it "returns false since single obstacles are not grouped" do
187
+ subject.wont_be :grouped?
188
188
  end
189
+ end
189
190
 
190
- it "returns true if radius is bigger than height" do
191
- subject.tap { |s| s.radius, s.height = AIXM.d(2, :m), AIXM.d(1, :m) }.must_be :clustered?
191
+ describe :linked? do
192
+ subject do
193
+ AIXM::Factory.unlinked_obstacle_group.obstacles.first
192
194
  end
193
195
 
194
- it "returns false if radius is smaller than height" do
195
- subject.tap { |s| s.radius, s.height = AIXM.d(1, :m), AIXM.d(2, :m) }.wont_be :clustered?
196
+ it "returns false for unlinked obstacles" do
197
+ subject.wont_be :linked?
196
198
  end
197
- end
198
199
 
199
- describe :grouped? do
200
- it "returns false since obstacles are not grouped" do
201
- subject.wont_be :grouped?
200
+ it "returns true for linked obstacles" do
201
+ subject = AIXM::Factory.linked_obstacle_group.obstacles.last
202
+ subject.must_be :linked?
202
203
  end
203
204
  end
204
205
 
@@ -232,24 +233,40 @@ describe AIXM::Feature::Obstacle do
232
233
  it "builds correct OFMX" do
233
234
  AIXM.ofmx!
234
235
  subject.to_xml.must_equal <<~END
236
+ <!-- Obstacle group: EIFFEL TOWER -->
237
+ <Ogr>
238
+ <OgrUid>
239
+ <txtName>EIFFEL TOWER</txtName>
240
+ <geoLat>48.85825000N</geoLat>
241
+ <geoLong>002.29458889E</geoLong>
242
+ </OgrUid>
243
+ <codeDatum>WGE</codeDatum>
244
+ <valGeoAccuracy>2</valGeoAccuracy>
245
+ <uomGeoAccuracy>M</uomGeoAccuracy>
246
+ <valElevAccuracy>3</valElevAccuracy>
247
+ <uomElevAccuracy>FT</uomElevAccuracy>
248
+ </Ogr>
235
249
  <!-- Obstacle: [tower] 48.85825000N 002.29458889E EIFFEL TOWER -->
236
250
  <Obs>
237
251
  <ObsUid>
252
+ <OgrUid>
253
+ <txtName>EIFFEL TOWER</txtName>
254
+ <geoLat>48.85825000N</geoLat>
255
+ <geoLong>002.29458889E</geoLong>
256
+ </OgrUid>
238
257
  <geoLat>48.85825000N</geoLat>
239
258
  <geoLong>002.29458889E</geoLong>
240
259
  </ObsUid>
241
260
  <txtName>EIFFEL TOWER</txtName>
242
261
  <codeType>TOWER</codeType>
262
+ <codeGroup>N</codeGroup>
243
263
  <codeLgt>Y</codeLgt>
244
264
  <txtDescrLgt>red strobes</txtDescrLgt>
245
265
  <codeDatum>WGE</codeDatum>
246
- <valGeoAccuracy>2</valGeoAccuracy>
247
- <uomGeoAccuracy>M</uomGeoAccuracy>
248
266
  <valElev>1187</valElev>
249
- <valElevAccuracy>3</valElevAccuracy>
250
267
  <valHgt>1063</valHgt>
251
- <codeHgtAccuracy>Y</codeHgtAccuracy>
252
268
  <uomDistVer>FT</uomDistVer>
269
+ <codeHgtAccuracy>Y</codeHgtAccuracy>
253
270
  <valRadius>88</valRadius>
254
271
  <uomRadius>M</uomRadius>
255
272
  <datetimeValidWef>2018-01-01T12:00:00+01:00</datetimeValidWef>
@@ -260,26 +277,3 @@ describe AIXM::Feature::Obstacle do
260
277
  end
261
278
  end
262
279
  end
263
-
264
- describe AIXM::Feature::Obstacle::Grouped do
265
- subject do
266
- AIXM::Factory.unlinked_obstacle_group.obstacles.first
267
- end
268
-
269
- describe :grouped? do
270
- it "returns true since obstacles are grouped" do
271
- subject.must_be :grouped?
272
- end
273
- end
274
-
275
- describe :linked? do
276
- it "returns false for unlinked obstacles" do
277
- subject.wont_be :linked?
278
- end
279
-
280
- it "returns true for linked obstacles" do
281
- subject = AIXM::Factory.linked_obstacle_group.obstacles.last
282
- subject.must_be :linked?
283
- end
284
- end
285
- end
@@ -4,6 +4,22 @@ using AIXM::Refinements
4
4
 
5
5
  describe AIXM::Refinements do
6
6
 
7
+ context Object do
8
+ describe :then_if do
9
+ subject do
10
+ "foobar"
11
+ end
12
+
13
+ it "must return self if the condition is false" do
14
+ subject.then_if(false) { |s| s.gsub(/o/, 'i') }.must_equal subject
15
+ end
16
+
17
+ it "must return apply the block if the condition is true" do
18
+ subject.then_if(true) { |s| s.gsub(/o/, 'i') }.must_equal 'fiibar'
19
+ end
20
+ end
21
+ end
22
+
7
23
  context Array do
8
24
  describe :to_digest do
9
25
  it "must digest single string" do
@@ -111,6 +111,16 @@ describe AIXM::XY do
111
111
  end
112
112
  end
113
113
 
114
+ describe :to_point do
115
+ subject do
116
+ AIXM.xy(lat: %q(44°00'07.63"N), long: %q(004°45'07.81"E))
117
+ end
118
+
119
+ it "must return a point object with these coordinates" do
120
+ subject.to_point.xy.must_equal AIXM.point(xy: subject).xy
121
+ end
122
+ end
123
+
114
124
  describe :distance do
115
125
  subject do
116
126
  AIXM.xy(lat: %q(44°00'07.63"N), long: %q(004°45'07.81"E))
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
4
+ version: 0.3.5
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-04-24 00:00:00.000000000 Z
11
+ date: 2019-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake