This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] time/tst-strptime2.c: test full input range -9999 to +9999

On 13 Aug 2015 17:49, James Perkins wrote:
> +/*
> +   Write a string into the supplied buffer, containing a dummy string,
> +   + or - sign, two hour digits, optionally two minutes digits,
> +   and trailing NUL.
> +
> +   Also, calculate and return expected results for this value.  If the
> +   input is valid then the expected gmtoffset is returned. If the
> +   value is invalid input to strptime, then 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.
> +   */

GNU style says the first & last lines should be cuddled.  e.g.
/* Write a string ....
   part of the time is outside the valid range of 00 to 59.  */

> +	sprintf(buf, "%s %c", dummy_string, sign);

GNU style says there should be a space before the (

> +      printf ("%s: tm_gmtoff is %ld\n", buf, (long int) tm.tm_gmtoff);

tm_gmtoff is already long int, so why the cast ?  i know it was there before,
but the question remains.

> +static int
> +do_test (void)

this could do with a --verbose option i think that'd dump every buffer tested
and the results of the test.  trusting silent output does the right thing vs
getting a verbose report and scanning by eye/grep/whatever makes me way more
confident and helps check for future regressions.

look at the CMDLINE_OPTIONS & CMDLINE_PROCESS defines in test-skeleton.c.

Attachment: signature.asc
Description: Digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]