X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Ftests%2Fxestiacalendar_icaljournalload.h;h=13cb988967a8fca3e478834dbaa9dd3585e3be67;hb=cba151c4b833a26c63984769f921bab5e755decd;hp=708fd722aa150d1b33da6483563e0900d12baaea;hpb=21c4c8ea2f2464ad83d458adbe4ef451817eb3db;p=xestiacalendar%2F.git diff --git a/source/tests/xestiacalendar_icaljournalload.h b/source/tests/xestiacalendar_icaljournalload.h index 708fd72..13cb988 100644 --- a/source/tests/xestiacalendar_icaljournalload.h +++ b/source/tests/xestiacalendar_icaljournalload.h @@ -1,14 +1,14 @@ -// xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Journal Component Unit Tests +// xestiacalendar_icaljournalload.h - Xestia Calendar iCalendar Journal Component Unit Tests // -// (c) 2016 Xestia Software Development. +// (c) 2016-2017 Xestia Software Development. // // This file is part of Xestia Calendar. // -// Xestia Address Book is free software: you can redistribute it and/or modify +// Xestia Calendar is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation, version 3 of the license. // -// Xestia Address Book is distributed in the hope that it will be useful, +// Xestia Calendar is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. @@ -684,4 +684,300 @@ TEST(iCalendarJournal, ObjectDataTests){ ASSERT_EQ("person.3@example.com", RelatedTo); ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens); + // Get the first RDATE. + + std::string RecurrenceDate; + + if (TestJournal.RecurranceDateData.begin() != TestJournal.RecurranceDateData.end()){ + + RecurrenceDate = TestJournal.RecurranceDateData[0]; + + } + + ASSERT_EQ("20160120", RecurrenceDate); + + // Get the second RDATE. + + RecurrenceDate.clear(); + + std::string RecurrenceDateTimeZoneParam; + std::string RecurrenceDateValue; + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDate = TestJournal.RecurranceDateData[1]; + + } + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDateTimeZoneParam = TestJournal.RecurranceDateDataTimeZoneParam[1]; + + } + + if (TestJournal.RecurranceDateData.size() > 1){ + + RecurrenceDateValue = TestJournal.RecurranceDateDataValue[1]; + + } + + ASSERT_EQ("20160121", RecurrenceDate); + ASSERT_EQ("DATE", RecurrenceDateValue); + ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam); + + // Get the third RDATE. + + RecurrenceDate.clear(); + + std::string RecurrenceTokens; + + if (TestJournal.RecurranceDateData.size() > 2){ + + RecurrenceDate = TestJournal.RecurranceDateData[2]; + + } + + if (TestJournal.RecurranceDateData.size() > 2){ + + RecurrenceTokens = TestJournal.RecurranceDateDataTokens[2]; + + } + + ASSERT_EQ("20160520", RecurrenceDate); + ASSERT_EQ("ZILCH=DATA", RecurrenceTokens); + + // Get the first REQUEST-STATUS. + + std::string RequestStatus; + + if (TestJournal.RequestStatusData.begin() != TestJournal.RequestStatusData.end()){ + + RequestStatus = TestJournal.RequestStatusData[0]; + + } + + ASSERT_EQ("2.0;Success", RequestStatus); + + // Get the second REQUEST-STATUS. + + RequestStatus.clear(); + + std::string RequestLanguage; + + if (TestJournal.ContactList.size() > 1){ + + RequestStatus = TestJournal.RequestStatusData[1]; + + } + + if (TestJournal.ContactList.size() > 1){ + + RequestLanguage = TestJournal.RequestStatusLanguage[1]; + + } + + ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus); + ASSERT_EQ("en", RequestLanguage); + + // Get the third REQUEST-STATUS. + + RequestStatus.clear(); + + std::string RequestTokens; + + if (TestJournal.ContactList.size() > 2){ + + RequestStatus = TestJournal.RequestStatusData[2]; + + } + + if (TestJournal.ContactList.size() > 2){ + + RequestTokens = TestJournal.RequestStatusTokens[2]; + + } + + ASSERT_EQ("3.7;Invalid calendar user", RequestStatus); + ASSERT_EQ("USER=MISSING", RequestTokens); + + // Get the first X-EXAMPLE1 token. + + std::string XTokenName; + std::string XTokenData; + + if (TestJournal.XTokensData.size() != 0 ){ + + XTokenData = TestJournal.XTokensData[0]; + + } + + if (TestJournal.XTokensData.size() != 0){ + + XTokenName = TestJournal.XTokensDataTokens[0]; + + } + + ASSERT_EQ("Moo", XTokenData); + ASSERT_EQ("X-EXAMPLE1", XTokenName); + + // Get the second X-EXAMPLE1 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 1){ + + XTokenData = TestJournal.XTokensData[1]; + + } + + if (TestJournal.XTokensData.size() > 1){ + + XTokenName = TestJournal.XTokensDataTokens[1]; + + } + + ASSERT_EQ("Meep", XTokenData); + ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName); + + // Get the third X-EXAMPLE1 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 2){ + + XTokenData = TestJournal.XTokensData[2]; + + } + + if (TestJournal.XTokensData.size() > 2){ + + XTokenName = TestJournal.XTokensDataTokens[2]; + + } + + ASSERT_EQ("Meow", XTokenData); + ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName); + + // Get the first X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 3){ + + XTokenData = TestJournal.XTokensData[3]; + + } + + if (TestJournal.XTokensData.size() > 3){ + + XTokenName = TestJournal.XTokensDataTokens[3]; + + } + + ASSERT_EQ("Dish", XTokenData); + ASSERT_EQ("X-EXAMPLE2", XTokenName); + + // Get the second X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 4){ + + XTokenData = TestJournal.XTokensData[4]; + + } + + if (TestJournal.XTokensData.size() > 4){ + + XTokenName = TestJournal.XTokensDataTokens[4]; + + } + + ASSERT_EQ("Fork", XTokenData); + ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName); + + // Get the third X-EXAMPLE2 token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 5){ + + XTokenData = TestJournal.XTokensData[5]; + + } + + if (TestJournal.XTokensData.size() > 5){ + + XTokenName = TestJournal.XTokensDataTokens[5]; + + } + + ASSERT_EQ("Table", XTokenData); + ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName); + + // Get the X-STATUS token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 6){ + + XTokenData = TestJournal.XTokensData[6]; + + } + + if (TestJournal.XTokensData.size() > 6){ + + XTokenName = TestJournal.XTokensDataTokens[6]; + + } + + ASSERT_EQ("Idle", XTokenData); + ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName); + + // Get the X-TRANSPORT token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 7){ + + XTokenData = TestJournal.XTokensData[7]; + + } + + if (TestJournal.XTokensData.size() > 7){ + + XTokenName = TestJournal.XTokensDataTokens[7]; + + } + + ASSERT_EQ("Private Hire", XTokenData); + ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName); + + // Get the X-PHANTOM-STATUS token. + + XTokenName.clear(); + XTokenData.clear(); + + if (TestJournal.XTokensData.size() > 8){ + + XTokenData = TestJournal.XTokensData[8]; + + } + + if (TestJournal.XTokensData.size() > 8){ + + XTokenName = TestJournal.XTokensDataTokens[8]; + + } + + ASSERT_EQ("None", XTokenData); + ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName); + } \ No newline at end of file