gooby 0.9.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.
- data/README +242 -0
- data/bin/example_usage.rb +38 -0
- data/bin/tests_gen.rb +16 -0
- data/data/20050305_corporate_cup_hm.csv +251 -0
- data/data/20050305_corporate_cup_hm.xml +2208 -0
- data/data/20050430_nashville_marathon.csv +1208 -0
- data/data/20050430_nashville_marathon.xml +10043 -0
- data/data/20051119_dowd_ymca_hm.csv +251 -0
- data/data/20051119_dowd_ymca_hm.xml +2210 -0
- data/data/20051124_hyatt_turkey_trot_8K.csv +321 -0
- data/data/20051124_hyatt_turkey_trot_8K.xml +2651 -0
- data/data/2007_03_03.tcx +6207 -0
- data/data/forerunner_2007.xml +259014 -0
- data/data/geo_data.txt +171 -0
- data/data/phx.csv +1280 -0
- data/data/phx.xml +10620 -0
- data/data/run_2007_01_01_16_38_27.xml +2020 -0
- data/data/run_2007_01_06_15_27_31.xml +2020 -0
- data/data/run_2007_01_10_12_25_47.xml +820 -0
- data/data/run_2007_01_10_22_44_54.csv +112 -0
- data/data/run_2007_01_10_22_44_54.xml +908 -0
- data/data/run_2007_01_11_10_48_45.xml +1292 -0
- data/data/run_2007_01_13_15_37_06.xml +1964 -0
- data/data/run_2007_01_14_15_46_02.xml +1368 -0
- data/data/run_2007_01_15_14_01_48.xml +1868 -0
- data/data/run_2007_01_20_16_22_05.xml +1702 -0
- data/data/run_2007_01_27_17_32_13.xml +3626 -0
- data/data/run_2007_01_28_19_14_52.xml +2538 -0
- data/data/run_2007_02_03_14_30_20.xml +2016 -0
- data/data/run_2007_02_04_18_02_30.xml +1476 -0
- data/data/run_2007_02_17_16_29_35.xml +1236 -0
- data/data/run_2007_02_19_14_44_33.xml +1816 -0
- data/data/run_2007_02_23_15_53_55.xml +36 -0
- data/data/run_2007_02_23_15_55_20.xml +1296 -0
- data/data/run_2007_02_24_15_01_35.csv +484 -0
- data/data/run_2007_02_24_15_01_35.xml +3884 -0
- data/data/test1.txt +4 -0
- data/img/gicons/blank.png +0 -0
- data/img/gicons/dd-end.png +0 -0
- data/img/gicons/dd-start.png +0 -0
- data/img/gicons/marker.png +0 -0
- data/img/gicons/marker0.png +0 -0
- data/img/gicons/marker00.png +0 -0
- data/img/gicons/marker01.png +0 -0
- data/img/gicons/marker02.png +0 -0
- data/img/gicons/marker03.png +0 -0
- data/img/gicons/marker04.png +0 -0
- data/img/gicons/marker05.png +0 -0
- data/img/gicons/marker06.png +0 -0
- data/img/gicons/marker07.png +0 -0
- data/img/gicons/marker08.png +0 -0
- data/img/gicons/marker09.png +0 -0
- data/img/gicons/marker1.png +0 -0
- data/img/gicons/marker10.png +0 -0
- data/img/gicons/marker11.png +0 -0
- data/img/gicons/marker12.png +0 -0
- data/img/gicons/marker13.png +0 -0
- data/img/gicons/marker14.png +0 -0
- data/img/gicons/marker15.png +0 -0
- data/img/gicons/marker16.png +0 -0
- data/img/gicons/marker17.png +0 -0
- data/img/gicons/marker18.png +0 -0
- data/img/gicons/marker19.png +0 -0
- data/img/gicons/marker2.png +0 -0
- data/img/gicons/marker20.png +0 -0
- data/img/gicons/marker21.png +0 -0
- data/img/gicons/marker22.png +0 -0
- data/img/gicons/marker23.png +0 -0
- data/img/gicons/marker24.png +0 -0
- data/img/gicons/marker25.png +0 -0
- data/img/gicons/marker26.png +0 -0
- data/img/gicons/marker27.png +0 -0
- data/img/gicons/marker28.png +0 -0
- data/img/gicons/marker29.png +0 -0
- data/img/gicons/marker3.png +0 -0
- data/img/gicons/marker30.png +0 -0
- data/img/gicons/marker31.png +0 -0
- data/img/gicons/marker32.png +0 -0
- data/img/gicons/marker33.png +0 -0
- data/img/gicons/marker34.png +0 -0
- data/img/gicons/marker35.png +0 -0
- data/img/gicons/marker36.png +0 -0
- data/img/gicons/marker37.png +0 -0
- data/img/gicons/marker38.png +0 -0
- data/img/gicons/marker39.png +0 -0
- data/img/gicons/marker4.png +0 -0
- data/img/gicons/marker40.png +0 -0
- data/img/gicons/marker41.png +0 -0
- data/img/gicons/marker42.png +0 -0
- data/img/gicons/marker43.png +0 -0
- data/img/gicons/marker44.png +0 -0
- data/img/gicons/marker45.png +0 -0
- data/img/gicons/marker46.png +0 -0
- data/img/gicons/marker47.png +0 -0
- data/img/gicons/marker48.png +0 -0
- data/img/gicons/marker49.png +0 -0
- data/img/gicons/marker5.png +0 -0
- data/img/gicons/marker50.png +0 -0
- data/img/gicons/marker51.png +0 -0
- data/img/gicons/marker52.png +0 -0
- data/img/gicons/marker53.png +0 -0
- data/img/gicons/marker54.png +0 -0
- data/img/gicons/marker55.png +0 -0
- data/img/gicons/marker56.png +0 -0
- data/img/gicons/marker57.png +0 -0
- data/img/gicons/marker58.png +0 -0
- data/img/gicons/marker59.png +0 -0
- data/img/gicons/marker6.png +0 -0
- data/img/gicons/marker60.png +0 -0
- data/img/gicons/marker61.png +0 -0
- data/img/gicons/marker62.png +0 -0
- data/img/gicons/marker63.png +0 -0
- data/img/gicons/marker64.png +0 -0
- data/img/gicons/marker65.png +0 -0
- data/img/gicons/marker66.png +0 -0
- data/img/gicons/marker67.png +0 -0
- data/img/gicons/marker68.png +0 -0
- data/img/gicons/marker69.png +0 -0
- data/img/gicons/marker7.png +0 -0
- data/img/gicons/marker70.png +0 -0
- data/img/gicons/marker71.png +0 -0
- data/img/gicons/marker72.png +0 -0
- data/img/gicons/marker73.png +0 -0
- data/img/gicons/marker74.png +0 -0
- data/img/gicons/marker75.png +0 -0
- data/img/gicons/marker76.png +0 -0
- data/img/gicons/marker77.png +0 -0
- data/img/gicons/marker78.png +0 -0
- data/img/gicons/marker79.png +0 -0
- data/img/gicons/marker8.png +0 -0
- data/img/gicons/marker80.png +0 -0
- data/img/gicons/marker81.png +0 -0
- data/img/gicons/marker82.png +0 -0
- data/img/gicons/marker83.png +0 -0
- data/img/gicons/marker84.png +0 -0
- data/img/gicons/marker85.png +0 -0
- data/img/gicons/marker86.png +0 -0
- data/img/gicons/marker87.png +0 -0
- data/img/gicons/marker88.png +0 -0
- data/img/gicons/marker89.png +0 -0
- data/img/gicons/marker9.png +0 -0
- data/img/gicons/marker90.png +0 -0
- data/img/gicons/marker91.png +0 -0
- data/img/gicons/marker92.png +0 -0
- data/img/gicons/marker93.png +0 -0
- data/img/gicons/marker94.png +0 -0
- data/img/gicons/marker95.png +0 -0
- data/img/gicons/marker96.png +0 -0
- data/img/gicons/marker97.png +0 -0
- data/img/gicons/marker98.png +0 -0
- data/img/gicons/marker99.png +0 -0
- data/img/gicons/markerA.png +0 -0
- data/img/gicons/markerB.png +0 -0
- data/img/gicons/markerC.png +0 -0
- data/img/gicons/markerD.png +0 -0
- data/img/gicons/markerE.png +0 -0
- data/img/gicons/markerF.png +0 -0
- data/img/gicons/markerG.png +0 -0
- data/img/gicons/markerH.png +0 -0
- data/img/gicons/markerI.png +0 -0
- data/img/gicons/markerJ.png +0 -0
- data/img/gicons/mm_20_red.png +0 -0
- data/img/gicons/mm_20_shadow.png +0 -0
- data/img/gicons/readme.txt +11 -0
- data/img/gicons/shadow50.png +0 -0
- data/lib/gooby/cls_counter_hash.rb +78 -0
- data/lib/gooby/cls_delim_line.rb +35 -0
- data/lib/gooby/cls_dttm.rb +79 -0
- data/lib/gooby/cls_duration.rb +79 -0
- data/lib/gooby/cls_forerunner_xml_parser.rb +178 -0
- data/lib/gooby/cls_forerunner_xml_splitter.rb +109 -0
- data/lib/gooby/cls_geo_data.rb +181 -0
- data/lib/gooby/cls_gooby_command.rb +35 -0
- data/lib/gooby/cls_gooby_object.rb +18 -0
- data/lib/gooby/cls_google_map_generator.rb +363 -0
- data/lib/gooby/cls_history.rb +33 -0
- data/lib/gooby/cls_lap.rb +22 -0
- data/lib/gooby/cls_line.rb +75 -0
- data/lib/gooby/cls_options.rb +67 -0
- data/lib/gooby/cls_position.rb +44 -0
- data/lib/gooby/cls_run.rb +194 -0
- data/lib/gooby/cls_simple_xml_parser.rb +41 -0
- data/lib/gooby/cls_test_regen.rb +182 -0
- data/lib/gooby/cls_track.rb +47 -0
- data/lib/gooby/cls_trackpoint.rb +200 -0
- data/lib/gooby/mod_introspect.rb +26 -0
- data/lib/gooby/mod_io.rb +58 -0
- data/lib/gooby/mod_project_info.rb +80 -0
- data/lib/gooby/mod_string.rb +19 -0
- data/lib/gooby/mod_test_helper.rb +15 -0
- data/lib/gooby.rb +2265 -0
- data/pkg/code_header.txt +21 -0
- data/pkg/pkg.rb +236 -0
- data/pkg/test_header.txt +19 -0
- data/samples/20041113_richmond_marathon.html +532 -0
- data/samples/20050305_corporate_cup_hm.html +448 -0
- data/samples/20050430_nashville_marathon.html +530 -0
- data/samples/gps_point_capture.html +54 -0
- data/samples/phoenix_marathon.html +542 -0
- data/samples/run_2007_01_10_22_44_54.html +201 -0
- data/samples/run_2007_02_24_15_01_35.html +298 -0
- data/tests/tc_cls_counter_hash.rb +107 -0
- data/tests/tc_cls_delim_line.rb +74 -0
- data/tests/tc_cls_dttm.rb +131 -0
- data/tests/tc_cls_duration.rb +51 -0
- data/tests/tc_cls_forerunner_xml_parser.rb +70 -0
- data/tests/tc_cls_geo_data.xxx +71 -0
- data/tests/tc_cls_gooby_object.rb +26 -0
- data/tests/tc_cls_google_map_generator.rb +109 -0
- data/tests/tc_cls_history.rb +46 -0
- data/tests/tc_cls_lap.rb +38 -0
- data/tests/tc_cls_line.rb +110 -0
- data/tests/tc_cls_options.rb +79 -0
- data/tests/tc_cls_position.rb +66 -0
- data/tests/tc_cls_run.rb +142 -0
- data/tests/tc_cls_simple_xml_parser.rb +50 -0
- data/tests/tc_cls_track.rb +70 -0
- data/tests/tc_cls_trackpoint.rb +145 -0
- data/tests/tc_mod_introspect.rb +32 -0
- data/tests/tc_mod_io.rb +53 -0
- data/tests/tc_mod_project_info.rb +79 -0
- data/tests/tc_mod_string.rb +58 -0
- data/tests/ts_gooby.rb +1237 -0
- metadata +270 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::CounterHash.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassCounterHash < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_CounterHash
|
|
22
|
+
|
|
23
|
+
# See the method-level tests below.
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_class_CounterHash_decrement
|
|
27
|
+
|
|
28
|
+
cHash = Gooby::CounterHash.new
|
|
29
|
+
7.times { cHash.decrement("seven") }
|
|
30
|
+
391.times { cHash.decrement("391") }
|
|
31
|
+
assert(cHash.value('seven') == -7, "decremented value not -7.")
|
|
32
|
+
assert(cHash.value('391') == -391, "decremented value not -391.")
|
|
33
|
+
assert(cHash.sorted_keys.size == 2, "sorted_keys size is not 2.")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_class_CounterHash_increment
|
|
37
|
+
|
|
38
|
+
cHash = Gooby::CounterHash.new
|
|
39
|
+
33.times { cHash.increment("33") }
|
|
40
|
+
123.times { cHash.increment("123") }
|
|
41
|
+
assert(cHash.value('33') == 33, "incremented value not 33.")
|
|
42
|
+
assert(cHash.value('123') == 123, "incremented value not 123.")
|
|
43
|
+
assert(cHash.sorted_keys.size == 2, "sorted_keys size is not 2.")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_class_CounterHash_initialize
|
|
47
|
+
|
|
48
|
+
cHash = Gooby::CounterHash.new
|
|
49
|
+
assert(cHash.value('test') == 0, "initial value is not 0.")
|
|
50
|
+
assert(cHash.sorted_keys.size == 0, "sorted_keys size is not 0.")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_class_CounterHash_sorted_keys
|
|
54
|
+
|
|
55
|
+
cHash = Gooby::CounterHash.new
|
|
56
|
+
cHash.increment('OS/X')
|
|
57
|
+
cHash.decrement('Windows')
|
|
58
|
+
cHash.increment('Linux')
|
|
59
|
+
array = cHash.sorted_keys
|
|
60
|
+
assert(array.class == Array, "sorted_keys is not an Array; #{array.class}.")
|
|
61
|
+
assert(cHash.sorted_keys.size == 3, "sorted_keys size is not 3.")
|
|
62
|
+
assert(array[0] == 'Linux', "sorted_keys element 0 is incorrect.")
|
|
63
|
+
assert(array[1] == 'OS/X', "sorted_keys element 1 is incorrect.")
|
|
64
|
+
assert(array[2] == 'Windows', "sorted_keys element 2 is incorrect.")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_class_CounterHash_to_s
|
|
68
|
+
|
|
69
|
+
cHash = Gooby::CounterHash.new
|
|
70
|
+
cHash.increment("romeo")
|
|
71
|
+
cHash.increment("maybelline")
|
|
72
|
+
cHash.decrement("romeo")
|
|
73
|
+
cHash.increment("yingling")
|
|
74
|
+
cHash.increment("maybelline")
|
|
75
|
+
cHash.decrement("domino")
|
|
76
|
+
cHash.increment("yingling")
|
|
77
|
+
cHash.increment("maybelline")
|
|
78
|
+
cHash.increment("leppie")
|
|
79
|
+
|
|
80
|
+
expected = 'CHash: key: [domino] val: [-1] key: [leppie] val: [1] key: [maybelline] val: [3] key: [romeo] val: [0] key: [yingling] val: [2]'
|
|
81
|
+
actual = cHash.to_s
|
|
82
|
+
assert_equal(expected, actual, "to_s value is not as expected; #{actual} vs #{expected}")
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_class_CounterHash_to_xml
|
|
86
|
+
|
|
87
|
+
cHash = Gooby::CounterHash.new
|
|
88
|
+
cHash.increment("romeo")
|
|
89
|
+
cHash.increment("maybelline")
|
|
90
|
+
cHash.decrement("romeo")
|
|
91
|
+
cHash.increment("yingling")
|
|
92
|
+
cHash.increment("maybelline")
|
|
93
|
+
cHash.decrement("domino")
|
|
94
|
+
cHash.increment("yingling")
|
|
95
|
+
cHash.increment("maybelline")
|
|
96
|
+
cHash.increment("leppie")
|
|
97
|
+
|
|
98
|
+
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>"
|
|
99
|
+
actual = cHash.to_xml(false)
|
|
100
|
+
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_class_CounterHash_value
|
|
104
|
+
|
|
105
|
+
# This method is tested in the other test methods.
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::DelimLine.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassDelimLine < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_DelimLine
|
|
22
|
+
|
|
23
|
+
line = '1 | 2007-01-01 | 16:38:43 | 1167669523 | 2 | 35.49532 | -80.83167 | 242.870 | 0.0313362638280469 '
|
|
24
|
+
dline = Gooby::DelimLine.new(line)
|
|
25
|
+
|
|
26
|
+
expected = 'DelimLine: length: 101 trim: true delim: | tokens: 9'
|
|
27
|
+
actual = dline.to_s
|
|
28
|
+
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
|
29
|
+
|
|
30
|
+
expected = '1'
|
|
31
|
+
actual = dline.tokens[0]
|
|
32
|
+
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
|
33
|
+
|
|
34
|
+
expected = '16:38:43'
|
|
35
|
+
actual = dline.tokens[2]
|
|
36
|
+
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
|
37
|
+
|
|
38
|
+
expected = '0.0313362638280469'
|
|
39
|
+
actual = dline.tokens[-1]
|
|
40
|
+
assert_equal(expected, actual, "to_xml value is not as expected; #{actual} vs #{expected}")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_class_DelimLine_as_trackpoint
|
|
44
|
+
|
|
45
|
+
line = '6 | 2007-01-13T16:35:53Z | 243 | 35.49517 | -80.83215 | 237.583 | 6.51627221396902 '
|
|
46
|
+
dline = Gooby::DelimLine.new(line)
|
|
47
|
+
tkpt = dline.as_trackpoint(0, 3, 4, 5, 1) # (numIdx, latIdx, lngIdx, altIdx, timeIdx)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_class_DelimLine_initialize
|
|
51
|
+
|
|
52
|
+
# This method is tested in the other test methods.
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_class_DelimLine_is_comment?
|
|
56
|
+
|
|
57
|
+
dline = Gooby::DelimLine.new('# this is a comment line')
|
|
58
|
+
bool1 = dline.is_comment?
|
|
59
|
+
|
|
60
|
+
dline = Gooby::DelimLine.new('this is not a comment line')
|
|
61
|
+
bool2 = dline.is_comment?
|
|
62
|
+
|
|
63
|
+
dline = Gooby::DelimLine.new(' # this is a comment line')
|
|
64
|
+
bool3 = dline.is_comment?
|
|
65
|
+
|
|
66
|
+
assert(bool1 == true, "line 1 should be a comment")
|
|
67
|
+
assert(bool2 == false, "line 2 not should be a comment")
|
|
68
|
+
assert(bool3 == true, "line 3 should be a comment")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def test_class_DelimLine_to_s
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::DtTm.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassDtTm < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
include Gooby::Con
|
|
17
|
+
|
|
18
|
+
@debug = false
|
|
19
|
+
|
|
20
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
21
|
+
|
|
22
|
+
def test_class_DtTm
|
|
23
|
+
|
|
24
|
+
# This class is tested in the methods below.
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_class_DtTm_hh_mm_ss
|
|
28
|
+
|
|
29
|
+
s = '2006-01-15T01:02:00Z'
|
|
30
|
+
dt = Gooby::DtTm.new(s)
|
|
31
|
+
actual = dt.hh_mm_ss
|
|
32
|
+
expected = '01:02:00'
|
|
33
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
34
|
+
|
|
35
|
+
s = '2006-01-15T03:41:40Z'
|
|
36
|
+
dt = Gooby::DtTm.new(s)
|
|
37
|
+
actual = dt.hh_mm_ss
|
|
38
|
+
expected = '03:41:40'
|
|
39
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_class_DtTm_hhmmss_diff
|
|
43
|
+
|
|
44
|
+
s1 = '2006-01-15T02:39:37Z'
|
|
45
|
+
dt1 = Gooby::DtTm.new(s1)
|
|
46
|
+
s2 = '2006-01-15T03:41:40Z'
|
|
47
|
+
dt2 = Gooby::DtTm.new(s2)
|
|
48
|
+
actual = dt2.hhmmss_diff(dt1)
|
|
49
|
+
expected = '01:02:03'
|
|
50
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_class_DtTm_initialize
|
|
54
|
+
|
|
55
|
+
dt1 = Gooby::DtTm.new(nil)
|
|
56
|
+
dt2 = Gooby::DtTm.new('too short')
|
|
57
|
+
dt3 = Gooby::DtTm.new('2006-01-15T03:41:40Z')
|
|
58
|
+
|
|
59
|
+
assert(dt1.valid == false, "dt1 should not be valid.")
|
|
60
|
+
assert(dt2.valid == false, "dt2 should not be valid.")
|
|
61
|
+
assert(dt3.valid == true, "dt3 should not be valid.")
|
|
62
|
+
assert(dt1.to_i == invalid_time, "dt1 to_i should be #{invalid_time}.")
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Warning: possible obsolete test method - test_class_DtTm_parse
|
|
67
|
+
|
|
68
|
+
def test_class_DtTm_parse
|
|
69
|
+
|
|
70
|
+
# This method is tested in the other test methods.
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_class_DtTm_print_string
|
|
74
|
+
|
|
75
|
+
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
|
76
|
+
actual = dt.print_string
|
|
77
|
+
expected = "DtTm: 2007-02-01 02:13:52 1170296032 2007-02-01T02:13:52Z"
|
|
78
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def test_class_DtTm_seconds_diff
|
|
82
|
+
|
|
83
|
+
dt1 = Gooby::DtTm.new('2007-02-01T11:59:59Z')
|
|
84
|
+
dt2 = Gooby::DtTm.new('2007-02-01T12:00:00Z')
|
|
85
|
+
dt3 = Gooby::DtTm.new('2007-02-01T13:01:02')
|
|
86
|
+
|
|
87
|
+
actual = dt2.seconds_diff(dt1)
|
|
88
|
+
expected = 1
|
|
89
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
90
|
+
|
|
91
|
+
actual = dt3.seconds_diff(dt1)
|
|
92
|
+
expected = 3663
|
|
93
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
94
|
+
|
|
95
|
+
actual = dt1.seconds_diff(dt3)
|
|
96
|
+
expected = -3663
|
|
97
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def test_class_DtTm_to_i
|
|
101
|
+
|
|
102
|
+
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
|
103
|
+
actual = dt.to_i
|
|
104
|
+
expected = 1170296032
|
|
105
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_class_DtTm_to_s
|
|
109
|
+
|
|
110
|
+
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
|
111
|
+
actual = dt.to_s
|
|
112
|
+
expected = "2007-02-01T02:13:52Z"
|
|
113
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_class_DtTm_yyyy_mm_dd
|
|
117
|
+
|
|
118
|
+
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
|
119
|
+
actual = dt.yyyy_mm_dd
|
|
120
|
+
expected = "2007-02-01"
|
|
121
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_class_DtTm_yyyy_mm_dd_hh_mm_ss
|
|
125
|
+
|
|
126
|
+
dt = Gooby::DtTm.new('2007-02-01T02:13:52Z')
|
|
127
|
+
actual = dt.yyyy_mm_dd_hh_mm_ss
|
|
128
|
+
expected = "2007-02-01 02:13:52"
|
|
129
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
130
|
+
end
|
|
131
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::Duration.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassDuration < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
include Gooby::Con
|
|
17
|
+
|
|
18
|
+
@debug = false
|
|
19
|
+
|
|
20
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
21
|
+
|
|
22
|
+
def test_class_Duration
|
|
23
|
+
|
|
24
|
+
d1 = Gooby::Duration.new('PT507.870S')
|
|
25
|
+
s1a = d1.to_s
|
|
26
|
+
s1b = d1.print_string
|
|
27
|
+
actual = s1a
|
|
28
|
+
expected = '08:27.87'
|
|
29
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
30
|
+
|
|
31
|
+
actual = s1b
|
|
32
|
+
expected = 'Duration: 507.870 sec: 507.87 min: 8.4645 mmss: 08:27.87 bm: 8 fm: 0.464499999999999 fs: 27.87'
|
|
33
|
+
assert_equal(expected, actual, "value is not as expected; #{actual} vs #{expected}")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_class_Duration_initialize
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_class_Duration_print_string
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_class_Duration_scrub
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_class_Duration_to_s
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::ForerunnerXmlParser.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassForerunnerXmlParser < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_ForerunnerXmlParser
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_class_ForerunnerXmlParser_detail_tag?
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_class_ForerunnerXmlParser_dump
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_class_ForerunnerXmlParser_gdump
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_class_ForerunnerXmlParser_initialize
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_class_ForerunnerXmlParser_is_tag?
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_class_ForerunnerXmlParser_put_all_run_tkpt_csv
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_class_ForerunnerXmlParser_put_run_csv
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_class_ForerunnerXmlParser_tag_end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_class_ForerunnerXmlParser_tag_start
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_class_ForerunnerXmlParser_text
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Warning: possible obsolete test method - test_stub
|
|
66
|
+
|
|
67
|
+
def test_stub
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::GeoData.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassGeoData < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_GeoData
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_class_GeoData_add_poi
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_class_GeoData_add_route
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_class_GeoData_add_track
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_class_GeoData_dump
|
|
38
|
+
|
|
39
|
+
geo = Gooby::GeoData.new(nil)
|
|
40
|
+
geo.dump
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_class_GeoData_initialize
|
|
44
|
+
|
|
45
|
+
geo = Gooby::GeoData.new(nil)
|
|
46
|
+
puts geo.to_s
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Warning: possible obsolete test method - test_class_GeoData_parse
|
|
51
|
+
|
|
52
|
+
def test_class_GeoData_parse
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_class_GeoData_parse_poi
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_class_GeoData_parse_routes
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_class_GeoData_parse_tracks
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_class_GeoData_to_s
|
|
69
|
+
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::GoobyObject.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassGoobyObject < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
# Warning: possible obsolete test method - test_stub
|
|
22
|
+
|
|
23
|
+
def test_stub
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::GoogleMapGenerator.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassGoogleMapGenerator < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_GoogleMapGenerator
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_class_GoogleMapGenerator_compute_center_point
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_class_GoogleMapGenerator_filter_trackpoints
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_class_GoogleMapGenerator_generate
|
|
34
|
+
|
|
35
|
+
gen = Gooby::GoogleMapGenerator.new('data/phx.csv')
|
|
36
|
+
content_hash = gen.generate(nil)
|
|
37
|
+
#content_hash.keys.sort.each { | key | puts key }
|
|
38
|
+
|
|
39
|
+
s = <<HERE
|
|
40
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
41
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
42
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
43
|
+
<head>
|
|
44
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
|
45
|
+
<title> Google Map by Gooby </title>
|
|
46
|
+
#{content_hash['key_js']}
|
|
47
|
+
#{content_hash['main_js_start']}
|
|
48
|
+
#{content_hash['main_js_route_overlay']}
|
|
49
|
+
#{content_hash['main_js_checkpoint_overlays']}
|
|
50
|
+
#{content_hash['main_js_map_clicked_listeners']}
|
|
51
|
+
#{content_hash['main_js_end']}
|
|
52
|
+
</head>
|
|
53
|
+
<body onload="load()" onunload="GUnload()">
|
|
54
|
+
<center>
|
|
55
|
+
<h3> #{content_hash['title']} </h3>
|
|
56
|
+
<h5> Generated by Gooby #{content_hash['when_generated']} <br> Gooby = Google APIs + Ruby </h5>
|
|
57
|
+
#{content_hash['map_div']}
|
|
58
|
+
#{content_hash['messages_div']}
|
|
59
|
+
</center>
|
|
60
|
+
</body>
|
|
61
|
+
</html>
|
|
62
|
+
HERE
|
|
63
|
+
|
|
64
|
+
html_file = File.new("zgen_gmap.html", "w")
|
|
65
|
+
html_file.write(s)
|
|
66
|
+
html_file.flush
|
|
67
|
+
html_file.close
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_class_GoogleMapGenerator_generate_key_js
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_class_GoogleMapGenerator_generate_main_js_checkpoint_overlays
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def test_class_GoogleMapGenerator_generate_main_js_end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def test_class_GoogleMapGenerator_generate_main_js_map_clicked_listeners
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_class_GoogleMapGenerator_generate_main_js_route_overlay
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_class_GoogleMapGenerator_generate_main_js_start
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_class_GoogleMapGenerator_generate_map_div
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_class_GoogleMapGenerator_generate_messages_div
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_class_GoogleMapGenerator_generate_page
|
|
103
|
+
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_class_GoogleMapGenerator_initialize
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
### Copyright 2007 by Chris Joakim.
|
|
2
|
+
### Gooby is available under GNU General Public License (GPL) license.
|
|
3
|
+
|
|
4
|
+
=begin rdoc
|
|
5
|
+
|
|
6
|
+
This class tests the functionality in class Gooby::History.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'gooby'
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
|
|
13
|
+
class TestClassHistory < Test::Unit::TestCase
|
|
14
|
+
|
|
15
|
+
include Gooby::TestHelper
|
|
16
|
+
|
|
17
|
+
@debug = false
|
|
18
|
+
|
|
19
|
+
### Start of tests. Keep this line - see class TestGenerator.
|
|
20
|
+
|
|
21
|
+
def test_class_History
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_class_History_add_run
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_class_History_initialize
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_class_History_print_string
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_class_History_to_s
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Warning: possible obsolete test method - test_stub
|
|
42
|
+
|
|
43
|
+
def test_stub
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|