This is the mail archive of the libc-alpha@sourceware.org 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 v2 3/3] Add tests for strfrom functions


On Tue, 30 Aug 2016, Gabriel F. T. Gomes wrote:

> +static const struct ltest ltests[] = {
> +  {"12345.3", 12345.345, "%g", 50, 7},
> +  {"1.000001", 0x80000Ap-23, "%f", 50, 8},

I'm not sure where this set of test inputs comes from.  But I'd expect you 
to have test values of the relevant type, not double.

> +      rc = FTOSTR (buf, lt->size, lt->fmt, lt->val);			\
> +      if (strcmp (lt->fmt, "%a") == 0 || strcmp (lt->fmt, "%A") == 0)	\
> +	rc1 = (strtold (lt->expect, NULL) == strtold (buf, NULL))	\
> +	      ? 0 : 1;							\

And I'm not convinced by the use of strtold here.  There are limited 
number of possible valid hex strings for given floating-point input; you 
could just make the tests list them all.

I don't see test coverage of the results when the buffer is too small.  
Or of LC_NUMERIC changes (meaning different decimal points, if it does 
have that effect).

-- 
Joseph S. Myers
joseph@codesourcery.com


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