From: Steve Brokenshire Date: Fri, 27 Oct 2017 06:25:36 +0000 (+0100) Subject: CommonFunctions Unit Tests: cleanup X-Git-Tag: release-0.21~17 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=7144da5e7c93db0df978e028fe79c41b7445cd10;p=xestiaab%2F.git CommonFunctions Unit Tests: cleanup --- diff --git a/source/tests/xestiaab_common.h b/source/tests/xestiaab_common.h index 5777b31..5a37f83 100644 --- a/source/tests/xestiaab_common.h +++ b/source/tests/xestiaab_common.h @@ -27,7 +27,8 @@ static wxString AccountInput1 = "Example1"; static wxString AccountInput2 = "Example2"; static wxString AccountInput3 = "Example3"; -TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserDirIsCalledThenReceivedPathMatches){ +TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserDirIsCalledThenReceivedPathMatches) +{ // Run the unit tests depending on the operating system being used. @@ -57,7 +58,8 @@ TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserDirIsCalledThenReceivedPath } -TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserPrefDirIsCalledThenReceivedPathMatches){ +TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserPrefDirIsCalledThenReceivedPathMatches) +{ // Run the unit tests depending on the operating system being used. @@ -87,7 +89,8 @@ TEST(CommonFunctions, GivenAPredefinedPathWhenGetUserPrefDirIsCalledThenReceived } -TEST(CommonFunctions, GivenThreePredefinedPathsWhenGetAccountDirIsCalledForEachThenReceivedPathsMatches){ +TEST(CommonFunctions, GivenThreePredefinedPathsWhenGetAccountDirIsCalledForEachThenReceivedPathsMatches) +{ // Run the unit tests depending on the operating system being used. @@ -136,7 +139,8 @@ TEST(CommonFunctions, GivenThreePredefinedPathsWhenGetAccountDirIsCalledForEachT } -TEST(CommonFunctions, GivenThreePredefinedFilePathsWhenGetAccountDirIsCalledWithAppendServerCertificateSetToTrueForEachThenReceivedPathsMatches){ +TEST(CommonFunctions, GivenThreePredefinedFilePathsWhenGetAccountDirIsCalledWithAppendServerCertificateSetToTrueForEachThenReceivedPathsMatches) +{ // Run the unit tests depending on the operating system being used. @@ -185,7 +189,8 @@ TEST(CommonFunctions, GivenThreePredefinedFilePathsWhenGetAccountDirIsCalledWith } -TEST(CommonFunctions, GivenPredefinedFilePathWhenGetAccountsFileIsCalledThenReceivedFilePathMatches){ +TEST(CommonFunctions, GivenPredefinedFilePathWhenGetAccountsFileIsCalledThenReceivedFilePathMatches) +{ // Run the unit tests depending on the operating system being used. @@ -217,7 +222,8 @@ TEST(CommonFunctions, GivenPredefinedFilePathWhenGetAccountsFileIsCalledThenRece } -TEST(CommonFunctions, GivenPredefinedFilePathWhenGetSettingsFileIsCalledThenReceivedFilePathMatches){ +TEST(CommonFunctions, GivenPredefinedFilePathWhenGetSettingsFileIsCalledThenReceivedFilePathMatches) +{ // Run the unit tests depending on the operating system being used. @@ -249,7 +255,8 @@ TEST(CommonFunctions, GivenPredefinedFilePathWhenGetSettingsFileIsCalledThenRece } -TEST(CommonFunctions, GivenFivePredefinedFilenamePathsWhenCreateFilenamePathIsCalledThenReceivedPathMatches){ +TEST(CommonFunctions, GivenFivePredefinedFilenamePathsWhenCreateFilenamePathIsCalledThenReceivedPathMatches) +{ // Run the unit tests depending on the operating system being used. @@ -287,7 +294,8 @@ TEST(CommonFunctions, GivenFivePredefinedFilenamePathsWhenCreateFilenamePathIsCa } -TEST(CommonFunctions, GivenTwoFilesWhenGetMIMEIsCalledThenBothFilesMIMETypesAreGiven){ +TEST(CommonFunctions, GivenTwoFilesWhenGetMIMEIsCalledThenBothFilesMIMETypesAreGiven) +{ // Get the MIME type based on the files given. @@ -308,7 +316,8 @@ TEST(CommonFunctions, GivenTwoFilesWhenGetMIMEIsCalledThenBothFilesMIMETypesAreG } -TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCorrectStatus){ +TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCorrectStatus) +{ // Test that the blacklist is actually working. @@ -335,7 +344,8 @@ TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCo } -TEST(CommonFunctions, GivenExampleStringWhenEscapeStringIsCalledThenReturnedStringIsExample){ +TEST(CommonFunctions, GivenExampleStringWhenEscapeStringIsCalledThenReturnedStringIsExample) +{ // Test the escape string function. @@ -353,7 +363,8 @@ TEST(CommonFunctions, GivenExampleStringWhenEscapeStringIsCalledThenReturnedStri } -TEST(CommonFunctions, GivenStringWithCommaWhenEscapeStringIsCalledThenCommaIsEscaped){ +TEST(CommonFunctions, GivenStringWithCommaWhenEscapeStringIsCalledThenCommaIsEscaped) +{ // Test the escape string function. @@ -371,7 +382,8 @@ TEST(CommonFunctions, GivenStringWithCommaWhenEscapeStringIsCalledThenCommaIsEsc } -TEST(CommonFunctions, GivenStringWithNewlineCharactersWhenEscapeStringIsCalledThenNewlinesAreEscaped){ +TEST(CommonFunctions, GivenStringWithNewlineCharactersWhenEscapeStringIsCalledThenNewlinesAreEscaped) +{ // Test the escape string function. @@ -389,7 +401,8 @@ TEST(CommonFunctions, GivenStringWithNewlineCharactersWhenEscapeStringIsCalledTh } -TEST(CommonFunctions, GivenAStringWithReturnCharactersWhenEscapeStringIsCalledThenReturnsAreRemoved){ +TEST(CommonFunctions, GivenAStringWithReturnCharactersWhenEscapeStringIsCalledThenReturnsAreRemoved) +{ // Test the escape string function. @@ -407,7 +420,8 @@ TEST(CommonFunctions, GivenAStringWithReturnCharactersWhenEscapeStringIsCalledTh } -TEST(CommonFunctions, GivenStringWithBackslashesWhenEscapeStringIsCalledThenBackslashesAreEscaped){ +TEST(CommonFunctions, GivenStringWithBackslashesWhenEscapeStringIsCalledThenBackslashesAreEscaped) +{ // Test the escape string function. @@ -425,7 +439,8 @@ TEST(CommonFunctions, GivenStringWithBackslashesWhenEscapeStringIsCalledThenBack } -TEST(CommonFunctions, GivenExampleStringWhenCaptureStringIsCalledThenReturnedStringIsExample){ +TEST(CommonFunctions, GivenExampleStringWhenCaptureStringIsCalledThenReturnedStringIsExample) +{ // Test the capture string function. @@ -443,7 +458,8 @@ TEST(CommonFunctions, GivenExampleStringWhenCaptureStringIsCalledThenReturnedStr } -TEST(CommonFunctions, GivenStringWithEscapedCommasWhenCaptureStringIsCalledThenCommasAreCaptured){ +TEST(CommonFunctions, GivenStringWithEscapedCommasWhenCaptureStringIsCalledThenCommasAreCaptured) +{ // Test the capture string function. @@ -461,7 +477,8 @@ TEST(CommonFunctions, GivenStringWithEscapedCommasWhenCaptureStringIsCalledThenC } -TEST(CommonFunctions, GivenStringWithEscapedNewlinesWhenCaptureStringIsCalledThenNewlinesAreCaptured){ +TEST(CommonFunctions, GivenStringWithEscapedNewlinesWhenCaptureStringIsCalledThenNewlinesAreCaptured) +{ // Test the capture string function. @@ -479,7 +496,8 @@ TEST(CommonFunctions, GivenStringWithEscapedNewlinesWhenCaptureStringIsCalledThe } -TEST(CommonFunctions, GivenStringWithEscapedBackslashesWhenCaptureStringIsCalledThenBackslashesAreCaptured){ +TEST(CommonFunctions, GivenStringWithEscapedBackslashesWhenCaptureStringIsCalledThenBackslashesAreCaptured) +{ // Test the capture string function. @@ -497,7 +515,8 @@ TEST(CommonFunctions, GivenStringWithEscapedBackslashesWhenCaptureStringIsCalled } -TEST(CommonFunctions, GivenStringWithSeveralBackslashesWhenResetUnusedStringIsCalledThenStringIsReset){ +TEST(CommonFunctions, GivenStringWithSeveralBackslashesWhenResetUnusedStringIsCalledThenStringIsReset) +{ // Tests for resetting an unused string. @@ -515,7 +534,8 @@ TEST(CommonFunctions, GivenStringWithSeveralBackslashesWhenResetUnusedStringIsCa } -TEST(CommonFunctions, GivenStringWithNewlinesWhenResetUnusedStringIsCalledThenStringIsFormatted){ +TEST(CommonFunctions, GivenStringWithNewlinesWhenResetUnusedStringIsCalledThenStringIsFormatted) +{ // Tests for resetting an unused string. @@ -533,7 +553,8 @@ TEST(CommonFunctions, GivenStringWithNewlinesWhenResetUnusedStringIsCalledThenSt } -TEST(CommonFunctions, GivenStringWithSeveralCharactersWhenResetUnusedStringThenStringIsFormatted){ +TEST(CommonFunctions, GivenStringWithSeveralCharactersWhenResetUnusedStringThenStringIsFormatted) +{ // Tests for resetting an unused string. @@ -551,7 +572,8 @@ TEST(CommonFunctions, GivenStringWithSeveralCharactersWhenResetUnusedStringThenS } -TEST(CommonFunctions, GivenStringWhenConvertToHTMLIsCalledThenStringisHTMLEscaped){ +TEST(CommonFunctions, GivenStringWhenConvertToHTMLIsCalledThenStringisHTMLEscaped) +{ // Tests for converting data for inserting into a HTML // formatted document. @@ -570,7 +592,8 @@ TEST(CommonFunctions, GivenStringWhenConvertToHTMLIsCalledThenStringisHTMLEscape } -TEST(CommonFunctions, GivenStringWithNewlineWhenConvertToHTMLIsCalledThenStringIsHTMLEscapedWithFormattedNewline){ +TEST(CommonFunctions, GivenStringWithNewlineWhenConvertToHTMLIsCalledThenStringIsHTMLEscapedWithFormattedNewline) +{ // Tests for converting data for inserting into a HTML // formatted document. @@ -589,7 +612,8 @@ TEST(CommonFunctions, GivenStringWithNewlineWhenConvertToHTMLIsCalledThenStringI } -TEST(CommonFunctions, GivenStringWithSeveralLinesWhenConvertToHTMLIsCalledThenStringIsHTMLEscapedWithFormattedNewlines){ +TEST(CommonFunctions, GivenStringWithSeveralLinesWhenConvertToHTMLIsCalledThenStringIsHTMLEscapedWithFormattedNewlines) +{ // Tests for converting data for inserting into a HTML // formatted document. @@ -608,18 +632,19 @@ TEST(CommonFunctions, GivenStringWithSeveralLinesWhenConvertToHTMLIsCalledThenSt } -static std::map MapExample; +static std::map mapExample; static int itemIndex = 0; -static MapExample.insert(std::make_pair(0,1)); -static MapExample.insert(std::make_pair(1,1)); -static MapExample.insert(std::make_pair(2,1)); -static MapExample.insert(std::make_pair(5,1)); -static MapExample.insert(std::make_pair(500,1)); -static MapExample.insert(std::make_pair(2415,1)); +static mapExample.insert(std::make_pair(0,1)); +static mapExample.insert(std::make_pair(1,1)); +static mapExample.insert(std::make_pair(2,1)); +static mapExample.insert(std::make_pair(5,1)); +static mapExample.insert(std::make_pair(500,1)); +static mapExample.insert(std::make_pair(2415,1)); static mapExistsStatus = false; -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs0WhenMapDataExistsIsCalledThenConfirmItemIndex0DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs0WhenMapDataExistsIsCalledThenConfirmItemIndex0DoesExist) +{ // Tests for checking that map data exists. @@ -630,7 +655,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs0WhenMapDataExist // When - mapExistsStatus = MapDataExists(&itemIndex, &MapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then @@ -638,7 +663,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs0WhenMapDataExist } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs1WhenMapDataExistsIsCalledThenConfirmItemIndex1DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs1WhenMapDataExistsIsCalledThenConfirmItemIndex1DoesExist) +{ // Tests for checking that map data exists. @@ -649,7 +675,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs1WhenMapDataExist // When - mapExistsStatus = MapDataExists(&itemIndex, &MapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then @@ -657,7 +683,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs1WhenMapDataExist } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2WhenMapDataExistsIsCalledThenConfirmItemIndex2DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2WhenMapDataExistsIsCalledThenConfirmItemIndex2DoesExist) +{ // Tests for checking that map data exists. @@ -668,7 +695,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2WhenMapDataExist // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -676,7 +703,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2WhenMapDataExist } -TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs3WhenMapDataExistsIsCalledThenConfirmItemIndex3DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs3WhenMapDataExistsIsCalledThenConfirmItemIndex3DoesntExist) +{ // Tests for checking that map data exists. @@ -687,7 +715,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs3WhenMapDataExists // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -695,7 +723,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs3WhenMapDataExists } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs5WhenMapDataExistsIsCalledThenConfirmItemIndex5DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs5WhenMapDataExistsIsCalledThenConfirmItemIndex5DoesExist) +{ // Tests for checking that map data exists. @@ -706,7 +735,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs5WhenMapDataExist // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -714,7 +743,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs5WhenMapDataExist } -TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs6WhenMapDataExistsIsCalledThenConfirmItemIndex6DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs6WhenMapDataExistsIsCalledThenConfirmItemIndex6DoesntExist) +{ // Tests for checking that map data exists. @@ -725,7 +755,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs6WhenMapDataExists // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -733,7 +763,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs6WhenMapDataExists } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs499WhenMapDataExistsIsCalledThenConfirmItemIndex499DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs499WhenMapDataExistsIsCalledThenConfirmItemIndex499DoesntExist) +{ // Tests for checking that map data exists. @@ -744,7 +775,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs499WhenMapDataExi // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -752,7 +783,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs499WhenMapDataExi } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs500WhenMapDataExistsIsCalledThenConfirmItemIndex500DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs500WhenMapDataExistsIsCalledThenConfirmItemIndex500DoesExist) +{ // Tests for checking that map data exists. @@ -763,7 +795,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs500WhenMapDataExi // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -771,7 +803,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs500WhenMapDataExi } -TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs501WhenMapDataExistsIsCalledThenConfirmItemIndex501DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs501WhenMapDataExistsIsCalledThenConfirmItemIndex501DoesntExist) +{ // Tests for checking that map data exists. @@ -782,7 +815,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs501WhenMapDataExis // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -790,7 +823,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs501WhenMapDataExis } -TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2414WhenMapDataExistsIsCalledThenConfirmItemIndex2414DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2414WhenMapDataExistsIsCalledThenConfirmItemIndex2414DoesntExist) +{ // Tests for checking that map data exists. @@ -801,7 +835,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2414WhenMapDataExi // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -809,7 +843,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2414WhenMapDataExi } -TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2415WhenMapDataExistsIsCalledThenConfirmItemIndex2415DoesExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2415WhenMapDataExistsIsCalledThenConfirmItemIndex2415DoesExist) +{ // Tests for checking that map data exists. @@ -820,7 +855,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2415WhenMapDataEx // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then @@ -828,7 +863,8 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2415WhenMapDataEx } -TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2416WhenMapDataExistsIsCalledThenConfirmItemIndex2416DoesntExist){ +TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2416WhenMapDataExistsIsCalledThenConfirmItemIndex2416DoesntExist) +{ // Tests for checking that map data exists. @@ -839,7 +875,7 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2416WhenMapDataExi // When - mapStatusExists = MapDataExists(&itemIndex, &MapExample); + mapStatusExists = MapDataExists(&itemIndex, &mapExample); // Then