X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Ftests%2Fxestiaab_contactload.h;h=10d10b0e5a94aa8c9191977df159c672c30b2339;hp=6ace86fb397ecbc90a32b227f2798496443eecf9;hb=b9c2b33681e480071aa685c157b456bf5990ef41;hpb=82a74eaae46b4fd7f3365d2ce0b6a503cbb97c8a diff --git a/source/tests/xestiaab_contactload.h b/source/tests/xestiaab_contactload.h index 6ace86f..10d10b0 100644 --- a/source/tests/xestiaab_contactload.h +++ b/source/tests/xestiaab_contactload.h @@ -154,7 +154,20 @@ TEST(ContactLoad, ContactLoadTests){ // Check the extra tokens parameter. ASSERT_EQ("TEST=Yes", TestFile.NameTokens); - + +} + +TEST(ContactLoad, NicknameTests){ + + ContactDataObject TestFile; + + // Check that the vCard 4.0 file loads OK. + + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); + + std::map::iterator TestFileIter; + std::map::iterator TestFileIntIter; + // Check that the nickname has been read (NICKNAME). General. TestFileIter = TestFile.GeneralNicknamesList.find(0); @@ -265,4 +278,104 @@ TEST(ContactLoad, ContactLoadTests){ } +TEST(ContactLoad, GenderTests){ + + // Check that the gender has been read. + + ContactDataObject TestFile; + + // Check that the vCard 4.0 file loads OK. + + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); + + std::map::iterator TestFileIter; + std::map::iterator TestFileIntIter; + + ASSERT_NE("", TestFile.Gender); + ASSERT_EQ("F", TestFile.Gender); + ASSERT_EQ("Example Text", TestFile.GenderDetails); + ASSERT_EQ("BEEP=Boop", TestFile.GenderTokens); + +} + +TEST(ContactLoad, BirthdayTests){ + + // Check that the birthday has been read. + + // Check that the gender has been read. + + ContactDataObject TestFile; + + // Check that the vCard 4.0 file loads OK. + + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); + + std::map::iterator TestFileIter; + std::map::iterator TestFileIntIter; + + ASSERT_NE("", TestFile.Birthday); + ASSERT_EQ("20040101", TestFile.Birthday); + + // Check the ALTID parameter. + + ASSERT_EQ("35", TestFile.BirthdayAltID); + + // Check the CALSCALE parameter. + + ASSERT_EQ("georgian", TestFile.BirthdayCalScale); + + // Check the extra tokens parameter. + + ASSERT_EQ("HAPPY=Days", TestFile.BirthdayTokens); + + // Check the VALUE parameter. (Note have to use a different file + // due to the *1 rule in RFC6350. + + ContactDataObject TestFileValue; + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf")); + + ASSERT_EQ("Circa 2000s", TestFile.Birthday); + +} + +TEST(ContactLoad, AnniversaryTests){ + + // Check that the birthday has been read. + + // Check that the gender has been read. + + ContactDataObject TestFile; + + // Check that the vCard 4.0 file loads OK. + + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf")); + + std::map::iterator TestFileIter; + std::map::iterator TestFileIntIter; + + ASSERT_NE("", TestFile.Anniversary); + ASSERT_EQ("20200516", TestFile.Anniversary); + + // Check the ALTID parameter. + + ASSERT_EQ("70", TestFile.AnniversaryAltID); + + // Check the CALSCALE parameter. + + ASSERT_EQ("georgian", TestFile.AnniversaryCalScale); + + // Check the extra tokens parameter. + + ASSERT_EQ("WONDERFUL=Day", TestFile.AnniversaryTokens); + + // Check the VALUE parameter. (Note have to use a different file + // due to the *1 rule in RFC6350. + + ContactDataObject TestFileValue; + ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf")); + + ASSERT_EQ("Circa 2020s", TestFile.Anniversary); + +} + // TODO: Add tests for the Contact Loading process. \ No newline at end of file