Package er.chronic.utils

Examples of er.chronic.utils.Span


      time = parse_now("next monday at 12:01 pm");
      assertEquals(Time.construct(2006, 8, 21, 12, 1), time);
    }

    public void test_parse_guess_rgr() {
      Span time;
      time = parse_now("afternoon yesterday");
      assertEquals(Time.construct(2006, 8, 15, 15), time);

      time = parse_now("tuesday last week");
      assertEquals(Time.construct(2006, 8, 8, 12), time);
View Full Code Here


      time = parse_now("tuesday last week");
      assertEquals(Time.construct(2006, 8, 8, 12), time);
    }

    public void test_parse_guess_s_r_p() {
      Span time;
      // past

      time = parse_now("3 years ago");
      assertEquals(Time.construct(2003, 8, 16, 14), time);
View Full Code Here

      time = Chronic.parse("2 months ago", options);
      assertEquals(Time.construct(2007, 1, 7, 23, 30), time);
    }

    public void test_parse_guess_p_s_r() {
      Span time;
      time = parse_now("in 3 hours");
      assertEquals(Time.construct(2006, 8, 16, 17), time);
    }
View Full Code Here

      time = parse_now("in 3 hours");
      assertEquals(Time.construct(2006, 8, 16, 17), time);
    }

    public void test_parse_guess_s_r_p_a() {
      Span time;
      // past

      time = parse_now("3 years ago tomorrow");
      assertEquals(Time.construct(2003, 8, 17, 12), time);
View Full Code Here

      // future
    }

    public void test_parse_guess_o_r_s_r() {
      Span time;
      time = parse_now("3rd wednesday in november");
      assertEquals(Time.construct(2006, 11, 15, 12), time);

      time = parse_now("10th wednesday in november");
      assertEquals(null, time);
View Full Code Here

      // time = parse_now("3rd wednesday in 2007");
      // assertEquals(Time.construct(2007, 1, 20, 12), time);
    }

    public void test_parse_guess_o_r_g_r() {
      Span time;
      time = parse_now("3rd month next year");
      assertEquals(Time.construct(2007, 3, 16, 12, 30), time);

      time = parse_now("3rd thursday this september");
      assertEquals(Time.construct(2006, 9, 21, 12), time);
View Full Code Here

      time = parse_now("4th day last week");
      assertEquals(Time.construct(2006, 8, 9, 12), time);
    }

    public void test_parse_guess_nonsense() {
      Span time;
      time = parse_now("some stupid nonsense");
      assertEquals(null, time);

      time = parse_now("Ham Sandwich");
      assertEquals(null, time);
View Full Code Here

      time = parse_now("Ham Sandwich");
      assertEquals(null, time);
    }

    public void test_parse_span() {
      Span span;
      span = parse_now("friday", new Options(false));
      assertEquals(Time.construct(2006, 8, 18), span.getBeginCalendar());
      assertEquals(Time.construct(2006, 8, 19), span.getEndCalendar());

      span = parse_now("november", new Options(false));
      assertEquals(Time.construct(2006, 11), span.getBeginCalendar());
      assertEquals(Time.construct(2006, 12), span.getEndCalendar());

      Options options = new Options(_time_2006_08_16_14_00_00, false);
      span = Chronic.parse("weekend", options);
      assertEquals(Time.construct(2006, 8, 19), span.getBeginCalendar());
      assertEquals(Time.construct(2006, 8, 21), span.getEndCalendar());
    }
View Full Code Here

    assertEquals(RepeaterDayPortion.DayPortion.MORNING, tokens.get(1).getTags().get(0).getType());
    assertEquals(2, tokens.size());
  }

  public void testGuess() {
    Span span;

    span = new Span(Time.construct(2006, 8, 16, 0), Time.construct(2006, 8, 17, 0));
    assertEquals(Time.construct(2006, 8, 16, 12), Chronic.guess(span).getBeginCalendar());

    span = new Span(Time.construct(2006, 8, 16, 0), Time.construct(2006, 8, 17, 0, 0, 1));
    assertEquals(Time.construct(2006, 8, 16, 12), Chronic.guess(span).getBeginCalendar());

    span = new Span(Time.construct(2006, 11), Time.construct(2006, 12));
    assertEquals(Time.construct(2006, 11, 16), Chronic.guess(span).getBeginCalendar());
  }
View Full Code Here

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

    Span nextWeekend = weekends.nextSpan(Pointer.PointerType.FUTURE);
    assertEquals(Time.construct(2006, 8, 19), nextWeekend.getBeginCalendar());
    assertEquals(Time.construct(2006, 8, 21), nextWeekend.getEndCalendar());
  }
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.