gooby 1.0.0 → 1.1.0
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.
- data/README +144 -180
- data/bin/example_usage.txt +55 -0
- data/bin/gooby_been_there.rb +35 -0
- data/bin/gooby_config.rb +16 -0
- data/bin/gooby_gen_gmap.rb +16 -0
- data/bin/gooby_parser.rb +19 -0
- data/bin/gooby_splitter.rb +18 -0
- data/bin/gooby_version.rb +16 -0
- data/bin/run_all.sh +23 -0
- data/bin/run_been_there.sh +16 -0
- data/bin/run_db_gen.sh +11 -0
- data/bin/run_db_load.sh +11 -0
- data/bin/run_gen_gmaps.sh +20 -0
- data/bin/run_parse.sh +43 -0
- data/bin/run_parse_named.sh +19 -0
- data/bin/run_split.sh +23 -0
- data/config/gooby_config.yaml +137 -0
- data/data/20050305_corporate_cup_hm.csv +251 -251
- data/data/20050430_nashville_marathon.csv +1208 -1208
- data/data/20060115_phoenix_marathon.csv +1280 -1280
- data/data/davidson_11m_20070101.csv +251 -0
- data/data/davidson_11m_20070101.xml +2020 -0
- data/data/davidson_5K_20070505.csv +286 -0
- data/data/davidson_5K_20070505.xml +2875 -0
- data/lib/gooby.rb +889 -361
- data/samples/20050305_corporate_cup_hm.html +270 -270
- data/samples/20050430_nashville_marathon.html +1240 -1240
- data/samples/20060115_phoenix_marathon.html +1312 -1312
- data/samples/been_there.txt +744 -0
- data/samples/davidson_11m_20070101.html +432 -0
- data/samples/davidson_5K_20070505.html +395 -0
- data/sql/gooby.ddl +56 -0
- data/sql/gooby_load.dml +35 -0
- metadata +30 -32
- data/bin/20050305_corporate_cup_hm_to_csv.rb +0 -9
- data/bin/20050430_nashville_marathon_to_csv.rb +0 -9
- data/bin/20060115_phoenix_marathon_to_csv.rb +0 -9
- data/bin/activity_2007_03_10_13_02_32.xml_to_csv.rb +0 -9
- data/bin/example_usage.rb +0 -46
- data/bin/example_usage.sh +0 -52
- data/bin/gen_gap_phx.rb +0 -10
- data/bin/gen_gmap_cc_2005.rb +0 -10
- data/bin/gen_gmap_cc_2007.rb +0 -10
- data/bin/gen_gmap_nashville.rb +0 -10
- data/bin/gen_gmap_phx.rb +0 -10
- data/bin/phx_to_csv.rb +0 -47
- data/bin/split_forerunner_logbook_2007.rb +0 -10
- data/bin/split_training_center_2007.rb +0 -8
- data/data/2007_03_10.tcx +0 -28445
- data/data/activity_2007_03_10_13_02_32.csv +0 -1168
- data/data/activity_2007_03_10_13_02_32.xml +0 -11695
- data/data/forerunner_2007.xml +0 -31872
- data/data/geo_data.txt +0 -171
- data/pkg/code_header.txt +0 -21
- data/pkg/pkg.rb +0 -238
- data/pkg/test_header.txt +0 -19
- data/samples/20070310_corporate_cup_hm.html +0 -1367
- data/samples/gps_point_capture.html +0 -54
- data/samples/phoenix_marathon.html +0 -1596
- data/tests/ts_gooby.rb +0 -1109
- data/tests/ts_gooby_min.rb +0 -550
data/tests/ts_gooby_min.rb
DELETED
@@ -1,550 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
|
3
|
-
This contains the regression test suite for the Gooby project.
|
4
|
-
|
5
|
-
See file 'lib/gooby.rb' which is the subject of this test suite.
|
6
|
-
|
7
|
-
Gooby - Copyright 2007 by Chris Joakim.
|
8
|
-
Gooby is available under GNU General Public License (GPL) license.
|
9
|
-
=end
|
10
|
-
|
11
|
-
# The following prefixes ../lib to the active ruby load path
|
12
|
-
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
13
|
-
puts '$LOAD_PATH is now:'
|
14
|
-
puts $LOAD_PATH
|
15
|
-
|
16
|
-
require 'gooby'
|
17
|
-
require 'test/unit'
|
18
|
-
|
19
|
-
class TestGoobyKernel < Test::Unit::TestCase
|
20
|
-
|
21
|
-
include Gooby::TestHelper
|
22
|
-
include Gooby::GoobyKernel
|
23
|
-
|
24
|
-
@debug = false
|
25
|
-
|
26
|
-
# beginning of tests - keep this marker
|
27
|
-
|
28
|
-
def test_class_CounterHash
|
29
|
-
|
30
|
-
# See the method-level tests below.
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_class_CounterHash_decrement
|
34
|
-
|
35
|
-
ctr_hash = Gooby::CounterHash.new
|
36
|
-
7.times { ctr_hash.decrement("seven") }
|
37
|
-
391.times { ctr_hash.decrement("391") }
|
38
|
-
assert(ctr_hash.value('seven') == -7, "decremented value not -7.")
|
39
|
-
assert(ctr_hash.value('391') == -391, "decremented value not -391.")
|
40
|
-
assert(ctr_hash.sorted_keys.size == 2, "sorted_keys size is not 2.")
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_class_CounterHash_increment
|
44
|
-
|
45
|
-
ctr_hash = Gooby::CounterHash.new
|
46
|
-
33.times { ctr_hash.increment("33") }
|
47
|
-
123.times { ctr_hash.increment("123") }
|
48
|
-
assert(ctr_hash.value('33') == 33, "incremented value not 33.")
|
49
|
-
assert(ctr_hash.value('123') == 123, "incremented value not 123.")
|
50
|
-
assert(ctr_hash.sorted_keys.size == 2, "sorted_keys size is not 2.")
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_class_CounterHash_increment_tokens
|
54
|
-
|
55
|
-
ctr_hash = Gooby::CounterHash.new
|
56
|
-
ctr_hash.increment_tokens("gooby ruby perl java cobol smalltalk")
|
57
|
-
ctr_hash.increment_tokens("gooby ruby")
|
58
|
-
assert(ctr_hash.value('ruby') == 2, "increment_tokens value of ruby is not 2.")
|
59
|
-
assert(ctr_hash.value('cobol') == 1, "increment_tokens value of cobol is not 1.")
|
60
|
-
assert(ctr_hash.value('vb') == 0, "increment_tokens value of vb is not 0.")
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_class_CounterHash_initialize
|
64
|
-
|
65
|
-
ctr_hash = Gooby::CounterHash.new
|
66
|
-
assert(ctr_hash.value('test') == 0, "initial value is not 0.")
|
67
|
-
assert(ctr_hash.sorted_keys.size == 0, "sorted_keys size is not 0.")
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_class_CounterHash_size
|
71
|
-
|
72
|
-
ctr_hash = Gooby::CounterHash.new
|
73
|
-
assert(ctr_hash.size == 0, "initial ctr_hash size is not 0.")
|
74
|
-
ctr_hash.increment("a")
|
75
|
-
ctr_hash.increment_tokens("a b c")
|
76
|
-
assert(ctr_hash.size == 3, "ctr_hash size is not 3.")
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_class_CounterHash_sorted_keys
|
80
|
-
|
81
|
-
ctr_hash = Gooby::CounterHash.new
|
82
|
-
ctr_hash.increment('OS/X')
|
83
|
-
ctr_hash.decrement('Windows')
|
84
|
-
ctr_hash.increment('Linux')
|
85
|
-
array = ctr_hash.sorted_keys
|
86
|
-
assert(array.class == Array, "sorted_keys is not an Array; #{array.class}.")
|
87
|
-
assert(ctr_hash.sorted_keys.size == 3, "sorted_keys size is not 3.")
|
88
|
-
assert(array[0] == 'Linux', "sorted_keys element 0 is incorrect.")
|
89
|
-
assert(array[1] == 'OS/X', "sorted_keys element 1 is incorrect.")
|
90
|
-
assert(array[2] == 'Windows', "sorted_keys element 2 is incorrect.")
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_class_CounterHash_to_s
|
94
|
-
|
95
|
-
ctr_hash = Gooby::CounterHash.new
|
96
|
-
ctr_hash.increment("romeo")
|
97
|
-
ctr_hash.increment("maybelline")
|
98
|
-
ctr_hash.decrement("romeo")
|
99
|
-
ctr_hash.increment("yingling")
|
100
|
-
ctr_hash.increment("maybelline")
|
101
|
-
ctr_hash.decrement("domino")
|
102
|
-
ctr_hash.increment("yingling")
|
103
|
-
ctr_hash.increment("maybelline")
|
104
|
-
ctr_hash.increment("leppie")
|
105
|
-
expected = "CHash: key: [domino] val: [-1]\n key: [leppie] val: [1]\n key: [maybelline] val: [3]\n key: [romeo] val: [0]\n key: [yingling] val: [2]\n"
|
106
|
-
actual = ctr_hash.to_s
|
107
|
-
assert_equal(expected, actual, "to_s value is not as expected; #{actual} vs #{expected}")
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_class_CounterHash_to_xml
|
111
|
-
|
112
|
-
ctr_hash = Gooby::CounterHash.new
|
113
|
-
ctr_hash.increment("romeo")
|
114
|
-
ctr_hash.increment("maybelline")
|
115
|
-
ctr_hash.decrement("romeo")
|
116
|
-
ctr_hash.increment("yingling")
|
117
|
-
ctr_hash.increment("maybelline")
|
118
|
-
ctr_hash.decrement("domino")
|
119
|
-
ctr_hash.increment("yingling")
|
120
|
-
ctr_hash.increment("maybelline")
|
121
|
-
ctr_hash.increment("leppie")
|
122
|
-
|
123
|
-
expected = "<CHash> <entry key='domino' value='-1'/> <entry key='leppie' value='1'/> <entry key='maybelline' value='3'/> <entry key='romeo' value='0'/> <entry key='yingling' value='2'/> </CHash>"
|
124
|
-
actual = ctr_hash.to_xml(false)
|
125
|
-
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_class_CounterHash_value
|
129
|
-
|
130
|
-
# This method is tested in the other test methods.
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_class_DelimLine
|
134
|
-
|
135
|
-
line = '1 | 2007-01-01 | 16:38:43 | 1167669523 | 2 | 35.49532 | -80.83167 | 242.870 | 0.0313362638280469 '
|
136
|
-
dline = Gooby::DelimLine.new(line)
|
137
|
-
|
138
|
-
expected = 'DelimLine: length: 101 trim: true delim: | tokens: 9'
|
139
|
-
actual = dline.to_s
|
140
|
-
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
141
|
-
|
142
|
-
expected = '1'
|
143
|
-
actual = dline.tokens[0]
|
144
|
-
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
145
|
-
|
146
|
-
expected = '16:38:43'
|
147
|
-
actual = dline.tokens[2]
|
148
|
-
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
149
|
-
|
150
|
-
expected = '0.0313362638280469'
|
151
|
-
actual = dline.tokens[-1]
|
152
|
-
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_class_DelimLine_as_trackpoint
|
156
|
-
|
157
|
-
line = '6 | 2007-01-13T16:35:53Z | 243 | 35.49517 | -80.83215 | 237.583 | 6.51627221396902 '
|
158
|
-
dline = Gooby::DelimLine.new(line)
|
159
|
-
tkpt = dline.as_trackpoint(0, 3, 4, 5, 1) # (numIdx, latIdx, lngIdx, altIdx, timeIdx)
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_class_DelimLine_initialize
|
163
|
-
|
164
|
-
# This method is tested in the other test methods.
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_class_DelimLine_is_comment?
|
168
|
-
|
169
|
-
dline = Gooby::DelimLine.new('# this is a comment line')
|
170
|
-
bool1 = dline.is_comment?
|
171
|
-
|
172
|
-
dline = Gooby::DelimLine.new('this is not a comment line')
|
173
|
-
bool2 = dline.is_comment?
|
174
|
-
|
175
|
-
dline = Gooby::DelimLine.new(' # this is a comment line')
|
176
|
-
bool3 = dline.is_comment?
|
177
|
-
|
178
|
-
assert(bool1 == true, "line 1 should be a comment")
|
179
|
-
assert(bool2 == false, "line 2 not should be a comment")
|
180
|
-
assert(bool3 == true, "line 3 should be a comment")
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_class_DelimLine_to_s
|
184
|
-
|
185
|
-
dline = Gooby::DelimLine.new('# this is a comment line')
|
186
|
-
actual = dline.to_s
|
187
|
-
expected = 'DelimLine: length: 24 trim: true delim: | tokens: 1'
|
188
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_class_DtTm
|
192
|
-
|
193
|
-
# This class is tested in the methods below.
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_class_DtTm_hh_mm_ss
|
197
|
-
|
198
|
-
s = '2006-01-15T01:02:00Z'
|
199
|
-
dt = Gooby::DtTm.new(s)
|
200
|
-
actual = dt.hh_mm_ss
|
201
|
-
expected = '01:02:00'
|
202
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
203
|
-
|
204
|
-
s = '2006-01-15T03:41:40Z'
|
205
|
-
dt = Gooby::DtTm.new(s)
|
206
|
-
actual = dt.hh_mm_ss
|
207
|
-
expected = '03:41:40'
|
208
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
209
|
-
end
|
210
|
-
|
211
|
-
def test_class_DtTm_hhmmss_diff
|
212
|
-
|
213
|
-
s1 = '2006-01-15T02:39:37Z'
|
214
|
-
dt1 = Gooby::DtTm.new(s1)
|
215
|
-
s2 = '2006-01-15T03:41:40Z'
|
216
|
-
dt2 = Gooby::DtTm.new(s2)
|
217
|
-
actual = dt2.hhmmss_diff(dt1)
|
218
|
-
expected = '01:02:03'
|
219
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
220
|
-
end
|
221
|
-
|
222
|
-
def test_class_DtTm_initialize
|
223
|
-
|
224
|
-
dt1 = Gooby::DtTm.new(nil)
|
225
|
-
dt2 = Gooby::DtTm.new('too short')
|
226
|
-
dt3 = Gooby::DtTm.new('2006-01-15T03:41:40Z')
|
227
|
-
|
228
|
-
assert(dt1.valid == false, "dt1 should not be valid.")
|
229
|
-
assert(dt2.valid == false, "dt2 should not be valid.")
|
230
|
-
assert(dt3.valid == true, "dt3 should not be valid.")
|
231
|
-
assert(dt1.to_i == invalid_time, "dt1 to_i should be #{invalid_time}.")
|
232
|
-
|
233
|
-
end
|
234
|
-
|
235
|
-
def test_class_DtTm_print_string
|
236
|
-
|
237
|
-
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
238
|
-
actual = dt.print_string
|
239
|
-
expected = "DtTm: 2007-02-01 02:13:52 1170296032 2007-02-01T02:13:52Z"
|
240
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
241
|
-
end
|
242
|
-
|
243
|
-
def test_class_DtTm_seconds_diff
|
244
|
-
|
245
|
-
dt1 = Gooby::DtTm.new('2007-02-01T11:59:59Z')
|
246
|
-
dt2 = Gooby::DtTm.new('2007-02-01T12:00:00Z')
|
247
|
-
dt3 = Gooby::DtTm.new('2007-02-01T13:01:02')
|
248
|
-
|
249
|
-
actual = dt2.seconds_diff(dt1)
|
250
|
-
expected = 1
|
251
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
252
|
-
|
253
|
-
actual = dt3.seconds_diff(dt1)
|
254
|
-
expected = 3663
|
255
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
256
|
-
|
257
|
-
actual = dt1.seconds_diff(dt3)
|
258
|
-
expected = -3663
|
259
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_class_DtTm_to_i
|
263
|
-
|
264
|
-
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
265
|
-
actual = dt.to_i
|
266
|
-
expected = 1170296032
|
267
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
268
|
-
end
|
269
|
-
|
270
|
-
def test_class_DtTm_to_s
|
271
|
-
|
272
|
-
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
273
|
-
actual = dt.to_s
|
274
|
-
expected = "2007-02-01T02:13:52Z"
|
275
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
276
|
-
end
|
277
|
-
|
278
|
-
def test_class_DtTm_yyyy_mm_dd
|
279
|
-
|
280
|
-
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
281
|
-
actual = dt.yyyy_mm_dd
|
282
|
-
expected = "2007-02-01"
|
283
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_class_DtTm_yyyy_mm_dd_hh_mm_ss
|
287
|
-
|
288
|
-
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
289
|
-
actual = dt.yyyy_mm_dd_hh_mm_ss
|
290
|
-
expected = "2007-02-01 02:13:52"
|
291
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
292
|
-
end
|
293
|
-
|
294
|
-
def test_class_Duration
|
295
|
-
|
296
|
-
# This class is tested in the methods below.
|
297
|
-
end
|
298
|
-
|
299
|
-
def test_class_Duration_initialize
|
300
|
-
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_class_Duration_print_string
|
304
|
-
|
305
|
-
d1 = Gooby::Duration.new('PT507.870S')
|
306
|
-
actual = d1.print_string
|
307
|
-
expected = 'Duration: 507.870 sec: 507.87 min: 8.4645 mmss: 08:27.87 bm: 8 fm: 0.464499999999999 fs: 27.87'
|
308
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_class_Duration_scrub
|
312
|
-
|
313
|
-
end
|
314
|
-
|
315
|
-
def test_class_Duration_to_s
|
316
|
-
|
317
|
-
d1 = Gooby::Duration.new('PT507.870S')
|
318
|
-
actual = d1.to_s
|
319
|
-
expected = '08:27.87'
|
320
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
321
|
-
end
|
322
|
-
|
323
|
-
def test_class_Line_concatinate_tokens
|
324
|
-
|
325
|
-
s = '35.4954711908794 -80.83214521408081 Home at South Faulkner Way Stopsign'
|
326
|
-
line = Gooby::Line.new(s)
|
327
|
-
actual = line.concatinate_tokens(2)
|
328
|
-
expected = 'Home at South Faulkner Way Stopsign'
|
329
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
330
|
-
end
|
331
|
-
|
332
|
-
def test_class_Line_initialize
|
333
|
-
|
334
|
-
s = '35.4954711908794 -80.83214521408081 Home at South Faulkner Way Stopsign'
|
335
|
-
line = Gooby::Line.new(s)
|
336
|
-
actual = line.tokens[6]
|
337
|
-
expected = 'Way'
|
338
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
339
|
-
end
|
340
|
-
|
341
|
-
def test_class_Line_is_comment
|
342
|
-
|
343
|
-
line = Gooby::Line.new(' # hello ')
|
344
|
-
actual = line.is_comment
|
345
|
-
expected = true
|
346
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
347
|
-
|
348
|
-
line = Gooby::Line.new('heck no')
|
349
|
-
actual = line.is_comment
|
350
|
-
expected = false
|
351
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
352
|
-
|
353
|
-
end
|
354
|
-
|
355
|
-
def test_class_Line_token_idx_equals
|
356
|
-
|
357
|
-
s = '35.4954711908794 -80.83214521408081 Home at South Faulkner Way Stopsign'
|
358
|
-
line = Gooby::Line.new(s)
|
359
|
-
|
360
|
-
actual = line.token_idx_equals(2, 'Home')
|
361
|
-
expected = true
|
362
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
363
|
-
|
364
|
-
actual = line.token_idx_equals(1, 'Home')
|
365
|
-
expected = false
|
366
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
367
|
-
|
368
|
-
actual = line.token_idx_equals(99, 'Home')
|
369
|
-
expected = false
|
370
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
371
|
-
end
|
372
|
-
|
373
|
-
def test_class_Position
|
374
|
-
|
375
|
-
end
|
376
|
-
|
377
|
-
def test_class_Position_altitude_as_float
|
378
|
-
|
379
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
380
|
-
assert_equal(220.279, pos.altitude_as_float, "altitude is not as expected.")
|
381
|
-
end
|
382
|
-
|
383
|
-
def test_class_Position_initialize
|
384
|
-
|
385
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
386
|
-
assert_equal('35.49910', pos.latitude, "latitude is not as expected.")
|
387
|
-
assert_equal('-80.83695', pos.longitude, "longitude is not as expected.")
|
388
|
-
assert_equal('220.279', pos.altitude, "altitude is not as expected.")
|
389
|
-
end
|
390
|
-
|
391
|
-
def test_class_Position_latitude_as_float
|
392
|
-
|
393
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
394
|
-
assert_equal(35.49910, pos.latitude_as_float, "latitude is not as expected.")
|
395
|
-
end
|
396
|
-
|
397
|
-
def test_class_Position_longitude_as_float
|
398
|
-
|
399
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
400
|
-
assert_equal(-80.83695, pos.longitude_as_float, "longitude is not as expected.")
|
401
|
-
end
|
402
|
-
|
403
|
-
def test_class_Position_to_csv
|
404
|
-
|
405
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
406
|
-
actual = pos.to_csv
|
407
|
-
expected = '35.49910 | -80.83695 | 220.279'
|
408
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
409
|
-
end
|
410
|
-
|
411
|
-
def test_class_Position_to_s
|
412
|
-
|
413
|
-
pos = Gooby::Position.new('35.49910', '-80.83695', '220.279')
|
414
|
-
actual = pos.to_s
|
415
|
-
expected = 'lat: 35.49910 lng: -80.83695 alt: 220.279 note: '
|
416
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
417
|
-
end
|
418
|
-
|
419
|
-
def test_class_Trackpoint
|
420
|
-
|
421
|
-
tkpt = Gooby::Trackpoint.new(1, '35.49910', '-80.83695', '220.279', '2007-02-01T02:13:52Z')
|
422
|
-
end
|
423
|
-
|
424
|
-
def test_class_Trackpoint_to_csv
|
425
|
-
|
426
|
-
tkpt = Gooby::Trackpoint.new(1, '35.49910', '-80.83695', '220.279', '2007-02-01T02:13:52Z')
|
427
|
-
actual = tkpt.to_csv
|
428
|
-
expected = '0 | 2007-02-01T02:13:52Z | 1 | 35.49910 | -80.83695 | 220.279 | 0.0 '
|
429
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
430
|
-
end
|
431
|
-
|
432
|
-
def test_class_Trackpoint_to_geo_s
|
433
|
-
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_class_Trackpoint_to_s
|
437
|
-
|
438
|
-
tkpt = Gooby::Trackpoint.new(1, '35.49910', '-80.83695', '220.279', '2007-02-01T02:13:52Z')
|
439
|
-
actual = tkpt.to_s
|
440
|
-
expected = 'Tkpt: 1 lat: 35.49910 lng: -80.83695 alt: 220.279 note: date: 2007-02-01T02:13:52Z cdist: 0.0'
|
441
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
442
|
-
end
|
443
|
-
|
444
|
-
def test_module_GoobyKernel_default_delimiter
|
445
|
-
|
446
|
-
obj = Gooby::GoobyObject.new
|
447
|
-
actual = obj.default_delimiter
|
448
|
-
expected = '|'
|
449
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
450
|
-
end
|
451
|
-
|
452
|
-
def test_module_GoobyKernel_invalid_altitude
|
453
|
-
|
454
|
-
obj = Gooby::GoobyObject.new
|
455
|
-
actual = obj.invalid_altitude
|
456
|
-
expected = -1
|
457
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
458
|
-
end
|
459
|
-
|
460
|
-
def test_module_GoobyKernel_invalid_latitude
|
461
|
-
|
462
|
-
obj = Gooby::GoobyObject.new
|
463
|
-
actual = obj.invalid_latitude
|
464
|
-
expected = -1
|
465
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
466
|
-
end
|
467
|
-
|
468
|
-
def test_module_GoobyKernel_invalid_longitude
|
469
|
-
|
470
|
-
obj = Gooby::GoobyObject.new
|
471
|
-
actual = obj.invalid_longitude
|
472
|
-
expected = -1
|
473
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
474
|
-
end
|
475
|
-
|
476
|
-
def test_module_GoobyKernel_invalid_time
|
477
|
-
|
478
|
-
obj = Gooby::GoobyObject.new
|
479
|
-
actual = obj.invalid_time
|
480
|
-
expected = -99999999
|
481
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
482
|
-
end
|
483
|
-
|
484
|
-
def test_module_GoobyKernel_project_author
|
485
|
-
|
486
|
-
obj = Gooby::GoobyObject.new
|
487
|
-
end
|
488
|
-
|
489
|
-
def test_module_GoobyKernel_project_copyright
|
490
|
-
|
491
|
-
end
|
492
|
-
|
493
|
-
def test_module_GoobyKernel_project_date
|
494
|
-
|
495
|
-
obj = Gooby::GoobyObject.new
|
496
|
-
assert_equal '2007/03/21', obj.project_date
|
497
|
-
end
|
498
|
-
|
499
|
-
def test_module_GoobyKernel_project_license
|
500
|
-
|
501
|
-
obj = Gooby::GoobyObject.new
|
502
|
-
assert_equal 'GNU General Public License (GPL). See http://www.gnu.org/copyleft/gpl.html', obj.project_license
|
503
|
-
end
|
504
|
-
|
505
|
-
def test_module_GoobyKernel_project_version_number
|
506
|
-
|
507
|
-
obj = Gooby::GoobyObject.new
|
508
|
-
assert_equal '1.0.0', obj.project_version_number
|
509
|
-
end
|
510
|
-
|
511
|
-
def test_module_GoobyKernel_project_year
|
512
|
-
|
513
|
-
obj = Gooby::GoobyObject.new
|
514
|
-
assert_equal '2007', obj.project_year
|
515
|
-
end
|
516
|
-
|
517
|
-
def test_module_GoobyKernel_tokenize
|
518
|
-
|
519
|
-
obj = Gooby::GoobyObject.new
|
520
|
-
s = '35.4954711908794 -80.83214521408081 Home at South Faulkner Way Stopsign'
|
521
|
-
array = obj.tokenize(s, nil)
|
522
|
-
actual = array.size
|
523
|
-
expected = 8
|
524
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
525
|
-
|
526
|
-
actual = array[1]
|
527
|
-
expected = '-80.83214521408081'
|
528
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
529
|
-
|
530
|
-
actual = array[6]
|
531
|
-
expected = 'Way'
|
532
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
533
|
-
|
534
|
-
obj = Gooby::GoobyObject.new
|
535
|
-
s = 'twain , faulkner, wolfe, caldwell '
|
536
|
-
array = obj.tokenize(s, ',', false)
|
537
|
-
|
538
|
-
actual = array.size
|
539
|
-
expected = 4
|
540
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
541
|
-
|
542
|
-
actual = array[0]
|
543
|
-
expected = 'twain '
|
544
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
545
|
-
|
546
|
-
actual = array[3]
|
547
|
-
expected = ' caldwell '
|
548
|
-
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
549
|
-
end
|
550
|
-
end
|