Closed LuckyJayce closed 3 years ago
dart 测试完美通过,测试代码如下,(Solar类 加了equals,hashCode和toString)
main(List<String> arguments) {
DateTime dateTime = DateTime(1900, 1, 1);
int dayCount = 365 * 1;
for (int i = 0; i < dayCount; i++) {
dateTime = dateTime.add(Duration(days: 1));
Solar solar = Solar(
solarYear: dateTime.year,
solarMonth: dateTime.month,
solarDay: dateTime.day);
Lunar lunar = LunarSolarConverter.solarToLunar(solar);
Solar solar2 = LunarSolarConverter.lunarToSolar(lunar);
if (solar == solar2) {
// print('ok solar:$solar lunar:$lunar solar2:$solar2');
} else {
print('---error solar:$solar lunar:$lunar solar2:$solar2');
}
}
print('finished');
}
打印结果 finished
随机抽样了几个和日历上的一致。
java 测试出现通过,测试代码如下 (Solar类 加了equals,hashCode和toString)
打印结果