aixm 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.yardopts +3 -0
- data/CHANGELOG.md +34 -14
- data/Guardfile +1 -0
- data/README.md +64 -257
- data/lib/aixm.rb +16 -7
- data/lib/aixm/component.rb +6 -0
- data/lib/aixm/component/frequency.rb +135 -0
- data/lib/aixm/component/geometry.rb +34 -23
- data/lib/aixm/component/geometry/arc.rb +37 -22
- data/lib/aixm/component/geometry/border.rb +29 -20
- data/lib/aixm/component/geometry/circle.rb +39 -22
- data/lib/aixm/component/geometry/point.rb +29 -13
- data/lib/aixm/component/helipad.rb +154 -0
- data/lib/aixm/component/layer.rb +91 -0
- data/lib/aixm/component/runway.rb +294 -0
- data/lib/aixm/component/service.rb +170 -0
- data/lib/aixm/component/timetable.rb +65 -0
- data/lib/aixm/component/vertical_limits.rb +65 -29
- data/lib/aixm/config.rb +87 -0
- data/lib/aixm/document.rb +66 -42
- data/lib/aixm/errors.rb +11 -0
- data/lib/aixm/f.rb +34 -20
- data/lib/aixm/feature.rb +38 -0
- data/lib/aixm/feature/airport.rb +473 -0
- data/lib/aixm/feature/airspace.rb +145 -92
- data/lib/aixm/feature/navigational_aid.rb +94 -0
- data/lib/aixm/feature/navigational_aid/designated_point.rb +50 -54
- data/lib/aixm/feature/navigational_aid/dme.rb +48 -40
- data/lib/aixm/feature/navigational_aid/marker.rb +55 -45
- data/lib/aixm/feature/navigational_aid/ndb.rb +54 -50
- data/lib/aixm/feature/navigational_aid/tacan.rb +38 -31
- data/lib/aixm/feature/navigational_aid/vor.rb +84 -76
- data/lib/aixm/feature/organisation.rb +97 -0
- data/lib/aixm/feature/unit.rb +152 -0
- data/lib/aixm/refinements.rb +132 -47
- data/lib/aixm/shortcuts.rb +11 -6
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/xy.rb +64 -20
- data/lib/aixm/z.rb +51 -22
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-DataTypes.xsd +0 -0
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Features.xsd +0 -0
- data/{lib/aixm/schemas → schemas/aixm}/4.5/AIXM-Snapshot.xsd +0 -0
- data/schemas/ofmx/0/OFMX-DataTypes.xsd +5077 -0
- data/schemas/ofmx/0/OFMX-Features.xsd +9955 -0
- data/schemas/ofmx/0/OFMX-Snapshot.xsd +217 -0
- data/spec/factory.rb +209 -33
- data/spec/lib/aixm/component/frequency_spec.rb +75 -0
- data/spec/lib/aixm/component/geometry/arc_spec.rb +28 -22
- data/spec/lib/aixm/component/geometry/border_spec.rb +23 -20
- data/spec/lib/aixm/component/geometry/circle_spec.rb +31 -22
- data/spec/lib/aixm/component/geometry/point_spec.rb +11 -14
- data/spec/lib/aixm/component/geometry_spec.rb +150 -69
- data/spec/lib/aixm/component/helipad_spec.rb +136 -0
- data/spec/lib/aixm/component/layer_spec.rb +110 -0
- data/spec/lib/aixm/component/runway_spec.rb +402 -0
- data/spec/lib/aixm/component/service_spec.rb +61 -0
- data/spec/lib/aixm/component/timetable_spec.rb +49 -0
- data/spec/lib/aixm/component/vertical_limits_spec.rb +39 -20
- data/spec/lib/aixm/config_spec.rb +41 -0
- data/spec/lib/aixm/document_spec.rb +637 -147
- data/spec/lib/aixm/errors_spec.rb +14 -0
- data/spec/lib/aixm/f_spec.rb +17 -10
- data/spec/lib/aixm/feature/airport_spec.rb +546 -0
- data/spec/lib/aixm/feature/airspace_spec.rb +349 -226
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +47 -36
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +61 -36
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +61 -113
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +65 -79
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +57 -36
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +86 -112
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +52 -0
- data/spec/lib/aixm/feature/organisation_spec.rb +77 -0
- data/spec/lib/aixm/feature/unit_spec.rb +227 -0
- data/spec/lib/aixm/feature_spec.rb +58 -0
- data/spec/lib/aixm/refinements_spec.rb +187 -178
- data/spec/lib/aixm/xy_spec.rb +45 -34
- data/spec/lib/aixm/z_spec.rb +19 -21
- data/spec/macros/organisation.rb +11 -0
- data/spec/macros/remarks.rb +12 -0
- data/spec/macros/timetable.rb +11 -0
- data/spec/macros/xy.rb +11 -0
- data/spec/macros/z_qnh.rb +11 -0
- data/spec/spec_helper.rb +26 -0
- metadata +60 -19
- data/lib/aixm/base.rb +0 -10
- data/lib/aixm/component/base.rb +0 -6
- data/lib/aixm/component/class_layer.rb +0 -46
- data/lib/aixm/component/geometry/base.rb +0 -8
- data/lib/aixm/component/schedule.rb +0 -43
- data/lib/aixm/feature/base.rb +0 -6
- data/lib/aixm/feature/navigational_aid/base.rb +0 -79
- data/spec/lib/aixm/component/class_layer_spec.rb +0 -74
- data/spec/lib/aixm/component/schedule_spec.rb +0 -33
- data/spec/lib/aixm/feature/navigational_aid/base_spec.rb +0 -41
@@ -1,50 +1,61 @@
|
|
1
1
|
require_relative '../../../../spec_helper'
|
2
2
|
|
3
3
|
describe AIXM::Feature::NavigationalAid::DesignatedPoint do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.designated_point
|
6
|
+
end
|
7
|
+
|
8
|
+
describe :type= do
|
9
|
+
it "fails on invalid values" do
|
10
|
+
[nil, :foobar, 123].wont_be_written_to subject, :type
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
subject.
|
13
|
+
it "looks up valid values" do
|
14
|
+
subject.tap { |s| s.type = :icao }.type.must_equal :icao
|
15
|
+
subject.tap { |s| s.type = :OTHER }.type.must_equal :other
|
11
16
|
end
|
17
|
+
end
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
19
|
+
describe :kind do
|
20
|
+
it "must return class/type combo" do
|
21
|
+
subject.kind.must_equal "DesignatedPoint:ICAO"
|
17
22
|
end
|
23
|
+
end
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
describe :to_xml do
|
26
|
+
it "builds correct complete OFMX" do
|
27
|
+
AIXM.ofmx!
|
28
|
+
subject.to_xml.must_equal <<~END
|
29
|
+
<!-- NavigationalAid: [DesignatedPoint:ICAO] DESIGNATED POINT NAVAID -->
|
30
|
+
<Dpn source="LF|GEN|0.0 FACTORY|0|0">
|
31
|
+
<DpnUid region="LF">
|
32
|
+
<codeId>DDD</codeId>
|
33
|
+
<geoLat>47.85916667N</geoLat>
|
34
|
+
<geoLong>007.56000000E</geoLong>
|
35
|
+
</DpnUid>
|
36
|
+
<codeDatum>WGE</codeDatum>
|
37
|
+
<codeType>ICAO</codeType>
|
38
|
+
<txtName>DESIGNATED POINT NAVAID</txtName>
|
39
|
+
<txtRmk>designated point navaid</txtRmk>
|
40
|
+
</Dpn>
|
41
|
+
END
|
23
42
|
end
|
24
43
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
</
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<uomDistVer>FT</uomDistVer>
|
41
|
-
<Dtt>
|
42
|
-
<codeWorkHr>H24</codeWorkHr>
|
43
|
-
</Dtt>
|
44
|
-
<txtRmk>designated point navaid</txtRmk>
|
45
|
-
</Dpn>
|
46
|
-
END
|
47
|
-
end
|
44
|
+
it "builds correct minimal OFMX" do
|
45
|
+
AIXM.ofmx!
|
46
|
+
subject.name = subject.remarks = nil
|
47
|
+
subject.to_xml.must_equal <<~END
|
48
|
+
<!-- NavigationalAid: [DesignatedPoint:ICAO] UNNAMED -->
|
49
|
+
<Dpn source="LF|GEN|0.0 FACTORY|0|0">
|
50
|
+
<DpnUid region="LF">
|
51
|
+
<codeId>DDD</codeId>
|
52
|
+
<geoLat>47.85916667N</geoLat>
|
53
|
+
<geoLong>007.56000000E</geoLong>
|
54
|
+
</DpnUid>
|
55
|
+
<codeDatum>WGE</codeDatum>
|
56
|
+
<codeType>ICAO</codeType>
|
57
|
+
</Dpn>
|
58
|
+
END
|
48
59
|
end
|
49
60
|
end
|
50
61
|
end
|
@@ -1,50 +1,75 @@
|
|
1
1
|
require_relative '../../../../spec_helper'
|
2
2
|
|
3
3
|
describe AIXM::Feature::NavigationalAid::DME do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.dme
|
6
|
+
end
|
7
|
+
|
8
|
+
describe :organisation= do
|
9
|
+
macro :organisation
|
10
|
+
end
|
11
|
+
|
12
|
+
describe :channel= do
|
13
|
+
it "fails on invalid values" do
|
14
|
+
[nil, :foobar, 123].wont_be_written_to subject, :channel
|
7
15
|
end
|
8
16
|
|
9
|
-
|
10
|
-
subject.
|
17
|
+
it "upcases value" do
|
18
|
+
subject.tap { |s| s.channel = '3x' }.channel.must_equal '3X'
|
11
19
|
end
|
20
|
+
end
|
12
21
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
22
|
+
describe :kind do
|
23
|
+
it "must return class/type combo" do
|
24
|
+
subject.kind.must_equal "DME"
|
17
25
|
end
|
26
|
+
end
|
18
27
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
describe :to_xml do
|
29
|
+
it "builds correct complete OFMX" do
|
30
|
+
AIXM.ofmx!
|
31
|
+
subject.to_xml.must_equal <<~END
|
32
|
+
<!-- NavigationalAid: [DME] DME NAVAID -->
|
33
|
+
<Dme source="LF|GEN|0.0 FACTORY|0|0">
|
34
|
+
<DmeUid region="LF">
|
35
|
+
<codeId>MMM</codeId>
|
36
|
+
<geoLat>47.85916667N</geoLat>
|
37
|
+
<geoLong>007.56000000E</geoLong>
|
38
|
+
</DmeUid>
|
39
|
+
<OrgUid region=\"LF\">
|
40
|
+
<txtName>FRANCE</txtName>
|
41
|
+
</OrgUid>
|
42
|
+
<txtName>DME NAVAID</txtName>
|
43
|
+
<codeChannel>95X</codeChannel>
|
44
|
+
<codeDatum>WGE</codeDatum>
|
45
|
+
<valElev>500</valElev>
|
46
|
+
<uomDistVer>FT</uomDistVer>
|
47
|
+
<Dtt>
|
48
|
+
<codeWorkHr>H24</codeWorkHr>
|
49
|
+
</Dtt>
|
50
|
+
<txtRmk>dme navaid</txtRmk>
|
51
|
+
</Dme>
|
52
|
+
END
|
23
53
|
end
|
24
54
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
</
|
35
|
-
|
36
|
-
|
37
|
-
<
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
</Dtt>
|
44
|
-
<txtRmk>dme navaid</txtRmk>
|
45
|
-
</Dme>
|
46
|
-
END
|
47
|
-
end
|
55
|
+
it "builds correct minimal OFMX" do
|
56
|
+
AIXM.ofmx!
|
57
|
+
subject.name = subject.z = subject.timetable = subject.remarks = nil
|
58
|
+
subject.to_xml.must_equal <<~END
|
59
|
+
<!-- NavigationalAid: [DME] UNNAMED -->
|
60
|
+
<Dme source="LF|GEN|0.0 FACTORY|0|0">
|
61
|
+
<DmeUid region="LF">
|
62
|
+
<codeId>MMM</codeId>
|
63
|
+
<geoLat>47.85916667N</geoLat>
|
64
|
+
<geoLong>007.56000000E</geoLong>
|
65
|
+
</DmeUid>
|
66
|
+
<OrgUid region=\"LF\">
|
67
|
+
<txtName>FRANCE</txtName>
|
68
|
+
</OrgUid>
|
69
|
+
<codeChannel>95X</codeChannel>
|
70
|
+
<codeDatum>WGE</codeDatum>
|
71
|
+
</Dme>
|
72
|
+
END
|
48
73
|
end
|
49
74
|
end
|
50
75
|
end
|
@@ -1,131 +1,79 @@
|
|
1
1
|
require_relative '../../../../spec_helper'
|
2
2
|
|
3
3
|
describe AIXM::Feature::NavigationalAid::Marker do
|
4
|
-
|
5
|
-
|
6
|
-
AIXM::Factory.marker
|
7
|
-
end
|
8
|
-
|
9
|
-
let :digest do
|
10
|
-
subject.to_digest
|
11
|
-
end
|
12
|
-
|
13
|
-
describe :kind do
|
14
|
-
it "must return class/type combo" do
|
15
|
-
subject.kind.must_equal "Marker:O"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe :to_digest do
|
20
|
-
it "must return digest of payload" do
|
21
|
-
subject.to_digest.must_equal 300437209
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe :to_aixm do
|
26
|
-
it "must build correct XML with OFM extension" do
|
27
|
-
subject.to_aixm(:ofm).must_equal <<~END
|
28
|
-
<!-- NavigationalAid: [Marker:O] MARKER NAVAID -->
|
29
|
-
<Mkr>
|
30
|
-
<MkrUid mid="#{digest}" newEntity="true">
|
31
|
-
<codeId>---</codeId>
|
32
|
-
<geoLat>47.85916667N</geoLat>
|
33
|
-
<geoLong>7.56000000E</geoLong>
|
34
|
-
</MkrUid>
|
35
|
-
<OrgUid/>
|
36
|
-
<codePsnIls>O</codePsnIls>
|
37
|
-
<valFreq>75</valFreq>
|
38
|
-
<uomFreq>MHZ</uomFreq>
|
39
|
-
<txtName>MARKER NAVAID</txtName>
|
40
|
-
<codeDatum>WGE</codeDatum>
|
41
|
-
<valElev>500</valElev>
|
42
|
-
<uomDistVer>FT</uomDistVer>
|
43
|
-
<Mtt>
|
44
|
-
<codeWorkHr>H24</codeWorkHr>
|
45
|
-
</Mtt>
|
46
|
-
<txtRmk>marker navaid</txtRmk>
|
47
|
-
</Mkr>
|
48
|
-
END
|
49
|
-
end
|
50
|
-
end
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.marker
|
51
6
|
end
|
52
7
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
marker.type = :middle
|
57
|
-
end
|
8
|
+
describe :type= do
|
9
|
+
it "fails on invalid values" do
|
10
|
+
[:foobar, 123].wont_be_written_to subject, :type
|
58
11
|
end
|
59
12
|
|
60
|
-
|
61
|
-
|
62
|
-
subject.kind.must_equal "Marker:M"
|
63
|
-
end
|
13
|
+
it "accepts nil value" do
|
14
|
+
[nil].must_be_written_to subject, :name
|
64
15
|
end
|
65
16
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
17
|
+
it "looks up valid values" do
|
18
|
+
subject.tap { |s| s.type = :middle }.type.must_equal :middle
|
19
|
+
subject.tap { |s| s.type = :O }.type.must_equal :outer
|
70
20
|
end
|
71
21
|
end
|
72
|
-
context "complete middle marker" do
|
73
|
-
subject do
|
74
|
-
AIXM::Factory.marker.tap do |marker|
|
75
|
-
marker.type = :middle
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe :kind do
|
80
|
-
it "must return class/type combo" do
|
81
|
-
subject.kind.must_equal "Marker:M"
|
82
|
-
end
|
83
|
-
end
|
84
22
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
23
|
+
describe :kind do
|
24
|
+
it "must return class/type combo" do
|
25
|
+
subject.kind.must_equal "Marker:O"
|
89
26
|
end
|
90
27
|
end
|
91
28
|
|
92
|
-
|
93
|
-
|
94
|
-
AIXM
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
29
|
+
describe :to_xml do
|
30
|
+
it "builds correct complete OFMX" do
|
31
|
+
AIXM.ofmx!
|
32
|
+
subject.to_xml.must_equal <<~END
|
33
|
+
<!-- NavigationalAid: [Marker:O] MARKER NAVAID -->
|
34
|
+
<Mkr source="LF|GEN|0.0 FACTORY|0|0">
|
35
|
+
<MkrUid region="LF">
|
36
|
+
<codeId>---</codeId>
|
37
|
+
<geoLat>47.85916667N</geoLat>
|
38
|
+
<geoLong>007.56000000E</geoLong>
|
39
|
+
</MkrUid>
|
40
|
+
<OrgUid region="LF">
|
41
|
+
<txtName>FRANCE</txtName>
|
42
|
+
</OrgUid>
|
43
|
+
<codePsnIls>O</codePsnIls>
|
44
|
+
<valFreq>75</valFreq>
|
45
|
+
<uomFreq>MHZ</uomFreq>
|
46
|
+
<txtName>MARKER NAVAID</txtName>
|
47
|
+
<codeDatum>WGE</codeDatum>
|
48
|
+
<valElev>500</valElev>
|
49
|
+
<uomDistVer>FT</uomDistVer>
|
50
|
+
<Mtt>
|
51
|
+
<codeWorkHr>H24</codeWorkHr>
|
52
|
+
</Mtt>
|
53
|
+
<txtRmk>marker navaid</txtRmk>
|
54
|
+
</Mkr>
|
55
|
+
END
|
56
|
+
end
|
57
|
+
|
58
|
+
it "builds correct minimal OFMX" do
|
59
|
+
AIXM.ofmx!
|
60
|
+
subject.type = subject.name = subject.z = subject.timetable = subject.remarks = nil
|
61
|
+
subject.to_xml.must_equal <<~END
|
62
|
+
<!-- NavigationalAid: [Marker] UNNAMED -->
|
63
|
+
<Mkr source="LF|GEN|0.0 FACTORY|0|0">
|
64
|
+
<MkrUid region="LF">
|
65
|
+
<codeId>---</codeId>
|
66
|
+
<geoLat>47.85916667N</geoLat>
|
67
|
+
<geoLong>007.56000000E</geoLong>
|
68
|
+
</MkrUid>
|
69
|
+
<OrgUid region="LF">
|
70
|
+
<txtName>FRANCE</txtName>
|
71
|
+
</OrgUid>
|
72
|
+
<valFreq>75</valFreq>
|
73
|
+
<uomFreq>MHZ</uomFreq>
|
74
|
+
<codeDatum>WGE</codeDatum>
|
75
|
+
</Mkr>
|
76
|
+
END
|
129
77
|
end
|
130
78
|
end
|
131
79
|
end
|
@@ -1,103 +1,89 @@
|
|
1
1
|
require_relative '../../../../spec_helper'
|
2
2
|
|
3
3
|
describe AIXM::Feature::NavigationalAid::NDB do
|
4
|
-
|
5
|
-
|
6
|
-
AIXM.f(555, :khz)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "won't accept invalid arguments" do
|
10
|
-
-> { AIXM.ndb(id: 'N', name: 'NDB', xy: AIXM::Factory.xy, type: :foo, f: f) }.must_raise ArgumentError
|
11
|
-
-> { AIXM.ndb(id: 'N', name: 'NDB', xy: AIXM::Factory.xy, type: :en_route, f: 0) }.must_raise ArgumentError
|
12
|
-
end
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.ndb
|
13
6
|
end
|
14
7
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
let :digest do
|
21
|
-
subject.to_digest
|
8
|
+
describe :type= do
|
9
|
+
it "fails on invalid values" do
|
10
|
+
[:foobar, 123].wont_be_written_to subject, :type
|
22
11
|
end
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
subject.kind.must_equal "NDB:B"
|
27
|
-
end
|
13
|
+
it "accepts nil value" do
|
14
|
+
[nil].must_be_written_to subject, :type
|
28
15
|
end
|
29
16
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe :to_aixm do
|
37
|
-
it "must build correct XML with OFM extension" do
|
38
|
-
subject.to_aixm(:ofm).must_equal <<~END
|
39
|
-
<!-- NavigationalAid: [NDB:B] NDB NAVAID -->
|
40
|
-
<Ndb>
|
41
|
-
<NdbUid mid="#{digest}" newEntity="true">
|
42
|
-
<codeId>NNN</codeId>
|
43
|
-
<geoLat>47.85916667N</geoLat>
|
44
|
-
<geoLong>7.56000000E</geoLong>
|
45
|
-
</NdbUid>
|
46
|
-
<OrgUid/>
|
47
|
-
<txtName>NDB NAVAID</txtName>
|
48
|
-
<valFreq>555</valFreq>
|
49
|
-
<uomFreq>KHZ</uomFreq>
|
50
|
-
<codeClass>B</codeClass>
|
51
|
-
<codeDatum>WGE</codeDatum>
|
52
|
-
<valElev>500</valElev>
|
53
|
-
<uomDistVer>FT</uomDistVer>
|
54
|
-
<Ntt>
|
55
|
-
<codeWorkHr>H24</codeWorkHr>
|
56
|
-
</Ntt>
|
57
|
-
<txtRmk>ndb navaid</txtRmk>
|
58
|
-
</Ndb>
|
59
|
-
END
|
60
|
-
end
|
17
|
+
it "looks up valid values" do
|
18
|
+
subject.tap { |s| s.type = :en_route }.type.must_equal :en_route
|
19
|
+
subject.tap { |s| s.type = :L }.type.must_equal :locator
|
61
20
|
end
|
62
21
|
end
|
63
22
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
ndb.type = :locator
|
68
|
-
end
|
23
|
+
describe :f= do
|
24
|
+
it "fails on invalid values" do
|
25
|
+
[nil, :foobar, 123].wont_be_written_to subject, :f
|
69
26
|
end
|
70
27
|
|
71
|
-
|
72
|
-
|
73
|
-
subject.kind.must_equal "NDB:L"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe :to_aixm do
|
78
|
-
it "must build correct XML with OFM extension" do
|
79
|
-
subject.to_aixm(:ofm).must_match %r(<codeClass>L</codeClass>)
|
80
|
-
end
|
28
|
+
it "accepts valid values" do
|
29
|
+
[AIXM.f(200, :khz)].must_be_written_to subject, :f
|
81
30
|
end
|
82
31
|
end
|
83
32
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
ndb.type = :marine
|
88
|
-
end
|
33
|
+
describe :kind do
|
34
|
+
it "must return class/type combo" do
|
35
|
+
subject.kind.must_equal "NDB:B"
|
89
36
|
end
|
37
|
+
end
|
90
38
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
39
|
+
describe :to_xml do
|
40
|
+
it "builds correct complete OFMX" do
|
41
|
+
AIXM.ofmx!
|
42
|
+
subject.to_xml.must_equal <<~END
|
43
|
+
<!-- NavigationalAid: [NDB:B] NDB NAVAID -->
|
44
|
+
<Ndb source="LF|GEN|0.0 FACTORY|0|0">
|
45
|
+
<NdbUid region="LF">
|
46
|
+
<codeId>NNN</codeId>
|
47
|
+
<geoLat>47.85916667N</geoLat>
|
48
|
+
<geoLong>007.56000000E</geoLong>
|
49
|
+
</NdbUid>
|
50
|
+
<OrgUid region="LF">
|
51
|
+
<txtName>FRANCE</txtName>
|
52
|
+
</OrgUid>
|
53
|
+
<txtName>NDB NAVAID</txtName>
|
54
|
+
<valFreq>555</valFreq>
|
55
|
+
<uomFreq>KHZ</uomFreq>
|
56
|
+
<codeClass>B</codeClass>
|
57
|
+
<codeDatum>WGE</codeDatum>
|
58
|
+
<valElev>500</valElev>
|
59
|
+
<uomDistVer>FT</uomDistVer>
|
60
|
+
<Ntt>
|
61
|
+
<codeWorkHr>H24</codeWorkHr>
|
62
|
+
</Ntt>
|
63
|
+
<txtRmk>ndb navaid</txtRmk>
|
64
|
+
</Ndb>
|
65
|
+
END
|
95
66
|
end
|
96
67
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
68
|
+
it "builds correct minimal OFMX" do
|
69
|
+
AIXM.ofmx!
|
70
|
+
subject.name = subject.type = subject.z = subject.timetable = subject.remarks = nil
|
71
|
+
subject.to_xml.must_equal <<~END
|
72
|
+
<!-- NavigationalAid: [NDB] UNNAMED -->
|
73
|
+
<Ndb source="LF|GEN|0.0 FACTORY|0|0">
|
74
|
+
<NdbUid region="LF">
|
75
|
+
<codeId>NNN</codeId>
|
76
|
+
<geoLat>47.85916667N</geoLat>
|
77
|
+
<geoLong>007.56000000E</geoLong>
|
78
|
+
</NdbUid>
|
79
|
+
<OrgUid region="LF">
|
80
|
+
<txtName>FRANCE</txtName>
|
81
|
+
</OrgUid>
|
82
|
+
<valFreq>555</valFreq>
|
83
|
+
<uomFreq>KHZ</uomFreq>
|
84
|
+
<codeDatum>WGE</codeDatum>
|
85
|
+
</Ndb>
|
86
|
+
END
|
101
87
|
end
|
102
88
|
end
|
103
89
|
end
|