修复立春至正月初一之间八字年月柱错误的问题;新增支持农历日期的推移。
This commit is contained in:
@@ -22,6 +22,33 @@ public class BaZiTest {
|
||||
Assert.assertEquals("时柱", "壬辰", eightChar.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGanZhi2() {
|
||||
Solar solar = new Solar(1988, 2, 15, 23, 30, 0);
|
||||
Lunar lunar = solar.getLunar();
|
||||
EightChar eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
|
||||
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
|
||||
Assert.assertEquals("日柱", "辛丑", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "戊子", eightChar.getTime());
|
||||
|
||||
solar = new Solar(1988, 2, 15, 22, 30, 0);
|
||||
lunar = solar.getLunar();
|
||||
eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("年柱", "戊辰", eightChar.getYear());
|
||||
Assert.assertEquals("月柱", "甲寅", eightChar.getMonth());
|
||||
Assert.assertEquals("日柱", "庚子", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "丁亥", eightChar.getTime());
|
||||
|
||||
solar = new Solar(1988, 2, 2, 22, 30, 0);
|
||||
lunar = solar.getLunar();
|
||||
eightChar = lunar.getEightChar();
|
||||
Assert.assertEquals("年柱", "丁卯", eightChar.getYear());
|
||||
Assert.assertEquals("月柱", "癸丑", eightChar.getMonth());
|
||||
Assert.assertEquals("日柱", "丁亥", eightChar.getDay());
|
||||
Assert.assertEquals("时柱", "辛亥", eightChar.getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHideGan() {
|
||||
Solar solar = new Solar(2005, 12, 23, 8, 37, 0);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package test;
|
||||
|
||||
import com.nlf.calendar.Lunar;
|
||||
import com.nlf.calendar.Solar;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -20,4 +21,13 @@ public class LunarTest {
|
||||
Assert.assertEquals("2019-05-01 00:00:00 星期三 (劳动节) 金牛座",date.getSolar().toFullString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNext(){
|
||||
Solar solar = new Solar(2020,1,10,12,0,0);
|
||||
Lunar lunar = solar.getLunar();
|
||||
for(int i=-500;i<500;i++){
|
||||
Assert.assertEquals("推移天数:"+i,solar.next(i).getLunar().toFullString(),lunar.next(i).toFullString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user