equationoftime 4.1.1 → 4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.autotest +39 -0
  3. data/.gemtest +0 -0
  4. data/.minitest.rb +2 -0
  5. data/.ruby-version +1 -0
  6. data/.settings/org.eclipse.ltk.core.refactoring.prefs +2 -0
  7. data/CHANGELOG.rdoc +6 -0
  8. data/Gemfile +12 -0
  9. data/Gemfile.lock +44 -3
  10. data/Guardfile +29 -0
  11. data/{LICENSE.md → LICENSE.rdoc} +0 -0
  12. data/Manifest.txt +82 -0
  13. data/README.rdoc +66 -0
  14. data/Rakefile +60 -45
  15. data/equationoftime.gemspec +17 -9
  16. data/examples/Equation_of_Time.jpg +0 -0
  17. data/examples/analemma_data_generator.rb +58 -0
  18. data/examples/check_date_type.rb +60 -0
  19. data/examples/compare_geoc_long_ra.rb +44 -0
  20. data/examples/data_table_for_astro_dog.rb +45 -0
  21. data/examples/earth_rotation.rb +42 -0
  22. data/examples/eot_methods_list.rb +48 -0
  23. data/examples/eot_plot.r +57 -0
  24. data/examples/eot_suntimes.rb +149 -0
  25. data/examples/equation_of_time.py +186 -0
  26. data/examples/figure_1.jpg +0 -0
  27. data/examples/file_converter.rb +31 -0
  28. data/examples/from_readme.rb +14 -0
  29. data/examples/from_wiki.rb +46 -0
  30. data/examples/geo_locator.rb +16 -0
  31. data/examples/getjd.rb +45 -0
  32. data/examples/gmst_gast_non_sofa.rb +406 -0
  33. data/examples/input_suntimes.rb +24 -0
  34. data/examples/julian_day_formula.rb +29 -0
  35. data/examples/julian_day_formula.txt +12 -0
  36. data/examples/my_time_conversion.rb +21 -0
  37. data/examples/nutation_series.txt +678 -0
  38. data/examples/nutation_table5_3a.txt +682 -0
  39. data/examples/ptime.rb +162 -0
  40. data/examples/suntimes.rb +30 -0
  41. data/examples/suntimes_test.rb +50 -0
  42. data/examples/t_sofa.rb +8228 -0
  43. data/examples/test_celes.rb +51 -0
  44. data/examples/test_ceot.rb +55 -0
  45. data/examples/test_poly_eval.rb +32 -0
  46. data/examples/time_scales.rb +29 -0
  47. data/examples/times_year.rb +53 -0
  48. data/examples/usage_example.rb +26 -0
  49. data/examples/use_angles.rb +222 -0
  50. data/ext/{ceot/eot.c → eot/ceot.c} +1 -1
  51. data/ext/{ceot/eot.h → eot/ceot.h} +0 -0
  52. data/ext/{ceot/ceot.c → eot/eot.c} +2 -2
  53. data/ext/{ceot → eot}/extconf.rb +1 -1
  54. data/lib/eot.rb +2 -1
  55. data/lib/eot/angles.rb +28 -28
  56. data/lib/eot/constants.rb +2 -0
  57. data/lib/eot/displays.rb +17 -17
  58. data/lib/eot/eot.so +0 -0
  59. data/lib/eot/geo_lat_lng_smt.rb +44 -31
  60. data/lib/eot/init.rb +20 -19
  61. data/lib/eot/nutation.rb +1 -1
  62. data/lib/eot/times.rb +22 -22
  63. data/lib/eot/utilities.rb +5 -5
  64. data/lib/eot/version.rb +2 -6
  65. data/test/aliased_angles_spec.rb +239 -0
  66. data/test/aliased_displays_spec.rb +105 -0
  67. data/test/aliased_utilities_spec.rb +36 -0
  68. data/test/angles_spec.rb +264 -0
  69. data/test/constants_spec.rb +20 -0
  70. data/test/displays_spec.rb +110 -0
  71. data/test/geo_spec.rb +38 -0
  72. data/test/init_spec.rb +44 -0
  73. data/test/nutation_spec.rb +37 -0
  74. data/test/spec_config.rb +8 -0
  75. data/test/times_spec.rb +133 -0
  76. data/test/utilities_spec.rb +35 -0
  77. metadata +109 -115
  78. data/.gitignore +0 -24
  79. data/.rvmrc +0 -1
  80. data/README.md +0 -83
  81. data/README2.txt +0 -70
  82. data/wiki.md +0 -43
  83. data/wiki2.md +0 -4
@@ -0,0 +1,105 @@
1
+ # aliased_displays_spec.rb
2
+ #
3
+
4
+ require_relative 'spec_config'
5
+
6
+ lib = File.expand_path('../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+ require 'eot'
9
+
10
+ Eot_aliased_displays = Eot.new
11
+
12
+ describe 'Eot_aliased_displays using ajd of 2456885.0' do
13
+
14
+ before(:each) do
15
+ Eot_aliased_displays.ajd = 2456885.0
16
+ ajd = Eot_aliased_displays.ajd
17
+ # check date for this ajd when needed.
18
+ Eot_aliased_displays.date = Eot_aliased_displays.ajd_to_datetime(ajd)
19
+
20
+ end
21
+
22
+ it 'expected 2456885.0 , returned by Eot_aliased_displays.' do
23
+ assert_equal 2456885.0, Eot_aliased_displays.ajd
24
+ end
25
+
26
+ it 'expected "2014-08-15T12:00:00+00:00", returned by Eot_aliased_displays.date.to_s' do
27
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_aliased_displays.date.to_s
28
+ end
29
+
30
+ it 'expected 3.8508003966038915, returned by Eot_aliased_displays.' do
31
+ assert_equal 3.8508003966038915, Eot_aliased_displays.ma
32
+ end
33
+
34
+ it 'expected "+142:35:33.356" returned by Eot_aliased_displays.apparent_longitude_string()? ' do
35
+ assert_equal "+142:35:33.356", Eot_aliased_displays.apparent_longitude_string()
36
+ end
37
+
38
+ it 'expected "+013:58:51.521" returned by Eot_aliased_displays.declination_string()? ' do
39
+ assert_equal "+013:58:51.521", Eot_aliased_displays.declination_string()
40
+ end
41
+
42
+ it 'expected "-04m, 29.2s" returned by Eot_aliased_displays.display_equation_of_time()? ' do
43
+ assert_equal "-04m, 29.2s", Eot_aliased_displays.display_equation_of_time()
44
+ end
45
+
46
+ it 'expected "12:00:00.000" returned by Eot_aliased_displays.display_time_string()? ' do
47
+ assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string()
48
+ assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string(nil)
49
+ assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string(0)
50
+ end
51
+
52
+ it 'expected "12:00:00.000" returned by Eot_aliased_displays.display_time_string(Eot_aliased_displays.date)? ' do
53
+ assert_equal "12:00:00.000", Eot_aliased_displays.display_time_string(Eot_aliased_displays.date)
54
+ end
55
+
56
+ it 'expected "2000-01-01" returned by Eot_aliased_displays.jd_to_date_string()? ' do
57
+ assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string()
58
+ assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string(nil)
59
+ assert_equal "2000-01-01", Eot_aliased_displays.jd_to_date_string(0)
60
+ end
61
+
62
+ it 'expected "2014-08-15" returned by Eot_aliased_displays.jd_to_date_string(Eot_aliased_displays.ajd)? ' do
63
+ assert_equal "2014-08-15", Eot_aliased_displays.jd_to_date_string(Eot_aliased_displays.ajd)
64
+ end
65
+
66
+ it 'expected "12:00:00" returned by Eot_aliased_displays.julian_period_day_fraction_to_time()? ' do
67
+ assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time()
68
+ assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time(nil)
69
+ assert_equal "12:00:00", Eot_aliased_displays.julian_period_day_fraction_to_time(0)
70
+ end
71
+
72
+ it 'expected "+220:38:04.597" returned by Eot_aliased_displays.mean_anomaly_string()? ' do
73
+ assert_equal "+220:38:04.597", Eot_aliased_displays.mean_anomaly_string()
74
+ end
75
+
76
+ it 'expected "+144:56:36.571" returned by Eot_aliased_displays.right_ascension_string()? ' do
77
+ assert_equal "+144:56:36.571", Eot_aliased_displays.right_ascension_string()
78
+ end
79
+
80
+ it 'expected "+219:24:27.797" returned by Eot_aliased_displays.true_anomaly_string()? ' do
81
+ assert_equal "+219:24:27.797", Eot_aliased_displays.true_anomaly_string()
82
+ end
83
+
84
+ it 'expected "+142:35:47.3184" returned by Eot_aliased_displays.true_longitude_string()? ' do
85
+ assert_equal "+142:35:47.318", Eot_aliased_displays.true_longitude_string()
86
+ end
87
+
88
+ it 'expected "+023:26:06.163" returned by Eot_aliased_displays.true_obliquity_string()? ' do
89
+ assert_equal "+023:26:06.163", Eot_aliased_displays.true_obliquity_string()
90
+ end
91
+
92
+ end
93
+
94
+ describe 'Eot aliased displays explicit values' do
95
+
96
+ it 'expected "16:40:40.800" returned by Eot_aliased_displays.display_time_string(16.6780)? ' do
97
+ assert_equal "16:40:40.800", Eot_aliased_displays.display_time_string(16.6780)
98
+ end
99
+
100
+ it 'expected "17:59:16.800" returned by Eot_aliased_displays.display_time_string(17988)? ' do
101
+ Eot_aliased_displays.date = Date.today.to_s
102
+ assert_equal "17:59:16.800", Eot_aliased_displays.display_time_string(17.988)
103
+ end
104
+
105
+ end
@@ -0,0 +1,36 @@
1
+ # aliased_utilities_spec.rb
2
+ #
3
+
4
+ require_relative 'spec_config'
5
+
6
+ lib = File.expand_path('../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+ require 'eot'
9
+
10
+ Eot_aliased_utilities = Eot.new
11
+
12
+ describe 'tests ajd of 2456885.0' do
13
+
14
+
15
+ before(:each) do
16
+ Eot_aliased_utilities.ajd = 2456885.0
17
+ ajd = Eot_aliased_utilities.ajd
18
+ # check date for this ajd when needed.
19
+ Eot_aliased_utilities.date = Eot_aliased_utilities.ajd_to_datetime(ajd)
20
+ end
21
+
22
+ it 'expected 2456885.0 for Eot_aliased_utilities.ajd'do
23
+ assert_equal 2456885.0, Eot_aliased_utilities.ajd
24
+ end
25
+
26
+ it 'expected 3.8508003966038915 for Eot_aliased_utilities.ma'do
27
+ assert_equal 3.8508003966038915, Eot_aliased_utilities.ma
28
+ end
29
+
30
+ it 'expected 0.0 returned by Eot_aliased_utilities.truncate() ' do
31
+ assert_equal 0.0, Eot_aliased_utilities.truncate()
32
+ assert_equal 0.0, Eot_aliased_utilities.truncate(nil)
33
+ assert_equal 0.0, Eot_aliased_utilities.truncate(0)
34
+ end
35
+
36
+ end
@@ -0,0 +1,264 @@
1
+ # angles_spec.rb
2
+ #
3
+
4
+ require_relative 'spec_config'
5
+
6
+ lib = File.expand_path('../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+ require 'eot'
9
+
10
+ Eot_angles = Eot.new
11
+
12
+ describe 'Tests ajd of 2456885.0' do
13
+
14
+ before(:each) do
15
+ Eot_angles.ajd = 2456885.0
16
+ ajd = Eot_angles.ajd
17
+ # check date for this ajd when needed.
18
+ Eot_angles.date = Eot_angles.ajd_to_datetime(ajd)
19
+ end
20
+
21
+ it 'expected 2456885.0 for Eot_angles.ajd'do
22
+ assert_equal( 2456885.0, Eot_angles.ajd )
23
+ end
24
+
25
+ it 'expected "2014-08-15T12:00:00+00:00" for Eot_angles.date'.to_s do
26
+ assert_equal( "2014-08-15T12:00:00+00:00", Eot_angles.date.to_s )
27
+ end
28
+
29
+ it 'expected 3.8508003966038915 for Eot_angles.ma'do
30
+ assert_equal( 3.8508003966038915, Eot_angles.ma )
31
+ end
32
+
33
+ it 'expected 2.4887103398436143 from Eot_angles.al_Sun()? ' do
34
+ assert_equal( 2.4887103398436143, Eot_angles.al_Sun() )
35
+ end
36
+
37
+ it 'expected -0.021413249720702462 from Eot_angles.centre()? ' do
38
+ assert_equal( -0.021413249720702462, Eot_angles.center() )
39
+ end
40
+
41
+ it 'expected -0.7943361570447028 from Eot_angles.cosine_al_Sun()? ' do
42
+ assert_equal( -0.7943361570447028, Eot_angles.cosine_al_Sun() )
43
+ end
44
+
45
+ it 'expected -0.7943772759574919 from Eot_angles.cosine_tl_Sun()? ' do
46
+ assert_equal( -0.7943772759574919, Eot_angles.cosine_tl_Sun() )
47
+ end
48
+
49
+ it 'expected 0.9175115346811911 from Eot_angles.cosine_to_Earth()? ' do
50
+ assert_equal( 0.9175115346811911, Eot_angles.cosine_to_Earth() )
51
+ end
52
+
53
+ it 'expected 0.24401410218543554 from Eot_angles.dec_Sun()? ' do
54
+ assert_equal( 0.24401410218543554, Eot_angles.dec_Sun() )
55
+ end
56
+
57
+ it 'expected -4.069792718159396e-05 from Eot_angles.delta_epsilon()? ' do
58
+ assert_equal( -4.069792718159396e-05, Eot_angles.delta_epsilon() )
59
+ end
60
+
61
+ it 'expected -0.04103082558803539 from Eot_angles.delta_oblique()? ' do
62
+ assert_equal( -0.04103082558803539, Eot_angles.delta_oblique() )
63
+ end
64
+
65
+ it 'expected 0.021413249720702243 from Eot_angles.delta_orbit()? ' do
66
+ assert_equal( 0.021413249720702243, Eot_angles.delta_orbit() )
67
+ end
68
+
69
+ it 'expected 3.75123821843003e-05 from Eot_angles.delta_psi()? ' do
70
+ assert_equal( 3.75123821843003e-05, Eot_angles.delta_psi() )
71
+ end
72
+
73
+ it 'expected 0.016702468499021204 from Eot_angles.eccentricity_Earth()? ' do
74
+ assert_equal( 0.016702468499021204, Eot_angles.eccentricity_Earth() )
75
+ end
76
+
77
+ it 'expected 3.441804334746474e-05 from Eot_angles.eq_of_equinox()? ' do
78
+ assert_equal( 3.441804334746474e-05, Eot_angles.eq_of_equinox() )
79
+ end
80
+
81
+ it 'expected -0.019617575867333148 from Eot_angles.eot()? ' do
82
+ assert_equal( -0.019617575867333148, Eot_angles.eot() )
83
+ end
84
+
85
+ it 'expected 2.5101912804141424 from Eot_angles.gml_Sun()? ' do
86
+ assert_equal( 2.5101912804141424, Eot_angles.gml_Sun() )
87
+ end
88
+
89
+ it 'expected 1.9143229567859146 from Eot_angles.ha_Sun()? ' do
90
+ assert_equal( 1.9143229567859146, Eot_angles.ha_Sun() )
91
+ end
92
+
93
+ it 'expected 3.8508003966038915 from Eot_angles.ma_Sun()? ' do
94
+ assert_equal( 3.8508003966038915, Eot_angles.ma_Sun( ) )
95
+ end
96
+
97
+ it 'expected 2.510089864980358 from Eot_angles.ml_Aries()? ' do
98
+ assert_equal( 2.510089864980358, Eot_angles.ml_Aries() )
99
+ end
100
+
101
+ it 'expected 0.40905940254265843 from Eot_angles.mo_Earth()? ' do
102
+ assert_equal( 0.40905940254265843, Eot_angles.mo_Earth() )
103
+ end
104
+
105
+ it 'expected -2.7528817371494685 from Eot_angles.omega()? ' do
106
+ assert_equal( -2.7528817371494685, Eot_angles.omega() )
107
+ end
108
+
109
+ it 'expected 2.5297411654316497 from Eot_angles.ra_Sun()? ' do
110
+ assert_equal( 2.5297411654316497, Eot_angles.ra_Sun() )
111
+ end
112
+
113
+ it 'expected 0.6074784519729512 from Eot_angles.sine_al_Sun()? ' do
114
+ assert_equal( 0.6074784519729512, Eot_angles.sine_al_Sun() )
115
+ end
116
+
117
+ it 'expected 0.6074246812917259 from Eot_angles.sine_tl_Sun()? ' do
118
+ assert_equal( 0.6074246812917259, Eot_angles.sine_tl_Sun() )
119
+ end
120
+
121
+ it 'expected 3.8293871468831893 from Eot_angles.ta_Sun()? ' do
122
+ assert_equal( 3.8293871468831893, Eot_angles.ta_Sun() )
123
+ end
124
+
125
+ it 'expected 2.5101242776531474 from Eot_angles.tl_Aries()? ' do
126
+ assert_equal( 2.5101242776531474, Eot_angles.tl_Aries() )
127
+ end
128
+
129
+ it 'expected 2.48877803069344 from Eot_angles.tl_Sun()? ' do
130
+ assert_equal( 2.48877803069344, Eot_angles.tl_Sun() )
131
+ end
132
+
133
+ it 'expected 0.40901870461547685 from Eot_angles.to_Earth()? ' do
134
+ assert_equal( 0.40901870461547685, Eot_angles.to_Earth() )
135
+ end
136
+ end
137
+
138
+
139
+
140
+ describe 'Tests ajd of 2455055.5 ' do
141
+
142
+ before(:each) do
143
+ Eot_angles.ajd = 2455055.0
144
+ ajd = Eot_angles.ajd
145
+ # check date for this ajd when needed.
146
+ Eot_angles.date = Eot_angles.ajd_to_datetime(ajd)
147
+ end
148
+
149
+ it 'expected 2455055.0, from Eot_angles.' do
150
+ assert_equal( 2455055.0, Eot_angles.ajd )
151
+ end
152
+
153
+ it 'expected "2009-08-11T12:00:00+00:00", from Eot_angles.date.to_s' do
154
+ assert_equal( "2009-08-11T12:00:00+00:00", Eot_angles.date.to_s )
155
+ end
156
+
157
+ it 'expected 3.7871218188949207, from Eot_angles.' do
158
+ assert_equal( 3.7871218188949207, Eot_angles.ma )
159
+ end
160
+
161
+ it 'expected 2.4252140645725033 from Eot_angles.al_Sun()? ' do
162
+ assert_equal( 2.4252140645725033, Eot_angles.al_Sun() )
163
+ end
164
+
165
+ it 'expected -0.019768413456709915 from Eot_angles.center()? ' do
166
+ assert_equal( -0.019768413456709915, Eot_angles.center() )
167
+ end
168
+
169
+ it 'expected -0.7541886969975007 from Eot_angles.cosine_al_Sun()? ' do
170
+ assert_equal( -0.7541886969975007, Eot_angles.cosine_al_Sun() )
171
+ end
172
+
173
+ it 'expected -0.7542060769936684 from Eot_angles.cosine_tl_Sun()? ' do
174
+ assert_equal( -0.7542060769936684, Eot_angles.cosine_tl_Sun() )
175
+ end
176
+
177
+ it 'expected 0.9174818088112336 from Eot_angles.cosine_to_Earth()? ' do
178
+ assert_equal( 0.9174818088112336, Eot_angles.cosine_to_Earth() )
179
+ end
180
+
181
+ it 'expected 0.26426912722944046 from Eot_angles.dec_Sun()? ' do
182
+ assert_equal( 0.26426912722944046, Eot_angles.dec_Sun() )
183
+ end
184
+
185
+ it 'expected 2.2661506700250296e-05 from Eot_angles.delta_epsilon()? ' do
186
+ assert_equal( 2.2661506700250296e-05, Eot_angles.delta_epsilon() )
187
+ end
188
+
189
+ it 'expected -0.04234904897476355 from Eot_angles.delta_oblique()? ' do
190
+ assert_equal( -0.04234904897476355, Eot_angles.delta_oblique() )
191
+ end
192
+
193
+ it 'expected 0.019768413456709766 from Eot_angles.delta_orbit()? ' do
194
+ assert_equal( 0.019768413456709766, Eot_angles.delta_orbit() )
195
+ end
196
+
197
+ it 'expected 7.639341522992976e-05 from Eot_angles.delta_psi()? ' do
198
+ assert_equal( 7.639341522992976e-05, Eot_angles.delta_psi() )
199
+ end
200
+
201
+ it 'expected 0.016704576164208475 from Eot_angles.eccentricity_Earth()? ' do
202
+ assert_equal( 0.016704576164208475, Eot_angles.eccentricity_Earth() )
203
+ end
204
+
205
+ it 'expected 7.00895687864236e-05 from Eot_angles.eq_of_equinox()? ' do
206
+ assert_equal( 7.00895687864236e-05, Eot_angles.eq_of_equinox() )
207
+ end
208
+
209
+ it 'expected -0.022580635518053782 from Eot_angles.eot()? ' do
210
+ assert_equal( -0.022580635518053782, Eot_angles.eot() )
211
+ end
212
+
213
+ it 'expected 2.445008945789877 from Eot_angles.gml_Sun()? ' do
214
+ assert_equal( 2.445008945789877, Eot_angles.gml_Sun() )
215
+ end
216
+
217
+ it 'expected 1.9434600427973594 from Eot_angles.ha_Sun()? ' do
218
+ assert_equal( 1.9434600427973594, Eot_angles.ha_Sun() )
219
+ end
220
+
221
+ it 'expected 3.7871218188949207 from Eot_angles.ma_Sun()? ' do
222
+ assert_equal( 3.7871218188949207, Eot_angles.ma_Sun() )
223
+ end
224
+
225
+ it 'expected 2.444907382260759 from Eot_angles.ml_Aries()? ' do
226
+ assert_equal( 2.444907382260759, Eot_angles.ml_Aries() )
227
+ end
228
+
229
+ it 'expected 0.4090707793981491 from Eot_angles.mo_Earth()? ' do
230
+ assert_equal( 0.4090707793981491, Eot_angles.mo_Earth() )
231
+ end
232
+
233
+ it 'expected -1.0615640635268548 from Eot_angles.omega()? ' do
234
+ assert_equal( -1.0615640635268548, Eot_angles.omega() )
235
+ end
236
+
237
+ it 'expected 2.467563113547267 from Eot_angles.ra_Sun()? ' do
238
+ assert_equal( 2.467563113547267, Eot_angles.ra_Sun() )
239
+ end
240
+
241
+ it 'expected 0.6566577566139093 from Eot_angles.sine_al_Sun()? ' do
242
+ assert_equal( 0.6566577566139093, Eot_angles.sine_al_Sun() )
243
+ end
244
+
245
+ it 'expected 0.6566377946979757 from Eot_angles.sine_tl_Sun()? ' do
246
+ assert_equal( 0.6566377946979757, Eot_angles.sine_tl_Sun() )
247
+ end
248
+
249
+ it 'expected 3.767353405438211 from Eot_angles.ta_Sun()? ' do
250
+ assert_equal( 3.767353405438211, Eot_angles.ta_Sun() )
251
+ end
252
+
253
+ it 'expected 2.4449774607872907 from Eot_angles.tl_Aries()? ' do
254
+ assert_equal( 2.4449774607872907, Eot_angles.tl_Aries() )
255
+ end
256
+
257
+ it 'expected 2.4252405323331674 from Eot_angles.tl_Sun()? ' do
258
+ assert_equal( 2.4252405323331674, Eot_angles.tl_Sun() )
259
+ end
260
+
261
+ it 'expected 0.4090934409048494 from Eot_angles.to_Earth()? ' do
262
+ assert_equal( 0.4090934409048494, Eot_angles.to_Earth() )
263
+ end
264
+ end
@@ -0,0 +1,20 @@
1
+ # constants_spec.rb
2
+ #
3
+
4
+ require_relative 'spec_config'
5
+
6
+ lib = File.expand_path('../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+ require 'eot'
9
+
10
+ describe "Equation of Time constants." do
11
+
12
+ it "01 require 'eot' should find all constants." do
13
+ assert_equal 24.0, Eot::DAY_HOURS
14
+ assert_equal 1440.0, Eot::DAY_MINUTES
15
+ assert_equal 86400.0, Eot::DAY_SECONDS
16
+ assert_equal 86400.0 * 1.0e+6, Eot::DAY_USECS
17
+ assert_equal 57.29577951308232, Eot::R2D
18
+ assert_equal 0.017453292519943295, Eot::D2R
19
+ end
20
+ end
@@ -0,0 +1,110 @@
1
+ # displays_spec.rb
2
+ #
3
+
4
+ require_relative 'spec_config'
5
+
6
+ lib = File.expand_path('../../../lib', __FILE__)
7
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
8
+ require 'eot'
9
+
10
+ Eot_displays = Eot.new
11
+
12
+ describe 'Eot displays using ajd of 2456885.0' do
13
+
14
+ before(:each) do
15
+ Eot_displays.ajd = 2456885.0
16
+ ajd = Eot_displays.ajd
17
+ # check date for this ajd when needed.
18
+ Eot_displays.date = Eot_displays.ajd_to_datetime(ajd)
19
+ end
20
+
21
+ it 'expected 2456885.0 for Eot_displays.ajd'do
22
+ assert_equal 2456885.0, Eot_displays.ajd
23
+ end
24
+
25
+ it 'expected "2014-08-15T12:00:00+00:00", returned by Eot_displays.date.to_s' do
26
+ assert_equal "2014-08-15T12:00:00+00:00", Eot_displays.date.to_s
27
+ end
28
+
29
+ it 'expected 3.8508003966038915, returned by Eot_displays.' do
30
+ assert_equal 3.8508003966038915, Eot_displays.ma
31
+ end
32
+
33
+ it 'expected "+000:00:00.000" returned by Eot_displays.degrees_to_s() ' do
34
+ assert_equal "+000:00:00.000", Eot_displays.degrees_to_s()
35
+ assert_equal "+000:00:00.000", Eot_displays.degrees_to_s(nil)
36
+ assert_equal "+000:00:00.000", Eot_displays.degrees_to_s(0)
37
+ end
38
+
39
+ it 'expected "+142:35:33.356" returned by Eot_displays.string_al_Sun() ' do
40
+ assert_equal "+142:35:33.356", Eot_displays.string_al_Sun()
41
+ end
42
+
43
+ it 'expected "12:00:00" returned by Eot_displays.string_day_fraction_to_time() ' do
44
+ assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time()
45
+ assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time(nil)
46
+ assert_equal "12:00:00", Eot_displays.string_day_fraction_to_time(0)
47
+ end
48
+
49
+ it 'expected "+013:58:51.521" returned by Eot_displays.string_dec_Sun() ' do
50
+ assert_equal "+013:58:51.521", Eot_displays.string_dec_Sun()
51
+ end
52
+
53
+ it 'expected "-04m, 29.2s" returned by Eot_displays.string_eot() ' do
54
+ assert_equal "-04m, 29.2s", Eot_displays.string_eot()
55
+ end
56
+
57
+ it 'expected "2000-01-01" returned by Eot_displays.string_jd_to_date() ' do
58
+ assert_equal "2000-01-01", Eot_displays.string_jd_to_date()
59
+ assert_equal "2000-01-01", Eot_displays.string_jd_to_date(nil)
60
+ assert_equal "2000-01-01", Eot_displays.string_jd_to_date(0)
61
+ end
62
+
63
+ it 'expected "2014-08-15" returned by Eot_displays.jd_to_date_string(Eot_displays.ajd)? ' do
64
+ assert_equal "2014-08-15", Eot_displays.jd_to_date_string(Eot_displays.ajd)
65
+ end
66
+
67
+ it 'expected "+220:38:04.597" returned by Eot_displays.string_ma_Sun() ' do
68
+ assert_equal "+220:38:04.597", Eot_displays.string_ma_Sun()
69
+ end
70
+
71
+ it 'expected "+144:56:36.571" returned by Eot_displays.string_ra_Sun() ' do
72
+ assert_equal "+144:56:36.571", Eot_displays.string_ra_Sun()
73
+ end
74
+
75
+ it 'expected "+219:24:27.797" returned by Eot_displays.string_ta_Sun() ' do
76
+ assert_equal "+219:24:27.797", Eot_displays.string_ta_Sun()
77
+ end
78
+
79
+ it 'expected "12:00:00.000" returned by Eot_displays.string_time() ' do
80
+ assert_equal "12:00:00.000", Eot_displays.string_time()
81
+ assert_equal "12:00:00.000", Eot_displays.string_time(nil)
82
+ assert_equal "12:00:00.000", Eot_displays.string_time(0)
83
+ end
84
+
85
+ it 'expected "12:00:00.000" returned by Eot_displays.display_time_string(Eot_adisplays.date)? ' do
86
+ assert_equal "12:00:00.000", Eot_displays.display_time_string(Eot_displays.date)
87
+ end
88
+
89
+ it 'expected "+142:35:47.318" returned by Eot_displays.string_tl_Sun() ' do
90
+ assert_equal "+142:35:47.318", Eot_displays.string_tl_Sun()
91
+ end
92
+
93
+ it 'expected "+023:26:06.163" returned by Eot_displays.string_to_Earth() ' do
94
+ assert_equal "+023:26:06.163", Eot_displays.string_to_Earth()
95
+ end
96
+
97
+ end
98
+
99
+ describe 'Eot displays explicit values' do
100
+
101
+ it 'expected "16:40:40.800" returned by Eot_displays.string_time(16.6780) ' do
102
+ assert_equal "16:40:40.800", Eot_displays.string_time(16.6780)
103
+ end
104
+
105
+ it 'expected "17:59:16.800" returned by Eot_displays.string_time(17988) ' do
106
+ Eot_displays.date= Date.today.to_s
107
+ assert_equal "17:59:16.800", Eot_displays.string_time(17.988)
108
+ end
109
+
110
+ end