gooby 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README +48 -67
- data/bin/20050305_corporate_cup_hm_to_csv.rb +9 -0
- data/bin/20050430_nashville_marathon_to_csv.rb +9 -0
- data/bin/20060115_phoenix_marathon_to_csv.rb +9 -0
- data/bin/activity_2007_03_10_13_02_32.xml_to_csv.rb +9 -0
- data/bin/{tests_gen.rb → code_scan.rb} +6 -4
- data/bin/example_usage.rb +2 -3
- data/bin/example_usage.sh +52 -0
- data/bin/gen_gap_phx.rb +10 -0
- data/bin/gen_gmap_cc_2005.rb +10 -0
- data/bin/gen_gmap_cc_2007.rb +10 -0
- data/bin/gen_gmap_nashville.rb +10 -0
- data/bin/gen_gmap_phx.rb +10 -0
- data/bin/phx_to_csv.rb +47 -0
- data/bin/split_forerunner_logbook_2007.rb +10 -0
- data/bin/split_training_center_2007.rb +8 -0
- data/data/{2007_03_04.tcx → 2007_03_10.tcx} +11694 -0
- data/data/activity_2007_03_10_13_02_32.csv +1168 -0
- data/data/activity_2007_03_10_13_02_32.xml +11695 -0
- data/data/forerunner_2007.xml +0 -227142
- data/img/gicons/readme.txt +3 -0
- data/lib/gooby.rb +625 -552
- data/samples/20050305_corporate_cup_hm.html +271 -269
- data/samples/20050430_nashville_marathon.html +1240 -246
- data/samples/20060115_phoenix_marathon.html +1596 -0
- data/samples/20070310_corporate_cup_hm.html +1367 -0
- data/samples/phoenix_marathon.html +1312 -258
- data/tests/ts_gooby.rb +423 -551
- data/tests/ts_gooby_min.rb +550 -0
- metadata +25 -67
- data/bin/tcx_ex.rb +0 -35
- data/data/20051124_hyatt_turkey_trot_8K.csv +0 -321
- data/data/20051124_hyatt_turkey_trot_8K.xml +0 -2651
- data/data/2007_03_03.tcx +0 -6207
- data/data/activity_2007_03_04_15_22_36.xml +0 -10545
- data/data/run_2007_01_01_16_38_27.xml +0 -2020
- data/data/run_2007_02_24_15_01_35.csv +0 -484
- data/data/run_2007_02_24_15_01_35.xml +0 -3884
- data/lib/gooby/cls_counter_hash.rb +0 -78
- data/lib/gooby/cls_delim_line.rb +0 -35
- data/lib/gooby/cls_dttm.rb +0 -79
- data/lib/gooby/cls_duration.rb +0 -79
- data/lib/gooby/cls_forerunner_xml_parser.rb +0 -178
- data/lib/gooby/cls_forerunner_xml_splitter.rb +0 -109
- data/lib/gooby/cls_geo_data.rb +0 -181
- data/lib/gooby/cls_gooby_command.rb +0 -46
- data/lib/gooby/cls_gooby_object.rb +0 -18
- data/lib/gooby/cls_google_map_generator.rb +0 -363
- data/lib/gooby/cls_history.rb +0 -33
- data/lib/gooby/cls_lap.rb +0 -22
- data/lib/gooby/cls_line.rb +0 -75
- data/lib/gooby/cls_options.rb +0 -67
- data/lib/gooby/cls_position.rb +0 -44
- data/lib/gooby/cls_run.rb +0 -194
- data/lib/gooby/cls_simple_xml_parser.rb +0 -41
- data/lib/gooby/cls_test_regen.rb +0 -182
- data/lib/gooby/cls_track.rb +0 -47
- data/lib/gooby/cls_trackpoint.rb +0 -200
- data/lib/gooby/cls_training_center_parser.rb +0 -183
- data/lib/gooby/cls_training_center_splitter.rb +0 -109
- data/lib/gooby/mod_introspect.rb +0 -26
- data/lib/gooby/mod_io.rb +0 -58
- data/lib/gooby/mod_project_info.rb +0 -80
- data/lib/gooby/mod_string.rb +0 -19
- data/lib/gooby/mod_test_helper.rb +0 -15
- data/samples/20041113_richmond_marathon.html +0 -532
- data/samples/run_2007_01_10_22_44_54.html +0 -201
- data/samples/run_2007_02_24_15_01_35.html +0 -298
- data/tests/tc_cls_counter_hash.rb +0 -107
- data/tests/tc_cls_delim_line.rb +0 -74
- data/tests/tc_cls_dttm.rb +0 -131
- data/tests/tc_cls_duration.rb +0 -51
- data/tests/tc_cls_forerunner_xml_parser.rb +0 -70
- data/tests/tc_cls_geo_data.xxx +0 -71
- data/tests/tc_cls_gooby_object.rb +0 -26
- data/tests/tc_cls_google_map_generator.rb +0 -109
- data/tests/tc_cls_history.rb +0 -46
- data/tests/tc_cls_lap.rb +0 -38
- data/tests/tc_cls_line.rb +0 -110
- data/tests/tc_cls_options.rb +0 -79
- data/tests/tc_cls_position.rb +0 -66
- data/tests/tc_cls_run.rb +0 -142
- data/tests/tc_cls_simple_xml_parser.rb +0 -50
- data/tests/tc_cls_track.rb +0 -70
- data/tests/tc_cls_trackpoint.rb +0 -145
- data/tests/tc_mod_introspect.rb +0 -32
- data/tests/tc_mod_io.rb +0 -53
- data/tests/tc_mod_project_info.rb +0 -79
- data/tests/tc_mod_string.rb +0 -58
- /data/data/{phx.csv → 20060115_phoenix_marathon.csv} +0 -0
- /data/data/{phx.xml → 20060115_phoenix_marathon.xml} +0 -0
@@ -0,0 +1,550 @@
|
|
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/15', 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 '0.9.5', 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
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: gooby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 0.9.5
|
7
|
+
date: 2007-03-15 00:00:00 -04:00
|
8
8
|
summary: Google APIs + Ruby = Gooby
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,25 +29,32 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Chris Joakim
|
31
31
|
files:
|
32
|
+
- bin/20050305_corporate_cup_hm_to_csv.rb
|
33
|
+
- bin/20050430_nashville_marathon_to_csv.rb
|
34
|
+
- bin/20060115_phoenix_marathon_to_csv.rb
|
35
|
+
- bin/activity_2007_03_10_13_02_32.xml_to_csv.rb
|
36
|
+
- bin/code_scan.rb
|
32
37
|
- bin/example_usage.rb
|
33
|
-
- bin/
|
34
|
-
- bin/
|
38
|
+
- bin/example_usage.sh
|
39
|
+
- bin/gen_gap_phx.rb
|
40
|
+
- bin/gen_gmap_cc_2005.rb
|
41
|
+
- bin/gen_gmap_cc_2007.rb
|
42
|
+
- bin/gen_gmap_nashville.rb
|
43
|
+
- bin/gen_gmap_phx.rb
|
44
|
+
- bin/phx_to_csv.rb
|
45
|
+
- bin/split_forerunner_logbook_2007.rb
|
46
|
+
- bin/split_training_center_2007.rb
|
35
47
|
- data/20050305_corporate_cup_hm.csv
|
36
48
|
- data/20050305_corporate_cup_hm.xml
|
37
49
|
- data/20050430_nashville_marathon.csv
|
38
50
|
- data/20050430_nashville_marathon.xml
|
39
|
-
- data/
|
40
|
-
- data/
|
41
|
-
- data/
|
42
|
-
- data/
|
43
|
-
- data/
|
51
|
+
- data/20060115_phoenix_marathon.csv
|
52
|
+
- data/20060115_phoenix_marathon.xml
|
53
|
+
- data/2007_03_10.tcx
|
54
|
+
- data/activity_2007_03_10_13_02_32.csv
|
55
|
+
- data/activity_2007_03_10_13_02_32.xml
|
44
56
|
- data/forerunner_2007.xml
|
45
57
|
- data/geo_data.txt
|
46
|
-
- data/phx.csv
|
47
|
-
- data/phx.xml
|
48
|
-
- data/run_2007_01_01_16_38_27.xml
|
49
|
-
- data/run_2007_02_24_15_01_35.csv
|
50
|
-
- data/run_2007_02_24_15_01_35.xml
|
51
58
|
- data/test1.txt
|
52
59
|
- img/gicons
|
53
60
|
- img/gicons/blank.png
|
@@ -178,70 +185,21 @@ files:
|
|
178
185
|
- img/gicons/mm_20_shadow.png
|
179
186
|
- img/gicons/readme.txt
|
180
187
|
- img/gicons/shadow50.png
|
181
|
-
- lib/gooby
|
182
188
|
- lib/gooby.rb
|
183
|
-
- lib/gooby/cls_counter_hash.rb
|
184
|
-
- lib/gooby/cls_delim_line.rb
|
185
|
-
- lib/gooby/cls_dttm.rb
|
186
|
-
- lib/gooby/cls_duration.rb
|
187
|
-
- lib/gooby/cls_forerunner_xml_parser.rb
|
188
|
-
- lib/gooby/cls_forerunner_xml_splitter.rb
|
189
|
-
- lib/gooby/cls_geo_data.rb
|
190
|
-
- lib/gooby/cls_gooby_command.rb
|
191
|
-
- lib/gooby/cls_gooby_object.rb
|
192
|
-
- lib/gooby/cls_google_map_generator.rb
|
193
|
-
- lib/gooby/cls_history.rb
|
194
|
-
- lib/gooby/cls_lap.rb
|
195
|
-
- lib/gooby/cls_line.rb
|
196
|
-
- lib/gooby/cls_options.rb
|
197
|
-
- lib/gooby/cls_position.rb
|
198
|
-
- lib/gooby/cls_run.rb
|
199
|
-
- lib/gooby/cls_simple_xml_parser.rb
|
200
|
-
- lib/gooby/cls_test_regen.rb
|
201
|
-
- lib/gooby/cls_track.rb
|
202
|
-
- lib/gooby/cls_trackpoint.rb
|
203
|
-
- lib/gooby/cls_training_center_parser.rb
|
204
|
-
- lib/gooby/cls_training_center_splitter.rb
|
205
|
-
- lib/gooby/mod_introspect.rb
|
206
|
-
- lib/gooby/mod_io.rb
|
207
|
-
- lib/gooby/mod_project_info.rb
|
208
|
-
- lib/gooby/mod_string.rb
|
209
|
-
- lib/gooby/mod_test_helper.rb
|
210
189
|
- pkg/code_header.txt
|
211
190
|
- pkg/pkg.rb
|
212
191
|
- pkg/test_header.txt
|
213
|
-
- samples/20041113_richmond_marathon.html
|
214
192
|
- samples/20050305_corporate_cup_hm.html
|
215
193
|
- samples/20050430_nashville_marathon.html
|
194
|
+
- samples/20060115_phoenix_marathon.html
|
195
|
+
- samples/20070310_corporate_cup_hm.html
|
216
196
|
- samples/gps_point_capture.html
|
217
197
|
- samples/phoenix_marathon.html
|
218
|
-
- samples/run_2007_01_10_22_44_54.html
|
219
|
-
- samples/run_2007_02_24_15_01_35.html
|
220
|
-
- tests/tc_cls_counter_hash.rb
|
221
|
-
- tests/tc_cls_delim_line.rb
|
222
|
-
- tests/tc_cls_dttm.rb
|
223
|
-
- tests/tc_cls_duration.rb
|
224
|
-
- tests/tc_cls_forerunner_xml_parser.rb
|
225
|
-
- tests/tc_cls_geo_data.xxx
|
226
|
-
- tests/tc_cls_gooby_object.rb
|
227
|
-
- tests/tc_cls_google_map_generator.rb
|
228
|
-
- tests/tc_cls_history.rb
|
229
|
-
- tests/tc_cls_lap.rb
|
230
|
-
- tests/tc_cls_line.rb
|
231
|
-
- tests/tc_cls_options.rb
|
232
|
-
- tests/tc_cls_position.rb
|
233
|
-
- tests/tc_cls_run.rb
|
234
|
-
- tests/tc_cls_simple_xml_parser.rb
|
235
|
-
- tests/tc_cls_track.rb
|
236
|
-
- tests/tc_cls_trackpoint.rb
|
237
|
-
- tests/tc_mod_introspect.rb
|
238
|
-
- tests/tc_mod_io.rb
|
239
|
-
- tests/tc_mod_project_info.rb
|
240
|
-
- tests/tc_mod_string.rb
|
241
198
|
- tests/ts_gooby.rb
|
199
|
+
- tests/ts_gooby_min.rb
|
242
200
|
- README
|
243
201
|
test_files:
|
244
|
-
- tests/
|
202
|
+
- tests/ts_gooby_min.rb
|
245
203
|
rdoc_options: []
|
246
204
|
|
247
205
|
extra_rdoc_files:
|