X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Ftests%2Fxestiaab_common.h;h=c87076594923169afb1f46896a27c75244d80b77;hp=5a37f830816948e90a70f108c2f0d8ebce24f5ea;hb=ce32889b3a42670bfbc3bbb87a689ae79e889e68;hpb=7144da5e7c93db0df978e028fe79c41b7445cd10 diff --git a/source/tests/xestiaab_common.h b/source/tests/xestiaab_common.h index 5a37f83..c870765 100644 --- a/source/tests/xestiaab_common.h +++ b/source/tests/xestiaab_common.h @@ -1,6 +1,6 @@ // xestiaab_common.h - Xestia Address Book Common Functions Unit Tests. // -// (c) 2012-2015 Xestia Software Development. +// (c) 2012-2017 Xestia Software Development. // // This file is part of Xestia Address Book. // @@ -20,7 +20,7 @@ #include "../common/dirs.h" #include "../common/filename.h" #include "../common/mime.h" -#include "../common/svrblist.h" +#include "../common/svrdlist.h" #include "../common/textprocessing.h" static wxString AccountInput1 = "Example1"; @@ -316,10 +316,10 @@ TEST(CommonFunctions, GivenTwoFilesWhenGetMIMEIsCalledThenBothFilesMIMETypesAreG } -TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCorrectStatus) +TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckDangerousListIsCalledThenReturnsCorrectStatus) { - // Test that the blacklist is actually working. + // Test that the dangerous list is actually working. // Given @@ -327,7 +327,7 @@ TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCo // When - domainStatus = CheckBlacklist("example.com"); + domainStatus = CheckDangerousList("example.com"); // Then @@ -336,7 +336,7 @@ TEST(CommonFunctions, GivenTwoDomainNamesWhenCheckBlacklistIsCalledThenReturnsCo // When domainStatus = false; - domainStatus = CheckBlacklist("google.com"); + domainStatus = CheckDangerousList("google.com"); // Then @@ -370,7 +370,7 @@ TEST(CommonFunctions, GivenStringWithCommaWhenEscapeStringIsCalledThenCommaIsEsc // Given - EscapeStringData = "Here we go, an \"example\" of escaping string."; + wxString EscapeStringData = "Here we go, an \"example\" of escaping string."; // When @@ -389,7 +389,7 @@ TEST(CommonFunctions, GivenStringWithNewlineCharactersWhenEscapeStringIsCalledTh // Given - EscapeStringData = "Lets put some \nnew \nlines \nin \nhere."; + wxString EscapeStringData = "Lets put some \nnew \nlines \nin \nhere."; // When @@ -408,7 +408,7 @@ TEST(CommonFunctions, GivenAStringWithReturnCharactersWhenEscapeStringIsCalledTh // Given - EscapeStringData = "Lets put some \r\nnew \r\nlines \r\nin \r\nhere."; + wxString EscapeStringData = "Lets put some \r\nnew \r\nlines \r\nin \r\nhere."; // When @@ -427,7 +427,7 @@ TEST(CommonFunctions, GivenStringWithBackslashesWhenEscapeStringIsCalledThenBack // Given - EscapeStringData = "A:\\path\\example\\lets\\have\\some\\fun"; + wxString EscapeStringData = "A:\\path\\example\\lets\\have\\some\\fun"; // When @@ -465,7 +465,7 @@ TEST(CommonFunctions, GivenStringWithEscapedCommasWhenCaptureStringIsCalledThenC // Given - CaptureStringData = "Here we go\\, an \"example\" of escaping string."; + wxString CaptureStringData = "Here we go\\, an \"example\" of escaping string."; // When @@ -484,7 +484,7 @@ TEST(CommonFunctions, GivenStringWithEscapedNewlinesWhenCaptureStringIsCalledThe // Given - CaptureStringData = "Lets put some \\nnew \\nlines \\nin \\nhere."; + wxString CaptureStringData = "Lets put some \\nnew \\nlines \\nin \\nhere."; // When @@ -503,7 +503,7 @@ TEST(CommonFunctions, GivenStringWithEscapedBackslashesWhenCaptureStringIsCalled // Given - CaptureStringData = "A:\\\\path\\\\example\\\\lets\\\\have\\\\some\\\\fun"; + wxString CaptureStringData = "A:\\\\path\\\\example\\\\lets\\\\have\\\\some\\\\fun"; // When @@ -541,7 +541,7 @@ TEST(CommonFunctions, GivenStringWithNewlinesWhenResetUnusedStringIsCalledThenSt // Given - ResetUnusedStringData = "Some text \\nwith new \\nlines!"; + wxString ResetUnusedStringData = "Some text \\nwith new \\nlines!"; // When @@ -560,7 +560,7 @@ TEST(CommonFunctions, GivenStringWithSeveralCharactersWhenResetUnusedStringThenS // Given - ResetUnusedStringData = "And now the list of characters: \\\\ \\n \\; \\,"; + wxString ResetUnusedStringData = "And now the list of characters: \\\\ \\n \\; \\,"; // When @@ -600,7 +600,7 @@ TEST(CommonFunctions, GivenStringWithNewlineWhenConvertToHTMLIsCalledThenStringI // Given - ConvertToHTMLData = "More testing &<>\n"; + wxString ConvertToHTMLData = "More testing &<>\n"; // When @@ -620,7 +620,7 @@ TEST(CommonFunctions, GivenStringWithSeveralLinesWhenConvertToHTMLIsCalledThenSt // Given - ConvertToHTMLData = "This is the first line.\nThis is the second line.\nThis is the third line."; + wxString ConvertToHTMLData = "This is the first line.\nThis is the second line.\nThis is the third line."; // When @@ -632,16 +632,13 @@ TEST(CommonFunctions, GivenStringWithSeveralLinesWhenConvertToHTMLIsCalledThenSt } -static std::map mapExample; +static std::map mapExample = +{ + { 0, 1 }, { 1, 1 }, { 2, 1 }, { 5, 1 }, { 500, 1 }, { 2415, 1 } +}; 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 mapExistsStatus = false; +bool mapExistsStatus = false; TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs0WhenMapDataExistsIsCalledThenConfirmItemIndex0DoesExist) { @@ -690,16 +687,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2WhenMapDataExist // Given - mapStatusExists = false; + mapExistsStatus = false; itemIndex = 2; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(true, mapStatusExists); + ASSERT_EQ(true, mapExistsStatus); } @@ -710,16 +707,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs3WhenMapDataExists // Given - mapStatusExists = true; + mapExistsStatus = true; itemIndex = 3; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } @@ -730,16 +727,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs5WhenMapDataExist // Given - mapStatusExists = false; + mapExistsStatus = false; itemIndex = 5; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(true, mapStatusExists); + ASSERT_EQ(true, mapExistsStatus); } @@ -750,16 +747,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs6WhenMapDataExists // Given - mapStatusExists = true; + mapExistsStatus = true; itemIndex = 6; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } @@ -770,16 +767,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs499WhenMapDataExi // Given - mapStatusExists = false; + mapExistsStatus = false; itemIndex = 499; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } @@ -790,16 +787,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs500WhenMapDataExi // Given - mapStatusExists = false; + mapExistsStatus = false; itemIndex = 500; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(true, mapStatusExists); + ASSERT_EQ(true, mapExistsStatus); } @@ -810,16 +807,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs501WhenMapDataExis // Given - mapStatusExists = true; + mapExistsStatus = true; itemIndex = 501; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } @@ -830,16 +827,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2414WhenMapDataExi // Given - mapStatusExists = true; + mapExistsStatus = true; itemIndex = 2414; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } @@ -850,16 +847,16 @@ TEST(CommonFunctions, GivenMapExistsStatusIsFalseAndItemIndexIs2415WhenMapDataEx // Given - mapStatusExists = false; + mapExistsStatus = false; itemIndex = 2415; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(true, mapStatusExists); + ASSERT_EQ(true, mapExistsStatus); } @@ -870,15 +867,15 @@ TEST(CommonFunctions, GivenMapExistsStatusIsTrueAndItemIndexIs2416WhenMapDataExi // Given - mapStatusExists = true; + mapExistsStatus = true; itemIndex = 2416; // When - mapStatusExists = MapDataExists(&itemIndex, &mapExample); + mapExistsStatus = MapDataExists(&itemIndex, &mapExample); // Then - ASSERT_EQ(false, mapStatusExists); + ASSERT_EQ(false, mapExistsStatus); } \ No newline at end of file