From patchwork Wed Dec 3 22:45:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Perkins X-Patchwork-Id: 4063 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 11633 invoked by alias); 3 Dec 2014 22:46:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11513 invoked by uid 89); 3 Dec 2014 22:46:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f172.google.com X-Received: by 10.42.78.208 with SMTP id o16mr9054630ick.41.1417646800653; Wed, 03 Dec 2014 14:46:40 -0800 (PST) From: James Perkins To: libc-alpha@sourceware.org Subject: [PATCH v3 3/4] [BZ #14161] tst-strptime2.c: test %z range to +/-9959 Date: Wed, 3 Dec 2014 14:45:59 -0800 Message-Id: <1417646760-19563-3-git-send-email-james@loowit.net> In-Reply-To: <1417646760-19563-1-git-send-email-james@loowit.net> References: <1417646760-19563-1-git-send-email-james@loowit.net> This is part of a fix for [BZ #16141] strptime %z offset restriction. Add tests to time/tst-strptime2.c to explicitly test the following areas of strptime's %z input field descriptor: 1) Unable to parse time offsets less than -1200. * Although there are currently no timezones with offset less than -1200, historical time zones exist less than -1500, POSIX supports offsets as low as -2459, and offsets as low as -9959 are useful. * Existing tests are modified to verify valid results for offsets -1201 and -1330. * New tests verify offsets -1201, -2459, -2500, -99, and -9959. 2) Unable to parse time offsets greater than +1200. * Current timezones with offset of +1400, namely Pacific/Kiritimati and summer time for Pacific/Apia. Historical time zones exist greater than +1500. POSIX supports offsets as high as +2559. Offsets as high as +9959 are useful. * Existing tests are modified to verify valid results for offsets +1201 and +1330. * New tests verify offsets +1400, +1401, +2559, +2600, +99, and +9959. James 2014-12-03 James Perkins james@loowit.net * time/strptime2.c (tests[]): Modify and add tests for the strptime %z input field descriptor, expecting a time zone offset range of -9959 to +9959. --- time/tst-strptime2.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c index 5f9860a..f5f9a2b 100644 --- a/time/tst-strptime2.c +++ b/time/tst-strptime2.c @@ -22,10 +22,20 @@ static const struct { "1113472456 +1159", 43140 }, { "1113472456 +1200", 43200 }, { "1113472456 -1200", -43200 }, - { "1113472456 +1201", LONG_MAX }, - { "1113472456 -1201", LONG_MAX }, - { "1113472456 -1330", LONG_MAX }, - { "1113472456 +1330", LONG_MAX }, + { "1113472456 +1201", 43260 }, + { "1113472456 -1201", -43260 }, + { "1113472456 +1330", 48600 }, + { "1113472456 -1330", -48600 }, + { "1113472456 +1400", 50400 }, + { "1113472456 +1401", 50460 }, + { "1113472456 -2459", -89940 }, + { "1113472456 -2500", -90000 }, + { "1113472456 +2559", 93540 }, + { "1113472456 +2600", 93600 }, + { "1113472456 -99", -356400 }, + { "1113472456 +99", 356400 }, + { "1113472456 -9959", -359940 }, + { "1113472456 +9959", 359940 }, { "1113472456 -1060", LONG_MAX }, { "1113472456 +1060", LONG_MAX }, { "1113472456 1030", LONG_MAX },