glibc/time/tst-strptime2.c

236 lines
6.4 KiB
C
Raw Normal View History

time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
/* tst-strptime2 - Test strptime %z timezone offset specifier. */
#include <limits.h>
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include <libc-diag.h>
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
/* Dummy string is used to match strptime's %s specifier. */
static const char dummy_string[] = "1113472456";
/* buffer_size contains the maximum test string length, including
trailing NUL. */
enum
{
buffer_size = 20,
};
/* Verbose execution, set with --verbose command line option. */
static bool verbose;
/* mkbuf - Write a test string for strptime with the specified time
value and number of digits into the supplied buffer, and return
the expected strptime test result.
The test string, buf, is written with the following content:
a dummy string matching strptime "%s" format specifier,
whitespace matching strptime " " format specifier, and
timezone string matching strptime "%z" format specifier.
Note that a valid timezone string is either "Z" or contains the
following fields:
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
Sign field consisting of a '+' or '-' sign,
Hours field in two decimal digits, and
optional Minutes field in two decimal digits. Optionally,
a ':' is used to seperate hours and minutes.
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
This function may write test strings with minutes values outside
the valid range 00-59. These are invalid strings and useful for
testing strptime's rejection of invalid strings.
The ndigits parameter is used to limit the number of timezone
string digits to be written and may range from 0 to 4. Note that
only 2 and 4 digit strings are valid input to strptime; strings
with 0, 1 or 3 digits are invalid and useful for testing strptime's
rejection of invalid strings.
This function returns the behavior expected of strptime resulting
from parsing the the test string. For valid strings, the function
returns the expected tm_gmtoff value. For invalid strings,
LONG_MAX is returned. LONG_MAX indicates the expectation that
strptime will return NULL; for example, if the number of digits
are not correct, or minutes part of the time is outside the valid
range of 00 to 59. */
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
static long int
mkbuf (char *buf, bool neg, bool colon, unsigned int hhmm, size_t ndigits)
{
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
const int mm_max = 59;
char sign = neg ? '-' : '+';
int i;
unsigned int hh = hhmm / 100;
unsigned int mm = hhmm % 100;
long int expect = LONG_MAX;
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
i = sprintf (buf, "%s %c", dummy_string, sign);
#if __GNUC_PREREQ (7, 0)
/* GCC issues a warning when it thinks the snprintf buffer may be too short.
This test is explicitly using short buffers to force snprintf to truncate
the output so we ignore the warnings. */
DIAG_PUSH_NEEDS_COMMENT;
DIAG_IGNORE_NEEDS_COMMENT (7.0, "-Wformat-truncation");
#endif
if (colon)
snprintf (buf + i, ndigits + 2, "%02u:%02u", hh, mm);
else
snprintf (buf + i, ndigits + 1, "%04u", hhmm);
#if __GNUC_PREREQ (7, 0)
DIAG_POP_NEEDS_COMMENT;
#endif
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
if (mm <= mm_max && (ndigits == 2 || ndigits == 4))
{
long int tm_gmtoff = hh * 3600 + mm * 60;
expect = neg ? -tm_gmtoff : tm_gmtoff;
}
return expect;
}
/* Write a description of expected or actual test result to stdout. */
static void
describe (bool string_valid, long int tm_gmtoff)
{
if (string_valid)
printf ("valid, tm.tm_gmtoff %ld", tm_gmtoff);
else
printf ("invalid, return value NULL");
}
/* Using buffer buf, run strptime. Compare results against expect,
the expected result. Report failures and verbose results to stdout.
Update the result counts. Return 1 if test failed, 0 if passed. */
Modify several tests to use test-skeleton.c This patch modifies several test cases to use test-skeleton.c. It was generated by a bash script written for this purpose and thus excludes several other tests which I deemed worth a visual inspection before making the change. I intend to follow up with individual patches to the tests skipped by the script. The script itself resides at http://git.io/WODAmg and should reproduce this very patch when run against master. ChangeLog: 2014-10-30 Arjun Shankar <arjun.is@lostca.se> * catgets/test-gencat.c: Use test-skeleton.c. * catgets/tst-catgets.c: Likewise. * csu/tst-empty.c: Likewise. * elf/tst-audit2.c: Likewise. * elf/tst-global1.c: Likewise. * elf/tst-pathopt.c: Likewise. * elf/tst-piemod1.c: Likewise. * elf/tst-tls10.c: Likewise. * elf/tst-tls11.c: Likewise. * elf/tst-tls12.c: Likewise. * gnulib/tst-gcc.c: Likewise. * iconvdata/tst-e2big.c: Likewise. * iconvdata/tst-loading.c: Likewise. * iconv/tst-iconv1.c: Likewise. * iconv/tst-iconv2.c: Likewise. * inet/test-inet6_opt.c: Likewise. * inet/tst-gethnm.c: Likewise. * inet/tst-network.c: Likewise. * inet/tst-ntoa.c: Likewise. * intl/tst-codeset.c: Likewise. * intl/tst-gettext2.c: Likewise. * intl/tst-gettext3.c: Likewise. * intl/tst-ngettext.c: Likewise. * intl/tst-translit.c: Likewise. * io/test-stat.c: Likewise. * libio/test-fmemopen.c: Likewise. * libio/tst-freopen.c: Likewise. * libio/tst-sscanf.c: Likewise. * libio/tst-ungetwc1.c: Likewise. * libio/tst-ungetwc2.c: Likewise. * libio/tst-widetext.c: Likewise. * localedata/tst-ctype.c: Likewise. * localedata/tst-digits.c: Likewise. * localedata/tst-leaks.c: Likewise. * localedata/tst-mbswcs1.c: Likewise. * localedata/tst-mbswcs2.c: Likewise. * localedata/tst-mbswcs3.c: Likewise. * localedata/tst-mbswcs4.c: Likewise. * localedata/tst-mbswcs5.c: Likewise. * localedata/tst-setlocale.c: Likewise. * localedata/tst-trans.c: Likewise. * localedata/tst-wctype.c: Likewise. * localedata/tst-xlocale1.c: Likewise. * login/tst-grantpt.c: Likewise. * malloc/tst-calloc.c: Likewise. * malloc/tst-malloc.c: Likewise. * malloc/tst-mallocstate.c: Likewise. * malloc/tst-mcheck.c: Likewise. * malloc/tst-mtrace.c: Likewise. * malloc/tst-obstack.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-exp.c: Likewise. * math/atest-sincos.c: Likewise. * math/test-matherr.c: Likewise. * math/test-misc.c: Likewise. * math/test-powl.c: Likewise. * math/tst-definitions.c: Likewise. * misc/tst-dirname.c: Likewise. * misc/tst-efgcvt.c: Likewise. * misc/tst-fdset.c: Likewise. * misc/tst-hsearch.c: Likewise. * misc/tst-mntent2.c: Likewise. * nptl/tst-sem7.c: Likewise. * nptl/tst-sem8.c: Likewise. * nptl/tst-sem9.c: Likewise. * nss/test-netdb.c: Likewise. * posix/tst-fnmatch.c: Likewise. * posix/tst-getlogin.c: Likewise. * posix/tst-gnuglob.c: Likewise. * posix/tst-mmap.c: Likewise. * pwd/tst-getpw.c: Likewise. * resolv/tst-inet_ntop.c: Likewise. * rt/tst-timer.c: Likewise. * stdio-common/test-fseek.c: Likewise. * stdio-common/test-popen.c: Likewise. * stdio-common/test-vfprintf.c: Likewise. * stdio-common/tst-cookie.c: Likewise. * stdio-common/tst-fileno.c: Likewise. * stdio-common/tst-gets.c: Likewise. * stdio-common/tst-obprintf.c: Likewise. * stdio-common/tst-perror.c: Likewise. * stdio-common/tst-sprintf2.c: Likewise. * stdio-common/tst-sprintf3.c: Likewise. * stdio-common/tst-sprintf.c: Likewise. * stdio-common/tst-swprintf.c: Likewise. * stdio-common/tst-tmpnam.c: Likewise. * stdio-common/tst-unbputc.c: Likewise. * stdio-common/tst-wc-printf.c: Likewise. * stdlib/tst-environ.c: Likewise. * stdlib/tst-fmtmsg.c: Likewise. * stdlib/tst-limits.c: Likewise. * stdlib/tst-rand48-2.c: Likewise. * stdlib/tst-rand48.c: Likewise. * stdlib/tst-random2.c: Likewise. * stdlib/tst-random.c: Likewise. * stdlib/tst-strtol.c: Likewise. * stdlib/tst-strtoll.c: Likewise. * stdlib/tst-tls-atexit.c: Likewise. * stdlib/tst-xpg-basename.c: Likewise. * string/test-ffs.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strxfrm.c: Likewise. * sysdeps/x86_64/tst-audit10.c: Likewise. * sysdeps/x86_64/tst-audit3.c: Likewise. * sysdeps/x86_64/tst-audit4.c: Likewise. * sysdeps/x86_64/tst-audit5.c: Likewise. * time/tst-ftime_l.c: Likewise. * time/tst-getdate.c: Likewise. * time/tst-mktime3.c: Likewise. * time/tst-mktime.c: Likewise. * time/tst-posixtz.c: Likewise. * time/tst-strptime2.c: Likewise. * time/tst-strptime3.c: Likewise. * wcsmbs/tst-btowc.c: Likewise. * wcsmbs/tst-mbrtowc.c: Likewise. * wcsmbs/tst-mbsrtowcs.c: Likewise. * wcsmbs/tst-wchar-h.c: Likewise. * wcsmbs/tst-wcpncpy.c: Likewise. * wcsmbs/tst-wcrtomb.c: Likewise. * wcsmbs/tst-wcsnlen.c: Likewise. * wcsmbs/tst-wcstof.c: Likewise.
2014-11-05 10:54:08 +01:00
static int
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
compare (const char *buf, long int expect, unsigned int *nresult)
{
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
struct tm tm;
char *p;
bool test_string_valid;
long int test_result;
bool fail;
int result;
p = strptime (buf, "%s %z", &tm);
test_string_valid = p != NULL;
test_result = test_string_valid ? tm.tm_gmtoff : LONG_MAX;
fail = test_result != expect;
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
if (fail || verbose)
{
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
bool expect_string_valid = expect != LONG_MAX;
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
printf ("%s: input \"%s\", expected: ", fail ? "FAIL" : "PASS", buf);
describe (expect_string_valid, expect);
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
if (fail)
{
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
printf (", got: ");
describe (test_string_valid, test_result);
}
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
printf ("\n");
}
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
result = fail ? 1 : 0;
nresult[result]++;
return result;
}
static int
do_test (void)
{
char buf[buffer_size];
long int expect;
int result = 0;
/* Number of tests run with passing (index==0) and failing (index==1)
results. */
unsigned int nresult[2];
unsigned int ndigits;
unsigned int step;
unsigned int hhmm;
nresult[0] = 0;
nresult[1] = 0;
/* Create and test input string with no sign and four digits input
(invalid format). */
sprintf (buf, "%s 1030", dummy_string);
expect = LONG_MAX;
result |= compare (buf, expect, nresult);
/* Create and test input string with "Z" input (valid format).
Expect tm_gmtoff of 0. */
sprintf (buf, "%s Z", dummy_string);
expect = 0;
result |= compare (buf, expect, nresult);
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
/* Create and test input strings with sign and digits:
0 digits (invalid format),
1 digit (invalid format),
2 digits (valid format),
3 digits (invalid format),
4 digits (valid format if and only if minutes is in range 00-59,
otherwise invalid).
If format is valid, the returned tm_gmtoff is checked. */
for (ndigits = 0, step = 10000; ndigits <= 4; ndigits++, step /= 10)
for (hhmm = 0; hhmm <= 9999; hhmm += step)
{
/* Test both positive and negative signs. */
expect = mkbuf (buf, false, false, hhmm, ndigits);
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
result |= compare (buf, expect, nresult);
expect = mkbuf (buf, true, false, hhmm, ndigits);
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
result |= compare (buf, expect, nresult);
/* Test with colon as well. */
if (ndigits >= 3)
{
expect = mkbuf (buf, false, true, hhmm, ndigits);
result |= compare (buf, expect, nresult);
expect = mkbuf (buf, true, true, hhmm, ndigits);
result |= compare (buf, expect, nresult);
}
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
}
if (result > 0 || verbose)
printf ("%s: %u input strings: %u fail, %u pass\n",
result > 0 ? "FAIL" : "PASS",
nresult[1] + nresult[0], nresult[1], nresult[0]);
return result;
}
Modify several tests to use test-skeleton.c This patch modifies several test cases to use test-skeleton.c. It was generated by a bash script written for this purpose and thus excludes several other tests which I deemed worth a visual inspection before making the change. I intend to follow up with individual patches to the tests skipped by the script. The script itself resides at http://git.io/WODAmg and should reproduce this very patch when run against master. ChangeLog: 2014-10-30 Arjun Shankar <arjun.is@lostca.se> * catgets/test-gencat.c: Use test-skeleton.c. * catgets/tst-catgets.c: Likewise. * csu/tst-empty.c: Likewise. * elf/tst-audit2.c: Likewise. * elf/tst-global1.c: Likewise. * elf/tst-pathopt.c: Likewise. * elf/tst-piemod1.c: Likewise. * elf/tst-tls10.c: Likewise. * elf/tst-tls11.c: Likewise. * elf/tst-tls12.c: Likewise. * gnulib/tst-gcc.c: Likewise. * iconvdata/tst-e2big.c: Likewise. * iconvdata/tst-loading.c: Likewise. * iconv/tst-iconv1.c: Likewise. * iconv/tst-iconv2.c: Likewise. * inet/test-inet6_opt.c: Likewise. * inet/tst-gethnm.c: Likewise. * inet/tst-network.c: Likewise. * inet/tst-ntoa.c: Likewise. * intl/tst-codeset.c: Likewise. * intl/tst-gettext2.c: Likewise. * intl/tst-gettext3.c: Likewise. * intl/tst-ngettext.c: Likewise. * intl/tst-translit.c: Likewise. * io/test-stat.c: Likewise. * libio/test-fmemopen.c: Likewise. * libio/tst-freopen.c: Likewise. * libio/tst-sscanf.c: Likewise. * libio/tst-ungetwc1.c: Likewise. * libio/tst-ungetwc2.c: Likewise. * libio/tst-widetext.c: Likewise. * localedata/tst-ctype.c: Likewise. * localedata/tst-digits.c: Likewise. * localedata/tst-leaks.c: Likewise. * localedata/tst-mbswcs1.c: Likewise. * localedata/tst-mbswcs2.c: Likewise. * localedata/tst-mbswcs3.c: Likewise. * localedata/tst-mbswcs4.c: Likewise. * localedata/tst-mbswcs5.c: Likewise. * localedata/tst-setlocale.c: Likewise. * localedata/tst-trans.c: Likewise. * localedata/tst-wctype.c: Likewise. * localedata/tst-xlocale1.c: Likewise. * login/tst-grantpt.c: Likewise. * malloc/tst-calloc.c: Likewise. * malloc/tst-malloc.c: Likewise. * malloc/tst-mallocstate.c: Likewise. * malloc/tst-mcheck.c: Likewise. * malloc/tst-mtrace.c: Likewise. * malloc/tst-obstack.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-exp.c: Likewise. * math/atest-sincos.c: Likewise. * math/test-matherr.c: Likewise. * math/test-misc.c: Likewise. * math/test-powl.c: Likewise. * math/tst-definitions.c: Likewise. * misc/tst-dirname.c: Likewise. * misc/tst-efgcvt.c: Likewise. * misc/tst-fdset.c: Likewise. * misc/tst-hsearch.c: Likewise. * misc/tst-mntent2.c: Likewise. * nptl/tst-sem7.c: Likewise. * nptl/tst-sem8.c: Likewise. * nptl/tst-sem9.c: Likewise. * nss/test-netdb.c: Likewise. * posix/tst-fnmatch.c: Likewise. * posix/tst-getlogin.c: Likewise. * posix/tst-gnuglob.c: Likewise. * posix/tst-mmap.c: Likewise. * pwd/tst-getpw.c: Likewise. * resolv/tst-inet_ntop.c: Likewise. * rt/tst-timer.c: Likewise. * stdio-common/test-fseek.c: Likewise. * stdio-common/test-popen.c: Likewise. * stdio-common/test-vfprintf.c: Likewise. * stdio-common/tst-cookie.c: Likewise. * stdio-common/tst-fileno.c: Likewise. * stdio-common/tst-gets.c: Likewise. * stdio-common/tst-obprintf.c: Likewise. * stdio-common/tst-perror.c: Likewise. * stdio-common/tst-sprintf2.c: Likewise. * stdio-common/tst-sprintf3.c: Likewise. * stdio-common/tst-sprintf.c: Likewise. * stdio-common/tst-swprintf.c: Likewise. * stdio-common/tst-tmpnam.c: Likewise. * stdio-common/tst-unbputc.c: Likewise. * stdio-common/tst-wc-printf.c: Likewise. * stdlib/tst-environ.c: Likewise. * stdlib/tst-fmtmsg.c: Likewise. * stdlib/tst-limits.c: Likewise. * stdlib/tst-rand48-2.c: Likewise. * stdlib/tst-rand48.c: Likewise. * stdlib/tst-random2.c: Likewise. * stdlib/tst-random.c: Likewise. * stdlib/tst-strtol.c: Likewise. * stdlib/tst-strtoll.c: Likewise. * stdlib/tst-tls-atexit.c: Likewise. * stdlib/tst-xpg-basename.c: Likewise. * string/test-ffs.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strxfrm.c: Likewise. * sysdeps/x86_64/tst-audit10.c: Likewise. * sysdeps/x86_64/tst-audit3.c: Likewise. * sysdeps/x86_64/tst-audit4.c: Likewise. * sysdeps/x86_64/tst-audit5.c: Likewise. * time/tst-ftime_l.c: Likewise. * time/tst-getdate.c: Likewise. * time/tst-mktime3.c: Likewise. * time/tst-mktime.c: Likewise. * time/tst-posixtz.c: Likewise. * time/tst-strptime2.c: Likewise. * time/tst-strptime3.c: Likewise. * wcsmbs/tst-btowc.c: Likewise. * wcsmbs/tst-mbrtowc.c: Likewise. * wcsmbs/tst-mbsrtowcs.c: Likewise. * wcsmbs/tst-wchar-h.c: Likewise. * wcsmbs/tst-wcpncpy.c: Likewise. * wcsmbs/tst-wcrtomb.c: Likewise. * wcsmbs/tst-wcsnlen.c: Likewise. * wcsmbs/tst-wcstof.c: Likewise.
2014-11-05 10:54:08 +01:00
time/tst-strptime2.c: test full input range +/- 0-9999 strptime's %z specifier parses a string consisting of a sign ('+' or '-'), two hours digits, and optionally two minutes digits, into a tm.tm_gmtoff field containing the signed number of seconds the time zone is offset from UTC time. The time/tst-strptime2.c program passes a short list of strings through strptime, validating that either the gmtoff value returned matches an expected value, or that strptime returns an expected NULL for invalid strings (for example, when the minutes portion of the string is outside of the range 00 to 59, or the sign is missing before the hours digits). In review of strptime fixes, Carlos O'Donell expressed a wish that the test function iterate through the entire range of all possible numeric strings (-9999 to +9999) which could be passed to strptime %z, and validate the correct response. Specifically, the test will look for a NULL response from strptime when: * sign ('+' or '-') is not present before the first digit (invalid format). * A sign and no digits are found (invalid format). * A sign and one digit are found (invalid format). * A sign and three digits are found (invalid format). * A sign and four digits (-9999 to +9999) are found but the last two digits (minutes) are in the range 60 to 99. The test will look for a success response from strptime with tm.tm_gmtoff matching the calculated tm_gmtoff value when: * A sign and four digits are found (-9999 to +9999), and the last two digits (minutes) are in the range 00 to 59. * A sign and two digit strings are found (-99 to +99). The test's iteration over the possible digit values results in 22223 test strings prepared, tested, and passed by strptime. The test supports a --verbose command line option which will show the test results of every test input, and a final summary of all tests. Here is some sample output: PASS: input "1113472456 1030", expected: invalid, return value NULL PASS: input "1113472456 +", expected: invalid, return value NULL PASS: input "1113472456 -", expected: invalid, return value NULL PASS: input "1113472456 +0", expected: invalid, return value NULL PASS: input "1113472456 -0", expected: invalid, return value NULL PASS: input "1113472456 +1", expected: invalid, return value NULL ... PASS: input "1113472456 +9", expected: invalid, return value NULL PASS: input "1113472456 -9", expected: invalid, return value NULL PASS: input "1113472456 +00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -00", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +01", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -01", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +02", expected: valid, tm.tm_gmtoff 7200 ... PASS: input "1113472456 +99", expected: valid, tm.tm_gmtoff 356400 PASS: input "1113472456 -99", expected: valid, tm.tm_gmtoff -356400 PASS: input "1113472456 +000", expected: invalid, return value NULL PASS: input "1113472456 -000", expected: invalid, return value NULL PASS: input "1113472456 +001", expected: invalid, return value NULL ... PASS: input "1113472456 +999", expected: invalid, return value NULL PASS: input "1113472456 -999", expected: invalid, return value NULL PASS: input "1113472456 +0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 -0000", expected: valid, tm.tm_gmtoff 0 PASS: input "1113472456 +0001", expected: valid, tm.tm_gmtoff 60 PASS: input "1113472456 -0001", expected: valid, tm.tm_gmtoff -60 ... PASS: input "1113472456 +0059", expected: valid, tm.tm_gmtoff 3540 PASS: input "1113472456 -0059", expected: valid, tm.tm_gmtoff -3540 PASS: input "1113472456 +0060", expected: invalid, return value NULL PASS: input "1113472456 -0060", expected: invalid, return value NULL ... PASS: input "1113472456 +0099", expected: invalid, return value NULL PASS: input "1113472456 -0099", expected: invalid, return value NULL PASS: input "1113472456 +0100", expected: valid, tm.tm_gmtoff 3600 PASS: input "1113472456 -0100", expected: valid, tm.tm_gmtoff -3600 PASS: input "1113472456 +0101", expected: valid, tm.tm_gmtoff 3660 ... PASS: input "1113472456 +9999", expected: invalid, return value NULL PASS: input "1113472456 -9999", expected: invalid, return value NULL PASS: 22223 input strings: 0 fail, 22223 pass Any failing test will result in printing the failed line to stdout, and will trigger the printing of the summary line at the of all tests. For example: FAIL: input "1113472456 1030", expected: invalid, return value NULL, got: valid, tm.tm_gmtoff 37800 FAIL: 22223 input strings: 1 fail, 22222 pass
2015-08-17 22:48:39 +02:00
/* Add a "--verbose" command line option to test-skeleton.c. */
#define OPT_VERBOSE 10000
#define CMDLINE_OPTIONS \
{ "verbose", no_argument, NULL, OPT_VERBOSE, },
#define CMDLINE_PROCESS \
case OPT_VERBOSE: \
verbose = true; \
break;
Modify several tests to use test-skeleton.c This patch modifies several test cases to use test-skeleton.c. It was generated by a bash script written for this purpose and thus excludes several other tests which I deemed worth a visual inspection before making the change. I intend to follow up with individual patches to the tests skipped by the script. The script itself resides at http://git.io/WODAmg and should reproduce this very patch when run against master. ChangeLog: 2014-10-30 Arjun Shankar <arjun.is@lostca.se> * catgets/test-gencat.c: Use test-skeleton.c. * catgets/tst-catgets.c: Likewise. * csu/tst-empty.c: Likewise. * elf/tst-audit2.c: Likewise. * elf/tst-global1.c: Likewise. * elf/tst-pathopt.c: Likewise. * elf/tst-piemod1.c: Likewise. * elf/tst-tls10.c: Likewise. * elf/tst-tls11.c: Likewise. * elf/tst-tls12.c: Likewise. * gnulib/tst-gcc.c: Likewise. * iconvdata/tst-e2big.c: Likewise. * iconvdata/tst-loading.c: Likewise. * iconv/tst-iconv1.c: Likewise. * iconv/tst-iconv2.c: Likewise. * inet/test-inet6_opt.c: Likewise. * inet/tst-gethnm.c: Likewise. * inet/tst-network.c: Likewise. * inet/tst-ntoa.c: Likewise. * intl/tst-codeset.c: Likewise. * intl/tst-gettext2.c: Likewise. * intl/tst-gettext3.c: Likewise. * intl/tst-ngettext.c: Likewise. * intl/tst-translit.c: Likewise. * io/test-stat.c: Likewise. * libio/test-fmemopen.c: Likewise. * libio/tst-freopen.c: Likewise. * libio/tst-sscanf.c: Likewise. * libio/tst-ungetwc1.c: Likewise. * libio/tst-ungetwc2.c: Likewise. * libio/tst-widetext.c: Likewise. * localedata/tst-ctype.c: Likewise. * localedata/tst-digits.c: Likewise. * localedata/tst-leaks.c: Likewise. * localedata/tst-mbswcs1.c: Likewise. * localedata/tst-mbswcs2.c: Likewise. * localedata/tst-mbswcs3.c: Likewise. * localedata/tst-mbswcs4.c: Likewise. * localedata/tst-mbswcs5.c: Likewise. * localedata/tst-setlocale.c: Likewise. * localedata/tst-trans.c: Likewise. * localedata/tst-wctype.c: Likewise. * localedata/tst-xlocale1.c: Likewise. * login/tst-grantpt.c: Likewise. * malloc/tst-calloc.c: Likewise. * malloc/tst-malloc.c: Likewise. * malloc/tst-mallocstate.c: Likewise. * malloc/tst-mcheck.c: Likewise. * malloc/tst-mtrace.c: Likewise. * malloc/tst-obstack.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-exp.c: Likewise. * math/atest-sincos.c: Likewise. * math/test-matherr.c: Likewise. * math/test-misc.c: Likewise. * math/test-powl.c: Likewise. * math/tst-definitions.c: Likewise. * misc/tst-dirname.c: Likewise. * misc/tst-efgcvt.c: Likewise. * misc/tst-fdset.c: Likewise. * misc/tst-hsearch.c: Likewise. * misc/tst-mntent2.c: Likewise. * nptl/tst-sem7.c: Likewise. * nptl/tst-sem8.c: Likewise. * nptl/tst-sem9.c: Likewise. * nss/test-netdb.c: Likewise. * posix/tst-fnmatch.c: Likewise. * posix/tst-getlogin.c: Likewise. * posix/tst-gnuglob.c: Likewise. * posix/tst-mmap.c: Likewise. * pwd/tst-getpw.c: Likewise. * resolv/tst-inet_ntop.c: Likewise. * rt/tst-timer.c: Likewise. * stdio-common/test-fseek.c: Likewise. * stdio-common/test-popen.c: Likewise. * stdio-common/test-vfprintf.c: Likewise. * stdio-common/tst-cookie.c: Likewise. * stdio-common/tst-fileno.c: Likewise. * stdio-common/tst-gets.c: Likewise. * stdio-common/tst-obprintf.c: Likewise. * stdio-common/tst-perror.c: Likewise. * stdio-common/tst-sprintf2.c: Likewise. * stdio-common/tst-sprintf3.c: Likewise. * stdio-common/tst-sprintf.c: Likewise. * stdio-common/tst-swprintf.c: Likewise. * stdio-common/tst-tmpnam.c: Likewise. * stdio-common/tst-unbputc.c: Likewise. * stdio-common/tst-wc-printf.c: Likewise. * stdlib/tst-environ.c: Likewise. * stdlib/tst-fmtmsg.c: Likewise. * stdlib/tst-limits.c: Likewise. * stdlib/tst-rand48-2.c: Likewise. * stdlib/tst-rand48.c: Likewise. * stdlib/tst-random2.c: Likewise. * stdlib/tst-random.c: Likewise. * stdlib/tst-strtol.c: Likewise. * stdlib/tst-strtoll.c: Likewise. * stdlib/tst-tls-atexit.c: Likewise. * stdlib/tst-xpg-basename.c: Likewise. * string/test-ffs.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strxfrm.c: Likewise. * sysdeps/x86_64/tst-audit10.c: Likewise. * sysdeps/x86_64/tst-audit3.c: Likewise. * sysdeps/x86_64/tst-audit4.c: Likewise. * sysdeps/x86_64/tst-audit5.c: Likewise. * time/tst-ftime_l.c: Likewise. * time/tst-getdate.c: Likewise. * time/tst-mktime3.c: Likewise. * time/tst-mktime.c: Likewise. * time/tst-posixtz.c: Likewise. * time/tst-strptime2.c: Likewise. * time/tst-strptime3.c: Likewise. * wcsmbs/tst-btowc.c: Likewise. * wcsmbs/tst-mbrtowc.c: Likewise. * wcsmbs/tst-mbsrtowcs.c: Likewise. * wcsmbs/tst-wchar-h.c: Likewise. * wcsmbs/tst-wcpncpy.c: Likewise. * wcsmbs/tst-wcrtomb.c: Likewise. * wcsmbs/tst-wcsnlen.c: Likewise. * wcsmbs/tst-wcstof.c: Likewise.
2014-11-05 10:54:08 +01:00
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"