On 05/07/2013 11:42 PM, Eric Blake wrote: > The surest way to avoid regressions is to test documented behavior :) > > * tests/virstringtest.c (testStrdup): New test case. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > tests/virstringtest.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > ... > + value = VIR_STRNDUP(array[i++], NULL, 5); > + if (value != 0) { > + fprintf(stderr, "unexpected strdup result %d, expected 0\n", value); > + goto cleanup; > + } > + if (i != 2) { > + fprintf(stderr, "unexpected side effects i=%zu, expected 2\n", i); > + goto cleanup; > + }
Should we test the side effects for the other two arguments as well? > + if (STRNEQ_NULLABLE(array[0], "hello") || array[1]) { > + fprintf(stderr, "incorrect array contents '%s' '%s'\n", > + NULLSTR(array[0]), NULLSTR(array[1])); > + goto cleanup; > + } > + > + ret = 0; ACK Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list