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

Roger Riggs Roger.Riggs at oracle.com
Wed Jan 30 07:39:48 PST 2013


Hi Patrick,

The data for these tests may need to change; we are expecting
to replace the default Hijrah calendar with one defined by the Saudi 
government
(Umm al-Qura).
Also there will be another variant as well.

The structure of the test is good and it will be easy to update.

Thanks, Roger



On 1/30/2013 1:26 AM, Patrick Zhang wrote:
> 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

-- 
Thanks, Roger

Oracle Java Platform Group

Green Oracle <http://www.oracle.com/commitment> Oracle is committed to 
developing practices and products that help protect the environment



More information about the threeten-dev mailing list