--- var_test.c 2001/11/13 13:29:50 1.4
+++ var_test.c 2001/11/13 13:33:28 1.5
@@ -107,14 +107,18 @@
for (i = 0; i < sizeof(tests) / sizeof(struct test_case); ++i)
{
+#ifdef DEBUG
printf("Test case #%02d: Original input is '%s'.\n", i, tests[i].input);
+#endif
rc = var_unescape(tests[i].input, strlen(tests[i].input), buffer, 0);
if (rc != VAR_OK)
{
printf("Test case #%d: First var_unescape() failed with return code %d.\n", i, rc);
return 1;
}
+#ifdef DEBUG
printf("Test case #%02d: Unescaped input is '%s'.\n", i, buffer);
+#endif
rc = var_expand(buffer, strlen(buffer), &tmp, &tmp_len,
&env_lookup, NULL,
NULL, 0);
@@ -123,7 +127,9 @@
printf("Test case #%d: var_expand() failed with return code %d.\n", i, rc);
return 1;
}
+#ifdef DEBUG
printf("Test case #%02d: Expanded output is '%s'.\n", i, tmp);
+#endif
if (tmp_len != strlen(tests[i].expected) || tmp == NULL || memcmp(tests[i].expected, tmp, tmp_len) != 0)
{
printf("Test case #%d: Expected result '%s' but got '%s'.\n", i, tests[i].expected, tmp);
@@ -135,7 +141,9 @@
printf("Test case #%d: Second var_unescape() failed with return code %d.\n", i, rc);
return 1;
}
+#ifdef DEBUG
printf("Test case #%02d: Unescaped output is '%s'.\n\n", i, tmp);
+#endif
free(tmp);
}
|