Commit 71decd73 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Allow tested functions to return NULL

parent f7aa8a53
......@@ -37,12 +37,19 @@ static void test (conv_t f, const char *in, const char *out)
{
char *res;
if (out != NULL)
printf ("\"%s\" -> \"%s\" ?\n", in, out);
else
printf ("\"%s\" -> NULL ?\n", in);
res = f (in);
if (res == NULL)
exit (1);
if (strcmp (res, out))
{
if (out == NULL)
return; /* good: NULL -> NULL */
puts (" ERROR: got NULL");
exit (2);
}
if (out == NULL || strcmp (res, out))
{
printf (" ERROR: got \"%s\"\n", res);
exit (2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment