1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Remove semicolons from TEST_RESULT*() macros.

These prevented the macros from being used in single line statements (e.g. if-else).

Also fix some missing semicolons in macro invocations.
This commit is contained in:
David Steele
2021-01-24 08:55:13 -05:00
parent 5cb9f166ec
commit 4a83ca4f78
4 changed files with 25 additions and 25 deletions

View File

@@ -178,7 +178,7 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_BOOL(statement, expected, ...) \
TEST_RESULT_BOOL_PARAM(statement, expected, __VA_ARGS__);
TEST_RESULT_BOOL_PARAM(statement, expected, __VA_ARGS__)
#define TEST_RESULT_DOUBLE_PARAM(statement, expected, ...) \
do \
@@ -190,7 +190,7 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_DOUBLE(statement, expected, ...) \
TEST_RESULT_DOUBLE_PARAM(statement, expected, __VA_ARGS__);
TEST_RESULT_DOUBLE_PARAM(statement, expected, __VA_ARGS__)
#define TEST_RESULT_INT_PARAM(statement, expected, operation, ...) \
do \
@@ -202,9 +202,9 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_INT(statement, expected, ...) \
TEST_RESULT_INT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
TEST_RESULT_INT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__)
#define TEST_RESULT_INT_NE(statement, expected, ...) \
TEST_RESULT_INT_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__);
TEST_RESULT_INT_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__)
#define TEST_RESULT_PTR_PARAM(statement, expected, operation, ...) \
do \
@@ -218,9 +218,9 @@ Macros to compare results of common data types
// Compare raw pointers. When checking for NULL use the type-specific macro when available, e.g. TEST_RESULT_STR(). This is more
// type-safe and makes it clearer what is being tested.
#define TEST_RESULT_PTR(statement, expected, ...) \
TEST_RESULT_PTR_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
TEST_RESULT_PTR_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__)
#define TEST_RESULT_PTR_NE(statement, expected, ...) \
TEST_RESULT_PTR_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__);
TEST_RESULT_PTR_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__)
#define TEST_RESULT_Z_PARAM(statement, expected, operation, ...) \
do \
@@ -232,20 +232,20 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_Z(statement, expected, ...) \
TEST_RESULT_Z_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
TEST_RESULT_Z_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__)
#define TEST_RESULT_Z_NE(statement, expected, ...) \
TEST_RESULT_Z_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__);
TEST_RESULT_Z_PARAM(statement, expected, harnessTestResultOperationNe, __VA_ARGS__)
#define TEST_RESULT_STR(statement, resultExpected, ...) \
TEST_RESULT_Z(strZNull(statement), strZNull(resultExpected), __VA_ARGS__);
TEST_RESULT_Z(strZNull(statement), strZNull(resultExpected), __VA_ARGS__)
#define TEST_RESULT_STR_Z(statement, resultExpected, ...) \
TEST_RESULT_Z(strZNull(statement), resultExpected, __VA_ARGS__);
TEST_RESULT_Z(strZNull(statement), resultExpected, __VA_ARGS__)
#define TEST_RESULT_STR_KEYRPL(statement, resultExpected, ...) \
TEST_RESULT_Z(strZNull(statement), hrnReplaceKey(strZ(resultExpected)), __VA_ARGS__);
TEST_RESULT_Z(strZNull(statement), hrnReplaceKey(strZ(resultExpected)), __VA_ARGS__)
#define TEST_RESULT_STR_Z_KEYRPL(statement, resultExpected, ...) \
TEST_RESULT_Z(strZNull(statement), hrnReplaceKey(resultExpected), __VA_ARGS__);
TEST_RESULT_Z(strZNull(statement), hrnReplaceKey(resultExpected), __VA_ARGS__)
#define TEST_RESULT_Z_STR(statement, resultExpected, ...) \
TEST_RESULT_Z(statement, strZNull(resultExpected), __VA_ARGS__);
TEST_RESULT_Z(statement, strZNull(resultExpected), __VA_ARGS__)
// Compare a string list to a \n delimited string
#define TEST_RESULT_STRLST_Z(statement, resultExpected, ...) \
@@ -258,7 +258,7 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_STRLST_STR(statement, resultExpected, ...) \
TEST_RESULT_STRLST_Z(statement, strZNull(resultExpected), __VA_ARGS__);
TEST_RESULT_STRLST_Z(statement, strZNull(resultExpected), __VA_ARGS__)
#define TEST_RESULT_UINT_PARAM(statement, expected, operation, ...) \
do \
@@ -270,7 +270,7 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_UINT(statement, expected, ...) \
TEST_RESULT_UINT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
TEST_RESULT_UINT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__)
#define TEST_RESULT_UINT_INT_PARAM(statement, expected, operation, ...) \
do \
@@ -282,7 +282,7 @@ Macros to compare results of common data types
while (0)
#define TEST_RESULT_UINT_INT(statement, expected, ...) \
TEST_RESULT_UINT_INT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
TEST_RESULT_UINT_INT_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__)
/***********************************************************************************************************************************
Test system calls

View File

@@ -1672,11 +1672,11 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("verify next queue calculations");
TEST_RESULT_INT(restoreJobQueueNext(0, 0, 1), 0, "client idx 0, queue idx 0, 1 queue")
TEST_RESULT_INT(restoreJobQueueNext(0, 0, 2), 1, "client idx 0, queue idx 0, 2 queues")
TEST_RESULT_INT(restoreJobQueueNext(1, 1, 2), 0, "client idx 1, queue idx 1, 2 queues")
TEST_RESULT_INT(restoreJobQueueNext(0, 1, 2), 0, "client idx 0, queue idx 1, 2 queues")
TEST_RESULT_INT(restoreJobQueueNext(1, 0, 2), 1, "client idx 1, queue idx 0, 2 queues")
TEST_RESULT_INT(restoreJobQueueNext(0, 0, 1), 0, "client idx 0, queue idx 0, 1 queue");
TEST_RESULT_INT(restoreJobQueueNext(0, 0, 2), 1, "client idx 0, queue idx 0, 2 queues");
TEST_RESULT_INT(restoreJobQueueNext(1, 1, 2), 0, "client idx 1, queue idx 1, 2 queues");
TEST_RESULT_INT(restoreJobQueueNext(0, 1, 2), 0, "client idx 0, queue idx 1, 2 queues");
TEST_RESULT_INT(restoreJobQueueNext(1, 0, 2), 1, "client idx 1, queue idx 0, 2 queues");
// Locality error
// -------------------------------------------------------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@ testRun(void)
harnessCfgLoad(cfgCmdHelp, strLstNew());
cfgCommandSet(cfgCmdNone, cfgCmdRoleDefault);
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no command")
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no command");
// -------------------------------------------------------------------------------------------------------------------------
StringList *argList = strLstNew();
@@ -57,10 +57,10 @@ testRun(void)
hrnCfgArgRawNegate(argList, cfgOptLogTimestamp);
harnessCfgLoad(cfgCmdArchivePush, argList);
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no error")
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no error");
harnessLogResult("P00 INFO: archive-push command end: completed successfully");
TEST_RESULT_INT(exitSafe(1, false, signalTypeNone), 1, "exit with no error")
TEST_RESULT_INT(exitSafe(1, false, signalTypeNone), 1, "exit with no error");
harnessLogResult("P00 INFO: archive-push command end: completed successfully");
// -------------------------------------------------------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@ testRun(void)
httpDateToTime(STRDEF("Wed, 1 Oct 2015 07:28:00 GMT")), FormatError, "unable to convert base 10 string ' 1' to int");
TEST_RESULT_INT(httpDateToTime(STRDEF("Wed, 21 Oct 2015 07:28:00 GMT")), 1445412480, "convert HTTP date to time_t");
TEST_RESULT_STR_Z(httpDateFromTime(1592743579), "Sun, 21 Jun 2020 12:46:19 GMT", "convert time_t to HTTP date")
TEST_RESULT_STR_Z(httpDateFromTime(1592743579), "Sun, 21 Jun 2020 12:46:19 GMT", "convert time_t to HTTP date");
}
// *****************************************************************************************************************************