public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] systemd/time: add tests for weekday month wrapping
Date: Fri, 31 Jul 2020 14:15:12 +0200	[thread overview]
Message-ID: <20200731121513.2573-1-d.csapak@proxmox.com> (raw)

this will fail for now, gets fixed in the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/tools/systemd/time.rs | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/tools/systemd/time.rs b/src/tools/systemd/time.rs
index 430fb5c1..773a1509 100644
--- a/src/tools/systemd/time.rs
+++ b/src/tools/systemd/time.rs
@@ -301,6 +301,9 @@ mod test {
         const THURSDAY_00_00: i64 = make_test_time(0, 0, 0);
         const THURSDAY_15_00: i64 = make_test_time(0, 15, 0);
 
+        const JUL_31_2020: i64 = 1596153600; // Friday, 2020-07-31 00:00:00
+        const DEC_31_2020: i64 = 1609372800; // Thursday, 2020-12-31 00:00:00
+
         test_value("*:0", THURSDAY_00_00, THURSDAY_00_00 + HOUR)?;
         test_value("*:*", THURSDAY_00_00, THURSDAY_00_00 + MIN)?;
         test_value("*:*:*", THURSDAY_00_00, THURSDAY_00_00 + 1)?;
@@ -317,6 +320,24 @@ mod test {
         test_value("sat", THURSDAY_00_00, THURSDAY_00_00 + 2*DAY)?;
         test_value("sun", THURSDAY_00_00, THURSDAY_00_00 + 3*DAY)?;
 
+        // test month wrapping
+        test_value("sat", JUL_31_2020, JUL_31_2020 + 1*DAY)?;
+        test_value("sun", JUL_31_2020, JUL_31_2020 + 2*DAY)?;
+        test_value("mon", JUL_31_2020, JUL_31_2020 + 3*DAY)?;
+        test_value("tue", JUL_31_2020, JUL_31_2020 + 4*DAY)?;
+        test_value("wed", JUL_31_2020, JUL_31_2020 + 5*DAY)?;
+        test_value("thu", JUL_31_2020, JUL_31_2020 + 6*DAY)?;
+        test_value("fri", JUL_31_2020, JUL_31_2020 + 7*DAY)?;
+
+        // test year wrapping
+        test_value("fri", DEC_31_2020, DEC_31_2020 + 1*DAY)?;
+        test_value("sat", DEC_31_2020, DEC_31_2020 + 2*DAY)?;
+        test_value("sun", DEC_31_2020, DEC_31_2020 + 3*DAY)?;
+        test_value("mon", DEC_31_2020, DEC_31_2020 + 4*DAY)?;
+        test_value("tue", DEC_31_2020, DEC_31_2020 + 5*DAY)?;
+        test_value("wed", DEC_31_2020, DEC_31_2020 + 6*DAY)?;
+        test_value("thu", DEC_31_2020, DEC_31_2020 + 7*DAY)?;
+
         test_value("daily", THURSDAY_00_00, THURSDAY_00_00 + DAY)?;
         test_value("daily", THURSDAY_00_00+1, THURSDAY_00_00 + DAY)?;
 
-- 
2.20.1





             reply	other threads:[~2020-07-31 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 12:15 Dominik Csapak [this message]
2020-07-31 12:15 ` [pbs-devel] [PATCH proxmox-backup 2/2] systemd/time: fix weekday wrapping on month Dominik Csapak
2020-08-03  6:21 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] systemd/time: add tests for weekday month wrapping Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731121513.2573-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal