1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Task Component Unit Tests
3 // (c) 2016 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "../objects/calendartask/CalendarTask.h"
21 TEST(iCalendarTask, BasicTests){
23 CalendarTaskObject TestTask;
25 ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestTask.LoadFile("iCalendarTask-Missing.vcf"));
26 ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestTask.LoadFile("iCalendarTask-InvalidPermissions.vcf"));
27 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load1.vcf"));
31 TEST(iCalendarTask, ObjectDataTests){
33 CalendarTaskObject TestTask;
34 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask.LoadFile("iCalendarTask-Load2.vcf"));
35 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask.ValidBaseObject());
39 ASSERT_EQ("20160131T104500Z", TestTask.DateTimeStampData);
40 ASSERT_EQ("OTHER=PARAM", TestTask.DateTimeStampTokens);
44 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e1", TestTask.UniqueID);
45 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestTask.UniqueIDTokens);
49 ASSERT_EQ("PUBLIC", TestTask.ClassData);
50 ASSERT_EQ("CHOCOLATE=NONE", TestTask.ClassDataTokens);
52 // Tests for COMPLETED.
54 ASSERT_EQ("20160131T110100Z", TestTask.CompletedData);
55 ASSERT_EQ("LYING=NEVER", TestTask.CompletedDataTokens);
59 ASSERT_EQ("20160131T080000Z", TestTask.DateTimeCreatedData);
60 ASSERT_EQ("CARAMEL=PLEASE", TestTask.DateTimeCreatedTokens);
62 // Tests for DESCRIPTION.
64 std::string DescriptionData;
65 std::string DescriptionAltRep;
66 std::string DescriptionLanguage;
67 std::string DescriptionTokens;
69 if (TestTask.DescriptionList.begin() != TestTask.DescriptionList.end()){
70 DescriptionData = TestTask.DescriptionList[0];
73 if (TestTask.DescriptionListAltRep.begin() != TestTask.DescriptionListAltRep.end()){
74 DescriptionAltRep = TestTask.DescriptionListAltRep[0];
77 if (TestTask.DescriptionListLanguage.begin() != TestTask.DescriptionListLanguage.end()){
78 DescriptionLanguage = TestTask.DescriptionListLanguage[0];
81 if (TestTask.DescriptionListTokens.begin() != TestTask.DescriptionListTokens.end()){
82 DescriptionTokens = TestTask.DescriptionListTokens[0];
85 ASSERT_EQ("This is a description of the todo.", DescriptionData);
86 ASSERT_EQ("null:nodata", DescriptionAltRep);
87 ASSERT_EQ("kw", DescriptionLanguage);
88 ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", DescriptionTokens);
92 ASSERT_EQ("20160131T103000Z", TestTask.DateTimeStartData);
93 ASSERT_EQ("DATE-TIME", TestTask.DateTimeStartDataValue);
94 ASSERT_EQ("Europe/Truro", TestTask.DateTimeStartDataTimeZoneID);
95 ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestTask.DateTimeStartDataTokens);
99 ASSERT_EQ("20.0;20.0", TestTask.GeographicData);
100 ASSERT_EQ("EXAMPLE=MOOP", TestTask.GeographicTokens);
102 // Tests for LAST-MODIFIED.
104 ASSERT_EQ("20160131T114200Z", TestTask.LastModifiedData);
105 ASSERT_EQ("FUTURE=EVEN", TestTask.LastModifiedTokens);
107 // Tests for LOCATION.
109 ASSERT_EQ("The Crystal Ceiling, Truro", TestTask.LocationData);
110 ASSERT_EQ("null:nodata", TestTask.LocationDataAltRep);
111 ASSERT_EQ("kw", TestTask.LocationDataLanguage);
112 ASSERT_EQ("EXACT=YES", TestTask.LocationDataTokens);
114 // Tests for ORGANIZER.
116 ASSERT_EQ("mailto:organiser@example.com", TestTask.OrganiserData);
117 ASSERT_EQ("ExampleOrganiser", TestTask.OrganiserDataCommonName);
118 ASSERT_EQ("null:nodata", TestTask.OrganiserDataDirectoryEntry);
119 ASSERT_EQ("mailto:organiser.noreply@example.com", TestTask.OrganiserDataSentByParam);
120 ASSERT_EQ("kw", TestTask.OrganiserDataLanguage);
121 ASSERT_EQ("HAPPY=WEEKS", TestTask.OrganiserDataTokens);
123 // Tests for PERCENT-COMPLETE.
125 ASSERT_EQ("42", TestTask.PercentCompleteData);
126 ASSERT_EQ("DEEP=THOUGHT", TestTask.PercentCompleteTokens);
128 // Tests for PRIORITY.
130 ASSERT_EQ(5, TestTask.PriorityData);
131 ASSERT_EQ("STATUS=DEFAULT", TestTask.PriorityTokens);
133 // Tests for RECURRENCE-ID.
135 ASSERT_EQ("20160131", TestTask.RecurranceIDData);
136 ASSERT_EQ("Europe/Truro", TestTask.RecurranceIDDataTimeZoneParam);
137 ASSERT_EQ("THISANDFUTURE", TestTask.RecurranceIDDataRangeParam);
138 ASSERT_EQ("DATE", TestTask.RecurranceIDDataValue);
139 ASSERT_EQ("EXAMPLE=DATA", TestTask.RecurranceIDDataTokens);
141 // Tests for SEQUENCE.
143 ASSERT_EQ(3, TestTask.SequenceData);
144 ASSERT_EQ("TEST=YAY", TestTask.SequenceTokens);
148 ASSERT_EQ("2.0;Success", TestTask.StatusData);
149 ASSERT_EQ("kw", TestTask.StatusLanguage);
150 ASSERT_EQ("FAVOURITE=BEANS;NOTLIKE=UNKNOWN", TestTask.StatusTokens);
152 // Tests for SUMMARY.
154 ASSERT_EQ("A summary of the todo.", TestTask.SummaryData);
155 ASSERT_EQ("null:nodata", TestTask.SummaryDataAltRep);
156 ASSERT_EQ("kw", TestTask.SummaryDataLanguage);
157 ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", TestTask.SummaryDataTokens);
161 ASSERT_EQ("http://www.example.com/", TestTask.URLData);
162 ASSERT_EQ("EXTERNAL=YES", TestTask.URLDataTokens);
166 ASSERT_EQ("FREQ=DAILY;COUNT=10", TestTask.RecurranceRuleData);
167 ASSERT_EQ("TEST=DATA", TestTask.RecurranceRuleDataTokens);
171 ASSERT_EQ("20160131T150000Z", TestTask.DueData);
172 ASSERT_EQ("Europe/Truro", TestTask.DueDataTimeZoneID);
173 ASSERT_EQ("DATE-TIME", TestTask.DueDataValue);
174 ASSERT_EQ("TEST=YES", TestTask.DueDataTokens);
176 // Tests for DURATION.
178 CalendarTaskObject TestTask2;
179 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestTask2.LoadFile("iCalendarTask-Load3.vcf"));
180 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestTask2.ValidBaseObject());
182 ASSERT_EQ("PT15M", TestTask2.DurationData);
183 ASSERT_EQ("TEST=YES", TestTask2.DurationDataTokens);
185 // Tests for ATTACH. First ATTACH property.
187 std::string AttachData;
188 std::string AttachDataFormatType;
189 std::string AttachDataValue;
190 std::string AttachDataEncoding;
191 std::string AttachDataTokens;
193 if (TestTask.AttachList.begin() != TestTask.AttachList.end()){
195 AttachData = TestTask.AttachList[0];
199 if (TestTask.AttachListFormatType.begin() != TestTask.AttachListFormatType.end()){
201 AttachDataFormatType = TestTask.AttachListFormatType[0];
205 ASSERT_EQ("http://www.example.com/", AttachData);
206 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
208 // Second ATTACH property.
211 AttachDataFormatType.clear();
212 AttachDataValue.clear();
213 AttachDataEncoding.clear();
215 if (TestTask.AttachList.size() > 1){
217 AttachData = TestTask.AttachList[1];
221 if (TestTask.AttachListFormatType.size() > 1){
223 AttachDataFormatType = TestTask.AttachListFormatType[1];
227 ASSERT_EQ("http://www.example.com/page2.html", AttachData);
228 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
230 // Third ATTACH property.
233 AttachDataFormatType.clear();
234 AttachDataValue.clear();
235 AttachDataEncoding.clear();
236 AttachDataTokens.clear();
238 if (TestTask.AttachList.size() > 2){
240 AttachData = TestTask.AttachList[2];
244 if (TestTask.AttachListFormatType.size() > 2){
246 AttachDataFormatType = TestTask.AttachListFormatType[2];
250 if (TestTask.AttachListValue.size() > 2){
252 AttachDataValue = TestTask.AttachListValue[2];
256 if (TestTask.AttachListFormatType.size() > 2){
258 AttachDataEncoding = TestTask.AttachListEncoding[2];
262 if (TestTask.AttachListTokens.size() > 2){
264 AttachDataTokens = TestTask.AttachListTokens[2];
268 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
269 ASSERT_EQ("text/plain", AttachDataFormatType);
270 ASSERT_EQ("BASE64", AttachDataEncoding);
271 ASSERT_EQ("BINARY", AttachDataValue);
272 ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
274 // Tests for ATTENDEE. First ATTENDEE property.
276 std::string AttendeeDataMember;
277 std::string AttendeeDataDelegatedFrom;
278 std::string AttendeeDataDelegatedTo;
279 std::string AttendeeDataRole;
280 std::string AttendeeDataRSVP;
281 std::string AttendeeDataDirectoryEntry;
282 std::string AttendeeDataSentBy;
283 std::string AttendeeDataCommonName;
284 std::string AttendeeDataCalendarUserType;
285 std::string AttendeeDataParticipationStatus;
286 std::string AttendeeDataLanguage;
287 std::string AttendeeDataTokens;
288 std::string AttendeeData;
290 if (TestTask.AttendeeList.begin() != TestTask.AttendeeList.end()){
292 AttendeeData = TestTask.AttendeeList[0];
296 ASSERT_EQ("Attendee One", AttendeeData);
298 // Second ATTENDEE property.
300 AttendeeData.clear();
302 if (TestTask.AttendeeList.size() > 1){
304 AttendeeData = TestTask.AttendeeList[1];
308 if (TestTask.AttendeeList.size() > 1){
310 AttendeeDataDelegatedFrom = TestTask.AttendeeListDelegatedFrom[1];
314 if (TestTask.AttendeeList.size() > 1){
316 AttendeeDataDelegatedTo = TestTask.AttendeeListDelegatedTo[1];
320 if (TestTask.AttendeeList.size() > 1){
322 AttendeeDataRole = TestTask.AttendeeListRole[1];
326 if (TestTask.AttendeeList.size() > 1){
328 AttendeeDataRSVP = TestTask.AttendeeListRSVP[1];
332 ASSERT_EQ("Attendee Two", AttendeeData);
333 ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom);
334 ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo);
335 ASSERT_EQ("CHAIR", AttendeeDataRole);
336 ASSERT_EQ("TRUE", AttendeeDataRSVP);
338 // Third ATTENDEE property.
340 AttendeeData.clear();
342 if (TestTask.AttendeeList.size() > 2){
344 AttendeeData = TestTask.AttendeeList[2];
348 if (TestTask.AttendeeList.size() > 2){
350 AttendeeDataDirectoryEntry = TestTask.AttendeeListDirectoryEntry[2];
354 if (TestTask.AttendeeList.size() > 2){
356 AttendeeDataSentBy = TestTask.AttendeeListSentBy[2];
360 if (TestTask.AttendeeList.size() > 2){
362 AttendeeDataCommonName = TestTask.AttendeeListCommonName[2];
366 if (TestTask.AttendeeList.size() > 2){
368 AttendeeDataCalendarUserType = TestTask.AttendeeListCalendarUserType[2];
372 if (TestTask.AttendeeList.size() > 2){
374 AttendeeDataParticipationStatus = TestTask.AttendeeListParticipationStatus[2];
378 if (TestTask.AttendeeList.size() > 2){
380 AttendeeDataLanguage = TestTask.AttendeeListLanguage[2];
384 if (TestTask.AttendeeList.size() > 2){
386 AttendeeDataTokens = TestTask.AttendeeListTokens[2];
390 ASSERT_EQ("Attendee Three", AttendeeData);
391 ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry);
392 ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy);
393 ASSERT_EQ("Attendee The Third", AttendeeDataCommonName);
394 ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType);
395 ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus);
396 ASSERT_EQ("kw", AttendeeDataLanguage);
397 ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens);
399 // Get the first CATEGORIES.
401 std::string CategoryData;
403 if (TestTask.CategoriesList.begin() != TestTask.CategoriesList.end()){
405 CategoryData = TestTask.CategoriesList[0];
409 ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData);
411 CategoryData.clear();
413 std::string CategoryLanguage;
415 // Get the second CATEGORIES.
417 if (TestTask.CategoriesList.size() > 1){
419 CategoryData = TestTask.CategoriesList[1];
423 if (TestTask.CategoriesList.size() > 1){
425 CategoryLanguage = TestTask.CategoriesListLanguage[1];
429 ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData);
430 ASSERT_EQ("en", CategoryLanguage);
432 CategoryData.clear();
433 CategoryLanguage.clear();
435 // Get the third CATEGORIES.
437 std::string CategoryTokens;
439 if (TestTask.CategoriesList.size() > 2){
441 CategoryData = TestTask.CategoriesList[2];
445 if (TestTask.CategoriesList.size() > 2){
447 CategoryLanguage = TestTask.CategoriesListLanguage[2];
451 if (TestTask.CategoriesList.size() > 2){
453 CategoryTokens = TestTask.CategoriesListTokens[2];
457 ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData);
458 ASSERT_EQ("en-GB", CategoryLanguage);
459 ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens);
461 // Get the first COMMENT.
463 std::string CommentData;
465 if (TestTask.CommentList.begin() != TestTask.CommentList.end()){
467 CommentData = TestTask.CommentList[0];
471 ASSERT_EQ("This is the first comment.", CommentData);
473 // Get the second COMMENT.
477 std::string CommentDataAltRep;
478 std::string CommentDataLanguage;
480 if (TestTask.CommentList.size() > 1){
482 CommentData = TestTask.CommentList[1];
486 if (TestTask.CommentList.size() > 1){
488 CommentDataAltRep = TestTask.CommentListAltRep[1];
492 if (TestTask.CommentList.size() > 1){
494 CommentDataLanguage = TestTask.CommentListLanguage[1];
498 ASSERT_EQ("This is the second comment.", CommentData);
499 ASSERT_EQ("null:nodata", CommentDataAltRep);
500 ASSERT_EQ("en", CommentDataLanguage);
502 // Get the third COMMENT.
506 std::string CommentDataTokens;
508 if (TestTask.CommentList.size() > 2){
510 CommentData = TestTask.CommentList[2];
514 if (TestTask.CommentList.size() > 2){
516 CommentDataTokens = TestTask.CommentListTokens[2];
520 ASSERT_EQ("This is the third comment.", CommentData);
521 ASSERT_EQ("ZEBRAS=YES", CommentDataTokens);
523 // Get the first CONTACT.
525 std::string ContactData;
527 if (TestTask.ContactList.begin() != TestTask.ContactList.end()){
529 ContactData = TestTask.ContactList[0];
533 ASSERT_EQ("First Contact", ContactData);
535 // Get the second CONTACT.
539 std::string ContactDataAltRep;
540 std::string ContactDataLanguage;
542 if (TestTask.ContactList.size() > 1){
544 ContactData = TestTask.ContactList[1];
548 if (TestTask.ContactList.size() > 1){
550 ContactDataAltRep = TestTask.ContactListAltRep[1];
554 if (TestTask.ContactList.size() > 1){
556 ContactDataLanguage = TestTask.ContactListLanguage[1];
560 ASSERT_EQ("Second Contact", ContactData);
561 ASSERT_EQ("null:nodata", ContactDataAltRep);
562 ASSERT_EQ("en-GB", ContactDataLanguage);
564 // Get the third CONTACT.
568 std::string ContactDataTokens;
570 if (TestTask.ContactList.size() > 2){
572 ContactData = TestTask.ContactList[2];
576 if (TestTask.ContactList.size() > 2){
578 ContactDataTokens = TestTask.ContactListTokens[2];
582 ASSERT_EQ("Third Contact", ContactData);
583 ASSERT_EQ("ZEBRAS=NO", ContactDataTokens);
585 // Get the first EXDATE.
587 std::string ExcludeDate;
589 if (TestTask.ExcludeDateData.begin() != TestTask.ExcludeDateData.end()){
591 ExcludeDate = TestTask.ExcludeDateData[0];
595 ASSERT_EQ("20160125T120000Z", ExcludeDate);
597 // Get the second EXDATE.
601 std::string ExcludeDataTimeZoneParam;
602 std::string ExcludeDataValue;
604 if (TestTask.ContactList.size() > 1){
606 ExcludeDate = TestTask.ExcludeDateData[1];
610 if (TestTask.ContactList.size() > 1){
612 ExcludeDataTimeZoneParam = TestTask.ExcludeDateDataTimeZoneParam[1];
616 if (TestTask.ContactList.size() > 1){
618 ExcludeDataValue = TestTask.ExcludeDateDataValue[1];
622 ASSERT_EQ("20160125T130000Z", ExcludeDate);
623 ASSERT_EQ("DATE-TIME", ExcludeDataValue);
624 ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam);
626 // Get the third EXDATE.
630 std::string ExcludeDataTokens;
632 if (TestTask.ContactList.size() > 2){
634 ExcludeDate = TestTask.ExcludeDateData[2];
638 if (TestTask.ContactList.size() > 2){
640 ExcludeDataTokens = TestTask.ExcludeDateDataTokens[2];
644 ASSERT_EQ("20160125T133000Z", ExcludeDate);
645 ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens);
647 // Get the first REQUEST-STATUS.
649 std::string RequestStatus;
651 if (TestTask.RequestStatusData.begin() != TestTask.RequestStatusData.end()){
653 RequestStatus = TestTask.RequestStatusData[0];
657 ASSERT_EQ("2.0;Success", RequestStatus);
659 // Get the second REQUEST-STATUS.
661 RequestStatus.clear();
663 std::string RequestLanguage;
665 if (TestTask.ContactList.size() > 1){
667 RequestStatus = TestTask.RequestStatusData[1];
671 if (TestTask.ContactList.size() > 1){
673 RequestLanguage = TestTask.RequestStatusLanguage[1];
677 ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus);
678 ASSERT_EQ("en", RequestLanguage);
680 // Get the third REQUEST-STATUS.
682 RequestStatus.clear();
684 std::string RequestTokens;
686 if (TestTask.ContactList.size() > 2){
688 RequestStatus = TestTask.RequestStatusData[2];
692 if (TestTask.ContactList.size() > 2){
694 RequestTokens = TestTask.RequestStatusTokens[2];
698 ASSERT_EQ("3.7;Invalid calendar user", RequestStatus);
699 ASSERT_EQ("USER=MISSING", RequestTokens);
701 // Get the first RELATED-TO.
703 std::string RelatedTo;
705 if (TestTask.RelatedToData.begin() != TestTask.RelatedToData.end()){
707 RelatedTo = TestTask.RelatedToData[0];
711 ASSERT_EQ("person.1@example.com", RelatedTo);
713 // Get the second RELATED-TO.
717 std::string RelatedToType;
719 if (TestTask.RelatedToData.size() > 1){
721 RelatedTo = TestTask.RelatedToData[1];
725 if (TestTask.RelatedToData.size() > 1){
727 RelatedToType = TestTask.RelatedToDataRelationType[1];
731 ASSERT_EQ("person.2@example.com", RelatedTo);
732 ASSERT_EQ("PARENT", RelatedToType);
734 // Get the third RELATED-TO.
738 std::string RelatedToTokens;
740 if (TestTask.RelatedToData.size() > 2){
742 RelatedTo = TestTask.RelatedToData[2];
746 if (TestTask.RelatedToData.size() > 2){
748 RelatedToTokens = TestTask.RelatedToDataTokens[2];
752 ASSERT_EQ("person.3@example.com", RelatedTo);
753 ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens);
755 // Get the first RESOURCES.
757 std::string Resources;
759 if (TestTask.ResourcesData.begin() != TestTask.ResourcesData.end()){
761 Resources = TestTask.ResourcesData[0];
765 ASSERT_EQ("DMAC RECEIVER", Resources);
767 // Get the second RESOURCES.
771 std::string ResourcesLanguage;
773 if (TestTask.ResourcesData.size() > 1){
775 Resources = TestTask.ResourcesData[1];
779 if (TestTask.ResourcesData.size() > 1){
781 ResourcesLanguage = TestTask.ResourcesDataLanguage[1];
785 ASSERT_EQ("PAL-I TELEVISION SET", Resources);
786 ASSERT_EQ("en", ResourcesLanguage);
788 // Get the third RESOURCES.
792 std::string ResourcesAltRep;
793 std::string ResourcesTokens;
795 if (TestTask.ResourcesData.size() > 2){
797 Resources = TestTask.ResourcesData[2];
801 if (TestTask.ResourcesData.size() > 2){
803 ResourcesAltRep = TestTask.ResourcesDataAltRep[2];
807 if (TestTask.ResourcesData.size() > 2){
809 ResourcesTokens = TestTask.ResourcesDataTokens[2];
813 ASSERT_EQ("PAL/SECAM VCR", Resources);
814 ASSERT_EQ("null:nodata", ResourcesAltRep);
815 ASSERT_EQ("STATUS=BROKEN", ResourcesTokens);
817 // Get the first RDATE.
819 std::string RecurrenceDate;
821 if (TestTask.RecurranceDateData.begin() != TestTask.RecurranceDateData.end()){
823 RecurrenceDate = TestTask.RecurranceDateData[0];
827 ASSERT_EQ("20160120", RecurrenceDate);
829 // Get the second RDATE.
831 RecurrenceDate.clear();
833 std::string RecurrenceDateTimeZoneParam;
834 std::string RecurrenceDateValue;
836 if (TestTask.RecurranceDateData.size() > 1){
838 RecurrenceDate = TestTask.RecurranceDateData[1];
842 if (TestTask.RecurranceDateData.size() > 1){
844 RecurrenceDateTimeZoneParam = TestTask.RecurranceDateDataTimeZoneParam[1];
848 if (TestTask.RecurranceDateData.size() > 1){
850 RecurrenceDateValue = TestTask.RecurranceDateDataValue[1];
854 ASSERT_EQ("20160121", RecurrenceDate);
855 ASSERT_EQ("DATE", RecurrenceDateValue);
856 ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam);
858 // Get the third RDATE.
860 RecurrenceDate.clear();
862 std::string RecurrenceTokens;
864 if (TestTask.RecurranceDateData.size() > 2){
866 RecurrenceDate = TestTask.RecurranceDateData[2];
870 if (TestTask.RecurranceDateData.size() > 2){
872 RecurrenceTokens = TestTask.RecurranceDateDataTokens[2];
876 ASSERT_EQ("20160520", RecurrenceDate);
877 ASSERT_EQ("ZILCH=DATA", RecurrenceTokens);
879 // Get the first X-EXAMPLE1 token.
881 std::string XTokenName;
882 std::string XTokenData;
884 if (TestTask.XTokensData.size() != 0 ){
886 XTokenData = TestTask.XTokensData[0];
890 if (TestTask.XTokensData.size() != 0){
892 XTokenName = TestTask.XTokensDataTokens[0];
896 ASSERT_EQ("Moo", XTokenData);
897 ASSERT_EQ("X-EXAMPLE1", XTokenName);
899 // Get the second X-EXAMPLE1 token.
904 if (TestTask.XTokensData.size() > 1){
906 XTokenData = TestTask.XTokensData[1];
910 if (TestTask.XTokensData.size() > 1){
912 XTokenName = TestTask.XTokensDataTokens[1];
916 ASSERT_EQ("Meep", XTokenData);
917 ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName);
919 // Get the third X-EXAMPLE1 token.
924 if (TestTask.XTokensData.size() > 2){
926 XTokenData = TestTask.XTokensData[2];
930 if (TestTask.XTokensData.size() > 2){
932 XTokenName = TestTask.XTokensDataTokens[2];
936 ASSERT_EQ("Meow", XTokenData);
937 ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName);
939 // Get the first X-EXAMPLE2 token.
944 if (TestTask.XTokensData.size() > 3){
946 XTokenData = TestTask.XTokensData[3];
950 if (TestTask.XTokensData.size() > 3){
952 XTokenName = TestTask.XTokensDataTokens[3];
956 ASSERT_EQ("Dish", XTokenData);
957 ASSERT_EQ("X-EXAMPLE2", XTokenName);
959 // Get the second X-EXAMPLE2 token.
964 if (TestTask.XTokensData.size() > 4){
966 XTokenData = TestTask.XTokensData[4];
970 if (TestTask.XTokensData.size() > 4){
972 XTokenName = TestTask.XTokensDataTokens[4];
976 ASSERT_EQ("Fork", XTokenData);
977 ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName);
979 // Get the third X-EXAMPLE2 token.
984 if (TestTask.XTokensData.size() > 5){
986 XTokenData = TestTask.XTokensData[5];
990 if (TestTask.XTokensData.size() > 5){
992 XTokenName = TestTask.XTokensDataTokens[5];
996 ASSERT_EQ("Table", XTokenData);
997 ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName);
999 // Get the X-STATUS token.
1004 if (TestTask.XTokensData.size() > 6){
1006 XTokenData = TestTask.XTokensData[6];
1010 if (TestTask.XTokensData.size() > 6){
1012 XTokenName = TestTask.XTokensDataTokens[6];
1016 ASSERT_EQ("Idle", XTokenData);
1017 ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName);
1019 // Get the X-TRANSPORT token.
1024 if (TestTask.XTokensData.size() > 7){
1026 XTokenData = TestTask.XTokensData[7];
1030 if (TestTask.XTokensData.size() > 7){
1032 XTokenName = TestTask.XTokensDataTokens[7];
1036 ASSERT_EQ("Private Hire", XTokenData);
1037 ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName);
1039 // Get the X-PHANTOM-STATUS token.
1044 if (TestTask.XTokensData.size() > 8){
1046 XTokenData = TestTask.XTokensData[8];
1050 if (TestTask.XTokensData.size() > 8){
1052 XTokenName = TestTask.XTokensDataTokens[8];
1056 ASSERT_EQ("None", XTokenData);
1057 ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName);