mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
ICU-2010 calendar astronomer coverage
X-SVN-Rev: 9622
This commit is contained in:
parent
a7ca6ecb8c
commit
b32694746d
1 changed files with 49 additions and 2 deletions
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/calendar/AstroTest.java,v $
|
||||
* $Date: 2002/02/16 03:05:04 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2002/08/08 22:02:27 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -14,6 +14,8 @@ package com.ibm.icu.dev.test.calendar;
|
|||
|
||||
// AstroTest
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.ibm.icu.dev.test.*;
|
||||
import com.ibm.icu.util.*;
|
||||
|
||||
|
@ -72,4 +74,49 @@ public class AstroTest extends TestFmwk {
|
|||
logln("result is " + result + "; " + result.toHmsString());
|
||||
}
|
||||
|
||||
public void TestCoverage() {
|
||||
GregorianCalendar cal = new GregorianCalendar(1958, Calendar.AUGUST, 15);
|
||||
Date then = cal.getTime();
|
||||
CalendarAstronomer myastro = new CalendarAstronomer(then);
|
||||
|
||||
//Latitude: 34 degrees 05' North
|
||||
//Longitude: 118 degrees 22' West
|
||||
double laLat = 34 + 5d/60, laLong = 360 - (118 + 22d/60);
|
||||
CalendarAstronomer myastro2 = new CalendarAstronomer(laLong, laLat);
|
||||
|
||||
double eclLat = laLat * Math.PI / 360;
|
||||
double eclLong = laLong * Math.PI / 360;
|
||||
Ecliptic ecl = new Ecliptic(eclLat, eclLong);
|
||||
logln("ecliptic: " + ecl);
|
||||
|
||||
CalendarAstronomer myastro3 = new CalendarAstronomer();
|
||||
myastro3.setJulianDay((4713 + 2000) * 365.25);
|
||||
|
||||
CalendarAstronomer[] astronomers = {
|
||||
myastro, myastro2, myastro3, myastro2 // check cache
|
||||
};
|
||||
|
||||
for (int i = 0; i < astronomers.length; ++i) {
|
||||
CalendarAstronomer astro = astronomers[i];
|
||||
|
||||
logln("astro: " + astro);
|
||||
logln(" time: " + astro.getTime());
|
||||
logln(" date: " + astro.getDate());
|
||||
logln(" cent: " + astro.getJulianCentury());
|
||||
logln(" gw sidereal: " + astro.getGreenwichSidereal());
|
||||
logln(" loc sidereal: " + astro.getLocalSidereal());
|
||||
logln(" equ ecl: " + astro.eclipticToEquatorial(ecl));
|
||||
logln(" equ long: " + astro.eclipticToEquatorial(eclLong));
|
||||
logln(" horiz: " + astro.eclipticToHorizon(eclLong));
|
||||
logln(" sunrise: " + new Date(astro.getSunRiseSet(true)));
|
||||
logln(" sunset: " + new Date(astro.getSunRiseSet(false)));
|
||||
logln(" moon phase: " + astro.getMoonPhase());
|
||||
logln(" moonrise: " + new Date(astro.getMoonRiseSet(true)));
|
||||
logln(" moonset: " + new Date(astro.getMoonRiseSet(false)));
|
||||
logln(" prev summer solstice: " + new Date(astro.getSunTime(astro.SUMMER_SOLSTICE, false)));
|
||||
logln(" next summer solstice: " + new Date(astro.getSunTime(astro.SUMMER_SOLSTICE, true)));
|
||||
logln(" prev full moon: " + new Date(astro.getMoonTime(astro.FULL_MOON, false)));
|
||||
logln(" next full moon: " + new Date(astro.getMoonTime(astro.FULL_MOON, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue