Renamed diffx() to diff().

This commit is contained in:
Pietro Gagliardi 2019-06-02 01:59:08 -04:00
parent 0c673acf70
commit 3f4765d116
5 changed files with 12 additions and 12 deletions

View File

@ -94,10 +94,10 @@ static void runFull(testingT *t, const char *file, long line, uiEvent *e, void *
if (h->gotRun && h->wantRun) {
// only check these if it was correctly run, to reduce noise if the above failed
if (h->gotSender != h->wantSender)
testingTErrorfFull(t, file, line, "incorrect sender seen by %s:" diffx("%p"),
testingTErrorfFull(t, file, line, "incorrect sender seen by %s:" diff("%p"),
h->name, h->gotSender, h->wantSender);
if (h->gotArgs != h->wantArgs)
testingTErrorfFull(t, file, line, "incorrect args seen by %s:" diffx("%p"),
testingTErrorfFull(t, file, line, "incorrect args seen by %s:" diff("%p"),
h->name, h->gotArgs, h->wantArgs);
}
if (h->validID) {
@ -111,7 +111,7 @@ static void runFull(testingT *t, const char *file, long line, uiEvent *e, void *
h++;
}
if (gotRunCount != wantRunCount)
testingTErrorfFull(t, file, line, "incorrect number of handler runs:" diffx("%d"),
testingTErrorfFull(t, file, line, "incorrect number of handler runs:" diff("%d"),
gotRunCount, wantRunCount);
}

View File

@ -24,7 +24,7 @@ testingTestInSet(beforeTests, Init)
if (uiInit(&err, &err))
testingTErrorf(t, "uiInit() with non-NULL options succeeded; expected failure");
if (strcmp(err.Message, errInvalidOptions) != 0)
testingTErrorf(t, "uiInit() with non-NULL options returned bad error message:" diffx("%s"),
testingTErrorf(t, "uiInit() with non-NULL options returned bad error message:" diff("%s"),
err.Message, errInvalidOptions);
}
@ -37,7 +37,7 @@ testingTest(InitAfterInitialized)
if (uiInit(NULL, &err))
testingTErrorf(t, "uiInit() after a previous successful call succeeded; expected failure");
if (strcmp(err.Message, errAlreadyInitialized) != 0)
testingTErrorf(t, "uiInit() after a previous successful call returned bad error message:" diffx("%s"),
testingTErrorf(t, "uiInit() after a previous successful call returned bad error message:" diff("%s"),
err.Message, errAlreadyInitialized);
}
@ -69,7 +69,7 @@ testingTest(QueueMain)
uiQueueMain(queued, &p);
timeout_uiMain(t, 5 * timerSecond);
if (p.flag != 1)
testingTErrorf(t, "uiQueueMain() didn't set flag properly:" diffx("%d"),
testingTErrorf(t, "uiQueueMain() didn't set flag properly:" diff("%d"),
p.flag, 1);
}
@ -117,12 +117,12 @@ static void checkOrderFull(testingT *t, const char *file, long line, uint32_t fl
return;
for (i = 1; i < 6; i++)
if (flag == orders[i].result) {
testingTErrorfFull(t, file, line, "wrong order:" diffx("%" PRIu32 " (%s)"),
testingTErrorfFull(t, file, line, "wrong order:" diff("%" PRIu32 " (%s)"),
flag, orders[i].order,
orders[0].result, orders[0].order);
return;
}
testingTErrorfFull(t, file, line, "wrong result:" diffx("%" PRIu32 " (%s)"),
testingTErrorfFull(t, file, line, "wrong result:" diff("%" PRIu32 " (%s)"),
flag, "unknown order",
orders[0].result, orders[0].order);
}
@ -165,7 +165,7 @@ testingTest(QueueMain_DifferentThread)
if (p.err != 0)
testingTErrorf(t, "error sleeping in thread to ensure a high likelihood the uiQueueMain() is run after uiMain() starts: " timerSysErrorFmt, timerSysErrorFmtArg(p.err));
if (p.flag != 1)
testingTErrorf(t, "uiQueueMain() didn't set flag properly:" diffx("%d"),
testingTErrorf(t, "uiQueueMain() didn't set flag properly:" diff("%d"),
p.flag, 1);
}

View File

@ -16,7 +16,7 @@ void catchProgrammerError(const char *prefix, const char *msg, const char *suffi
if (internal)
testingTErrorfFull(errorParams.t, errorParams.file, errorParams.line, "%s error is marked internal; should not have been", errorParams.exprstr);
if (strstr(msg, errorParams.msgWant) == NULL)
testingTErrorf(errorParams.t, errorParams.file, errorParams.line, "%s: message doesn't contain expected substring:" diffx("%s"),
testingTErrorf(errorParams.t, errorParams.file, errorParams.line, "%s: message doesn't contain expected substring:" diff("%s"),
errorParams.exprstr, msg, errorParams.msgWant);
}

View File

@ -125,7 +125,7 @@ static void reportCases(testingT *t, struct errorCase *p)
if (p->internalGot)
testingTErrorfFull(t, p->file, p->line, "%s error is marked internal; should not have been", p->name);
if (p->msgGot != NULL)
testingTErrorfFull(t, p->file, p->line, "%s message doesn't contain expected substring:" diffx("%s"),
testingTErrorfFull(t, p->file, p->line, "%s message doesn't contain expected substring:" diff("%s"),
p->name, p->msgGot, p->msgWant);
p = p->next;
}

View File

@ -10,7 +10,7 @@
#include "lib/thread.h"
#include "lib/timer.h"
#define diffx(fmt) "\ngot " fmt "\nwant " fmt
#define diff(fmt) "\ngot " fmt "\nwant " fmt
// main.c
extern void timeoutMain(void *data);