1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Journal 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/calendarjournal/CalendarJournal.h"
21 TEST(iCalendarJournal, BasicTests){
23 CalendarJournalObject TestJournal;
25 ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestJournal.LoadFile("iCalendarJournal-Missing.vcf"));
26 ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestJournal.LoadFile("iCalendarJournal-InvalidPermissions.vcf"));
27 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestJournal.LoadFile("iCalendarJournal-Load1.vcf"));
31 TEST(iCalendarJournal, ObjectDataTests){
33 CalendarJournalObject TestJournal;
34 ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestJournal.LoadFile("iCalendarJournal-Load2.vcf"));
35 ASSERT_EQ(CALENDAROBJECTVALID_OK, TestJournal.ValidBaseObject());
39 ASSERT_EQ("20160131T141500Z", TestJournal.DateTimeStampData);
40 ASSERT_EQ("OTHER=PARAM", TestJournal.DateTimeStampTokens);
44 ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306c1", TestJournal.UniqueID);
45 ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestJournal.UniqueIDTokens);
49 ASSERT_EQ("PUBLIC", TestJournal.ClassData);
50 ASSERT_EQ("CHOCOLATE=BAR", TestJournal.ClassDataTokens);
54 ASSERT_EQ("20160131T143500Z", TestJournal.DateTimeStartData);
55 ASSERT_EQ("DATE-TIME", TestJournal.DateTimeStartDataValue);
56 ASSERT_EQ("Europe/Truro", TestJournal.DateTimeStartDataTimeZoneID);
57 ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestJournal.DateTimeStartDataTokens);
59 // Tests for LAST-MODIFIED.
61 ASSERT_EQ("20160131T143700Z", TestJournal.LastModifiedData);
62 ASSERT_EQ("FUTURE=YES", TestJournal.LastModifiedTokens);
64 // Tests for ORGANIZER.
66 ASSERT_EQ("mailto:organiser@example.com", TestJournal.OrganiserData);
67 ASSERT_EQ("ExampleOrganiser", TestJournal.OrganiserDataCommonName);
68 ASSERT_EQ("null:nodata", TestJournal.OrganiserDataDirectoryEntry);
69 ASSERT_EQ("mailto:organiser.noreply@example.com", TestJournal.OrganiserDataSentByParam);
70 ASSERT_EQ("kw", TestJournal.OrganiserDataLanguage);
71 ASSERT_EQ("HAPPY=DAYS", TestJournal.OrganiserDataTokens);
73 // Tests for RECURRENCE-ID.
75 ASSERT_EQ("20160131", TestJournal.RecurranceIDData);
76 ASSERT_EQ("Europe/Truro", TestJournal.RecurranceIDDataTimeZoneParam);
77 ASSERT_EQ("THISANDFUTURE", TestJournal.RecurranceIDDataRangeParam);
78 ASSERT_EQ("DATE", TestJournal.RecurranceIDDataValue);
79 ASSERT_EQ("EXAMPLE=DATA", TestJournal.RecurranceIDDataTokens);
81 // Tests for SEQUENCE.
83 ASSERT_EQ(7, TestJournal.SequenceData);
84 ASSERT_EQ("TEST=YAY", TestJournal.SequenceTokens);
88 ASSERT_EQ("2.0;Success", TestJournal.StatusData);
89 ASSERT_EQ("kw", TestJournal.StatusLanguage);
90 ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", TestJournal.StatusTokens);
94 ASSERT_EQ("A summary of the journal entry.", TestJournal.SummaryData);
95 ASSERT_EQ("null:nodata", TestJournal.SummaryDataAltRep);
96 ASSERT_EQ("kw", TestJournal.SummaryDataLanguage);
97 ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", TestJournal.SummaryDataTokens);
101 ASSERT_EQ("http://www.example.com/", TestJournal.URLData);
102 ASSERT_EQ("EXTERNAL=YES", TestJournal.URLDataTokens);
106 ASSERT_EQ("FREQ=DAILY;COUNT=10", TestJournal.RecurranceRuleData);
107 ASSERT_EQ("TEST=DATA", TestJournal.RecurranceRuleDataTokens);
109 // Tests for ATTACH. First ATTACH property.
111 std::string AttachData;
112 std::string AttachDataFormatType;
113 std::string AttachDataValue;
114 std::string AttachDataEncoding;
115 std::string AttachDataTokens;
117 if (TestJournal.AttachList.begin() != TestJournal.AttachList.end()){
119 AttachData = TestJournal.AttachList[0];
123 if (TestJournal.AttachListFormatType.begin() != TestJournal.AttachListFormatType.end()){
125 AttachDataFormatType = TestJournal.AttachListFormatType[0];
129 ASSERT_EQ("http://www.example.com/", AttachData);
130 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
132 // Second ATTACH property.
135 AttachDataFormatType.clear();
136 AttachDataValue.clear();
137 AttachDataEncoding.clear();
139 if (TestJournal.AttachList.size() > 1){
141 AttachData = TestJournal.AttachList[1];
145 if (TestJournal.AttachListFormatType.size() > 1){
147 AttachDataFormatType = TestJournal.AttachListFormatType[1];
151 ASSERT_EQ("http://www.example.com/page2.html", AttachData);
152 ASSERT_EQ("application/internet-shortcut", AttachDataFormatType);
154 // Third ATTACH property.
157 AttachDataFormatType.clear();
158 AttachDataValue.clear();
159 AttachDataEncoding.clear();
160 AttachDataTokens.clear();
162 if (TestJournal.AttachList.size() > 2){
164 AttachData = TestJournal.AttachList[2];
168 if (TestJournal.AttachListFormatType.size() > 2){
170 AttachDataFormatType = TestJournal.AttachListFormatType[2];
174 if (TestJournal.AttachListValue.size() > 2){
176 AttachDataValue = TestJournal.AttachListValue[2];
180 if (TestJournal.AttachListFormatType.size() > 2){
182 AttachDataEncoding = TestJournal.AttachListEncoding[2];
186 if (TestJournal.AttachListTokens.size() > 2){
188 AttachDataTokens = TestJournal.AttachListTokens[2];
192 ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", AttachData);
193 ASSERT_EQ("text/plain", AttachDataFormatType);
194 ASSERT_EQ("BASE64", AttachDataEncoding);
195 ASSERT_EQ("BINARY", AttachDataValue);
196 ASSERT_EQ("STUPID=EXAMPLE", AttachDataTokens);
198 // Tests for ATTENDEE. First ATTENDEE property.
200 std::string AttendeeDataMember;
201 std::string AttendeeDataDelegatedFrom;
202 std::string AttendeeDataDelegatedTo;
203 std::string AttendeeDataRole;
204 std::string AttendeeDataRSVP;
205 std::string AttendeeDataDirectoryEntry;
206 std::string AttendeeDataSentBy;
207 std::string AttendeeDataCommonName;
208 std::string AttendeeDataCalendarUserType;
209 std::string AttendeeDataParticipationStatus;
210 std::string AttendeeDataLanguage;
211 std::string AttendeeDataTokens;
212 std::string AttendeeData;
214 if (TestJournal.AttendeeList.begin() != TestJournal.AttendeeList.end()){
216 AttendeeData = TestJournal.AttendeeList[0];
220 ASSERT_EQ("Attendee One", AttendeeData);
222 // Second ATTENDEE property.
224 AttendeeData.clear();
226 if (TestJournal.AttendeeList.size() > 1){
228 AttendeeData = TestJournal.AttendeeList[1];
232 if (TestJournal.AttendeeList.size() > 1){
234 AttendeeDataDelegatedFrom = TestJournal.AttendeeListDelegatedFrom[1];
238 if (TestJournal.AttendeeList.size() > 1){
240 AttendeeDataDelegatedTo = TestJournal.AttendeeListDelegatedTo[1];
244 if (TestJournal.AttendeeList.size() > 1){
246 AttendeeDataRole = TestJournal.AttendeeListRole[1];
250 if (TestJournal.AttendeeList.size() > 1){
252 AttendeeDataRSVP = TestJournal.AttendeeListRSVP[1];
256 ASSERT_EQ("Attendee Two", AttendeeData);
257 ASSERT_EQ("mailto:delegated.from@example.com", AttendeeDataDelegatedFrom);
258 ASSERT_EQ("mailto:delegated.to@example.com", AttendeeDataDelegatedTo);
259 ASSERT_EQ("CHAIR", AttendeeDataRole);
260 ASSERT_EQ("TRUE", AttendeeDataRSVP);
262 // Third ATTENDEE property.
264 AttendeeData.clear();
266 if (TestJournal.AttendeeList.size() > 2){
268 AttendeeData = TestJournal.AttendeeList[2];
272 if (TestJournal.AttendeeList.size() > 2){
274 AttendeeDataDirectoryEntry = TestJournal.AttendeeListDirectoryEntry[2];
278 if (TestJournal.AttendeeList.size() > 2){
280 AttendeeDataSentBy = TestJournal.AttendeeListSentBy[2];
284 if (TestJournal.AttendeeList.size() > 2){
286 AttendeeDataCommonName = TestJournal.AttendeeListCommonName[2];
290 if (TestJournal.AttendeeList.size() > 2){
292 AttendeeDataCalendarUserType = TestJournal.AttendeeListCalendarUserType[2];
296 if (TestJournal.AttendeeList.size() > 2){
298 AttendeeDataParticipationStatus = TestJournal.AttendeeListParticipationStatus[2];
302 if (TestJournal.AttendeeList.size() > 2){
304 AttendeeDataLanguage = TestJournal.AttendeeListLanguage[2];
308 if (TestJournal.AttendeeList.size() > 2){
310 AttendeeDataTokens = TestJournal.AttendeeListTokens[2];
314 ASSERT_EQ("Attendee Three", AttendeeData);
315 ASSERT_EQ("null:nodata", AttendeeDataDirectoryEntry);
316 ASSERT_EQ("mailto:sent.by@example.com", AttendeeDataSentBy);
317 ASSERT_EQ("Attendee The Third", AttendeeDataCommonName);
318 ASSERT_EQ("INDIVIDUAL", AttendeeDataCalendarUserType);
319 ASSERT_EQ("ACCEPTED", AttendeeDataParticipationStatus);
320 ASSERT_EQ("kw", AttendeeDataLanguage);
321 ASSERT_EQ("EXAMPLE=DATA", AttendeeDataTokens);
323 // Get the first CATEGORIES.
325 std::string CategoryData;
327 if (TestJournal.CategoriesList.begin() != TestJournal.CategoriesList.end()){
329 CategoryData = TestJournal.CategoriesList[0];
333 ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", CategoryData);
335 CategoryData.clear();
337 std::string CategoryLanguage;
339 // Get the second CATEGORIES.
341 if (TestJournal.CategoriesList.size() > 1){
343 CategoryData = TestJournal.CategoriesList[1];
347 if (TestJournal.CategoriesList.size() > 1){
349 CategoryLanguage = TestJournal.CategoriesListLanguage[1];
353 ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", CategoryData);
354 ASSERT_EQ("en", CategoryLanguage);
356 CategoryData.clear();
357 CategoryLanguage.clear();
359 // Get the third CATEGORIES.
361 std::string CategoryTokens;
363 if (TestJournal.CategoriesList.size() > 2){
365 CategoryData = TestJournal.CategoriesList[2];
369 if (TestJournal.CategoriesList.size() > 2){
371 CategoryLanguage = TestJournal.CategoriesListLanguage[2];
375 if (TestJournal.CategoriesList.size() > 2){
377 CategoryTokens = TestJournal.CategoriesListTokens[2];
381 ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", CategoryData);
382 ASSERT_EQ("en-GB", CategoryLanguage);
383 ASSERT_EQ("SAMPLE=TOKEN", CategoryTokens);
385 // Get the first COMMENT.
387 std::string CommentData;
389 if (TestJournal.CommentList.begin() != TestJournal.CommentList.end()){
391 CommentData = TestJournal.CommentList[0];
395 ASSERT_EQ("This is the first comment.", CommentData);
397 // Get the second COMMENT.
401 std::string CommentDataAltRep;
402 std::string CommentDataLanguage;
404 if (TestJournal.CommentList.size() > 1){
406 CommentData = TestJournal.CommentList[1];
410 if (TestJournal.CommentList.size() > 1){
412 CommentDataAltRep = TestJournal.CommentListAltRep[1];
416 if (TestJournal.CommentList.size() > 1){
418 CommentDataLanguage = TestJournal.CommentListLanguage[1];
422 ASSERT_EQ("This is the second comment.", CommentData);
423 ASSERT_EQ("null:nodata", CommentDataAltRep);
424 ASSERT_EQ("en", CommentDataLanguage);
426 // Get the third COMMENT.
430 std::string CommentDataTokens;
432 if (TestJournal.CommentList.size() > 2){
434 CommentData = TestJournal.CommentList[2];
438 if (TestJournal.CommentList.size() > 2){
440 CommentDataTokens = TestJournal.CommentListTokens[2];
444 ASSERT_EQ("This is the third comment.", CommentData);
445 ASSERT_EQ("ZEBRAS=YES", CommentDataTokens);
447 // Get the first CONTACT.
449 std::string ContactData;
451 if (TestJournal.ContactList.begin() != TestJournal.ContactList.end()){
453 ContactData = TestJournal.ContactList[0];
457 ASSERT_EQ("First Contact", ContactData);
459 // Get the second CONTACT.
463 std::string ContactDataAltRep;
464 std::string ContactDataLanguage;
466 if (TestJournal.ContactList.size() > 1){
468 ContactData = TestJournal.ContactList[1];
472 if (TestJournal.ContactList.size() > 1){
474 ContactDataAltRep = TestJournal.ContactListAltRep[1];
478 if (TestJournal.ContactList.size() > 1){
480 ContactDataLanguage = TestJournal.ContactListLanguage[1];
484 ASSERT_EQ("Second Contact", ContactData);
485 ASSERT_EQ("null:nodata", ContactDataAltRep);
486 ASSERT_EQ("en-GB", ContactDataLanguage);
488 // Get the third CONTACT.
492 std::string ContactDataTokens;
494 if (TestJournal.ContactList.size() > 2){
496 ContactData = TestJournal.ContactList[2];
500 if (TestJournal.ContactList.size() > 2){
502 ContactDataTokens = TestJournal.ContactListTokens[2];
506 ASSERT_EQ("Third Contact", ContactData);
507 ASSERT_EQ("ZEBRAS=NO", ContactDataTokens);
509 // Get the first DESCRIPTION.
511 std::string DescriptionData;
513 if (TestJournal.DescriptionList.begin() != TestJournal.DescriptionList.end()){
515 DescriptionData = TestJournal.DescriptionList[0];
519 ASSERT_EQ("First Journal Entry Description", DescriptionData);
521 // Get the second DESCRIPTION.
523 DescriptionData.clear();
525 std::string DescriptionAltRep;
526 std::string DescriptionLanguage;
528 if (TestJournal.DescriptionList.size() > 1){
530 DescriptionData = TestJournal.DescriptionList[1];
534 if (TestJournal.DescriptionList.size() > 1){
536 DescriptionAltRep = TestJournal.DescriptionListAltRep[1];
540 if (TestJournal.DescriptionList.size() > 1){
542 DescriptionLanguage = TestJournal.DescriptionListLanguage[1];
546 ASSERT_EQ("This is the second journal description.", DescriptionData);
547 ASSERT_EQ("null:nodata", DescriptionAltRep);
548 ASSERT_EQ("en-GB", DescriptionLanguage);
550 // Get the third DESCRIPTION.
552 DescriptionData.clear();
554 std::string DescriptionDataTokens;
556 if (TestJournal.DescriptionList.size() > 2){
558 DescriptionData = TestJournal.DescriptionList[2];
562 if (TestJournal.DescriptionList.size() > 2){
564 DescriptionDataTokens = TestJournal.DescriptionListTokens[2];
568 ASSERT_EQ("This is the third journal description.", DescriptionData);
569 ASSERT_EQ("ZEBRAS=NO", DescriptionDataTokens);
571 // Get the first EXDATE.
573 std::string ExcludeDate;
575 if (TestJournal.ExcludeDateData.begin() != TestJournal.ExcludeDateData.end()){
577 ExcludeDate = TestJournal.ExcludeDateData[0];
581 ASSERT_EQ("20160125T120000Z", ExcludeDate);
583 // Get the second EXDATE.
587 std::string ExcludeDataTimeZoneParam;
588 std::string ExcludeDataValue;
590 if (TestJournal.ContactList.size() > 1){
592 ExcludeDate = TestJournal.ExcludeDateData[1];
596 if (TestJournal.ContactList.size() > 1){
598 ExcludeDataTimeZoneParam = TestJournal.ExcludeDateDataTimeZoneParam[1];
602 if (TestJournal.ContactList.size() > 1){
604 ExcludeDataValue = TestJournal.ExcludeDateDataValue[1];
608 ASSERT_EQ("20160125T130000Z", ExcludeDate);
609 ASSERT_EQ("DATE-TIME", ExcludeDataValue);
610 ASSERT_EQ("Europe/Truro", ExcludeDataTimeZoneParam);
612 // Get the third EXDATE.
616 std::string ExcludeDataTokens;
618 if (TestJournal.ContactList.size() > 2){
620 ExcludeDate = TestJournal.ExcludeDateData[2];
624 if (TestJournal.ContactList.size() > 2){
626 ExcludeDataTokens = TestJournal.ExcludeDateDataTokens[2];
630 ASSERT_EQ("20160125T133000Z", ExcludeDate);
631 ASSERT_EQ("ZOOP=ZIPPO", ExcludeDataTokens);
633 // Get the first RELATED-TO.
635 std::string RelatedTo;
637 if (TestJournal.RelatedToData.begin() != TestJournal.RelatedToData.end()){
639 RelatedTo = TestJournal.RelatedToData[0];
643 ASSERT_EQ("person.1@example.com", RelatedTo);
645 // Get the second RELATED-TO.
649 std::string RelatedToType;
651 if (TestJournal.RelatedToData.size() > 1){
653 RelatedTo = TestJournal.RelatedToData[1];
657 if (TestJournal.RelatedToData.size() > 1){
659 RelatedToType = TestJournal.RelatedToDataRelationType[1];
663 ASSERT_EQ("person.2@example.com", RelatedTo);
664 ASSERT_EQ("PARENT", RelatedToType);
666 // Get the third RELATED-TO.
670 std::string RelatedToTokens;
672 if (TestJournal.RelatedToData.size() > 2){
674 RelatedTo = TestJournal.RelatedToData[2];
678 if (TestJournal.RelatedToData.size() > 2){
680 RelatedToTokens = TestJournal.RelatedToDataTokens[2];
684 ASSERT_EQ("person.3@example.com", RelatedTo);
685 ASSERT_EQ("SCHOOL=MEETING", RelatedToTokens);
687 // Get the first RDATE.
689 std::string RecurrenceDate;
691 if (TestJournal.RecurranceDateData.begin() != TestJournal.RecurranceDateData.end()){
693 RecurrenceDate = TestJournal.RecurranceDateData[0];
697 ASSERT_EQ("20160120", RecurrenceDate);
699 // Get the second RDATE.
701 RecurrenceDate.clear();
703 std::string RecurrenceDateTimeZoneParam;
704 std::string RecurrenceDateValue;
706 if (TestJournal.RecurranceDateData.size() > 1){
708 RecurrenceDate = TestJournal.RecurranceDateData[1];
712 if (TestJournal.RecurranceDateData.size() > 1){
714 RecurrenceDateTimeZoneParam = TestJournal.RecurranceDateDataTimeZoneParam[1];
718 if (TestJournal.RecurranceDateData.size() > 1){
720 RecurrenceDateValue = TestJournal.RecurranceDateDataValue[1];
724 ASSERT_EQ("20160121", RecurrenceDate);
725 ASSERT_EQ("DATE", RecurrenceDateValue);
726 ASSERT_EQ("Europe/Truro", RecurrenceDateTimeZoneParam);
728 // Get the third RDATE.
730 RecurrenceDate.clear();
732 std::string RecurrenceTokens;
734 if (TestJournal.RecurranceDateData.size() > 2){
736 RecurrenceDate = TestJournal.RecurranceDateData[2];
740 if (TestJournal.RecurranceDateData.size() > 2){
742 RecurrenceTokens = TestJournal.RecurranceDateDataTokens[2];
746 ASSERT_EQ("20160520", RecurrenceDate);
747 ASSERT_EQ("ZILCH=DATA", RecurrenceTokens);
749 // Get the first REQUEST-STATUS.
751 std::string RequestStatus;
753 if (TestJournal.RequestStatusData.begin() != TestJournal.RequestStatusData.end()){
755 RequestStatus = TestJournal.RequestStatusData[0];
759 ASSERT_EQ("2.0;Success", RequestStatus);
761 // Get the second REQUEST-STATUS.
763 RequestStatus.clear();
765 std::string RequestLanguage;
767 if (TestJournal.ContactList.size() > 1){
769 RequestStatus = TestJournal.RequestStatusData[1];
773 if (TestJournal.ContactList.size() > 1){
775 RequestLanguage = TestJournal.RequestStatusLanguage[1];
779 ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", RequestStatus);
780 ASSERT_EQ("en", RequestLanguage);
782 // Get the third REQUEST-STATUS.
784 RequestStatus.clear();
786 std::string RequestTokens;
788 if (TestJournal.ContactList.size() > 2){
790 RequestStatus = TestJournal.RequestStatusData[2];
794 if (TestJournal.ContactList.size() > 2){
796 RequestTokens = TestJournal.RequestStatusTokens[2];
800 ASSERT_EQ("3.7;Invalid calendar user", RequestStatus);
801 ASSERT_EQ("USER=MISSING", RequestTokens);
803 // Get the first X-EXAMPLE1 token.
805 std::string XTokenName;
806 std::string XTokenData;
808 if (TestJournal.XTokensData.size() != 0 ){
810 XTokenData = TestJournal.XTokensData[0];
814 if (TestJournal.XTokensData.size() != 0){
816 XTokenName = TestJournal.XTokensDataTokens[0];
820 ASSERT_EQ("Moo", XTokenData);
821 ASSERT_EQ("X-EXAMPLE1", XTokenName);
823 // Get the second X-EXAMPLE1 token.
828 if (TestJournal.XTokensData.size() > 1){
830 XTokenData = TestJournal.XTokensData[1];
834 if (TestJournal.XTokensData.size() > 1){
836 XTokenName = TestJournal.XTokensDataTokens[1];
840 ASSERT_EQ("Meep", XTokenData);
841 ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", XTokenName);
843 // Get the third X-EXAMPLE1 token.
848 if (TestJournal.XTokensData.size() > 2){
850 XTokenData = TestJournal.XTokensData[2];
854 if (TestJournal.XTokensData.size() > 2){
856 XTokenName = TestJournal.XTokensDataTokens[2];
860 ASSERT_EQ("Meow", XTokenData);
861 ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", XTokenName);
863 // Get the first X-EXAMPLE2 token.
868 if (TestJournal.XTokensData.size() > 3){
870 XTokenData = TestJournal.XTokensData[3];
874 if (TestJournal.XTokensData.size() > 3){
876 XTokenName = TestJournal.XTokensDataTokens[3];
880 ASSERT_EQ("Dish", XTokenData);
881 ASSERT_EQ("X-EXAMPLE2", XTokenName);
883 // Get the second X-EXAMPLE2 token.
888 if (TestJournal.XTokensData.size() > 4){
890 XTokenData = TestJournal.XTokensData[4];
894 if (TestJournal.XTokensData.size() > 4){
896 XTokenName = TestJournal.XTokensDataTokens[4];
900 ASSERT_EQ("Fork", XTokenData);
901 ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", XTokenName);
903 // Get the third X-EXAMPLE2 token.
908 if (TestJournal.XTokensData.size() > 5){
910 XTokenData = TestJournal.XTokensData[5];
914 if (TestJournal.XTokensData.size() > 5){
916 XTokenName = TestJournal.XTokensDataTokens[5];
920 ASSERT_EQ("Table", XTokenData);
921 ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", XTokenName);
923 // Get the X-STATUS token.
928 if (TestJournal.XTokensData.size() > 6){
930 XTokenData = TestJournal.XTokensData[6];
934 if (TestJournal.XTokensData.size() > 6){
936 XTokenName = TestJournal.XTokensDataTokens[6];
940 ASSERT_EQ("Idle", XTokenData);
941 ASSERT_EQ("X-STATUS;HOLIDAY=YES", XTokenName);
943 // Get the X-TRANSPORT token.
948 if (TestJournal.XTokensData.size() > 7){
950 XTokenData = TestJournal.XTokensData[7];
954 if (TestJournal.XTokensData.size() > 7){
956 XTokenName = TestJournal.XTokensDataTokens[7];
960 ASSERT_EQ("Private Hire", XTokenData);
961 ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", XTokenName);
963 // Get the X-PHANTOM-STATUS token.
968 if (TestJournal.XTokensData.size() > 8){
970 XTokenData = TestJournal.XTokensData[8];
974 if (TestJournal.XTokensData.size() > 8){
976 XTokenName = TestJournal.XTokensDataTokens[8];
980 ASSERT_EQ("None", XTokenData);
981 ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", XTokenName);