test/test/region/chinese.rb in when_exe-0.3.7 vs test/test/region/chinese.rb in when_exe-0.3.8
- old
+ new
@@ -7,10 +7,21 @@
=end
module MiniTest
class Chinese < MiniTest::TestCase
+ def test_chinese_table
+ assert_equal({1677=>{"iJ"=>"Ij"},
+ 1698=>{"jK"=>"Jk"},
+ 1709=>{"aB"=>"Ab", "jK"=>"Jk"},
+ 1727=>{"cC"=>"Cc"},
+ 1730=>{"Cd"=>"cD"},
+ 1751=>{"Jk"=>"jK"},
+ 1778=>{"Cd"=>"cD"},
+ 1841=>{"kL"=>"Kl"}}, When.Calendar('Korean').verify(When.Calendar('Chinese1645'), 1654..1911))
+ end
+
def test_chinese_date
emd = When.Resource('_c:EphemerisBasedSolar?time_basis=+09:00')
date = When.when?('2009-01-01', {:frame=>emd})
[
@@ -108,11 +119,11 @@
end
def test_chinese_epoch
date = When.when?('天保2.10.01')
assert_equal([2390126, "天保02(1831).10.01", "神無月"],
- [date.to_i, date.to_s, date.name('Month')])
+ [date.to_i, date.to_s, date.name('Month')/'alias'])
assert_equal("1831-11-04", (When.Calendar('Gregorian') ^ When.when?('天保02.10.01')).to_s)
#=begin
date = When.when?('天保2.10.01', {:count=>2})
assert_equal([1926999, "天保02(0563).10.01", "十月"],
@@ -130,11 +141,11 @@
When::era('天保').map {|v| v.parent.label}) # v.iri
assert_raises(ArgumentError) { When.when?('天保3(0563).10.01') }
date = When.when?('始皇帝26*10.01')
- assert_equal([1640641, "始皇帝26(-220)*10.01", "十月"],
- [date.to_i, date.to_s, date.name('Month')])
+ assert_equal([1640641, 1640641, "始皇帝26(-220)*10.01", "十月"],
+ [date.to_i, date.floor(When::YEAR).to_i, date.to_s, date.name('Month')])
cc_221 = When.Resource('_c:Chinese_221')
[
["-220*10-01", 1640641, "-00220*10-01", "十月"],
["-220*11-01", 1640671, "-00220*11-01", "十一月"],