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][BZ 14561] Testcase


> As testcases can be written independently I decided to post testcase
> separetely

It can be reviewed independently and I'm happy to do that now.  But it
can't be committed independently so I'm not sure there's much point in
posting it separately.

> 	* bug-srand-srandom-dependency.c: New file.
> 	* Makefile (tests) : Add bug-srand-srandom-dependency.

Spurious space before the : there.
(Also, in cases like this just "Add it." is sufficient.)

> +   <http://www.gnu.org/licenses/>.  */
> +
> +
> +
> +#include <stdlib.h>

Drop the extra blank lines (just one between header and #include).

> +int
> +do_test (int argc, char **argv)

static int
do_test (void)

and then put

#define TEST_FUNCTION	do_test ()

right before the #include at the bottom.

> +{
> +  int rand1, rand2;
> +  int random1, random2;

Use C99 in-line definitions.

> +  srand (43);
> +  rand1 = rand ();
> +  rand2 = rand ();
> +  srandom (42);
> +  random1 = random ();
> +  random2 = random ();
> +   
> +  /* We enumerate all combinations how rand and random
> +     can be interleaved and test independency.  */

"independency" is not an English word; "independence" works here.

> +  for (int com = 0; com < 64; com++)
> +    {
> +      int randstate = 0, randomstate = 0;
> +      for (int i = 0; i < 6; i++)

This seems like a bit of overkill and it takes some thought to understand
what you're doing here.  It's certainly not bad to be excessively thorough
in your test, but perhaps some more comments would help.


Thanks,
Roland


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