[threeten-dev] Please help to review new test code for java.time.calendars.HijrahChronology

Patrick Zhang patrick.zhang at oracle.com
Tue Jan 29 22:26:16 PST 2013


Hi Team,

Please help to review below new added test case:
http://cr.openjdk.java.net/~pzhang/JSR310/java/time/calendars/HijrahChronology/test/java/time/tck/java/time/calendars/TestHijrahChronology.java.udiff.html

test result:
http://cr.openjdk.java.net/~pzhang/JSR310/java/time/calendars/HijrahChronology/TestHijrahChronology.jtr

Description:
The new added test cases are used for prolepticYear() and isLeapYear().
1. As description of HijrahChronology, year 2,5,7,10,,13,16,18,21,24,26 
and 29 will be leap years. So add test_isLeapYear() to check it. And for 
leap year, date(prolepticYear, 12, 30) should be equal with 
dateYearDay(prolepticYear, 355). For non-leap year, date(prolepticYear, 
12, 29) should be equal with dateYearDay(prolepticYear, 354).

2. We can get below table from definition of HijrahChronology:
ISO prolepticYear 	618
	619
	620
	621
	622
	623
	624
	...
year of ERA_AH 	-2
	-1
	0
	1
	2
	3
	4
	...
year of ERA_BEFORE_AH 	3
	2
	1
	0
	-1
	-2
	-3
	...


 From above table, then we can get return value of prolepticYear():
     prolepticYear(ERA_AH, a) = a;
     prolepticYear(ERA_BEFORE_AH, a) +  prolepticYear(ERA_AH, a) = 1; It 
means prolepticYear(ERA_BEFORE_AH, a)= 1-a.

Above logic has been verified in test_prolepticYear()


Regards
Patrick


More information about the threeten-dev mailing list