rozi 0.0.7 → 0.1.3
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/README.md +255 -0
- data/lib/rozi.rb +6 -3
- data/lib/rozi/file_wrapper_base.rb +52 -0
- data/lib/rozi/module_functions.rb +19 -69
- data/lib/rozi/name_search.rb +176 -0
- data/lib/rozi/{ozi_functions.rb → shared.rb} +36 -9
- data/lib/rozi/tracks.rb +170 -0
- data/lib/rozi/version.rb +1 -1
- data/lib/rozi/waypoints.rb +315 -0
- data/test/rozi/file_wrapper_base_test.rb +29 -0
- data/test/rozi/module_functions_test.rb +11 -72
- data/test/rozi/name_search_test.rb +248 -0
- data/test/rozi/{ozi_functions_test.rb → shared_test.rb} +25 -5
- data/test/rozi/tracks_test.rb +105 -0
- data/test/rozi/waypoints_test.rb +268 -0
- data/test/test_data/expected_output_1.nst +6 -0
- data/{test_data → test/test_data}/expected_output_1.plt +9 -9
- data/{test_data → test/test_data}/expected_output_1.wpt +7 -7
- data/test/test_data/input_1.wpt +6 -0
- metadata +128 -34
- data/README.rdoc +0 -127
- data/lib/rozi/name.rb +0 -23
- data/lib/rozi/name_search_text.rb +0 -43
- data/lib/rozi/name_search_text_writer.rb +0 -71
- data/lib/rozi/track.rb +0 -67
- data/lib/rozi/track_point.rb +0 -39
- data/lib/rozi/track_writer.rb +0 -50
- data/lib/rozi/waypoint.rb +0 -90
- data/lib/rozi/waypoint_writer.rb +0 -38
- data/test/rozi/name_search_text_test.rb +0 -28
- data/test/rozi/name_search_text_writer_test.rb +0 -114
- data/test/rozi/track_point_test.rb +0 -32
- data/test/rozi/track_test.rb +0 -25
- data/test/rozi/track_writer_test.rb +0 -62
- data/test/rozi/waypoint_test.rb +0 -31
- data/test/rozi/waypoint_writer_test.rb +0 -60
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
module RoziTestSuite
|
3
|
+
class FileWrapperBaseTest < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@subject = Class.new(Rozi::FileWrapperBase)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_open
|
9
|
+
Rozi.expects(:open_file).with(:foo, "r").returns(:bar)
|
10
|
+
|
11
|
+
wrapper = @subject.open(:foo)
|
12
|
+
|
13
|
+
assert_same :bar, wrapper.file
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_open_with_block
|
17
|
+
file_mock = mock()
|
18
|
+
file_mock.expects(:closed?).returns(false)
|
19
|
+
file_mock.expects(:close)
|
20
|
+
|
21
|
+
Rozi.expects(:open_file).with(:foo, "r").returns(file_mock)
|
22
|
+
|
23
|
+
assert_same :pow, @subject.open(:foo) { |wrapper|
|
24
|
+
assert_same file_mock, wrapper.file
|
25
|
+
:pow
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,26 +1,29 @@
|
|
1
1
|
|
2
2
|
require "tempfile"
|
3
3
|
|
4
|
-
module
|
4
|
+
module RoziTestSuite
|
5
5
|
class ModuleFunctionsTest < Minitest::Test
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
file = Rozi.open_file_for_writing file_path
|
6
|
+
def test_open_file
|
7
|
+
RoziTestSuite.temp_file_path { |file_path|
|
8
|
+
file = Rozi.open_file(file_path, "w")
|
10
9
|
file.write("foo\nbar\næøå")
|
11
10
|
file.close
|
12
11
|
|
13
12
|
text = File.read(file_path, mode: "rb").force_encoding("ISO-8859-1")
|
14
13
|
|
15
14
|
assert_equal "foo\r\nbar\r\næøå".encode("ISO-8859-1"), text
|
15
|
+
|
16
|
+
file = Rozi.open_file(file_path, "r")
|
17
|
+
assert_equal "foo\nbar\næøå", file.read
|
18
|
+
file.close
|
16
19
|
}
|
17
20
|
end
|
18
21
|
|
19
|
-
def
|
20
|
-
temp_file_path { |file_path|
|
22
|
+
def test_open_file_with_block
|
23
|
+
RoziTestSuite.temp_file_path { |file_path|
|
21
24
|
f = nil
|
22
25
|
|
23
|
-
Rozi.
|
26
|
+
Rozi.open_file(file_path, "w") { |file|
|
24
27
|
assert_instance_of File, file
|
25
28
|
|
26
29
|
f = file
|
@@ -29,69 +32,5 @@ module Rozi
|
|
29
32
|
assert f.closed?
|
30
33
|
}
|
31
34
|
end
|
32
|
-
|
33
|
-
def test_write_waypoints
|
34
|
-
waypoints = [
|
35
|
-
Rozi::Waypoint.new(
|
36
|
-
latitude: 59.91273, longitude: 10.74609, name: "OSLO"
|
37
|
-
),
|
38
|
-
Rozi::Waypoint.new(
|
39
|
-
latitude: 60.39358, longitude: 5.32476, name: "BERGEN"
|
40
|
-
),
|
41
|
-
Rozi::Waypoint.new(
|
42
|
-
latitude: 62.56749, longitude: 7.68709, name: "ÅNDALSNES"
|
43
|
-
)
|
44
|
-
]
|
45
|
-
|
46
|
-
temp_file_path { |file_path|
|
47
|
-
Rozi.write_waypoints(waypoints, file_path)
|
48
|
-
|
49
|
-
text = File.read(file_path, mode: "rb")
|
50
|
-
expected_output = read_test_file("expected_output_1.wpt")
|
51
|
-
|
52
|
-
assert_equal expected_output, text
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_write_track
|
57
|
-
track = Rozi::Track.new()
|
58
|
-
track << Rozi::TrackPoint.new(latitude: 59.91273, longitude: 10.74609)
|
59
|
-
track << Rozi::TrackPoint.new(latitude: 60.39358, longitude: 5.32476)
|
60
|
-
track << Rozi::TrackPoint.new(latitude: 62.56749, longitude: 7.68709)
|
61
|
-
|
62
|
-
temp_file_path { |file_path|
|
63
|
-
Rozi.write_track(track, file_path)
|
64
|
-
|
65
|
-
text = File.read(file_path, mode: "rb")
|
66
|
-
expected_output = read_test_file("expected_output_1.plt")
|
67
|
-
|
68
|
-
assert_equal expected_output, text
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
def read_test_file(name)
|
75
|
-
path = File.join(Rozi::PROJECT_DIR, "test_data", name)
|
76
|
-
|
77
|
-
File.read(path, mode: "rb")
|
78
|
-
end
|
79
|
-
|
80
|
-
def temp_file_path(name="temp", suffix="")
|
81
|
-
path = Dir::Tmpname.make_tmpname(
|
82
|
-
"#{Dir::Tmpname.tmpdir}/rozi", "#{name}#{suffix}"
|
83
|
-
)
|
84
|
-
|
85
|
-
if block_given?
|
86
|
-
begin
|
87
|
-
yield path
|
88
|
-
ensure
|
89
|
-
File.unlink path if File.exist? path
|
90
|
-
end
|
91
|
-
else
|
92
|
-
return path
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
35
|
end
|
97
36
|
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
|
2
|
+
module RoziTestSuite
|
3
|
+
class WriteNstTest < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@subject = Rozi.method(:write_nst)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_basic_usage
|
9
|
+
expected_output = RoziTestSuite.read_test_data("expected_output_1.nst")
|
10
|
+
|
11
|
+
names = [
|
12
|
+
Rozi::Name.new(
|
13
|
+
name: "Oslo", latitude: 59.913309, longitude: 10.753188
|
14
|
+
),
|
15
|
+
Rozi::Name.new(
|
16
|
+
name: "Bergen", latitude: 60.389966, longitude: 5.323434
|
17
|
+
),
|
18
|
+
Rozi::Name.new(
|
19
|
+
name: "Trondheim", latitude: 63.429949, longitude: 10.395332
|
20
|
+
)
|
21
|
+
]
|
22
|
+
|
23
|
+
file = StringIO.new
|
24
|
+
Rozi.expects(:open_file).returns(file)
|
25
|
+
|
26
|
+
Rozi.write_nst(names, nil, comment: "Rozi test suite")
|
27
|
+
|
28
|
+
assert_equal expected_output, file.string
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class NameSearchPropertiesTest < Minitest::Test
|
33
|
+
def setup
|
34
|
+
@subject = Rozi::NameSearchProperties.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_setting_datum
|
38
|
+
@subject.datum = "Norsk"
|
39
|
+
assert_equal "Norsk", @subject.datum
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_setting_invalid_datum
|
43
|
+
assert_raises(ArgumentError) {
|
44
|
+
@subject.datum = "Foo"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class NameSearchTextFileTest < Minitest::Test
|
50
|
+
def setup
|
51
|
+
@subject = Rozi::NameSearchTextFile.new(mock())
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_write_name_empty_file
|
55
|
+
@subject.file = StringIO.new
|
56
|
+
|
57
|
+
# Each write performs two file writes, one for the object and one for the
|
58
|
+
# line break. We expect the properties to be written once, and each of the
|
59
|
+
# names to be written - 3*2=6
|
60
|
+
@subject.file.expects(:write).times(6)
|
61
|
+
|
62
|
+
@subject.write_name Rozi::Name.new(
|
63
|
+
name: "Oslo", latitude: 59.913309, longitude: 10.753188
|
64
|
+
)
|
65
|
+
@subject.write_name Rozi::Name.new(
|
66
|
+
name: "Bergen", latitude: 60.389966, longitude: 5.323434
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_write_properties_non_empty_file
|
71
|
+
@subject.file.expects(:size).returns(1)
|
72
|
+
|
73
|
+
assert_raises(RuntimeError) {
|
74
|
+
@subject.write_properties(Rozi::NameSearchProperties.new)
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_serialize_name_utm32
|
79
|
+
name = Rozi::Name.new("Oslo S", "Places", "32V", 6642760, 597993)
|
80
|
+
|
81
|
+
assert_equal(
|
82
|
+
"Oslo S,Places,32V,6642760.0,597993.0",
|
83
|
+
@subject.send(:serialize_name, name)
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_serialize_name_decimal_wgs84
|
88
|
+
expected_output = "Oslo S,Places,,59.910683,10.752267"
|
89
|
+
name = Rozi::Name.new("Oslo S", "Places", nil, 59.910683132, 10.752267219)
|
90
|
+
|
91
|
+
assert_equal expected_output, @subject.send(:serialize_name, name)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_serialize_properties_utm32
|
95
|
+
expected_output = "#1,UTM,32V,N\n#2,Norsk"
|
96
|
+
|
97
|
+
props = Rozi::NameSearchProperties.new(
|
98
|
+
utm: true, utm_zone: "32V", hemisphere: "N", datum: "Norsk"
|
99
|
+
)
|
100
|
+
|
101
|
+
assert_equal expected_output, @subject.send(:serialize_properties, props)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_serialize_properties_wgs84
|
105
|
+
expected_output = "#1,,\n#2,WGS 84"
|
106
|
+
|
107
|
+
props = Rozi::NameSearchProperties.new
|
108
|
+
|
109
|
+
assert_equal expected_output, @subject.send(:serialize_properties, props)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_serialize_properties_with_comments
|
113
|
+
expected_output = ";foo bar\n;test test\n#1,,\n#2,WGS 84"
|
114
|
+
|
115
|
+
props = Rozi::NameSearchProperties.new(comment: "foo bar\ntest test")
|
116
|
+
|
117
|
+
assert_equal expected_output, @subject.send(:serialize_properties, props)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# class NameSearchTextTest < Minitest::Test
|
122
|
+
# def setup
|
123
|
+
# @subject = NameSearchText.new
|
124
|
+
# end
|
125
|
+
|
126
|
+
# def test_add_name
|
127
|
+
# @subject << :foo
|
128
|
+
# @subject << :bar
|
129
|
+
|
130
|
+
# assert_equal [:foo, :bar], @subject.names
|
131
|
+
# end
|
132
|
+
|
133
|
+
# def test_set_datum
|
134
|
+
# @subject.datum = "WGS 84"
|
135
|
+
# @subject.datum = "Adindan"
|
136
|
+
|
137
|
+
# assert_raises(ArgumentError) {
|
138
|
+
# @subject.datum = "Foo bar"
|
139
|
+
# }
|
140
|
+
# end
|
141
|
+
# end
|
142
|
+
|
143
|
+
# class NameSearchTextWriterTest < Minitest::Test
|
144
|
+
# def setup
|
145
|
+
# @subject = NameSearchTextWriter.new
|
146
|
+
# end
|
147
|
+
|
148
|
+
# def test_write_wgs_84
|
149
|
+
# expected_output = <<-NST.gsub(/ {8}/, "")
|
150
|
+
# ;Foo
|
151
|
+
# ;Bar
|
152
|
+
# ;Baz
|
153
|
+
# #1,,
|
154
|
+
# #2,WGS 84
|
155
|
+
# Oslo,Cities,,12.340000,56.780000
|
156
|
+
# Bergen,Cities,,23.450000,67.890000
|
157
|
+
# NST
|
158
|
+
|
159
|
+
# nst = NameSearchText.new
|
160
|
+
# nst.comment = "Foo\nBar\nBaz"
|
161
|
+
# nst << Name.new("Oslo", "Cities", nil, 12.34, 56.78)
|
162
|
+
# nst << Name.new("Bergen", "Cities", nil, 23.45, 67.89)
|
163
|
+
|
164
|
+
# output = write_to_string nst
|
165
|
+
|
166
|
+
# assert_equal expected_output, output
|
167
|
+
# end
|
168
|
+
|
169
|
+
# def test_write_wgs_utm
|
170
|
+
# expected_output = <<-NST.gsub(/ {8}/, "")
|
171
|
+
# #1,UTM,32V,N
|
172
|
+
# #2,Norsk
|
173
|
+
# Oslo,Cities,,12.340000,56.780000
|
174
|
+
# Bergen,Cities,33,23.450000,67.890000
|
175
|
+
# NST
|
176
|
+
|
177
|
+
# nst = NameSearchText.new
|
178
|
+
# nst.utm = true
|
179
|
+
# nst.utm_zone = "32V"
|
180
|
+
# nst.hemisphere = "N"
|
181
|
+
# nst.datum = "Norsk"
|
182
|
+
|
183
|
+
# nst << Name.new("Oslo", "Cities", nil, 12.34, 56.78)
|
184
|
+
# nst << Name.new("Bergen", "Cities", "33", 23.45, 67.89)
|
185
|
+
|
186
|
+
# output = write_to_string nst
|
187
|
+
|
188
|
+
# assert_equal expected_output, output
|
189
|
+
# end
|
190
|
+
|
191
|
+
# def test_construct_first_line_latlng
|
192
|
+
# nst = NameSearchText.new
|
193
|
+
# nst.utm = false
|
194
|
+
|
195
|
+
# assert_equal "#1,,", @subject.send(:construct_first_line, nst)
|
196
|
+
# end
|
197
|
+
|
198
|
+
# def test_construct_first_line_utm
|
199
|
+
# nst = NameSearchText.new
|
200
|
+
# nst.utm = true
|
201
|
+
# nst.utm_zone = "32"
|
202
|
+
# nst.hemisphere = "N"
|
203
|
+
|
204
|
+
# assert_equal "#1,UTM,32,N", @subject.send(:construct_first_line, nst)
|
205
|
+
|
206
|
+
# nst.hemisphere = nil
|
207
|
+
|
208
|
+
# assert_equal "#1,UTM,32", @subject.send(:construct_first_line, nst)
|
209
|
+
# end
|
210
|
+
|
211
|
+
# def test_construct_second_line
|
212
|
+
# nst = NameSearchText.new
|
213
|
+
# nst.datum = "Egypt"
|
214
|
+
|
215
|
+
# assert_equal "#2,Egypt", @subject.send(:construct_second_line, nst)
|
216
|
+
# end
|
217
|
+
|
218
|
+
# def test_name_to_line
|
219
|
+
# name = Rozi::Name.new "Foo", "Bar", nil, 12.34, 56.78
|
220
|
+
|
221
|
+
# expected_output = "Foo,Bar,,12.340000,56.780000"
|
222
|
+
# output = @subject.send :name_to_line, name
|
223
|
+
|
224
|
+
# assert_equal expected_output, output
|
225
|
+
# end
|
226
|
+
|
227
|
+
# def test_name_to_line_missing_components
|
228
|
+
# name1 = Rozi::Name.new nil, "Bar", nil, 12.34, 56.78
|
229
|
+
# name2 = Rozi::Name.new "Foo", "Bar", nil, nil, nil
|
230
|
+
# name3 = Rozi::Name.new nil, "Bar", nil, nil, nil
|
231
|
+
|
232
|
+
# [name1, name2, name3].each { |name|
|
233
|
+
# assert_raises(RuntimeError) {
|
234
|
+
# @subject.send(:name_to_line, name)
|
235
|
+
# }
|
236
|
+
# }
|
237
|
+
# end
|
238
|
+
|
239
|
+
# def write_to_string(nst)
|
240
|
+
# file = StringIO.new
|
241
|
+
|
242
|
+
# @subject.write(nst, file)
|
243
|
+
|
244
|
+
# file.rewind
|
245
|
+
# return file.read
|
246
|
+
# end
|
247
|
+
# end
|
248
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
|
2
|
-
module
|
3
|
-
|
4
|
-
class OziFunctionsTest < Minitest::Test
|
2
|
+
module RoziTestSuite
|
3
|
+
class SharedTest < Minitest::Test
|
5
4
|
def setup
|
6
5
|
@subject = Class.new {
|
7
|
-
include
|
6
|
+
include Rozi::Shared
|
8
7
|
}.new
|
9
8
|
end
|
10
9
|
|
@@ -12,6 +11,10 @@ module Rozi
|
|
12
11
|
assert_equal "FooÑ barÑ baz", @subject.escape_text("Foo, bar, baz")
|
13
12
|
end
|
14
13
|
|
14
|
+
def test_unescape_text
|
15
|
+
assert_equal "Foo, bar, baz", @subject.unescape_text("FooÑ barÑ baz")
|
16
|
+
end
|
17
|
+
|
15
18
|
def test_interpret_color_integer
|
16
19
|
assert_equal 255, @subject.interpret_color(255)
|
17
20
|
end
|
@@ -28,6 +31,23 @@ module Rozi
|
|
28
31
|
refute @subject.datum_valid?("Coolywobbles")
|
29
32
|
refute @subject.datum_valid?("Rambunctious")
|
30
33
|
end
|
31
|
-
end
|
32
34
|
|
35
|
+
class DatumSetterTest < Minitest::Test
|
36
|
+
def setup
|
37
|
+
@subject = DataStruct(:datum) {
|
38
|
+
include Rozi::Shared::DatumSetter
|
39
|
+
}.new
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_setting_invalid_datum
|
43
|
+
assert_raises(ArgumentError) {
|
44
|
+
@subject.datum = "Foo"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_setting_datum
|
49
|
+
@subject.datum = "Norsk"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
33
53
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
|
2
|
+
require "stringio"
|
3
|
+
|
4
|
+
module RoziTestSuite
|
5
|
+
class WriteTrackTest < Minitest::Test
|
6
|
+
def setup
|
7
|
+
@subject = Rozi.method(:write_track)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_basic_usage
|
11
|
+
expected_output = RoziTestSuite.read_test_data("expected_output_1.plt")
|
12
|
+
|
13
|
+
track_points = [
|
14
|
+
Rozi::TrackPoint.new(59.912730, 10.746090),
|
15
|
+
Rozi::TrackPoint.new(60.393580, 5.324760),
|
16
|
+
Rozi::TrackPoint.new(62.567490, 7.687090),
|
17
|
+
]
|
18
|
+
|
19
|
+
file = StringIO.new
|
20
|
+
Rozi.expects(:open_file).returns(file)
|
21
|
+
|
22
|
+
@subject.call(
|
23
|
+
track_points, "/some/file/path.plt", description: "foo, bar"
|
24
|
+
)
|
25
|
+
|
26
|
+
assert_equal expected_output, file.string
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class TrackPropertiesTest < Minitest::Test
|
31
|
+
def setup
|
32
|
+
@subject = Rozi::TrackProperties.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_color
|
36
|
+
@subject.expects(:interpret_color).with(:foo).returns(:bar)
|
37
|
+
|
38
|
+
@subject.color = :foo
|
39
|
+
|
40
|
+
assert_equal :bar, @subject.color
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_set_datum
|
44
|
+
@subject.datum = "Norsk"
|
45
|
+
assert_equal "Norsk", @subject.datum
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_set_invalid_datum
|
49
|
+
assert_raises(ArgumentError) {
|
50
|
+
@subject.datum = "Foo"
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class TrackFileTest < Minitest::Test
|
56
|
+
def setup
|
57
|
+
@subject = Rozi::TrackFile.new(nil)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_serialize_track_attributes
|
61
|
+
expected_output = <<-TEXT.gsub(/^ {8}/, "")
|
62
|
+
OziExplorer Track Point File Version 2.1
|
63
|
+
Norsk
|
64
|
+
Altitude is in Feet
|
65
|
+
Reserved 3
|
66
|
+
0,5,12345,WellÑ this is fun!,2,5,1,54321
|
67
|
+
0
|
68
|
+
TEXT
|
69
|
+
|
70
|
+
props = Rozi::TrackProperties.new(
|
71
|
+
datum: "Norsk",
|
72
|
+
line_width: 5,
|
73
|
+
color: 12345,
|
74
|
+
description: "Well, this is fun!",
|
75
|
+
skip_value: 2,
|
76
|
+
type: 5,
|
77
|
+
fill_style: 1,
|
78
|
+
fill_color: 54321
|
79
|
+
)
|
80
|
+
|
81
|
+
assert_equal(
|
82
|
+
expected_output,
|
83
|
+
@subject.send(:serialize_track_properties, props)
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_serialize_track_point
|
88
|
+
expected_output = " 12.340000,45.560000,1,46.0,123.0000000,foo,bar"
|
89
|
+
|
90
|
+
track_point = Rozi::TrackPoint.new(
|
91
|
+
latitude: 12.34, longitude: 45.56,
|
92
|
+
break: true,
|
93
|
+
altitude: 46,
|
94
|
+
date: 123,
|
95
|
+
date_string: "foo",
|
96
|
+
time_string: "bar"
|
97
|
+
)
|
98
|
+
|
99
|
+
assert_equal(
|
100
|
+
expected_output,
|
101
|
+
@subject.send(:serialize_track_point, track_point)
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|