aixm 0.2.3 → 0.3.0

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