v1.3.3 优化八字转阳历;修复少量农历年的月份错误;新增农历年天数和当年月份列表。
This commit is contained in:
@@ -16,7 +16,7 @@ lunar是一款无第三方依赖的公历(阳历)、农历(阴历、老黄历)
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ lunar is a calendar library for Solar and Chinese Lunar.
|
||||
<dependency>
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
||||
<groupId>cn.6tail</groupId>
|
||||
<artifactId>lunar</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.3.2</version>
|
||||
<version>1.3.3</version>
|
||||
<name>${project.groupId}:${project.artifactId}</name>
|
||||
<url>https://github.com/6tail/lunar-java</url>
|
||||
<description>a calendar library for Solar and Chinese Lunar</description>
|
||||
|
||||
@@ -197,9 +197,7 @@ public class Lunar {
|
||||
public Lunar(Solar solar) {
|
||||
LunarYear ly = LunarYear.fromYear(solar.getYear());
|
||||
for (LunarMonth m : ly.getMonths()) {
|
||||
// 初一
|
||||
Solar firstDay = Solar.fromJulianDay(m.getFirstJulianDay());
|
||||
int days = solar.subtract(firstDay);
|
||||
int days = solar.subtract(Solar.fromJulianDay(m.getFirstJulianDay()));
|
||||
if (days < m.getDayCount()) {
|
||||
year = m.getYear();
|
||||
month = m.getMonth();
|
||||
@@ -2899,8 +2897,7 @@ public class Lunar {
|
||||
start = Solar.fromYmd(start.getYear(), start.getMonth(), start.getDay());
|
||||
}
|
||||
|
||||
Solar end = Solar.fromYmd(start.getYear(), start.getMonth(), start.getDay());
|
||||
end = end.next(81);
|
||||
Solar end = Solar.fromYmd(start.getYear(), start.getMonth(), start.getDay()).next(81);
|
||||
|
||||
if (current.isBefore(start) || !current.isBefore(end)) {
|
||||
return null;
|
||||
|
||||
@@ -134,7 +134,9 @@ public class LunarYear {
|
||||
// 冬至前的初一
|
||||
double w = ShouXingUtil.calcShuo(jq[0]);
|
||||
if (w > jq[0]) {
|
||||
w -= 29.5306;
|
||||
if (currentYear != 41 && currentYear != 193 && currentYear != 288 && currentYear != 345 && currentYear != 918 && currentYear != 1013) {
|
||||
w -= 29.5306;
|
||||
}
|
||||
}
|
||||
// 递推每月初一
|
||||
for (int i = 0, j = hs.length; i < j; i++) {
|
||||
@@ -145,39 +147,41 @@ public class LunarYear {
|
||||
dayCounts[i] = (int) (hs[i + 1] - hs[i]);
|
||||
}
|
||||
|
||||
Integer currentYearLeap = LEAP.get(currentYear);
|
||||
if (null == currentYearLeap) {
|
||||
currentYearLeap = -1;
|
||||
if (hs[13] <= jq[24]) {
|
||||
int i = 1;
|
||||
while (hs[i + 1] > jq[2 * i] && i < 13) {
|
||||
i++;
|
||||
}
|
||||
currentYearLeap = i;
|
||||
}
|
||||
}
|
||||
|
||||
int prevYear = currentYear - 1;
|
||||
Integer prevYearLeap = LEAP.get(prevYear);
|
||||
prevYearLeap = null == prevYearLeap ? -1 : prevYearLeap - 12;
|
||||
|
||||
int leapYear = -1;
|
||||
int leapIndex = -1;
|
||||
|
||||
Integer leap = LEAP.get(currentYear);
|
||||
if (null == leap) {
|
||||
leap = LEAP.get(prevYear);
|
||||
if (null == leap) {
|
||||
if (hs[13] <= jq[24]) {
|
||||
int i = 1;
|
||||
while (hs[i + 1] > jq[2 * i] && i < 13) {
|
||||
i++;
|
||||
}
|
||||
leapYear = currentYear;
|
||||
leapIndex = i;
|
||||
}
|
||||
} else {
|
||||
leapYear = prevYear;
|
||||
leapIndex = leap - 12;
|
||||
}
|
||||
} else {
|
||||
leapYear = currentYear;
|
||||
leapIndex = leap;
|
||||
}
|
||||
|
||||
int y = prevYear;
|
||||
int m = 11;
|
||||
for (int i = 0, j = dayCounts.length; i < j; i++) {
|
||||
int cm = m;
|
||||
boolean isNextLeap = false;
|
||||
if (y == currentYear && i == currentYearLeap) {
|
||||
if (y == leapYear && i == leapIndex) {
|
||||
cm = -cm;
|
||||
} else if (y == prevYear && i == prevYearLeap) {
|
||||
cm = -cm;
|
||||
}
|
||||
if (y == currentYear && i + 1 == currentYearLeap) {
|
||||
isNextLeap = true;
|
||||
} else if (y == prevYear && i + 1 == prevYearLeap) {
|
||||
isNextLeap = true;
|
||||
}
|
||||
this.months.add(new LunarMonth(y, cm, dayCounts[i], hs[i] + Solar.J2000));
|
||||
if (!isNextLeap) {
|
||||
if (y != leapYear || i + 1 != leapIndex) {
|
||||
m++;
|
||||
}
|
||||
if (m == 13) {
|
||||
@@ -196,6 +200,35 @@ public class LunarYear {
|
||||
return year;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总天数
|
||||
* @return 天数
|
||||
*/
|
||||
public int getDayCount() {
|
||||
int n = 0;
|
||||
for (LunarMonth m : months) {
|
||||
if (m.getYear() == year) {
|
||||
n += m.getDayCount();
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当年的农历月们
|
||||
*
|
||||
* @return 农历月们
|
||||
*/
|
||||
public List<LunarMonth> getMonthsInYear() {
|
||||
List<LunarMonth> l = new ArrayList<LunarMonth>();
|
||||
for (LunarMonth m : months) {
|
||||
if (m.getYear() == year) {
|
||||
l.add(m);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取农历月们
|
||||
*
|
||||
|
||||
@@ -92,6 +92,9 @@ public class Solar {
|
||||
if (day < 1 || day > 31) {
|
||||
throw new IllegalArgumentException(String.format("wrong day %d", day));
|
||||
}
|
||||
if (hour < 0 || hour > 23) {
|
||||
throw new IllegalArgumentException(String.format("wrong hour %d", hour));
|
||||
}
|
||||
if (minute < 0 || minute > 59) {
|
||||
throw new IllegalArgumentException(String.format("wrong minute %d", minute));
|
||||
}
|
||||
@@ -296,31 +299,37 @@ public class Solar {
|
||||
offsetYear += 60;
|
||||
}
|
||||
int startYear = today.getYear() - offsetYear - 1;
|
||||
while (true) {
|
||||
int minYear = baseYear - 2;
|
||||
while (startYear >= minYear) {
|
||||
years.add(startYear);
|
||||
startYear -= 60;
|
||||
if (startYear < baseYear) {
|
||||
years.add(baseYear);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int hour = 0;
|
||||
List<Integer> hours = new ArrayList<Integer>(2);
|
||||
String timeZhi = timeGanZhi.substring(1);
|
||||
for(int i = 0, j = LunarUtil.ZHI.length; i < j; i++){
|
||||
if(LunarUtil.ZHI[i].equals(timeZhi)){
|
||||
hour = (i - 1) * 2;
|
||||
hours.add((i - 1) * 2);
|
||||
}
|
||||
}
|
||||
for (Integer y : years) {
|
||||
inner: for (int x = 0; x < 3; x++) {
|
||||
int year = y + x;
|
||||
Solar solar = fromYmdHms(year, 1, 1, hour, 0, 0);
|
||||
while (solar.getYear() == year) {
|
||||
if ("子".equals(timeZhi)) {
|
||||
hours.add(23);
|
||||
}
|
||||
for (int hour: hours) {
|
||||
for (Integer y : years) {
|
||||
int maxYear = y + 3;
|
||||
int year = y;
|
||||
int month = 11;
|
||||
if (year < baseYear) {
|
||||
year = baseYear;
|
||||
month = 1;
|
||||
}
|
||||
Solar solar = fromYmdHms(year, month, 1, hour, 0, 0);
|
||||
while (solar.getYear() <= maxYear) {
|
||||
Lunar lunar = solar.getLunar();
|
||||
String dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
|
||||
if (lunar.getYearInGanZhiExact().equals(yearGanZhi) && lunar.getMonthInGanZhiExact().equals(monthGanZhi) && dgz.equals(dayGanZhi) && lunar.getTimeInGanZhi().equals(timeGanZhi)) {
|
||||
l.add(solar);
|
||||
break inner;
|
||||
break;
|
||||
}
|
||||
solar = solar.next(1);
|
||||
}
|
||||
@@ -722,8 +731,7 @@ public class Solar {
|
||||
* @return 阳历
|
||||
*/
|
||||
public Solar nextMonth(int months) {
|
||||
SolarMonth month = SolarMonth.fromYm(year, this.month);
|
||||
month = month.next(months);
|
||||
SolarMonth month = SolarMonth.fromYm(year, this.month).next(months);
|
||||
int y = month.getYear();
|
||||
int m = month.getMonth();
|
||||
int d = day;
|
||||
@@ -803,7 +811,7 @@ public class Solar {
|
||||
Solar solar = fromYmdHms(year, month, day, hour, minute, second);
|
||||
if (days != 0) {
|
||||
int rest = Math.abs(days);
|
||||
int add = days < 1 ? -1 : 1;
|
||||
int add = days < 0 ? -1 : 1;
|
||||
while (rest > 0) {
|
||||
solar = solar.next(add);
|
||||
boolean work = true;
|
||||
|
||||
@@ -214,10 +214,8 @@ public class SolarWeek {
|
||||
week = new SolarWeek(solar.getYear(), solar.getMonth(), solar.getDay(), start);
|
||||
}
|
||||
} else {
|
||||
int size = SolarUtil.getWeeksOfMonth(week.getYear(), week.getMonth(), start);
|
||||
if (size == index) {
|
||||
Solar firstDay = week.getFirstDay();
|
||||
Solar lastDay = firstDay.next(6);
|
||||
if (SolarUtil.getWeeksOfMonth(week.getYear(), week.getMonth(), start) == index) {
|
||||
Solar lastDay = week.getFirstDay().next(6);
|
||||
week = new SolarWeek(lastDay.getYear(), lastDay.getMonth(), lastDay.getDay(), start);
|
||||
weekMonth = week.getMonth();
|
||||
} else {
|
||||
|
||||
@@ -90,12 +90,11 @@ public class HolidayUtil {
|
||||
private static List<Holiday> findHolidaysForward(String key){
|
||||
List<Holiday> l = new ArrayList<Holiday>();
|
||||
String s = findForward(key);
|
||||
if(null==s) {
|
||||
return l;
|
||||
}
|
||||
while(s.startsWith(key)){
|
||||
l.add(buildHolidayForward(s));
|
||||
s = s.substring(SIZE);
|
||||
if(null!=s) {
|
||||
while (s.startsWith(key)) {
|
||||
l.add(buildHolidayForward(s));
|
||||
s = s.substring(SIZE);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@@ -103,14 +102,12 @@ public class HolidayUtil {
|
||||
private static List<Holiday> findHolidaysBackward(String key){
|
||||
List<Holiday> l = new ArrayList<Holiday>();
|
||||
String s = findBackward(key);
|
||||
if(null==s) {
|
||||
return l;
|
||||
if(null!=s) {
|
||||
while (s.endsWith(key)) {
|
||||
l.add(0, buildHolidayBackward(s));
|
||||
s = s.substring(0, s.length() - SIZE);
|
||||
}
|
||||
}
|
||||
while(s.endsWith(key)){
|
||||
l.add(buildHolidayBackward(s));
|
||||
s = s.substring(0,s.length()-SIZE);
|
||||
}
|
||||
Collections.reverse(l);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class LunarUtil{
|
||||
public static final String[] WU_HOU = {"蚯蚓结","麋角解","水泉动","雁北乡","鹊始巢","雉始雊","鸡始乳","征鸟厉疾","水泽腹坚","东风解冻","蛰虫始振","鱼陟负冰","獭祭鱼","候雁北","草木萌动","桃始华","仓庚鸣","鹰化为鸠","玄鸟至","雷乃发声","始电","桐始华","田鼠化为鴽","虹始见","萍始生","鸣鸠拂奇羽","戴胜降于桑","蝼蝈鸣","蚯蚓出","王瓜生","苦菜秀","靡草死","麦秋至","螳螂生","鵙始鸣","反舌无声","鹿角解","蜩始鸣","半夏生","温风至","蟋蟀居壁","鹰始挚","腐草为萤","土润溽暑","大雨行时","凉风至","白露降","寒蝉鸣","鹰乃祭鸟","天地始肃","禾乃登","鸿雁来","玄鸟归","群鸟养羞","雷始收声","蛰虫坯户","水始涸","鸿雁来宾","雀入大水为蛤","菊有黄花","豺乃祭兽","草木黄落","蛰虫咸俯","水始冰","地始冻","雉入大水为蜃","虹藏不见","天气上升地气下降","闭塞而成冬","鹖鴠不鸣","虎始交","荔挺出"};
|
||||
/** 天干 */
|
||||
public static final String[] GAN = {"","甲","乙","丙","丁","戊","己","庚","辛","壬","癸"};
|
||||
/** 喜神方位,《喜神方位歌》:甲己在艮乙庚乾,丙辛坤位喜神安. 丁壬只在离宫坐,戊癸原在在巽间。 */
|
||||
/** 喜神方位,《喜神方位歌》:甲己在艮乙庚乾,丙辛坤位喜神安。丁壬只在离宫坐,戊癸原在在巽间。 */
|
||||
public static final String[] POSITION_XI = {"","艮","乾","坤","离","巽","艮","乾","坤","离","巽"};
|
||||
/** 阳贵方位,《阳贵神歌》:甲戊坤艮位,乙己是坤坎,庚辛居离艮,丙丁兑与乾,震巽属何日,壬癸贵神安。 */
|
||||
public static final String[] POSITION_YANG_GUI = {"","坤","坤","兑","乾","艮","坎","离","艮","震","巽"};
|
||||
@@ -33,7 +33,7 @@ public class LunarUtil{
|
||||
public static final String[] POSITION_FU = {"","巽","巽","震","震","坎","离","坤","坤","乾","兑"};
|
||||
/** 流派2《福神方位歌》:甲己正北是福神,丙辛西北乾宫存,乙庚坤位戊癸艮,丁壬巽上好追寻。 */
|
||||
public static final String[] POSITION_FU_2 = {"","坎","坤","乾","巽","艮","坎","坤","乾","巽","艮"};
|
||||
/** 财神方位,《财神方位歌》:甲乙东北是财神,丙丁向在西南寻,戊己正北坐方位, 庚辛正东去安身,壬癸原来正南坐,便是财神方位真。 */
|
||||
/** 财神方位,《财神方位歌》:甲乙东北是财神,丙丁向在西南寻,戊己正北坐方位,庚辛正东去安身,壬癸原来正南坐,便是财神方位真。 */
|
||||
public static final String[] POSITION_CAI = {"","艮","艮","坤","坤","坎","坎","震","震","离","离"};
|
||||
/** 年太岁方位 */
|
||||
public static final String[] POSITION_TAI_SUI_YEAR = {"坎","艮","艮","震","巽","巽","离","坤","坤","兑","坎","坎"};
|
||||
|
||||
@@ -365,4 +365,45 @@ public class BaZiTest {
|
||||
Assert.assertEquals("日柱", "戊子", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "甲寅", eightChar.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test14() {
|
||||
List<Solar> l = Solar.fromBaZi("癸卯","甲寅","癸丑","甲子", 2, 1843);
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("2023-02-24 23:00:00");
|
||||
expected.add("1843-02-08 23:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test15() {
|
||||
List<Solar> l = Solar.fromBaZi("己亥","丁丑","壬寅","戊申");
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("1960-01-15 16:00:00");
|
||||
expected.add("1900-01-29 16:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test16() {
|
||||
List<Solar> l = Solar.fromBaZi("己亥","丙子","癸酉","庚申");
|
||||
List<String> actual = new ArrayList<String>();
|
||||
for (Solar solar : l) {
|
||||
actual.add(solar.toYmdHms());
|
||||
}
|
||||
|
||||
List<String> expected = new ArrayList<String>();
|
||||
expected.add("1959-12-17 16:00:00");
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,4 +459,172 @@ public class LunarTest {
|
||||
Assert.assertEquals("1582-10-15", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test64() {
|
||||
Lunar lunar = Lunar.fromYmd(1518, 1, 1);
|
||||
Assert.assertEquals("1518-02-10", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test65() {
|
||||
Lunar lunar = Lunar.fromYmd(793, 1, 1);
|
||||
Assert.assertEquals("0793-02-15", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test66() {
|
||||
Lunar lunar = Lunar.fromYmd(2025, -6, 1);
|
||||
Assert.assertEquals("2025-07-25", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test67() {
|
||||
Lunar lunar = Lunar.fromYmd(2025, 6, 1);
|
||||
Assert.assertEquals("2025-06-25", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test68() {
|
||||
Lunar lunar = Lunar.fromYmd(193, 1, 1);
|
||||
Assert.assertEquals("0193-02-19", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test69() {
|
||||
Lunar lunar = Lunar.fromYmd(288, 1, 1);
|
||||
Assert.assertEquals("0288-02-19", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test70() {
|
||||
Lunar lunar = Lunar.fromYmd(755, 1, 1);
|
||||
Assert.assertEquals("0755-02-16", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test71() {
|
||||
Lunar lunar = Lunar.fromYmd(41, 1, 1);
|
||||
Assert.assertEquals("0041-02-20", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test72() {
|
||||
Lunar lunar = Lunar.fromYmd(57, 1, 1);
|
||||
Assert.assertEquals("0057-02-23", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test73() {
|
||||
Lunar lunar = Lunar.fromYmd(345, 1, 1);
|
||||
Assert.assertEquals("0345-02-18", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test74() {
|
||||
Lunar lunar = Lunar.fromYmd(459, 1, 1);
|
||||
Assert.assertEquals("0459-02-18", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test75() {
|
||||
Lunar lunar = Lunar.fromYmd(497, 1, 1);
|
||||
Assert.assertEquals("0497-02-18", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test76() {
|
||||
Lunar lunar = Lunar.fromYmd(516, 1, 1);
|
||||
Assert.assertEquals("0516-02-18", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test77() {
|
||||
Lunar lunar = Lunar.fromYmd(554, 1, 1);
|
||||
Assert.assertEquals("0554-02-18", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test78() {
|
||||
Lunar lunar = Lunar.fromYmd(698, 1, 1);
|
||||
Assert.assertEquals("0698-02-16", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test79() {
|
||||
Lunar lunar = Lunar.fromYmd(793, 1, 1);
|
||||
Assert.assertEquals("0793-02-15", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test80() {
|
||||
Lunar lunar = Lunar.fromYmd(918, 1, 1);
|
||||
Assert.assertEquals("0918-02-14", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test81() {
|
||||
Lunar lunar = Lunar.fromYmd(1013, 1, 1);
|
||||
Assert.assertEquals("1013-02-13", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test82() {
|
||||
Lunar lunar = Lunar.fromYmd(1051, 1, 1);
|
||||
Assert.assertEquals("1051-02-14", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test83() {
|
||||
Lunar lunar = Lunar.fromYmd(1070, 1, 1);
|
||||
Assert.assertEquals("1070-02-14", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test84() {
|
||||
Lunar lunar = Lunar.fromYmd(1127, 1, 1);
|
||||
Assert.assertEquals("1127-02-13", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test85() {
|
||||
Lunar lunar = Lunar.fromYmd(1146, 1, 1);
|
||||
Assert.assertEquals("1146-02-13", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test86() {
|
||||
Lunar lunar = Lunar.fromYmd(1165, 1, 1);
|
||||
Assert.assertEquals("1165-02-13", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test87() {
|
||||
Lunar lunar = Lunar.fromYmd(1423, 1, 1);
|
||||
Assert.assertEquals("1423-02-11", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test88() {
|
||||
Lunar lunar = Lunar.fromYmd(1442, 1, 1);
|
||||
Assert.assertEquals("1442-02-11", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test89() {
|
||||
Lunar lunar = Lunar.fromYmd(1461, 1, 1);
|
||||
Assert.assertEquals("1461-02-10", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test90() {
|
||||
Lunar lunar = Lunar.fromYmd(1556, 1, 1);
|
||||
Assert.assertEquals("1556-02-11", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test91() {
|
||||
Lunar lunar = Lunar.fromYmd(1537, 1, 1);
|
||||
Assert.assertEquals("1537-02-10", lunar.getSolar().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -139,4 +139,34 @@ public class YearTest {
|
||||
Assert.assertEquals("八运",year.getYun());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test18(){
|
||||
LunarYear year = new LunarYear(2023);
|
||||
Assert.assertEquals(384, year.getDayCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test19(){
|
||||
LunarYear year = new LunarYear(1517);
|
||||
Assert.assertEquals(384, year.getDayCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test20(){
|
||||
LunarYear year = new LunarYear(1518);
|
||||
Assert.assertEquals(355, year.getDayCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test21(){
|
||||
LunarYear year = new LunarYear(2022);
|
||||
Assert.assertEquals(355, year.getDayCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test22(){
|
||||
LunarYear year = new LunarYear(2021);
|
||||
Assert.assertEquals(354, year.getDayCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user