# -*- coding: utf-8 -*- =begin Copyright (C) 2014 Takashi SUGA You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive. =end module MiniTest class Vietnamese < MiniTest::TestCase Sample1 = [%w(紹明2.1.1 1139-02-08 紹明02(1139).01.01), %w(ベトナム?LY=VSL::李朝::紹明2.1.1 1138-02-19 ベトナム?LY=VSL::李朝::紹明02(1138).01.01), %w(嗣徳2.8.1 1849-09-17 ベトナム::阮朝::嗣徳02(1849).08.01), %w(ベトナム?LY=VSL&DN=LDNK::阮朝::嗣徳2.8.1 1849-09-16 ベトナム?LY=VSL&DN=LDNK::阮朝::嗣徳02(1849).08.01), %w(ベトナム::後期黎朝::福泰2.7.1 1644-08-02 ベトナム::後期黎朝::福泰02(1644).07.01), %w(ベトナム::広南::阮福瀾10.7.1 1644-08-03 ベトナム::広南::阮福瀾10(1644).07.01), %w(ベトナム::後期黎朝::慶徳4.9.1 1652-10-02 ベトナム::後期黎朝::慶徳04(1652).09.01), %w(ベトナム::広南::阮福瀕4.9.1 1652-10-03 ベトナム::広南::阮福瀕04(1652).09.01), %w(ベトナム::阮朝::建福1.1.31 1884-02-26 ベトナム::阮朝::建福01(1884).01.31)] Sample2 = [%w(1659-01- 1659-01-23), %w(1659-01= 1659-02-21), %w(1659-02- 1659-03-23), %w(1659-03- 1659-04-21), %w(1659-04- 1659-05-21), %w(1659-05- 1659-06-20), %w(1659-06- 1659-07-19), %w(1659-07- 1659-08-18), %w(1659-08- 1659-09-16), %w(1659-09- 1659-10-16), %w(1659-10- 1659-11-14), %w(1659-11- 1659-12-14), %w(1659-12- 1660-01-12), %w(1660-01- 1660-02-11), %w(1660-02- 1660-03-11), %w(1660-03- 1660-04-10), %w(1660-04- 1660-05-09), %w(1660-05- 1660-06-08), %w(1660-06- 1660-07-07), %w(1660-07- 1660-08-06), %w(1660-08- 1660-09-05), %w(1660-09- 1660-10-04), %w(1660-10- 1660-11-03), %w(1660-11- 1660-12-02), %w(1660-12- 1661-01-01), %w(1659-01- 1659-01-23), %w(1659-01= 1659-02-22), %w(1659-02- 1659-03-23), %w(1659-03- 1659-04-21), %w(1659-04- 1659-05-21), %w(1659-05- 1659-06-20), %w(1659-06- 1659-07-19), %w(1659-07- 1659-08-18), %w(1659-08- 1659-09-16), %w(1659-09- 1659-10-16), %w(1659-10- 1659-11-15), # 1659-11-14 ではない %w(1659-11- 1659-12-14), %w(1659-12- 1660-01-12), %w(1660-01- 1660-02-11), %w(1660-02- 1660-03-11), %w(1660-03- 1660-04-10), %w(1660-04- 1660-05-09), %w(1660-05- 1660-06-08), %w(1660-06- 1660-07-07), %w(1660-07- 1660-08-06), %w(1660-08- 1660-09-05), %w(1660-09- 1660-10-04), %w(1660-10- 1660-11-03), %w(1660-11- 1660-12-03), # 1660-12-02 ではない %w(1660-12- 1661-01-01)] def test_vietnamese_era When.CalendarEra('Vietnamese') When.CalendarEra('Vietnamese?LY=VSL') When.CalendarEra('Vietnamese?LY=VSL&DN=LDNK') Sample1.each do |sample| date = When.when?(sample[0]) assert_equal(sample[1..2], [date.to_date.to_s, date.to_s]) end end def test_vietnamese_date When.CalendarEra('Vietnamese') sample = Sample2 [1544, 1631].each do |epoch| calendar = When.Calendar('Vietnamese' + epoch.to_s) date = When.TemporalPosition(1659, 1, :frame=>calendar) 25.times do assert_equal(sample.shift, [date.to_s, date.to_date.to_s]) date = date.next end end end end end