Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Unit Tests: Clean up of Common, ContactLoad and ContactSave tests
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 Oct 2017 21:57:54 +0000 (21:57 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 31 Oct 2017 21:57:54 +0000 (21:57 +0000)
source/tests/xestiaab_common.h
source/tests/xestiaab_contactload.h
source/tests/xestiaab_contactsave.h

index 4739afb..ca9b727 100644 (file)
@@ -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<int,int> mapExample;
+static std::map<int,int> 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
index cb625bb..86564ed 100644 (file)
@@ -29,7 +29,7 @@ TEST(ContactLoad, GivenContactDataObjectWhenLoadFileIsCalledWithMissingFileThenR
        // When
 
        ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL;
-       testFile.LoadFile("MissingFile.vcf");
+       testFileLoadStatus = testFile.LoadFile("MissingFile.vcf");
        
        // Then
 
index 0ddf8f9..c1f8b9a 100644 (file)
@@ -38,7 +38,7 @@ TEST(ContactSave, GivenAContactDataObjectWhenSaveStringIsCalledThenContactDataSa
        ContactDataObject testFile;
        
        ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL;
-       testFileLoadStatus = testFile1.LoadFile("LoadCheck-Load1.vcf");
+       testFileLoadStatus = testFile.LoadFile("LoadCheck-Load1.vcf");
        
        ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus);
 
@@ -729,14 +729,14 @@ TEST(ContactSave, GivenSeveralContactFilesWhenLoadFileAndSaveFileIsCalledThenCon
        ContactDataObject testFile2;
        ContactDataObject testFile3;    
        
-       ContactLoadStatus testFile1SaveStatus = CONTACTSAVE_UNITTESTFAIL;
-       ContactSaveStatus testFile1LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactLoadStatus testFile1LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactSaveStatus testFile1SaveStatus = CONTACTSAVE_UNITTESTFAIL;
        
-       ContactLoadStatus testFile2SaveStatus = CONTACTSAVE_UNITTESTFAIL;
-       ContactSaveStatus testFile2LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactLoadStatus testFile2LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactSaveStatus testFile2SaveStatus = CONTACTSAVE_UNITTESTFAIL;
        
-       ContactLoadStatus testFile3SaveStatus = CONTACTSAVE_UNITTESTFAIL;
-       ContactSaveStatus testFile3LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactLoadStatus testFile3LoadStatus = CONTACTLOAD_UNITTESTFAIL;
+       ContactSaveStatus testFile3SaveStatus = CONTACTSAVE_UNITTESTFAIL;
        
        // When
        
@@ -771,7 +771,7 @@ TEST(ContactSave, GivenContactDataObjectWhenFileIsSavedToInvalidLocationThenErro
        ContactLoadStatus testFileLoadStatus = CONTACTLOAD_UNITTESTFAIL;
        ContactSaveStatus testFileSaveStatus = CONTACTSAVE_UNITTESTFAIL;
        
-       testFileLoadStatus = testFile1.LoadFile("LoadCheck-Load1.vcf");
+       testFileLoadStatus = testFile.LoadFile("LoadCheck-Load1.vcf");
        
        ASSERT_EQ(CONTACTLOAD_OK, testFileLoadStatus);
        
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy