/**
* @param stream: output stream write to differences to
* @param expect: expected output text
+ * @param expectName: name designator of the expected text
* @param actual: actual output text
+ * @param actualName: name designator of the actual text
*
- * Display expected and actual output text, trimmed to
- * first and last characters at which differences occur
+ * Display expected and actual output text, trimmed to first and last
+ * characters at which differences occur. Displays names of the text strings if
+ * non-NULL.
*/
-int virtTestDifference(FILE *stream,
- const char *expect,
- const char *actual)
+int virtTestDifferenceFull(FILE *stream,
+ const char *expect,
+ const char *expectName,
+ const char *actual,
+ const char *actualName)
{
const char *expectStart;
const char *expectEnd;
}
/* Show the trimmed differences */
+ if (expectName)
+ fprintf(stream, "\nIn '%s':", expectName);
fprintf(stream, "\nOffset %d\nExpect [", (int) (expectStart - expect));
if ((expectEnd - expectStart + 1) &&
fwrite(expectStart, (expectEnd-expectStart+1), 1, stream) != 1)
return -1;
fprintf(stream, "]\n");
+ if (actualName)
+ fprintf(stream, "In '%s':\n", actualName);
fprintf(stream, "Actual [");
if ((actualEnd - actualStart + 1) &&
fwrite(actualStart, (actualEnd-actualStart+1), 1, stream) != 1)
return 0;
}
+/**
+ * @param stream: output stream write to differences to
+ * @param expect: expected output text
+ * @param actual: actual output text
+ *
+ * Display expected and actual output text, trimmed to
+ * first and last characters at which differences occur
+ */
+int virtTestDifference(FILE *stream,
+ const char *expect,
+ const char *actual)
+{
+ return virtTestDifferenceFull(stream, expect, NULL, actual, NULL);
+}
+
+
/**
* @param stream: output stream write to differences to
* @param expect: expected output text