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

patrick zhang patrick.zhang at oracle.com
Wed Jan 30 01:20:19 PST 2013


Hi Stephen,

Thanks. ISO year is 365/366 days and Hijrah year is 354/355 days. So the 
attached table is only correct in small scopes. I just use it as one 
sample. :)

And I will not add groups=tck for future webrevs.

Regards
Patrick

On 2013-1-30 17:07, Stephen Colebourne wrote:
> There is not a one-to-one mapping from an ISO year to a Hijrah year, 
> because the ISO year is longer than a Hijrah year. Thus, you can't 
> really say that ISO proleptic year  621 "equals" year 1 AH. What you 
> could say is that one date within year 621 "equals" one date in year 1 AH.
>
> This does not seem to change your test cases.
>
> In the webrev:
> - you no longer need "groups=tck", as the TCK tests are now a separate 
> directory structure
>
> Stephen
>
>
> On 30 January 2013 06:26, Patrick Zhang <patrick.zhang at oracle.com 
> <mailto:patrick.zhang at oracle.com>> 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
>     <http://cr.openjdk.java.net/%7Epzhang/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
>     <http://cr.openjdk.java.net/%7Epzhang/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