Package er.chronic.utils

Examples of er.chronic.utils.Span


  public void testThisPast() {
    RepeaterWeekend weekends = new RepeaterWeekend();
    weekends.setStart(_now);

    Span thisWeekend = weekends.thisSpan(Pointer.PointerType.PAST);
    assertEquals(Time.construct(2006, 8, 12), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 14), thisWeekend.getEndCalendar());
  }
View Full Code Here


  public void testThisNone() {
    RepeaterWeekend weekends = new RepeaterWeekend();
    weekends.setStart(_now);

    Span thisWeekend = weekends.thisSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 19), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), thisWeekend.getEndCalendar());
  }
View Full Code Here

    assertEquals(Time.construct(2006, 8, 19), thisWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), thisWeekend.getEndCalendar());
  }

  public void testOffset() {
    Span span = new Span(_now, Calendar.SECOND, 1);

    Span offsetSpan;

    offsetSpan = new RepeaterWeekend().getOffset(span, 3, Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 9, 2), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 9, 2, 0, 0, 1), offsetSpan.getEndCalendar());

    offsetSpan = new RepeaterWeekend().getOffset(span, 1, Pointer.PointerType.PAST);
    assertEquals(Time.construct(2006, 8, 12), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 12, 0, 0, 1), offsetSpan.getEndCalendar());

    offsetSpan = new RepeaterWeekend().getOffset(span, 0, Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 12), offsetSpan.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 12, 0, 0, 1), offsetSpan.getEndCalendar());
  }
View Full Code Here

    }

    public void test_parse_guess_dates() {
      // rm_sd

      Span time;
      time = parse_now("may 27");
      assertEquals(Time.construct(2007, 5, 27, 12), time);

      time = parse_now("may 28", new Options(Pointer.PointerType.PAST));
      assertEquals(Time.construct(2006, 5, 28, 12), time);
View Full Code Here

      time = parse_now("1800-08-20");
      assertEquals(null, time);
    }

    public void test_parse_guess_r() {
      Span time;
      time = parse_now("friday");
      assertEquals(Time.construct(2006, 8, 18, 12), time);

      time = parse_now("tue");
      assertEquals(Time.construct(2006, 8, 22, 12), time);
View Full Code Here

      time = parse_now("november");
      assertEquals(Time.construct(2006, 11, 16), time);
    }

    public void test_parse_guess_rr() {
      Span time;
      time = parse_now("friday 13:00");
      assertEquals(Time.construct(2006, 8, 18, 13), time);

      time = parse_now("monday 4:00");
      assertEquals(Time.construct(2006, 8, 21, 16), time);
View Full Code Here

      time = parse_now("aug 24");
      assertEquals(Time.construct(2006, 8, 24, 12), time);
    }

    public void test_parse_guess_rrr() {
      Span time;
      time = parse_now("friday 1 pm");
      assertEquals(Time.construct(2006, 8, 18, 13), time);

      time = parse_now("friday 11 at night");
      assertEquals(Time.construct(2006, 8, 18, 23), time);
View Full Code Here

      time = parse_now("friday evening at 7");
      assertEquals(Time.construct(2006, 8, 18, 19), time);
    }

    public void test_parse_guess_gr() {
      Span time;
      // year

      time = parse_now("this year");
      assertEquals(Time.construct(2006, 10, 24, 12, 30), time);
View Full Code Here

      time = parse_now("last second");
      assertEquals(Time.construct(2006, 8, 16, 13, 59, 59), time);
    }

    public void test_parse_guess_grr() {
      Span time;
      time = parse_now("yesterday at 4:00");
      assertEquals(Time.construct(2006, 8, 15, 16), time);

      time = parse_now("today at 9:00");
      assertEquals(Time.construct(2006, 8, 16, 9), time);
View Full Code Here

      time = parse_now("7 tonight");
      assertEquals(Time.construct(2006, 8, 16, 19), time);
    }

    public void test_parse_guess_grrr() {
      Span time;
      time = parse_now("today at 6:00pm");
      assertEquals(Time.construct(2006, 8, 16, 18), time);

      time = parse_now("today at 6:00am");
      assertEquals(Time.construct(2006, 8, 16, 6), time);
View Full Code Here

TOP

Related Classes of er.chronic.utils.Span

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.