aixm 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +26 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -4
- data/README.md +23 -5
- data/lib/aixm/component/fato.rb +3 -3
- data/lib/aixm/component/frequency.rb +1 -1
- data/lib/aixm/component/geometry/border.rb +9 -3
- data/lib/aixm/component/helipad.rb +1 -1
- data/lib/aixm/component/lighting.rb +1 -1
- data/lib/aixm/component/runway.rb +4 -7
- data/lib/aixm/config.rb +2 -1
- data/lib/aixm/document.rb +1 -0
- data/lib/aixm/feature/address.rb +1 -1
- data/lib/aixm/feature/airport.rb +13 -4
- data/lib/aixm/feature/airspace.rb +11 -8
- data/lib/aixm/feature/navigational_aid/designated_point.rb +1 -1
- data/lib/aixm/feature/navigational_aid/dme.rb +1 -1
- data/lib/aixm/feature/navigational_aid/marker.rb +1 -1
- data/lib/aixm/feature/navigational_aid/ndb.rb +1 -1
- data/lib/aixm/feature/navigational_aid/tacan.rb +1 -1
- data/lib/aixm/feature/navigational_aid/vor.rb +1 -1
- data/lib/aixm/feature/obstacle.rb +1 -1
- data/lib/aixm/feature/obstacle_group.rb +1 -1
- data/lib/aixm/feature/organisation.rb +1 -1
- data/lib/aixm/feature/service.rb +1 -1
- data/lib/aixm/feature/unit.rb +1 -1
- data/lib/aixm/refinements.rb +39 -8
- data/lib/aixm/version.rb +1 -1
- data/rakefile.rb +22 -8
- data/spec/lib/aixm/a_spec.rb +55 -55
- data/spec/lib/aixm/component/fato_spec.rb +30 -23
- data/spec/lib/aixm/component/frequency_spec.rb +12 -13
- data/spec/lib/aixm/component/geometry/arc_spec.rb +7 -9
- data/spec/lib/aixm/component/geometry/border_spec.rb +8 -3
- data/spec/lib/aixm/component/geometry/circle_spec.rb +6 -8
- data/spec/lib/aixm/component/geometry/point_spec.rb +2 -4
- data/spec/lib/aixm/component/geometry_spec.rb +57 -62
- data/spec/lib/aixm/component/helipad_spec.rb +25 -19
- data/spec/lib/aixm/component/layer_spec.rb +17 -19
- data/spec/lib/aixm/component/lighting_spec.rb +21 -15
- data/spec/lib/aixm/component/runway_spec.rb +44 -37
- data/spec/lib/aixm/component/surface_spec.rb +24 -24
- data/spec/lib/aixm/component/timetable_spec.rb +7 -9
- data/spec/lib/aixm/component/vertical_limits_spec.rb +9 -12
- data/spec/lib/aixm/config_spec.rb +8 -8
- data/spec/lib/aixm/d_spec.rb +28 -28
- data/spec/lib/aixm/document_spec.rb +46 -37
- data/spec/lib/aixm/errors_spec.rb +2 -2
- data/spec/lib/aixm/f_spec.rb +16 -16
- data/spec/lib/aixm/feature/address_spec.rb +12 -7
- data/spec/lib/aixm/feature/airport_spec.rb +80 -74
- data/spec/lib/aixm/feature/airspace_spec.rb +32 -28
- data/spec/lib/aixm/feature/navigational_aid/designated_point_spec.rb +16 -11
- data/spec/lib/aixm/feature/navigational_aid/dme_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/marker_spec.rb +13 -7
- data/spec/lib/aixm/feature/navigational_aid/ndb_spec.rb +15 -9
- data/spec/lib/aixm/feature/navigational_aid/tacan_spec.rb +22 -16
- data/spec/lib/aixm/feature/navigational_aid/vor_spec.rb +21 -15
- data/spec/lib/aixm/feature/navigational_aid_spec.rb +6 -6
- data/spec/lib/aixm/feature/obstacle_group_spec.rb +25 -21
- data/spec/lib/aixm/feature/obstacle_spec.rb +47 -42
- data/spec/lib/aixm/feature/organisation_spec.rb +16 -10
- data/spec/lib/aixm/feature/service_spec.rb +9 -9
- data/spec/lib/aixm/feature/unit_spec.rb +21 -13
- data/spec/lib/aixm/feature_spec.rb +5 -5
- data/spec/lib/aixm/p_spec.rb +37 -37
- data/spec/lib/aixm/refinements_spec.rb +164 -115
- data/spec/lib/aixm/version_spec.rb +1 -1
- data/spec/lib/aixm/w_spec.rb +28 -28
- data/spec/lib/aixm/xy_spec.rb +34 -34
- data/spec/lib/aixm/z_spec.rb +19 -19
- data/spec/macros/marking.rb +3 -3
- data/spec/macros/organisation.rb +2 -2
- data/spec/macros/remarks.rb +3 -3
- data/spec/macros/timetable.rb +2 -2
- data/spec/macros/xy.rb +2 -2
- data/spec/macros/z_qnh.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- metadata +3 -3
- data/.travis.yml +0 -8
data/spec/lib/aixm/w_spec.rb
CHANGED
@@ -7,97 +7,97 @@ describe AIXM::W do
|
|
7
7
|
|
8
8
|
describe :wgt= do
|
9
9
|
it "fails on invalid values" do
|
10
|
-
[:foobar, -1].wont_be_written_to subject, :wgt
|
10
|
+
_([:foobar, -1]).wont_be_written_to subject, :wgt
|
11
11
|
end
|
12
12
|
|
13
13
|
it "converts Numeric to Float" do
|
14
|
-
subject.tap { |s| s.wgt = 5 }.wgt.must_equal 5.0
|
14
|
+
_(subject.tap { |s| s.wgt = 5 }.wgt).must_equal 5.0
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe :unit= do
|
19
19
|
it "fails on invalid values" do
|
20
|
-
[:foobar, 123].wont_be_written_to subject, :unit
|
20
|
+
_([:foobar, 123]).wont_be_written_to subject, :unit
|
21
21
|
end
|
22
22
|
|
23
23
|
it "symbolizes and downcases values" do
|
24
|
-
subject.tap { |s| s.unit = "KG" }.unit.must_equal :kg
|
24
|
+
_(subject.tap { |s| s.unit = "KG" }.unit).must_equal :kg
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe :to_kg do
|
29
29
|
it "leaves kilograms untouched" do
|
30
30
|
subject = AIXM.w(2, :kg)
|
31
|
-
subject.to_kg.must_be_same_as subject
|
31
|
+
_(subject.to_kg).must_be_same_as subject
|
32
32
|
end
|
33
33
|
|
34
34
|
it "converts metric tonnes to kilograms" do
|
35
|
-
AIXM.w(0.5, :t).to_kg.must_equal AIXM.w(500, :kg)
|
35
|
+
_(AIXM.w(0.5, :t).to_kg).must_equal AIXM.w(500, :kg)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "converts pound to kilograms" do
|
39
|
-
AIXM.w(200, :lb).to_kg.must_equal AIXM.w(90.718474, :kg)
|
39
|
+
_(AIXM.w(200, :lb).to_kg).must_equal AIXM.w(90.718474, :kg)
|
40
40
|
end
|
41
41
|
|
42
42
|
it "converts US tons to kilograms" do
|
43
|
-
AIXM.w(0.5, :ton).to_kg.must_equal AIXM.w(453.59237, :kg)
|
43
|
+
_(AIXM.w(0.5, :ton).to_kg).must_equal AIXM.w(453.59237, :kg)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe :to_t do
|
48
48
|
it "leaves metric tonnes untouched" do
|
49
49
|
subject = AIXM.w(2, :t)
|
50
|
-
subject.to_t.must_be_same_as subject
|
50
|
+
_(subject.to_t).must_be_same_as subject
|
51
51
|
end
|
52
52
|
|
53
53
|
it "converts kilograms to metric tonnes" do
|
54
|
-
AIXM.w(10_000, :kg).to_t.must_equal AIXM.w(10, :t)
|
54
|
+
_(AIXM.w(10_000, :kg).to_t).must_equal AIXM.w(10, :t)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "converts pound to metric tonnes" do
|
58
|
-
AIXM.w(1000, :lb).to_t.must_equal AIXM.w(0.45359237, :t)
|
58
|
+
_(AIXM.w(1000, :lb).to_t).must_equal AIXM.w(0.45359237, :t)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "converts US tons to metric tonnes" do
|
62
|
-
AIXM.w(1, :ton).to_t.must_equal AIXM.w(0.90718474, :t)
|
62
|
+
_(AIXM.w(1, :ton).to_t).must_equal AIXM.w(0.90718474, :t)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
describe :to_lb do
|
67
67
|
it "leaves pound untouched" do
|
68
68
|
subject = AIXM.w(2, :lb)
|
69
|
-
subject.to_lb.must_be_same_as subject
|
69
|
+
_(subject.to_lb).must_be_same_as subject
|
70
70
|
end
|
71
71
|
|
72
72
|
it "converts kilograms to pound" do
|
73
|
-
AIXM.w(50, :kg).to_lb.must_equal AIXM.w(110.2311311, :lb)
|
73
|
+
_(AIXM.w(50, :kg).to_lb).must_equal AIXM.w(110.2311311, :lb)
|
74
74
|
end
|
75
75
|
|
76
76
|
it "converts metric tonnes to pound" do
|
77
|
-
AIXM.w(0.5, :t).to_lb.must_equal AIXM.w(1102.311311, :lb)
|
77
|
+
_(AIXM.w(0.5, :t).to_lb).must_equal AIXM.w(1102.311311, :lb)
|
78
78
|
end
|
79
79
|
|
80
80
|
it "converts US tons to pound" do
|
81
|
-
AIXM.w(0.5, :ton).to_lb.must_equal AIXM.w(1000.00000007, :lb)
|
81
|
+
_(AIXM.w(0.5, :ton).to_lb).must_equal AIXM.w(1000.00000007, :lb)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe :to_ton do
|
86
86
|
it "leaves US tons untouched" do
|
87
87
|
subject = AIXM.w(2, :ton)
|
88
|
-
subject.to_ton.must_be_same_as subject
|
88
|
+
_(subject.to_ton).must_be_same_as subject
|
89
89
|
end
|
90
90
|
|
91
91
|
it "converts kilograms to US tons" do
|
92
|
-
AIXM.w(1000, :kg).to_ton.must_equal AIXM.w(1.10231131, :ton)
|
92
|
+
_(AIXM.w(1000, :kg).to_ton).must_equal AIXM.w(1.10231131, :ton)
|
93
93
|
end
|
94
94
|
|
95
95
|
it "converts metrical tons to US tons" do
|
96
|
-
AIXM.w(0.5, :t).to_ton.must_equal AIXM.w(0.55115566, :ton)
|
96
|
+
_(AIXM.w(0.5, :t).to_ton).must_equal AIXM.w(0.55115566, :ton)
|
97
97
|
end
|
98
98
|
|
99
99
|
it "converts pound to US tons" do
|
100
|
-
AIXM.w(3000, :lb).to_ton.must_equal AIXM.w(1.5, :ton)
|
100
|
+
_(AIXM.w(3000, :lb).to_ton).must_equal AIXM.w(1.5, :ton)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -105,46 +105,46 @@ describe AIXM::W do
|
|
105
105
|
it "recognizes objects with identical unit and weight as equal" do
|
106
106
|
a = AIXM.w(123, :kg)
|
107
107
|
b = AIXM.w(123.0, 'KG')
|
108
|
-
a.must_equal b
|
108
|
+
_(a).must_equal b
|
109
109
|
end
|
110
110
|
|
111
111
|
it "recognizes objects with different units and converted weight as equal" do
|
112
112
|
a = AIXM.w(123, :kg)
|
113
113
|
b = AIXM.w(271.16858251, 'LB')
|
114
|
-
a.must_equal b
|
114
|
+
_(a).must_equal b
|
115
115
|
end
|
116
116
|
|
117
117
|
it "recognizes objects with different units and identical weight as unequal" do
|
118
118
|
a = AIXM.w(123, :kg)
|
119
119
|
b = AIXM.w(123, :lb)
|
120
|
-
a.wont_equal b
|
120
|
+
_(a).wont_equal b
|
121
121
|
end
|
122
122
|
|
123
123
|
it "recognizes objects of different class as unequal" do
|
124
124
|
a = AIXM.w(123, :kg)
|
125
125
|
b = :oggy
|
126
|
-
a.wont_equal b
|
126
|
+
_(a).wont_equal b
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
describe :hash do
|
131
131
|
it "returns an integer" do
|
132
|
-
subject.hash.must_be_instance_of Integer
|
132
|
+
_(subject.hash).must_be_instance_of Integer
|
133
133
|
end
|
134
134
|
|
135
135
|
it "allows for the use of instances as hash keys" do
|
136
136
|
dupe = subject.dup
|
137
|
-
{ subject => true }[dupe].must_equal true
|
137
|
+
_({ subject => true }[dupe]).must_equal true
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
describe :zero? do
|
142
142
|
it "returns true for zero weight" do
|
143
|
-
subject.tap { |s| s.wgt = 0 }.must_be :zero?
|
143
|
+
_(subject.tap { |s| s.wgt = 0 }).must_be :zero?
|
144
144
|
end
|
145
145
|
|
146
146
|
it "returns false for non-zero weight" do
|
147
|
-
subject.tap { |s| s.wgt = 1 }.wont_be :zero?
|
147
|
+
_(subject.tap { |s| s.wgt = 1 }).wont_be :zero?
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
data/spec/lib/aixm/xy_spec.rb
CHANGED
@@ -7,16 +7,16 @@ describe AIXM::XY do
|
|
7
7
|
|
8
8
|
describe :lat= do
|
9
9
|
it "fails on invalid values" do
|
10
|
-
[91, "foobar"].wont_be_written_to subject, :lat
|
10
|
+
_([91, "foobar"]).wont_be_written_to subject, :lat
|
11
11
|
end
|
12
12
|
|
13
13
|
it "parses valid DD values" do
|
14
|
-
subject.tap { |s| s.lat = 11.2233 }.lat.must_equal 11.2233
|
14
|
+
_(subject.tap { |s| s.lat = 11.2233 }.lat).must_equal 11.2233
|
15
15
|
end
|
16
16
|
|
17
17
|
it "parses valid DMS values" do
|
18
|
-
subject.tap { |s| s.lat = %q(11°22'33"N) }.lat.must_equal(11.37583333)
|
19
|
-
subject.tap { |s| s.lat = %q(11°22'33"S) }.lat.must_equal(-11.37583333)
|
18
|
+
_(subject.tap { |s| s.lat = %q(11°22'33"N) }.lat).must_equal(11.37583333)
|
19
|
+
_(subject.tap { |s| s.lat = %q(11°22'33"S) }.lat).must_equal(-11.37583333)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -27,15 +27,15 @@ describe AIXM::XY do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "must format DD (default) correctly" do
|
30
|
-
subject.lat.must_equal 1.1234
|
30
|
+
_(subject.lat).must_equal 1.1234
|
31
31
|
end
|
32
32
|
|
33
33
|
it "must format AIXM correctly" do
|
34
|
-
subject.lat(:aixm).must_equal %q(010724.24N)
|
34
|
+
_(subject.lat(:aixm)).must_equal %q(010724.24N)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "must format OFM correctly" do
|
38
|
-
subject.lat(:ofmx).must_equal '01.12340000N'
|
38
|
+
_(subject.lat(:ofmx)).must_equal '01.12340000N'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -45,31 +45,31 @@ describe AIXM::XY do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "must format DD (default) correctly" do
|
48
|
-
subject.lat.must_equal(-1.1234)
|
48
|
+
_(subject.lat).must_equal(-1.1234)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "must format AIXM correctly" do
|
52
|
-
subject.lat(:aixm).must_equal %q(010724.24S)
|
52
|
+
_(subject.lat(:aixm)).must_equal %q(010724.24S)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "must format OFM correctly" do
|
56
|
-
subject.lat(:ofmx).must_equal '01.12340000S'
|
56
|
+
_(subject.lat(:ofmx)).must_equal '01.12340000S'
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe :long= do
|
62
62
|
it "fails on invalid values" do
|
63
|
-
[181, "foobar"].wont_be_written_to subject, :lat
|
63
|
+
_([181, "foobar"]).wont_be_written_to subject, :lat
|
64
64
|
end
|
65
65
|
|
66
66
|
it "parses valid DD values" do
|
67
|
-
subject.tap { |s| s.long = 22.3344 }.long.must_equal 22.3344
|
67
|
+
_(subject.tap { |s| s.long = 22.3344 }.long).must_equal 22.3344
|
68
68
|
end
|
69
69
|
|
70
70
|
it "parses valid DMS values" do
|
71
|
-
subject.tap { |s| s.long = %q(22°33'44"E) }.long.must_equal(22.56222222)
|
72
|
-
subject.tap { |s| s.long = %q(22°33'44"W) }.long.must_equal(-22.56222222)
|
71
|
+
_(subject.tap { |s| s.long = %q(22°33'44"E) }.long).must_equal(22.56222222)
|
72
|
+
_(subject.tap { |s| s.long = %q(22°33'44"W) }.long).must_equal(-22.56222222)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -80,15 +80,15 @@ describe AIXM::XY do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "must format DD (default) correctly" do
|
83
|
-
subject.long.must_equal 1.1234
|
83
|
+
_(subject.long).must_equal 1.1234
|
84
84
|
end
|
85
85
|
|
86
86
|
it "must format AIXM correctly" do
|
87
|
-
subject.long(:aixm).must_equal %q(0010724.24E)
|
87
|
+
_(subject.long(:aixm)).must_equal %q(0010724.24E)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "must format OFM correctly" do
|
91
|
-
subject.long(:ofmx).must_equal '001.12340000E'
|
91
|
+
_(subject.long(:ofmx)).must_equal '001.12340000E'
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -98,27 +98,27 @@ describe AIXM::XY do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it "must format DD (default) correctly" do
|
101
|
-
subject.long.must_equal(-1.1234)
|
101
|
+
_(subject.long).must_equal(-1.1234)
|
102
102
|
end
|
103
103
|
|
104
104
|
it "must format AIXM correctly" do
|
105
|
-
subject.long(:aixm).must_equal %q(0010724.24W)
|
105
|
+
_(subject.long(:aixm)).must_equal %q(0010724.24W)
|
106
106
|
end
|
107
107
|
|
108
108
|
it "must format OFM correctly" do
|
109
|
-
subject.long(:ofmx).must_equal '001.12340000W'
|
109
|
+
_(subject.long(:ofmx)).must_equal '001.12340000W'
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
describe :seconds? do
|
115
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?
|
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
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -128,7 +128,7 @@ describe AIXM::XY do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
it "must return a point object with these coordinates" do
|
131
|
-
subject.to_point.xy.must_equal AIXM.point(xy: subject).xy
|
131
|
+
_(subject.to_point.xy).must_equal AIXM.point(xy: subject).xy
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -138,12 +138,12 @@ describe AIXM::XY do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
it "calculates the distance between the same point as zero" do
|
141
|
-
subject.distance(subject).must_equal AIXM.d(0, :m)
|
141
|
+
_(subject.distance(subject)).must_equal AIXM.d(0, :m)
|
142
142
|
end
|
143
143
|
|
144
144
|
it "calculates the distance between two points correctly" do
|
145
145
|
other = AIXM.xy(lat: %q(43°59'25.31"N), long: %q(004°45'23.24"E))
|
146
|
-
subject.distance(other).must_equal AIXM.d(1351, :m)
|
146
|
+
_(subject.distance(other)).must_equal AIXM.d(1351, :m)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -151,30 +151,30 @@ describe AIXM::XY do
|
|
151
151
|
it "recognizes objects with identical latitude and longitude as equal" do
|
152
152
|
a = AIXM.xy(lat: "112233N", long: "0223344E")
|
153
153
|
b = AIXM.xy(lat: 11.37583333, long: 22.56222222)
|
154
|
-
a.must_equal b
|
154
|
+
_(a).must_equal b
|
155
155
|
end
|
156
156
|
|
157
157
|
it "recognizes objects with different latitude or longitude as unequal" do
|
158
158
|
a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
|
159
159
|
b = AIXM.xy(lat: 11, long: 22)
|
160
|
-
a.wont_equal b
|
160
|
+
_(a).wont_equal b
|
161
161
|
end
|
162
162
|
|
163
163
|
it "recognizes objects of different class as unequal" do
|
164
164
|
a = AIXM.xy(lat: "112233.44N", long: "0223344.55E")
|
165
165
|
b = :oggy
|
166
|
-
a.wont_equal b
|
166
|
+
_(a).wont_equal b
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
170
|
describe :hash do
|
171
171
|
it "returns an integer" do
|
172
|
-
subject.hash.must_be_instance_of Integer
|
172
|
+
_(subject.hash).must_be_instance_of Integer
|
173
173
|
end
|
174
174
|
|
175
175
|
it "allows for the use of instances as hash keys" do
|
176
176
|
dupe = subject.dup
|
177
|
-
{ subject => true }[dupe].must_equal true
|
177
|
+
_({ subject => true }[dupe]).must_equal true
|
178
178
|
end
|
179
179
|
end
|
180
180
|
end
|
data/spec/lib/aixm/z_spec.rb
CHANGED
@@ -7,47 +7,47 @@ describe AIXM::Z do
|
|
7
7
|
|
8
8
|
describe :alt= do
|
9
9
|
it "fails on invalid values" do
|
10
|
-
[:foobar].wont_be_written_to subject, :alt
|
10
|
+
_([:foobar]).wont_be_written_to subject, :alt
|
11
11
|
end
|
12
12
|
|
13
13
|
it "converts Numeric to Integer" do
|
14
|
-
subject.tap { |s| s.alt = 5.5 }.alt.must_equal 5
|
14
|
+
_(subject.tap { |s| s.alt = 5.5 }.alt).must_equal 5
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe :code= do
|
19
19
|
it "fails on invalid values" do
|
20
|
-
[nil, :foobar].wont_be_written_to subject, :code
|
20
|
+
_([nil, :foobar]).wont_be_written_to subject, :code
|
21
21
|
end
|
22
22
|
|
23
23
|
it "symbolizes and downcases values" do
|
24
|
-
subject.tap { |s| s.code = "QFE" }.code.must_equal :qfe
|
24
|
+
_(subject.tap { |s| s.code = "QFE" }.code).must_equal :qfe
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe :qfe? do
|
29
29
|
it "recognizes same Q code" do
|
30
|
-
AIXM.z(111, :qfe).must_be :qfe?
|
30
|
+
_(AIXM.z(111, :qfe)).must_be :qfe?
|
31
31
|
end
|
32
32
|
|
33
33
|
it "doesn't recognize different Q code" do
|
34
|
-
AIXM.z(111, :qnh).wont_be :qfe?
|
34
|
+
_(AIXM.z(111, :qnh)).wont_be :qfe?
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe :ground? do
|
39
39
|
it "must detect ground" do
|
40
|
-
AIXM.z(0, :qfe).must_be :ground?
|
41
|
-
AIXM.z(111, :qfe).wont_be :ground?
|
42
|
-
AIXM.z(0, :qnh).wont_be :ground?
|
40
|
+
_(AIXM.z(0, :qfe)).must_be :ground?
|
41
|
+
_(AIXM.z(111, :qfe)).wont_be :ground?
|
42
|
+
_(AIXM.z(0, :qnh)).wont_be :ground?
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe :unit do
|
47
47
|
it "must return the correct unit" do
|
48
|
-
AIXM.z(0, :qfe).unit.must_equal :ft
|
49
|
-
AIXM.z(0, :qnh).unit.must_equal :ft
|
50
|
-
AIXM.z(0, :qne).unit.must_equal :fl
|
48
|
+
_(AIXM.z(0, :qfe).unit).must_equal :ft
|
49
|
+
_(AIXM.z(0, :qnh).unit).must_equal :ft
|
50
|
+
_(AIXM.z(0, :qne).unit).must_equal :fl
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -55,40 +55,40 @@ describe AIXM::Z do
|
|
55
55
|
it "recognizes objects with identical altitude and Q code as equal" do
|
56
56
|
a = AIXM.z(111, :qnh)
|
57
57
|
b = AIXM.z(111, :qnh)
|
58
|
-
a.must_equal b
|
58
|
+
_(a).must_equal b
|
59
59
|
end
|
60
60
|
|
61
61
|
it "recognizes objects with different altitude or Q code as unequal" do
|
62
62
|
a = AIXM.z(111, :qnh)
|
63
63
|
b = AIXM.z(222, :qnh)
|
64
|
-
a.wont_equal b
|
64
|
+
_(a).wont_equal b
|
65
65
|
end
|
66
66
|
|
67
67
|
it "recognizes objects of different class as unequal" do
|
68
68
|
a = AIXM.z(111, :qnh)
|
69
69
|
b = :oggy
|
70
|
-
a.wont_equal b
|
70
|
+
_(a).wont_equal b
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe :hash do
|
75
75
|
it "returns an integer" do
|
76
|
-
subject.hash.must_be_instance_of Integer
|
76
|
+
_(subject.hash).must_be_instance_of Integer
|
77
77
|
end
|
78
78
|
|
79
79
|
it "allows for the use of instances as hash keys" do
|
80
80
|
dupe = subject.dup
|
81
|
-
{ subject => true }[dupe].must_equal true
|
81
|
+
_({ subject => true }[dupe]).must_equal true
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe :zero? do
|
86
86
|
it "returns true for zero height, elevation or altitude" do
|
87
|
-
subject.tap { |s| s.alt = 0 }.must_be :zero?
|
87
|
+
_(subject.tap { |s| s.alt = 0 }).must_be :zero?
|
88
88
|
end
|
89
89
|
|
90
90
|
it "returns false for non-zero height, elevation or altitude" do
|
91
|
-
subject.tap { |s| s.alt = 1 }.wont_be :zero?
|
91
|
+
_(subject.tap { |s| s.alt = 1 }).wont_be :zero?
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|