public void test_loop() {

    // loop round at least one 400 year cycle, including before 1970
    LocalDate date = LocalDate.of(1960, 1, 5); // Tuseday of week 1 1960
    int year = 1960;
    int wby = 1960;
    int weekLen = 52;
    int week = 1;
    while (date.getYear() < 2400) {
      DayOfWeek loopDow = date.getDayOfWeek();
      if (date.getYear() != year) {
        year = date.getYear();
      }
      if (loopDow == MONDAY) {
        week++;
        if ((week == 53 && weekLen == 52) || week == 54) {
          week = 1;
          LocalDate firstDayOfWeekBasedYear = date.plusDays(14).withDayOfYear(1);
          DayOfWeek firstDay = firstDayOfWeekBasedYear.getDayOfWeek();
          weekLen = (firstDay == THURSDAY || (firstDay == WEDNESDAY && firstDayOfWeekBasedYear.isLeapYear()) ? 53 : 52);
          wby++;
        }
      }
      assertEquals(ISOWeeks.WEEK_OF_WEEK_BASED_YEAR.doRange(date), DateTimeValueRange.of(1, weekLen), "Failed on "
          + date + " " + date.getDayOfWeek());
      assertEquals(ISOWeeks.WEEK_OF_WEEK_BASED_YEAR.doGet(date), week, "Failed on " + date + " " + date.getDayOfWeek());
      assertEquals(date.get(ISOWeeks.WEEK_OF_WEEK_BASED_YEAR), week, "Failed on " + date + " " + date.getDayOfWeek());
      assertEquals(ISOWeeks.WEEK_BASED_YEAR.doGet(date), wby, "Failed on " + date + " " + date.getDayOfWeek());
      assertEquals(date.get(ISOWeeks.WEEK_BASED_YEAR), wby, "Failed on " + date + " " + date.getDayOfWeek());
      date = date.plusDays(1);
    }
  }