From b4cc67d455d598b28eb7cb7c8081c03975afe6d1 Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 31 Mar 2018 18:44:17 +0300 Subject: [PATCH] parser/tests: allow for DST change e.g. 21d / 2w are subject to DST; update the tolerance. --- lib/parser/test-utils.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/parser/test-utils.cc b/lib/parser/test-utils.cc index 2c008595..c0412d90 100644 --- a/lib/parser/test-utils.cc +++ b/lib/parser/test-utils.cc @@ -81,13 +81,13 @@ static void test_date_ymwdhMs (void) { struct { - std::string expr; - long diff; - int tolerance; + std::string expr; + long diff; + int tolerance; } tests[] = { { "3h", 3 * 60 * 60, 1 }, - { "21d", 21 * 24 * 60 * 60, 1 }, - { "2w", 2 * 7 * 24 * 60 * 60, 1 }, + { "21d", 21 * 24 * 60 * 60, 3600 + 1 }, + { "2w", 2 * 7 * 24 * 60 * 60, 3600 + 1 }, { "2y", 2 * 365 * 24 * 60 * 60, 24 * 3600 + 1 }, { "3m", 3 * 30 * 24 * 60 * 60, 3 * 24 * 3600 + 1 } @@ -154,8 +154,6 @@ test_format () "hello world, 123"); } - - int main (int argc, char *argv[]) {