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) ...@@ -37,12 +37,19 @@ static void test (conv_t f, const char *in, const char *out)
{ {
char *res; char *res;
printf ("\"%s\" -> \"%s\" ?\n", in, out); if (out != NULL)
printf ("\"%s\" -> \"%s\" ?\n", in, out);
else
printf ("\"%s\" -> NULL ?\n", in);
res = f (in); res = f (in);
if (res == NULL) if (res == NULL)
exit (1); {
if (out == NULL)
if (strcmp (res, out)) return; /* good: NULL -> NULL */
puts (" ERROR: got NULL");
exit (2);
}
if (out == NULL || strcmp (res, out))
{ {
printf (" ERROR: got \"%s\"\n", res); printf (" ERROR: got \"%s\"\n", res);
exit (2); 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