ruby_lunardate 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ruby_lunardate.rb +1 -1
- data/test/test_ruby_lunardate.rb +18 -18
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3982761f8a047576b3f1fbef2665397a3986bd68
|
|
4
|
+
data.tar.gz: f05ea450e7dea591ce5b3f88f2c5bafa376db893
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 389adbfa69caf9e06ebda5aaec0f2961c2bf7705eacca751e8f0f186d736d67099b535816b5f23655cebe70af14b5030d55b45bae26604b03c11cfec9552c318
|
|
7
|
+
data.tar.gz: 390716a6d4caa79388984318333bb49dd8ce5c56617eaa3025749d7ba28522e853178b3c3cf3f6e3754e0944f3e7ddb4e6798d31e1df0e2751f9e82909ef0d9a
|
data/lib/ruby_lunardate.rb
CHANGED
|
@@ -211,7 +211,7 @@ class LunarDate
|
|
|
211
211
|
return (solar_date - @start_date).to_i
|
|
212
212
|
end
|
|
213
213
|
|
|
214
|
-
def self.
|
|
214
|
+
def self.from_solar(year, month, day)
|
|
215
215
|
solar_date = Date.new(year, month, day)
|
|
216
216
|
days = self.get_dates(solar_date)
|
|
217
217
|
return self.lunar_from_days(days, self)
|
data/test/test_ruby_lunardate.rb
CHANGED
|
@@ -2,8 +2,8 @@ require 'minitest/autorun'
|
|
|
2
2
|
require 'ruby_lunardate'
|
|
3
3
|
|
|
4
4
|
class TestRubyLunarDate < Minitest::Test
|
|
5
|
-
def
|
|
6
|
-
date = LunarDate.
|
|
5
|
+
def test_from_solar_19790922_from_solar_19791111
|
|
6
|
+
date = LunarDate.from_solar(1979, 11, 11)
|
|
7
7
|
assert_equal(date.year, 1979)
|
|
8
8
|
assert_equal(date.month, 9)
|
|
9
9
|
assert_equal(date.day, 22)
|
|
@@ -15,8 +15,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
15
15
|
assert_equal(lunar_date.day, 11)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def
|
|
19
|
-
date = LunarDate.
|
|
18
|
+
def test_from_solar_19000101_from_solar_19000131
|
|
19
|
+
date = LunarDate.from_solar(1900, 1, 31)
|
|
20
20
|
assert_equal(date.year, 1900)
|
|
21
21
|
assert_equal(date.month, 1)
|
|
22
22
|
assert_equal(date.day, 1)
|
|
@@ -28,8 +28,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
28
28
|
assert_equal(lunar_date.day, 31)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def
|
|
32
|
-
date = LunarDate.
|
|
31
|
+
def test_from_solar_19020101_from_solar_19020208
|
|
32
|
+
date = LunarDate.from_solar(1902, 2, 8)
|
|
33
33
|
assert_equal(date.year, 1902)
|
|
34
34
|
assert_equal(date.month, 1)
|
|
35
35
|
assert_equal(date.day, 1)
|
|
@@ -41,8 +41,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
41
41
|
assert_equal(lunar_date.day, 8)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def
|
|
45
|
-
date = LunarDate.
|
|
44
|
+
def test_from_solar_19040101_from_solar_19040216
|
|
45
|
+
date = LunarDate.from_solar(1904, 2, 16)
|
|
46
46
|
assert_equal(date.year, 1904)
|
|
47
47
|
assert_equal(date.month, 1)
|
|
48
48
|
assert_equal(date.day, 1)
|
|
@@ -54,8 +54,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
54
54
|
assert_equal(lunar_date.day, 16)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
def
|
|
58
|
-
date = LunarDate.
|
|
57
|
+
def test_from_solar_20140930_from_solar_20141023
|
|
58
|
+
date = LunarDate.from_solar(2014, 10, 23)
|
|
59
59
|
assert_equal(date.year, 2014)
|
|
60
60
|
assert_equal(date.month, 9)
|
|
61
61
|
assert_equal(date.day, 30)
|
|
@@ -67,8 +67,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
67
67
|
assert_equal(lunar_date.day, 23)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
def
|
|
71
|
-
date = LunarDate.
|
|
70
|
+
def test_from_solar_19870621_from_solar_19870815_leap
|
|
71
|
+
date = LunarDate.from_solar(1987, 8, 15)
|
|
72
72
|
assert_equal(date.year, 1987)
|
|
73
73
|
assert_equal(date.month, 6)
|
|
74
74
|
assert_equal(date.day, 21)
|
|
@@ -81,8 +81,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# 3rd MONTHTYPE test case
|
|
84
|
-
def
|
|
85
|
-
date = LunarDate.
|
|
84
|
+
def test_from_solar_20171025_from_solar_20171212
|
|
85
|
+
date = LunarDate.from_solar(2017, 12, 12)
|
|
86
86
|
assert_equal(date.year, 2017)
|
|
87
87
|
assert_equal(date.month, 10)
|
|
88
88
|
assert_equal(date.day, 25)
|
|
@@ -95,8 +95,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# 4th MONTHTYPE test case
|
|
98
|
-
def
|
|
99
|
-
date = LunarDate.
|
|
98
|
+
def test_from_solar_19870729_from_solar_19870921
|
|
99
|
+
date = LunarDate.from_solar(1987, 9, 21)
|
|
100
100
|
assert_equal(date.year, 1987)
|
|
101
101
|
assert_equal(date.month, 7)
|
|
102
102
|
assert_equal(date.day, 29)
|
|
@@ -109,8 +109,8 @@ class TestRubyLunarDate < Minitest::Test
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
# 5th MONTHTYPE test case
|
|
112
|
-
def
|
|
113
|
-
date = LunarDate.
|
|
112
|
+
def test_from_solar_19551119_from_solar_19560101
|
|
113
|
+
date = LunarDate.from_solar(1956, 1, 1)
|
|
114
114
|
assert_equal(date.year, 1955)
|
|
115
115
|
assert_equal(date.month, 11)
|
|
116
116
|
assert_equal(date.day, 19)
|