Ejemplo n.º 1
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void test_registerLeapSecond_equalEarlierDate_differentLeap() {
   long[] dates = rules.getLeapSecondDates();
   long mjd = dates[dates.length - 2];
   int adj = rules.getLeapSecondAdjustment(mjd);
   rules.register(mjd, -adj);
 }
Ejemplo n.º 2
0
 public void test_negativeLeap_justAfterLeap() {
   rules.register(MJD_2100 - 1, -1);
   TaiInstant tai = TaiInstant.ofTaiSeconds(TAI_SECS_UTC2100_EXTRA_NEGATIVE_LEAP, 0); // 2100-01-01
   UtcInstant expected = UtcInstant.ofModifiedJulianDay(MJD_2100, 0);
   assertEquals(rules.convertToUtc(tai), expected);
   assertEquals(rules.convertToTai(expected), tai); // check reverse
 }
Ejemplo n.º 3
0
 public void test_registerLeapSecond_equalEarlierDate_sameLeap() {
   long[] dates = rules.getLeapSecondDates();
   long mjd = dates[dates.length - 2];
   int adj = rules.getLeapSecondAdjustment(mjd);
   rules.register(mjd, adj);
   long[] test = rules.getLeapSecondDates();
   assertEquals(Arrays.equals(test, dates), true);
   assertEquals(rules.getLeapSecondAdjustment(mjd), adj);
 }
Ejemplo n.º 4
0
 public void test_registerLeapSecond_justAfterLastDate_minusOne() {
   long[] dates = rules.getLeapSecondDates();
   long mjd = dates[dates.length - 1] + 1;
   rules.register(mjd, -1);
   long[] test = rules.getLeapSecondDates();
   assertEquals(test.length, dates.length + 1);
   assertEquals(test[test.length - 1], mjd);
   assertEquals(rules.getLeapSecondAdjustment(mjd), -1);
 }
Ejemplo n.º 5
0
 // -------------------------------------------------------------------------
 public void test_negativeLeap_justBeforeLeap() {
   rules.register(MJD_2100 - 1, -1);
   TaiInstant tai =
       TaiInstant.ofTaiSeconds(
           TAI_SECS_UTC2100_EXTRA_NEGATIVE_LEAP - 1, 0); // 2100-01-01 (1 second before 2100)
   UtcInstant expected =
       UtcInstant.ofModifiedJulianDay(MJD_2100 - 1, (SECS_PER_DAY - 2) * NANOS_PER_SEC);
   assertEquals(rules.convertToUtc(tai), expected);
   assertEquals(rules.convertToTai(expected), tai); // check reverse
 }
Ejemplo n.º 6
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void test_registerLeapSecond_invalidAdjustment_three() {
   rules.register(MJD_2100, 3);
 }
Ejemplo n.º 7
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void test_registerLeapSecond_beforeLastDate() {
   long[] dates = rules.getLeapSecondDates();
   long mjd = dates[dates.length - 1] - 1;
   rules.register(mjd, 1);
 }