diff --git a/doc/xml/release.xml b/doc/xml/release.xml index be1213a89..0b3711903 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -90,6 +90,14 @@ + + + + +

Add missing ToLog() coverage to String, List, and PgControl.

+
+
+
diff --git a/test/define.yaml b/test/define.yaml index 1f25fcbb0..a87892904 100644 --- a/test/define.yaml +++ b/test/define.yaml @@ -350,7 +350,7 @@ unit: test: # ---------------------------------------------------------------------------------------------------------------------------- - name: interface - total: 2 + total: 3 coverage: postgres/interface: full diff --git a/test/src/module/common/typeListTest.c b/test/src/module/common/typeListTest.c index cf43f21ad..087734548 100644 --- a/test/src/module/common/typeListTest.c +++ b/test/src/module/common/typeListTest.c @@ -29,7 +29,7 @@ testRun(void) FUNCTION_HARNESS_VOID(); // ***************************************************************************************************************************** - if (testBegin("lstNew(), lstMemContext(), and lstFree()")) + if (testBegin("lstNew(), lstMemContext(), lstToLog(), and lstFree()")) { List *list = lstNew(sizeof(void *)); @@ -41,6 +41,8 @@ testRun(void) void *ptr = NULL; TEST_RESULT_PTR(lstAdd(list, &ptr), list, "add item"); + TEST_RESULT_STR(strPtr(lstToLog(list)), "{size: 1}", "check log"); + TEST_RESULT_VOID(lstFree(list), "free list"); TEST_RESULT_VOID(lstFree(lstNew(1)), "free empty list"); TEST_RESULT_VOID(lstFree(NULL), "free null list"); diff --git a/test/src/module/common/typeStringTest.c b/test/src/module/common/typeStringTest.c index ec9b51b82..578ec0393 100644 --- a/test/src/module/common/typeStringTest.c +++ b/test/src/module/common/typeStringTest.c @@ -81,8 +81,11 @@ testRun(void) String *string2 = strNew("ZZZZ"); TEST_RESULT_STR(strPtr(strCat(string, "YYYY")), "XXXXYYYY", "cat string"); + TEST_RESULT_SIZE(string->common.extra, 4, "check extra"); TEST_RESULT_STR(strPtr(strCatFmt(string, "%05d", 777)), "XXXXYYYY00777", "cat formatted string"); + TEST_RESULT_SIZE(string->common.extra, 6, "check extra"); TEST_RESULT_STR(strPtr(strCatChr(string, '!')), "XXXXYYYY00777!", "cat chr"); + TEST_RESULT_SIZE(string->common.extra, 5, "check extra"); TEST_RESULT_STR(strPtr(string2), "ZZZZ", "check unaltered string"); } @@ -213,10 +216,17 @@ testRun(void) } // ***************************************************************************************************************************** - if (testBegin("strToLog()")) + if (testBegin("strToLog() and strObjToLog()")) { TEST_RESULT_STR(strPtr(strToLog(strNew("test"))), "{\"test\"}", "format string"); TEST_RESULT_STR(strPtr(strToLog(NULL)), "null", "format null string"); + + char buffer[256]; + TEST_RESULT_UINT(strObjToLog(NULL, (StrObjToLogFormat)strToLog, buffer, sizeof(buffer)), 4, "format null string"); + TEST_RESULT_STR(buffer, "null", "check null string"); + + TEST_RESULT_UINT(strObjToLog(strNew("teststr"), (StrObjToLogFormat)strToLog, buffer, sizeof(buffer)), 11, "format string"); + TEST_RESULT_STR(buffer, "{\"teststr\"}", "check string"); } // ***************************************************************************************************************************** diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index b2c15d09f..11a741741 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -89,5 +89,21 @@ testRun(void) TEST_RESULT_INT(info.version, PG_VERSION_83, " check version"); } + // ***************************************************************************************************************************** + if (testBegin("pgControlToLog()")) + { + PgControl pgControl = + { + .version = PG_VERSION_11, + .systemId = 0xEFEFEFEFEF, + .walSegmentSize= 16 * 1024 * 1024, + .pageChecksum = true + }; + + TEST_RESULT_STR( + strPtr(pgControlToLog(&pgControl)), + "{version: 110000, systemId: 1030522662895, walSegmentSize: 16777216, pageChecksum: true}", "check log"); + } + FUNCTION_HARNESS_RESULT_VOID(); }