From 6078b1e1d82dbef68cf39c91b6cf082f7a4e6d07 Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Wed, 27 Aug 2014 23:02:36 +0200 Subject: [PATCH] Week selector rework. Using ISO week dates. Closes #46. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not sure what the week selector was doing before this rework. I asked the author but it looked that he does not know either (at least when I asked, a couple of years after he wrote the code) … https://github.com/AMDmi3/opening_hours.js/issues/18 See https://en.wikipedia.org/wiki/ISO_week_date --- opening_hours.js | 61 +++++--- test.js | 389 ++++++++++++++++++++++++++++++++++++++++------- test.log | 170 +++++++++++---------- 3 files changed, 465 insertions(+), 155 deletions(-) diff --git a/opening_hours.js b/opening_hours.js index 9a47f6a2..d7f88b94 100644 --- a/opening_hours.js +++ b/opening_hours.js @@ -2619,6 +2619,7 @@ if (!done_with_selector_reordering) { prettified_group_value.sort( function (a, b) { + // FIXME: week comes after month: https://en.wikipedia.org/wiki/ISO_8601#General_principles var selector_order = [ 'year', 'week', 'month', 'holiday', 'weekday', 'time', '24/7', 'state', 'comment']; return selector_order.indexOf(a[0][2]) - selector_order.indexOf(b[0][2]); } @@ -4077,7 +4078,7 @@ if (is_range) { has_period = matchTokens(tokens, at+3, '/', 'number'); // if (week_stable) { - // if (tokens[at][0] == 1 && tokens[at+2][0] >) // Maximum? + // if (tokens[at][0] == 1 && tokens[at+2][0] >) // Maximum? 53 // week_stable = true; // else // week_stable = false; @@ -4087,25 +4088,22 @@ } selectors.week.push(function(tokens, at, is_range, has_period) { return function(date) { - var ourweek = Math.floor((date - dateAtWeek(date, 0)) / msec_in_week); + var ourweek = date.getWeekNumber(); - var week_from = tokens[at][0] - 1; - var week_to = is_range ? tokens[at+2][0] - 1 : week_from; - - var start_of_next_year = new Date(date.getFullYear() + 1, 0, 1); + var week_from = tokens[at][0]; + var week_to = is_range ? tokens[at+2][0] : week_from; + // console.log("week_from %s, week_to %s", week_from, week_to); // before range if (ourweek < week_from) { - // console.log('Start of date', start_of_next_year); - // console.log('dateAtWeek(date, week_from)', dateAtWeek(date, week_from)); - // console.log(getMinDate(dateAtWeek(date, week_from), start_of_next_year)); - return [false, getMinDate(dateAtWeek(date, week_from), start_of_next_year)]; + // console.log("Before: " + getDateOfISOWeek(week_from, date.getFullYear())); + return [false, getNextDateOfISOWeek(week_from, date)]; } // we're after range, set check date to next year if (ourweek > week_to) { // console.log("After"); - return [false, start_of_next_year]; + return [false, getNextDateOfISOWeek(week_from, date)]; } // we're in range @@ -4114,14 +4112,14 @@ if (period > 1) { var in_period = (ourweek - week_from) % period === 0; if (in_period) - return [true, getMinDate(dateAtWeek(date, ourweek + 1), start_of_next_year)]; + return [true, getNextDateOfISOWeek(ourweek + 1, date)]; else - return [false, getMinDate(dateAtWeek(date, ourweek + period - 1), start_of_next_year)]; + return [false, getNextDateOfISOWeek(ourweek + period - 1, date)]; } } - // console.log("return with: " + getMinDate(dateAtWeek(date, week_to + 1))); - return [true, getMinDate(dateAtWeek(date, week_to + 1), start_of_next_year)]; + // console.log("Match"); + return [true, getNextDateOfISOWeek(week_to + 1, date)]; }}(tokens, at, is_range, has_period)); at += 1 + (is_range ? 2 : 0) + (has_period ? 2 : 0); @@ -4144,17 +4142,30 @@ return at; } - function dateAtWeek(date, week) { - var tmpdate = new Date(date.getFullYear(), 0, 1); - tmpdate.setDate(1 - (tmpdate.getDay() + 6) % 7 + week * 7); // start of week n where week starts on Monday - return tmpdate; + // http://stackoverflow.com/a/6117889 + Date.prototype.getWeekNumber = function(){ + var d = new Date(+this); + d.setHours(0,0,0); + d.setDate(d.getDate()+4-(d.getDay()||7)); + return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); + }; + function getDateOfISOWeek(w, y) { + var simple = new Date(y, 0, 1 + (w - 1) * 7); + var dow = simple.getDay(); + var ISOweekStart = simple; + if (dow <= 4) + ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1); + else + ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay()); + return ISOweekStart; } - - function getMinDate(date /*, ...*/) { - for (var i = 1; i < arguments.length; i++) - if (arguments[i].getTime() < date.getTime()) - date = arguments[i]; - return date; + function getNextDateOfISOWeek(week, date) { + var next_date = getDateOfISOWeek(week, date.getFullYear()); + if (next_date.getTime () > date.getTime()) { + return next_date; + } else { + return getDateOfISOWeek(week, date.getFullYear() + 1); + } } // }}} diff --git a/test.js b/test.js index 40e7eb4e..89acff70 100755 --- a/test.js +++ b/test.js @@ -54,7 +54,6 @@ test.addTest('Time intervals', [ '10:00-11:00,11:00-12:00', '10:00-12:00,10:30-11:30', '10:00-14:00; 12:00-14:00 off', - // 'week 01-13: 07:00-20:00; week 14-40: 06:30-21:00; week 41-52: 07:00-20:00' ], '2012.10.01 0:00', '2012.10.08 0:00', [ [ '2012.10.01 10:00', '2012.10.01 12:00' ], [ '2012.10.02 10:00', '2012.10.02 12:00' ], @@ -1021,63 +1020,294 @@ test.addTest('Fallback group rules, with some closed times', [ // week ranges {{{ test.addTest('Week ranges', [ 'week 1,3 00:00-24:00', - 'week 1,3 00:00-24:00 || closed "should not change the test result"', // because comments for closed states are not compared. + 'week 1,3 00:00-24:00 || closed "should not change the test result"', + // because comments for closed states are not compared (not returned by the high-level API). 'week 1,3: 00:00-24:00', 'week 1,week 3: 00:00-24:00', 'week 1: 00:00-24:00; week 3: 00:00-24:00', 'week 1; week 3', 'week 1-3/2 00:00-24:00', ], '2012.01.01 0:00', '2013.01.01 0:00', [ - [ '2012.01.01 00:00', '2012.01.02 00:00' ], - [ '2012.01.09 00:00', '2012.01.16 00:00' ], - ], 1000 * 60 * 60 * 24 * (1 + 7), 0, false, {}, 'not last test'); + [ '2012.01.02 00:00', '2012.01.09 00:00' ], + [ '2012.01.16 00:00', '2012.01.23 00:00' ], + [ '2012.12.31 00:00', '2013.01.01 00:00' ], + ], 1000 * 60 * 60 * 24 * (2 * 7 + 1), 0, false, {}, 'not last test'); test.addTest('Week ranges', [ 'week 2,4 00:00-24:00', 'week 2-4/2 00:00-24:00', ], '2012.01.01 0:00', '2013.01.01 0:00', [ - [ '2012.01.02 00:00', '2012.01.09 00:00' ], - [ '2012.01.16 00:00', '2012.01.23 00:00' ], + [ '2012.01.09 00:00', '2012.01.16 00:00' ], + [ '2012.01.23 00:00', '2012.01.30 00:00' ], ], 1000 * 60 * 60 * 24 * (7 + 7), 0, false); test.addTest('Week range limit', [ + 'week 2-53 00:00-24:00', 'week 2-54 00:00-24:00', 'week 2-54: 00:00-24:00', 'week 2-57', ], '2012.01.01 0:00', '2014.01.01 0:00', [ - [ '2012.01.02 00:00', '2013.01.01 00:00' ], - [ '2013.01.07 00:00', '2014.01.01 00:00' ], - ], 1000 * 60 * 60 * 24 * 724, 0, false); + [ '2012.01.01 00:00', '2014.01.01 00:00' ], + ], 1000 * 60 * 60 * 24 * (365 * 2 + /* 2012 is leap year */ 1), 0, false, {}, 'not last test'); test.addTest('Week range', [ - 'week 2-52/2 We; week 1-53/2 Sa 0:00-24:00', + 'week 2-53/2 We; week 1-53/2 Sa 00:00-24:00', ], '2012.01.01 0:00', '2014.01.01 0:00', [ - ], 1000 * 60 * 60 * 24 * 724, 0, false); + /* Long test on per day base {{{ */ + [ '2012.01.07 00:00', '2012.01.08 00:00' ], // Sa, KW1 + [ '2012.01.11 00:00', '2012.01.12 00:00' ], // We, KW2 + [ '2012.01.21 00:00', '2012.01.22 00:00' ], // Sa, KW3 + [ '2012.01.25 00:00', '2012.01.26 00:00' ], + [ '2012.02.04 00:00', '2012.02.05 00:00' ], + [ '2012.02.08 00:00', '2012.02.09 00:00' ], + [ '2012.02.18 00:00', '2012.02.19 00:00' ], + [ '2012.02.22 00:00', '2012.02.23 00:00' ], + [ '2012.03.03 00:00', '2012.03.04 00:00' ], + [ '2012.03.07 00:00', '2012.03.08 00:00' ], + [ '2012.03.17 00:00', '2012.03.18 00:00' ], + [ '2012.03.21 00:00', '2012.03.22 00:00' ], + [ '2012.03.31 00:00', '2012.04.01 00:00' ], + [ '2012.04.04 00:00', '2012.04.05 00:00' ], + [ '2012.04.14 00:00', '2012.04.15 00:00' ], + [ '2012.04.18 00:00', '2012.04.19 00:00' ], + [ '2012.04.28 00:00', '2012.04.29 00:00' ], + [ '2012.05.02 00:00', '2012.05.03 00:00' ], + [ '2012.05.12 00:00', '2012.05.13 00:00' ], + [ '2012.05.16 00:00', '2012.05.17 00:00' ], + [ '2012.05.26 00:00', '2012.05.27 00:00' ], + [ '2012.05.30 00:00', '2012.05.31 00:00' ], + [ '2012.06.09 00:00', '2012.06.10 00:00' ], + [ '2012.06.13 00:00', '2012.06.14 00:00' ], + [ '2012.06.23 00:00', '2012.06.24 00:00' ], + [ '2012.06.27 00:00', '2012.06.28 00:00' ], + [ '2012.07.07 00:00', '2012.07.08 00:00' ], + [ '2012.07.11 00:00', '2012.07.12 00:00' ], + [ '2012.07.21 00:00', '2012.07.22 00:00' ], + [ '2012.07.25 00:00', '2012.07.26 00:00' ], + [ '2012.08.04 00:00', '2012.08.05 00:00' ], + [ '2012.08.08 00:00', '2012.08.09 00:00' ], + [ '2012.08.18 00:00', '2012.08.19 00:00' ], + [ '2012.08.22 00:00', '2012.08.23 00:00' ], + [ '2012.09.01 00:00', '2012.09.02 00:00' ], + [ '2012.09.05 00:00', '2012.09.06 00:00' ], + [ '2012.09.15 00:00', '2012.09.16 00:00' ], + [ '2012.09.19 00:00', '2012.09.20 00:00' ], + [ '2012.09.29 00:00', '2012.09.30 00:00' ], + [ '2012.10.03 00:00', '2012.10.04 00:00' ], + [ '2012.10.13 00:00', '2012.10.14 00:00' ], + [ '2012.10.17 00:00', '2012.10.18 00:00' ], + [ '2012.10.27 00:00', '2012.10.28 00:00' ], + [ '2012.10.31 00:00', '2012.11.01 00:00' ], + [ '2012.11.10 00:00', '2012.11.11 00:00' ], + [ '2012.11.14 00:00', '2012.11.15 00:00' ], + [ '2012.11.24 00:00', '2012.11.25 00:00' ], + [ '2012.11.28 00:00', '2012.11.29 00:00' ], + [ '2012.12.08 00:00', '2012.12.09 00:00' ], + [ '2012.12.12 00:00', '2012.12.13 00:00' ], + [ '2012.12.22 00:00', '2012.12.23 00:00' ], // Sa, KW51 + [ '2012.12.26 00:00', '2012.12.27 00:00' ], // We, KW52 + [ '2013.01.05 00:00', '2013.01.06 00:00' ], // Sa, KW01 + [ '2013.01.09 00:00', '2013.01.10 00:00' ], + [ '2013.01.19 00:00', '2013.01.20 00:00' ], + [ '2013.01.23 00:00', '2013.01.24 00:00' ], + [ '2013.02.02 00:00', '2013.02.03 00:00' ], + [ '2013.02.06 00:00', '2013.02.07 00:00' ], + [ '2013.02.16 00:00', '2013.02.17 00:00' ], + [ '2013.02.20 00:00', '2013.02.21 00:00' ], + [ '2013.03.02 00:00', '2013.03.03 00:00' ], + [ '2013.03.06 00:00', '2013.03.07 00:00' ], + [ '2013.03.16 00:00', '2013.03.17 00:00' ], + [ '2013.03.20 00:00', '2013.03.21 00:00' ], + [ '2013.03.30 00:00', '2013.03.31 00:00' ], + [ '2013.04.03 00:00', '2013.04.04 00:00' ], + [ '2013.04.13 00:00', '2013.04.14 00:00' ], + [ '2013.04.17 00:00', '2013.04.18 00:00' ], + [ '2013.04.27 00:00', '2013.04.28 00:00' ], + [ '2013.05.01 00:00', '2013.05.02 00:00' ], + [ '2013.05.11 00:00', '2013.05.12 00:00' ], + [ '2013.05.15 00:00', '2013.05.16 00:00' ], + [ '2013.05.25 00:00', '2013.05.26 00:00' ], + [ '2013.05.29 00:00', '2013.05.30 00:00' ], + [ '2013.06.08 00:00', '2013.06.09 00:00' ], + [ '2013.06.12 00:00', '2013.06.13 00:00' ], + [ '2013.06.22 00:00', '2013.06.23 00:00' ], + [ '2013.06.26 00:00', '2013.06.27 00:00' ], + [ '2013.07.06 00:00', '2013.07.07 00:00' ], + [ '2013.07.10 00:00', '2013.07.11 00:00' ], + [ '2013.07.20 00:00', '2013.07.21 00:00' ], + [ '2013.07.24 00:00', '2013.07.25 00:00' ], + [ '2013.08.03 00:00', '2013.08.04 00:00' ], + [ '2013.08.07 00:00', '2013.08.08 00:00' ], + [ '2013.08.17 00:00', '2013.08.18 00:00' ], + [ '2013.08.21 00:00', '2013.08.22 00:00' ], + [ '2013.08.31 00:00', '2013.09.01 00:00' ], + [ '2013.09.04 00:00', '2013.09.05 00:00' ], + [ '2013.09.14 00:00', '2013.09.15 00:00' ], + [ '2013.09.18 00:00', '2013.09.19 00:00' ], + [ '2013.09.28 00:00', '2013.09.29 00:00' ], + [ '2013.10.02 00:00', '2013.10.03 00:00' ], + [ '2013.10.12 00:00', '2013.10.13 00:00' ], + [ '2013.10.16 00:00', '2013.10.17 00:00' ], + [ '2013.10.26 00:00', '2013.10.27 00:00' ], + [ '2013.10.30 00:00', '2013.10.31 00:00' ], + [ '2013.11.09 00:00', '2013.11.10 00:00' ], + [ '2013.11.13 00:00', '2013.11.14 00:00' ], + [ '2013.11.23 00:00', '2013.11.24 00:00' ], + [ '2013.11.27 00:00', '2013.11.28 00:00' ], + [ '2013.12.07 00:00', '2013.12.08 00:00' ], + [ '2013.12.11 00:00', '2013.12.12 00:00' ], + [ '2013.12.21 00:00', '2013.12.22 00:00' ], // Sa, KW51 + [ '2013.12.25 00:00', '2013.12.26 00:00' ], // We, KW52 + /* }}} */ + ], 1000 * 60 * 60 * 24 * 104, 0, false); + +/* Week range {{{ */ +(function() { +var week_range_result = [ + [ + [ '2012.01.23 00:00', '2012.04.23 00:00' ], + [ '2013.01.21 00:00', '2013.04.22 00:00' ], + [ '2014.01.20 00:00', '2014.04.21 00:00' ], + [ '2015.01.19 00:00', '2015.04.20 00:00' ], + [ '2016.01.25 00:00', '2016.04.25 00:00' ], + [ '2017.01.23 00:00', '2017.04.24 00:00' ], + // Checked against http://www.schulferien.org/kalenderwoche/kalenderwochen_2017.html + ], 1000 * 60 * 60 * (24 * 7 * 6 * (16 - 3) - /* daylight saving */ 6), 0 ]; + +test.addTest('Week range (beginning in last year)', [ + 'week 4-16', + // 'week 4-16 We', + // 'week 38-42 Sa 0:00-24:00', + // 'week 4-16 We; week 38-42 Sa 0:00-24:00', + ], '2011.12.30 0:00', '2018.01.01 0:00', week_range_result[0], + week_range_result[1], week_range_result[2], false, {}, 'not only test'); -test.addTest('Week range', [ +test.addTest('Week range (beginning in matching year)', [ 'week 4-16', // 'week 4-16 We', // 'week 38-42 Sa 0:00-24:00', // 'week 4-16 We; week 38-42 Sa 0:00-24:00', - ], '2012.01.01 0:00', '2018.01.01 0:00', [ - ], 1000 * 60 * 60 * 24 * 724, 0, false, {}, 'not only test'); + ], '2012.01.01 0:00', '2018.01.01 0:00', week_range_result[0], + week_range_result[1], week_range_result[2], false, {}, 'not last test'); +})(); +// FIXME: Move up, before period week. test.addTest('Week range first week', [ 'week 1', + ], '2014.12.01 0:00', '2015.02.01 0:00', [ + [ '2014.12.29 00:00', '2015.01.05 00:00' ], + ], 1000 * 60 * 60 * 24 * 7, 0, false, {}, 'not only test'); + +test.addTest('Week range first week', [ + 'week 1', + 'week 1 open', + 'week 1 00:00-24:00', ], '2012.12.01 0:00', '2024.02.01 0:00', [ - [ '2013.01.01 00:00', '2013.01.07 00:00' ], // Ends on 6. day: Su - [ '2014.01.01 00:00', '2014.01.06 00:00' ], // Ends on 5. day: Su - [ '2015.01.01 00:00', '2015.01.05 00:00' ], // Ends on 4. day: Su - [ '2016.01.01 00:00', '2016.01.04 00:00' ], // Ends on 3. day: Su - [ '2017.01.01 00:00', '2017.01.02 00:00' ], // Ends on 1. day: Su - [ '2018.01.01 00:00', '2018.01.08 00:00' ], // Ends on 7. day: Su - [ '2019.01.01 00:00', '2019.01.07 00:00' ], // Ends on 6. day: Su - [ '2020.01.01 00:00', '2020.01.06 00:00' ], - [ '2021.01.01 00:00', '2021.01.04 00:00' ], - [ '2022.01.01 00:00', '2022.01.03 00:00' ], - [ '2023.01.01 00:00', '2023.01.02 00:00' ], + [ '2012.12.31 00:00', '2013.01.07 00:00' ], + [ '2013.12.30 00:00', '2014.01.06 00:00' ], + [ '2014.12.29 00:00', '2015.01.05 00:00' ], + [ '2016.01.04 00:00', '2016.01.11 00:00' ], + [ '2017.01.02 00:00', '2017.01.09 00:00' ], + [ '2018.01.01 00:00', '2018.01.08 00:00' ], + [ '2018.12.31 00:00', '2019.01.07 00:00' ], + [ '2019.12.30 00:00', '2020.01.06 00:00' ], + [ '2021.01.04 00:00', '2021.01.11 00:00' ], + [ '2022.01.03 00:00', '2022.01.10 00:00' ], + [ '2023.01.02 00:00', '2023.01.09 00:00' ], [ '2024.01.01 00:00', '2024.01.08 00:00' ], - ], 4320000000, 0, false, {}, 'not only test'); + // Checked against http://www.schulferien.org/kalenderwoche/kalenderwochen_2024.html + ], 1000 * 60 * 60 * 24 * 7 * 12, 0, false, {}, 'not only test'); + +test.addTest('Week range first week', [ + 'week 1 00:00-23:59', + ], '2012.12.01 0:00', '2024.02.01 0:00', [ + /* Long test on per day base {{{ */ + [ '2012.12.31 00:00', '2012.12.31 23:59' ], + [ '2013.01.01 00:00', '2013.01.01 23:59' ], + [ '2013.01.02 00:00', '2013.01.02 23:59' ], + [ '2013.01.03 00:00', '2013.01.03 23:59' ], + [ '2013.01.04 00:00', '2013.01.04 23:59' ], + [ '2013.01.05 00:00', '2013.01.05 23:59' ], + [ '2013.01.06 00:00', '2013.01.06 23:59' ], + [ '2013.12.30 00:00', '2013.12.30 23:59' ], + [ '2013.12.31 00:00', '2013.12.31 23:59' ], + [ '2014.01.01 00:00', '2014.01.01 23:59' ], + [ '2014.01.02 00:00', '2014.01.02 23:59' ], + [ '2014.01.03 00:00', '2014.01.03 23:59' ], + [ '2014.01.04 00:00', '2014.01.04 23:59' ], + [ '2014.01.05 00:00', '2014.01.05 23:59' ], + [ '2014.12.29 00:00', '2014.12.29 23:59' ], + [ '2014.12.30 00:00', '2014.12.30 23:59' ], + [ '2014.12.31 00:00', '2014.12.31 23:59' ], + [ '2015.01.01 00:00', '2015.01.01 23:59' ], + [ '2015.01.02 00:00', '2015.01.02 23:59' ], + [ '2015.01.03 00:00', '2015.01.03 23:59' ], + [ '2015.01.04 00:00', '2015.01.04 23:59' ], + [ '2016.01.04 00:00', '2016.01.04 23:59' ], + [ '2016.01.05 00:00', '2016.01.05 23:59' ], + [ '2016.01.06 00:00', '2016.01.06 23:59' ], + [ '2016.01.07 00:00', '2016.01.07 23:59' ], + [ '2016.01.08 00:00', '2016.01.08 23:59' ], + [ '2016.01.09 00:00', '2016.01.09 23:59' ], + [ '2016.01.10 00:00', '2016.01.10 23:59' ], + [ '2017.01.02 00:00', '2017.01.02 23:59' ], + [ '2017.01.03 00:00', '2017.01.03 23:59' ], + [ '2017.01.04 00:00', '2017.01.04 23:59' ], + [ '2017.01.05 00:00', '2017.01.05 23:59' ], + [ '2017.01.06 00:00', '2017.01.06 23:59' ], + [ '2017.01.07 00:00', '2017.01.07 23:59' ], + [ '2017.01.08 00:00', '2017.01.08 23:59' ], + [ '2018.01.01 00:00', '2018.01.01 23:59' ], + [ '2018.01.02 00:00', '2018.01.02 23:59' ], + [ '2018.01.03 00:00', '2018.01.03 23:59' ], + [ '2018.01.04 00:00', '2018.01.04 23:59' ], + [ '2018.01.05 00:00', '2018.01.05 23:59' ], + [ '2018.01.06 00:00', '2018.01.06 23:59' ], + [ '2018.01.07 00:00', '2018.01.07 23:59' ], + [ '2018.12.31 00:00', '2018.12.31 23:59' ], + [ '2019.01.01 00:00', '2019.01.01 23:59' ], + [ '2019.01.02 00:00', '2019.01.02 23:59' ], + [ '2019.01.03 00:00', '2019.01.03 23:59' ], + [ '2019.01.04 00:00', '2019.01.04 23:59' ], + [ '2019.01.05 00:00', '2019.01.05 23:59' ], + [ '2019.01.06 00:00', '2019.01.06 23:59' ], + [ '2019.12.30 00:00', '2019.12.30 23:59' ], + [ '2019.12.31 00:00', '2019.12.31 23:59' ], + [ '2020.01.01 00:00', '2020.01.01 23:59' ], + [ '2020.01.02 00:00', '2020.01.02 23:59' ], + [ '2020.01.03 00:00', '2020.01.03 23:59' ], + [ '2020.01.04 00:00', '2020.01.04 23:59' ], + [ '2020.01.05 00:00', '2020.01.05 23:59' ], + [ '2021.01.04 00:00', '2021.01.04 23:59' ], + [ '2021.01.05 00:00', '2021.01.05 23:59' ], + [ '2021.01.06 00:00', '2021.01.06 23:59' ], + [ '2021.01.07 00:00', '2021.01.07 23:59' ], + [ '2021.01.08 00:00', '2021.01.08 23:59' ], + [ '2021.01.09 00:00', '2021.01.09 23:59' ], + [ '2021.01.10 00:00', '2021.01.10 23:59' ], + [ '2022.01.03 00:00', '2022.01.03 23:59' ], + [ '2022.01.04 00:00', '2022.01.04 23:59' ], + [ '2022.01.05 00:00', '2022.01.05 23:59' ], + [ '2022.01.06 00:00', '2022.01.06 23:59' ], + [ '2022.01.07 00:00', '2022.01.07 23:59' ], + [ '2022.01.08 00:00', '2022.01.08 23:59' ], + [ '2022.01.09 00:00', '2022.01.09 23:59' ], + [ '2023.01.02 00:00', '2023.01.02 23:59' ], + [ '2023.01.03 00:00', '2023.01.03 23:59' ], + [ '2023.01.04 00:00', '2023.01.04 23:59' ], + [ '2023.01.05 00:00', '2023.01.05 23:59' ], + [ '2023.01.06 00:00', '2023.01.06 23:59' ], + [ '2023.01.07 00:00', '2023.01.07 23:59' ], + [ '2023.01.08 00:00', '2023.01.08 23:59' ], + [ '2024.01.01 00:00', '2024.01.01 23:59' ], + [ '2024.01.02 00:00', '2024.01.02 23:59' ], + [ '2024.01.03 00:00', '2024.01.03 23:59' ], + [ '2024.01.04 00:00', '2024.01.04 23:59' ], + [ '2024.01.05 00:00', '2024.01.05 23:59' ], + [ '2024.01.06 00:00', '2024.01.06 23:59' ], + [ '2024.01.07 00:00', '2024.01.07 23:59' ], + /* }}} */ + ], 1000 * 60 * (60 * 24 * 7 * 12 - 7 * 12) , 0, false, {}, 'not last test'); // }}} // full months/month ranges {{{ @@ -1398,20 +1628,20 @@ test.addTest('Date range which only applies for specific year', [ // selector combination and order {{{ test.addTest('Selector combination', [ - 'week 3 We', // week + weekday - 'week 3 Jan 11-Jan 11', // week + monthday - 'week 3 Jan 11', // week + monthday + 'week 2 We', // week + weekday + 'week 2 Jan 11-Jan 11', // week + monthday + 'week 2 Jan 11', // week + monthday ], '2012.01.01 0:00', '2013.01.01 0:00', [ [ '2012.01.11 0:00', '2012.01.12 00:00' ], ], 1000 * 60 * 60 * 24, 0, false, {}, 'not last test'); test.addTest('Selector combination', [ - 'week 3 Jan', // week + month + 'week 2 Jan', // week + month 'Jan-Feb Jan 9-Jan 15', // month + monthday 'Jan-Feb Jan 9-15', // month + monthday ], '2012.01.01 0:00', '2013.01.01 0:00', [ [ '2012.01.09 0:00', '2012.01.16 00:00' ], - ], 1000 * 60 * 60 * 24 * 7, 0, false); + ], 1000 * 60 * 60 * 24 * 7, 0, false, {}, 'not last test'); test.addTest('Selector combination', [ 'Jan We', // month + weekday @@ -1427,29 +1657,29 @@ test.addTest('Selector combination', [ test.addTest('Selector order', [ // Result should not depend on selector order although there are some best practices: // Use the selector types which can cover the biggest range first e.g. year before month. - ignored('Feb week 6', 'prettifyValue'), - 'week 6 Feb', - ignored('00:00-24:00 week 6 Feb', 'prettifyValue'), - ignored('week 6 00:00-24:00 Feb', 'prettifyValue'), - 'week 6 Feb 00:00-24:00', - 'week 6 Feb: 00:00-24:00', - 'week 6 Feb Mo-Su 00:00-24:00', - ignored('Mo-Su week 6 Feb 00:00-24:00', 'prettifyValue'), - ignored('00:00-24:00 Mo-Su week 6 Feb', 'prettifyValue'), - ignored('00:00-24:00 week 6 Mo-Su Feb', 'prettifyValue'), - ignored('Mo-Su 00:00-24:00 week 6 Feb', 'prettifyValue'), - ignored('2012 00:00-24:00 week 6 Feb', 'prettifyValue'), - ignored('00:00-24:00 2012 week 6 Feb', 'prettifyValue'), - ignored('week 6 Feb 2012-2014', 'prettifyValue'), + ignored('Feb week 5', 'prettifyValue'), + 'week 5 Feb', + ignored('00:00-24:00 week 5 Feb', 'prettifyValue'), + ignored('week 5 00:00-24:00 Feb', 'prettifyValue'), + 'week 5 Feb 00:00-24:00', + 'week 5 Feb: 00:00-24:00', + 'week 5 Feb Mo-Su 00:00-24:00', + ignored('Mo-Su week 5 Feb 00:00-24:00', 'prettifyValue'), + ignored('00:00-24:00 Mo-Su week 5 Feb', 'prettifyValue'), + ignored('00:00-24:00 week 5 Mo-Su Feb', 'prettifyValue'), + ignored('Mo-Su 00:00-24:00 week 5 Feb', 'prettifyValue'), + ignored('2012 00:00-24:00 week 5 Feb', 'prettifyValue'), + ignored('00:00-24:00 2012 week 5 Feb', 'prettifyValue'), + ignored('week 5 Feb 2012-2014', 'prettifyValue'), ], '2012.01.01 0:00', '2013.01.01 0:00', [ [ '2012.02.01 0:00', '2012.02.06 00:00' ], ], 1000 * 60 * 60 * 24 * 5, 0, false, {}, 'not last test'); test.addTest('Selector order', [ - ignored('Feb week 7', 'prettifyValue'), - 'week 7 Feb', - 'week 7 Feb open', - ignored('open week 7 Feb', 'prettifyValue'), // not preferred + ignored('Feb week 6', 'prettifyValue'), + 'week 6 Feb', + 'week 6 Feb open', + ignored('open week 6 Feb', 'prettifyValue'), // not preferred ], '2012.01.01 0:00', '2013.01.01 0:00', [ [ '2012.02.06 0:00', '2012.02.13 00:00' ], ], 1000 * 60 * 60 * 24 * 7, 0, false, {}, 'not last test'); @@ -2216,9 +2446,62 @@ test.addTest('Points in time, extrem example useful for ComplexAlarm', [ ], 1000 * 60 * 4, 0, false, nominatiomTestJSON, 'not only test', 1); test.addTest('Points in time, extrem example useful for ComplexAlarm', [ - 'Mo-We 07:00; Th 05:45; week 1-56/2 Fr 05:45; week 2-56/2 Fr 05:45; SH Mo-Fr (sunrise+03:00); PH off', - ], '2012.10.01 0:00', '2012.10.03 0:00', [ - ], 1000 * 60 * 5 * 2, 0, true, nominatiomTestJSON, 'not only test', 1); + 'Mo-We 07:00; Th 05:45; week 1-53/2 Fr 07:05; week 2-53/2 Fr 05:45; SH Mo-Fr (sunrise+03:00); PH off', + ], '2014.08.25 0:00', '2014.11.01 0:00', [ + /* Long test on per day base {{{ */ + [ '2014.08.25 09:27', '2014.08.25 09:28', false, 'Sommerferien' ], + [ '2014.08.26 09:28', '2014.08.26 09:29', false, 'Sommerferien' ], + [ '2014.08.27 09:30', '2014.08.27 09:31', false, 'Sommerferien' ], + [ '2014.08.28 09:31', '2014.08.28 09:32', false, 'Sommerferien' ], + [ '2014.08.29 09:33', '2014.08.29 09:34', false, 'Sommerferien' ], + [ '2014.09.01 09:37', '2014.09.01 09:38', false, 'Sommerferien' ], + [ '2014.09.02 09:39', '2014.09.02 09:40', false, 'Sommerferien' ], + [ '2014.09.03 09:40', '2014.09.03 09:41', false, 'Sommerferien' ], + [ '2014.09.04 09:42', '2014.09.04 09:43', false, 'Sommerferien' ], + [ '2014.09.05 09:43', '2014.09.05 09:44', false, 'Sommerferien' ], + [ '2014.09.08 09:47', '2014.09.08 09:48', false, 'Sommerferien' ], + [ '2014.09.09 09:49', '2014.09.09 09:50', false, 'Sommerferien' ], + [ '2014.09.10 09:50', '2014.09.10 09:51', false, 'Sommerferien' ], + [ '2014.09.11 09:52', '2014.09.11 09:53', false, 'Sommerferien' ], + [ '2014.09.12 09:53', '2014.09.12 09:54', false, 'Sommerferien' ], + [ '2014.09.15 07:00', '2014.09.15 07:01' ], // Mo + [ '2014.09.16 07:00', '2014.09.16 07:01' ], // Tu + [ '2014.09.17 07:00', '2014.09.17 07:01' ], // We + [ '2014.09.18 05:45', '2014.09.18 05:46' ], // Th + [ '2014.09.19 05:45', '2014.09.19 05:46' ], // Fr, KW38 + [ '2014.09.22 07:00', '2014.09.22 07:01' ], // Mo + [ '2014.09.23 07:00', '2014.09.23 07:01' ], // Th + [ '2014.09.24 07:00', '2014.09.24 07:01' ], // We + [ '2014.09.25 05:45', '2014.09.25 05:46' ], // Th + [ '2014.09.26 07:05', '2014.09.26 07:06' ], // Fr, KW39 + [ '2014.09.29 07:00', '2014.09.29 07:01' ], // Mo + [ '2014.09.30 07:00', '2014.09.30 07:01' ], // Tu + [ '2014.10.01 07:00', '2014.10.01 07:01' ], // We + [ '2014.10.02 05:45', '2014.10.02 05:46' ], // Th + // PH + [ '2014.10.06 07:00', '2014.10.06 07:01' ], // Mo + [ '2014.10.07 07:00', '2014.10.07 07:01' ], // Tu + [ '2014.10.08 07:00', '2014.10.08 07:01' ], // We + [ '2014.10.09 05:45', '2014.10.09 05:46' ], // Th + [ '2014.10.10 07:05', '2014.10.10 07:06' ], // Fr, KW41 + [ '2014.10.13 07:00', '2014.10.13 07:01' ], // Mo + [ '2014.10.14 07:00', '2014.10.14 07:01' ], // Tu + [ '2014.10.15 07:00', '2014.10.15 07:01' ], // We + [ '2014.10.16 05:45', '2014.10.16 05:46' ], // Th + [ '2014.10.17 05:45', '2014.10.17 05:46' ], // Fr, KW42 + [ '2014.10.20 07:00', '2014.10.20 07:01' ], // Mo + [ '2014.10.21 07:00', '2014.10.21 07:01' ], // Tu + [ '2014.10.22 07:00', '2014.10.22 07:01' ], // We + [ '2014.10.23 05:45', '2014.10.23 05:46' ], // Th + [ '2014.10.24 07:05', '2014.10.24 07:06' ], // Fr, KW43 + [ '2014.10.27 10:02', '2014.10.27 10:03', false, 'Herbstferien' ], // Mo + [ '2014.10.28 10:03', '2014.10.28 10:04', false, 'Herbstferien' ], // Tu + [ '2014.10.29 10:05', '2014.10.29 10:06', false, 'Herbstferien' ], // We + [ '2014.10.30 10:06', '2014.10.30 10:07', false, 'Herbstferien' ], // Th + [ '2014.10.31 05:45', '2014.10.31 05:46' ], // Fr, KW44 + // FIXME: Fr: There is no school holiday this day but you will not have to go to school because of "Reformationstag". + /* }}} */ + ], 1000 * 60 * 49, 0, false, nominatiomTestJSON, 'not only test', 1); // period times {{{ test.addTest('Points in time, period times', [ diff --git a/test.log b/test.log index d40e2447..c1330ebb 100644 --- a/test.log +++ b/test.log @@ -553,16 +553,32 @@ With warnings: "Week ranges" for "week 1-3/2 00:00-24:00": PASSED "Week ranges" for "week 2,4 00:00-24:00": PASSED "Week ranges" for "week 2-4/2 00:00-24:00": PASSED +"Week range limit" for "week 2-53 00:00-24:00": PASSED "Week range limit" for "week 2-54 00:00-24:00": PASSED "Week range limit" for "week 2-54: 00:00-24:00": PASSED "Week range limit" for "week 2-57": PASSED With warnings: *week 2-57 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Week range" for "week 2-52/2 We; week 1-53/2 Sa 0:00-24:00": CRASHED, reason: Fatal: infinite loop in nextChange -"Week range" for "week 4-16": CRASHED, reason: Fatal: infinite loop in nextChange +"Week range" for "week 2-53/2 We; week 1-53/2 Sa 00:00-24:00": PASSED +With warnings: + *week 2-53/2 We <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Week range (beginning in last year)" for "week 4-16": PASSED +With warnings: + *week 4-16 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Week range (beginning in matching year)" for "week 4-16": PASSED +With warnings: + *week 4-16 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) "Week range first week" for "week 1": PASSED With warnings: *week 1 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Week range first week" for "week 1": PASSED +With warnings: + *week 1 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Week range first week" for "week 1 open": PASSED +With warnings: + *week 1 open <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Week range first week" for "week 1 00:00-24:00": PASSED +"Week range first week" for "week 1 00:00-23:59": PASSED "Only in one month of the year" for "Apr 08:00-12:00": PASSED "Only in one month of the year" for "Apr: 08:00-12:00": PASSED "Month ranges" for "Nov-Feb 00:00-24:00": PASSED @@ -745,18 +761,18 @@ With warnings: "Date range which only applies for specific year" for "2012-2016": PASSED With warnings: *2012-2016 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector combination" for "week 3 We": PASSED +"Selector combination" for "week 2 We": PASSED With warnings: - *week 3 We <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector combination" for "week 3 Jan 11-Jan 11": PASSED + *week 2 We <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector combination" for "week 2 Jan 11-Jan 11": PASSED With warnings: - *week 3 Jan 11-Jan 11 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector combination" for "week 3 Jan 11": PASSED + *week 2 Jan 11-Jan 11 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector combination" for "week 2 Jan 11": PASSED With warnings: - *week 3 Jan 11 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector combination" for "week 3 Jan": PASSED + *week 2 Jan 11 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector combination" for "week 2 Jan": PASSED With warnings: - *week 3 Jan <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) + *week 2 Jan <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) "Selector combination" for "Jan-Feb Jan 9-Jan 15": PASSED With warnings: *Jan-Feb Jan 9-Jan 15 <--- (You have used 2 not connected months in one rule. This is probably an error. Equal selector types can (and should) always be written in conjunction separated by comma or something. Example for time ranges "12:00-13:00,15:00-18:00". Example for weekdays "Mo-We,Fr". Rules can be separated by ";".) @@ -774,6 +790,65 @@ With warnings: "Selector combination" for "Dec 30-Jan 27 We": PASSED With warnings: *Dec 30-Jan 27 We <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector order" for "Feb week 5": PASSED, except prettifyValue +With warnings: + *Feb week 5 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) + *week 5 <--- (The selector "week" was switched with the selector "month" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) +"Selector order" for "week 5 Feb": PASSED +With warnings: + *week 5 Feb <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector order" for "00:00-24:00 week 5 Feb": PASSED, except prettifyValue +With warnings: + *week 5 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *week 5 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "week 5 00:00-24:00 Feb": PASSED, except prettifyValue +With warnings: + *week 5 Feb <--- (The selector "month" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *week 5 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "week 5 Feb 00:00-24:00": PASSED +"Selector order" for "week 5 Feb: 00:00-24:00": PASSED +"Selector order" for "week 5 Feb Mo-Su 00:00-24:00": PASSED +"Selector order" for "Mo-Su week 5 Feb 00:00-24:00": PASSED, except prettifyValue +With warnings: + *week 5 <--- (The selector "week" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "00:00-24:00 Mo-Su week 5 Feb": PASSED, except prettifyValue +With warnings: + *week 5 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "00:00-24:00 week 5 Mo-Su Feb": PASSED, except prettifyValue +With warnings: + *week 5 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "Mo-Su 00:00-24:00 week 5 Feb": PASSED, except prettifyValue +With warnings: + *week 5 <--- (The selector "week" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) + *week 5 Feb <--- (The selector "month" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *week 5 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "2012 00:00-24:00 week 5 Feb": PASSED, except prettifyValue +With warnings: + *2012 week 5 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *2012 week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *2012 week 5 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "00:00-24:00 2012 week 5 Feb": PASSED, except prettifyValue +With warnings: + *2012 <--- (The selector "year" was switched with the selector "time" for readablitity and compatibiltity reasons.) + *2012 week 5 <--- (The selector "week" was switched with the selector "year" for readablitity and compatibiltity reasons.) + *2012 week 5 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *2012 week 5 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) +"Selector order" for "week 5 Feb 2012-2014": PASSED, except prettifyValue +With warnings: + *week 5 Feb 2012-2014 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) + *2012-2014 <--- (The selector "year" was switched with the selector "week" for readablitity and compatibiltity reasons.) + *2012-2014 week 5 <--- (The selector "week" was switched with the selector "month" for readablitity and compatibiltity reasons.) + *2012-2014 week 5 Feb <--- (The selector "month" was switched with the selector "year" for readablitity and compatibiltity reasons.) "Selector order" for "Feb week 6": PASSED, except prettifyValue With warnings: *Feb week 6 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) @@ -782,74 +857,15 @@ With warnings: "Selector order" for "week 6 Feb": PASSED With warnings: *week 6 Feb <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector order" for "00:00-24:00 week 6 Feb": PASSED, except prettifyValue -With warnings: - *week 6 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *week 6 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 6 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "week 6 00:00-24:00 Feb": PASSED, except prettifyValue +"Selector order" for "week 6 Feb open": PASSED With warnings: - *week 6 Feb <--- (The selector "month" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *week 6 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "week 6 Feb 00:00-24:00": PASSED -"Selector order" for "week 6 Feb: 00:00-24:00": PASSED -"Selector order" for "week 6 Feb Mo-Su 00:00-24:00": PASSED -"Selector order" for "Mo-Su week 6 Feb 00:00-24:00": PASSED, except prettifyValue + *week 6 Feb open <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) +"Selector order" for "open week 6 Feb": PASSED, except prettifyValue With warnings: - *week 6 <--- (The selector "week" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) + *open week 6 Feb <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) + *week 6 <--- (The selector "week" was switched with the selector "state" for readablitity and compatibiltity reasons.) *week 6 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "00:00-24:00 Mo-Su week 6 Feb": PASSED, except prettifyValue -With warnings: - *week 6 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *week 6 Feb <--- (The selector "month" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "00:00-24:00 week 6 Mo-Su Feb": PASSED, except prettifyValue -With warnings: - *week 6 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *week 6 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "Mo-Su 00:00-24:00 week 6 Feb": PASSED, except prettifyValue -With warnings: - *week 6 <--- (The selector "week" was switched with the selector "weekday" for readablitity and compatibiltity reasons.) - *week 6 Feb <--- (The selector "month" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su <--- (The selector "weekday" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 6 Feb Mo-Su 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "2012 00:00-24:00 week 6 Feb": PASSED, except prettifyValue -With warnings: - *2012 week 6 <--- (The selector "week" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *2012 week 6 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *2012 week 6 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "00:00-24:00 2012 week 6 Feb": PASSED, except prettifyValue -With warnings: - *2012 <--- (The selector "year" was switched with the selector "time" for readablitity and compatibiltity reasons.) - *2012 week 6 <--- (The selector "week" was switched with the selector "year" for readablitity and compatibiltity reasons.) - *2012 week 6 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *2012 week 6 Feb 00:00-24:00 <--- (The selector "time" was switched with the selector "month" for readablitity and compatibiltity reasons.) -"Selector order" for "week 6 Feb 2012-2014": PASSED, except prettifyValue -With warnings: - *week 6 Feb 2012-2014 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) - *2012-2014 <--- (The selector "year" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *2012-2014 week 6 <--- (The selector "week" was switched with the selector "month" for readablitity and compatibiltity reasons.) - *2012-2014 week 6 Feb <--- (The selector "month" was switched with the selector "year" for readablitity and compatibiltity reasons.) -"Selector order" for "Feb week 7": PASSED, except prettifyValue -With warnings: - *Feb week 7 <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) - *week 7 <--- (The selector "week" was switched with the selector "month" for readablitity and compatibiltity reasons.) - *week 7 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) -"Selector order" for "week 7 Feb": PASSED -With warnings: - *week 7 Feb <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector order" for "week 7 Feb open": PASSED -With warnings: - *week 7 Feb open <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) -"Selector order" for "open week 7 Feb": PASSED, except prettifyValue -With warnings: - *open week 7 Feb <--- (This rule is not very explicit because there is no time selector being used. Please add a time selector to this rule.) - *week 7 <--- (The selector "week" was switched with the selector "state" for readablitity and compatibiltity reasons.) - *week 7 Feb <--- (The selector "month" was switched with the selector "week" for readablitity and compatibiltity reasons.) - *week 7 Feb open <--- (The selector "state" was switched with the selector "month" for readablitity and compatibiltity reasons.) + *week 6 Feb open <--- (The selector "state" was switched with the selector "month" for readablitity and compatibiltity reasons.) "Additional comments" for "Mo,Tu 10:00-16:00 open "no warranty"; We 12:00-18:00 open "female only"; Th closed "Not open because we are coding :)"; Fr 10:00-16:00 open "male only"; Sa 10:00-12:00 "Maybe open. Call us."": PASSED "Additional comments for unknown" for "Sa 10:00-12:00 "Maybe open. Call us. (testing special tokens in comment: ; ;; ' || | test end)"": PASSED "Additional comments for unknown" for "Sa 10:00-12:00 unknown "Maybe open. Call us. (testing special tokens in comment: ; ;; ' || | test end)"": PASSED @@ -1011,7 +1027,7 @@ With warnings: *Monday-Wednesday 07:00; Thursday,Friday 05:45; Monday[1] 07:30; school holidays Monday-Friday <--- (Please use the abbreviation "Fr" for "friday".) *Monday-Wednesday 07:00; Thursday,Friday 05:45; Monday[1] 07:30; school holidays Monday-Friday (sunrise+03:00); public holidays <--- (Please use notation "PH" for "public holidays".) "Points in time, extrem example useful for ComplexAlarm" for "Mo-We 07:00; Th,Fr 05:45; Mo[1] 07:30; SH Mo-Fr (sunrise+03:00); PH off": PASSED -"Points in time, extrem example useful for ComplexAlarm" for "Mo-We 07:00; Th 05:45; week 1-56/2 Fr 05:45; week 2-56/2 Fr 05:45; SH Mo-Fr (sunrise+03:00); PH off": CRASHED, reason: Fatal: infinite loop in nextChange +"Points in time, extrem example useful for ComplexAlarm" for "Mo-We 07:00; Th 05:45; week 1-53/2 Fr 07:05; week 2-53/2 Fr 05:45; SH Mo-Fr (sunrise+03:00); PH off": PASSED "Points in time, period times" for "Mo-Fr 10:00-16:00/01:30": PASSED "Points in time, period times" for "Mo-Fr 10:00-16:00/90": PASSED "Points in time, period times" for "Mo-Fr 10:00-16:00/90; Sa off "testing at end for parser"": PASSED @@ -1762,4 +1778,4 @@ Su 7:30,10i <--- (Missing time separator in time range after: "number") "Compare result from getMatchingRule()" for "Fr 08:00-12:00 || Fr 12:00-16:00 open "Notfallsprechstunde"": PASSED "Compare result from getMatchingRule()" for "Fr 08:00-12:00, Fr 12:00-16:00 open "Notfallsprechstunde"": PASSED "Compare result from getMatchingRule()" for "Fr 08:00-12:00 || Fr 12:00-16:00 open "Notfallsprechstunde"": PASSED -644/672 tests passed +653/678 tests passed