// xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event 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.
TEST(iCalendarEvent, BasicTests){
- CalendarEventObject TestEvent;
+ CalendarEventObject testEvent;
- ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, TestEvent.LoadFile("iCalendarEvent-Missing.vcf"));
- ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, TestEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
- ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load1.vcf"));
+ ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testEvent.LoadFile("iCalendarEvent-Missing.vcf"));
+ ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
+ ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load1.vcf"));
}
TEST(iCalendarEvent, BaseObjectVerifyTests){
- CalendarEventObject TestEvent;
- TestEvent.LoadFile("iCalendarEvent-Load1.vcf");
- ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject());
+ CalendarEventObject testEvent;
+ testEvent.LoadFile("iCalendarEvent-Load1.vcf");
+ ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
// Tests for METHOD.
- ASSERT_EQ("REQUEST", TestEvent.MethodData);
- ASSERT_EQ("EXAMPLE=DATA", TestEvent.MethodTokens);
+ ASSERT_EQ("REQUEST", testEvent.methodData);
+ ASSERT_EQ("EXAMPLE=DATA", testEvent.methodTokens);
// Tests for CALSCALE.
- ASSERT_EQ("GREGORIAN", TestEvent.CalendarScaleData);
- ASSERT_EQ("MORE=YES", TestEvent.CalendarScaleTokens);
+ ASSERT_EQ("GREGORIAN", testEvent.calendarScaleData);
+ ASSERT_EQ("MORE=YES", testEvent.calendarScaleTokens);
}
TEST(iCalendarEvent, ObjectDataTests){
- CalendarEventObject TestEvent;
- ASSERT_EQ(CALENDAROBJECTLOAD_OK, TestEvent.LoadFile("iCalendarEvent-Load2.vcf"));
- ASSERT_EQ(CALENDAROBJECTVALID_OK, TestEvent.ValidBaseObject());
+ CalendarEventObject testEvent;
+ ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
+ ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
// Tests for DTSTAMP.
- ASSERT_EQ("20160122T124100Z", TestEvent.DateTimeStampData);
- ASSERT_EQ("OTHER=PARAM", TestEvent.DateTimeStampTokens);
+ ASSERT_EQ("20160122T124100Z", testEvent.dateTimeStampData);
+ ASSERT_EQ("OTHER=PARAM", testEvent.dateTimeStampTokens);
// Tests for UID.
- ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", TestEvent.UniqueID);
- ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", TestEvent.UniqueIDTokens);
+ ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", testEvent.uniqueID);
+ ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testEvent.uniqueIDTokens);
// Tests for DTSTART.
- ASSERT_EQ("20160122T183000Z", TestEvent.DateTimeStartData);
- ASSERT_EQ("DATE-TIME", TestEvent.DateTimeStartDataValue);
- ASSERT_EQ("Europe/Truro", TestEvent.DateTimeStartDataTimeZoneID);
- ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", TestEvent.DateTimeStartDataTokens);
+ ASSERT_EQ("20160122T183000Z", testEvent.dateTimeStartData);
+ ASSERT_EQ("DATE-TIME", testEvent.dateTimeStartDataValue);
+ ASSERT_EQ("Europe/Truro", testEvent.dateTimeStartDataTimeZoneID);
+ ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testEvent.dateTimeStartDataTokens);
-}
\ No newline at end of file
+ // Tests for CLASS.
+
+ ASSERT_EQ("PUBLIC", testEvent.classData);
+ ASSERT_EQ("CHOCOLATE=BAR", testEvent.classDataTokens);
+
+ // Tests for CREATED.
+
+ ASSERT_EQ("20160123T081100Z", testEvent.dateTimeCreatedData);
+ ASSERT_EQ("CARAMEL=PLEASE", testEvent.dateTimeCreatedTokens);
+
+ // Tests for DESCRIPTION.
+
+ std::string descriptionData;
+ std::string descriptionAltRep;
+ std::string descriptionLanguage;
+ std::string descriptionTokens;
+
+ if (testEvent.descriptionList.begin() != testEvent.descriptionList.end()){
+ descriptionData = testEvent.descriptionList[0];
+ }
+
+ if (testEvent.descriptionListAltRep.begin() != testEvent.descriptionListAltRep.end()){
+ descriptionAltRep = testEvent.descriptionListAltRep[0];
+ }
+
+ if (testEvent.descriptionListLanguage.begin() != testEvent.descriptionListLanguage.end()){
+ descriptionLanguage = testEvent.descriptionListLanguage[0];
+ }
+
+ if (testEvent.descriptionListTokens.begin() != testEvent.descriptionListTokens.end()){
+ descriptionTokens = testEvent.descriptionListTokens[0];
+ }
+
+ ASSERT_EQ("This is a description of the event.", descriptionData);
+ ASSERT_EQ("null:nodata", descriptionAltRep);
+ ASSERT_EQ("kw", descriptionLanguage);
+ ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", descriptionTokens);
+
+ // Tests for GEO.
+
+ ASSERT_EQ("5.0;5.0", testEvent.geographicData);
+ ASSERT_EQ("EXAMPLE=MEEP", testEvent.geographicTokens);
+
+ // Tests for LAST-MODIFIED.
+
+ ASSERT_EQ("20160124T093000Z", testEvent.lastModifiedData);
+ ASSERT_EQ("FUTURE=ODD", testEvent.lastModifiedTokens);
+
+ // Tests for LOCATION.
+
+ ASSERT_EQ("The Basement, Truro", testEvent.locationData);
+ ASSERT_EQ("null:nodata", testEvent.locationDataAltRep);
+ ASSERT_EQ("kw", testEvent.locationDataLanguage);
+ ASSERT_EQ("EXACT=NO", testEvent.locationDataTokens);
+
+ // Tests for ORGANIZER.
+
+ ASSERT_EQ("mailto:organiser@example.com", testEvent.organiserData);
+ ASSERT_EQ("ExampleOrganiser", testEvent.organiserDataCommonName);
+ ASSERT_EQ("null:nodata", testEvent.organiserDataDirectoryEntry);
+ ASSERT_EQ("mailto:organiser.noreply@example.com", testEvent.organiserDataSentByParam);
+ ASSERT_EQ("kw", testEvent.organiserDataLanguage);
+ ASSERT_EQ("HAPPY=DAYS", testEvent.organiserDataTokens);
+
+ // Tests for PRIORITY.
+
+ ASSERT_EQ(5, testEvent.priorityData);
+ ASSERT_EQ("STATUS=DEFAULT", testEvent.priorityTokens);
+
+ // Tests for SEQUENCE.
+
+ ASSERT_EQ(3, testEvent.sequenceData);
+ ASSERT_EQ("TEST=YAY", testEvent.sequenceTokens);
+
+ // Tests for STATUS.
+
+ ASSERT_EQ("2.0;Success", testEvent.statusData);
+ ASSERT_EQ("kw", testEvent.statusLanguage);
+ ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", testEvent.statusTokens);
+
+ // Tests for SUMMARY.
+
+ ASSERT_EQ("A summary of the event.", testEvent.summaryData);
+ ASSERT_EQ("null:nodata", testEvent.summaryDataAltRep);
+ ASSERT_EQ("kw", testEvent.summaryDataLanguage);
+ ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testEvent.summaryDataTokens);
+
+ // Tests for TRANSP.
+
+ ASSERT_EQ("TRANSPARENT", testEvent.timeTransparencyData);
+ ASSERT_EQ("OPAQUE=NOTYET", testEvent.timeTransparencyDataTokens);
+
+ // Tests for URL.
+
+ ASSERT_EQ("http://www.example.com/", testEvent.urlData);
+ ASSERT_EQ("EXTERNAL=YES", testEvent.urlDataTokens);
+
+ // Tests for RECURRENCE-ID.
+
+ ASSERT_EQ("20160124", testEvent.recurranceIDData);
+ ASSERT_EQ("Europe/Truro", testEvent.recurranceIDDataTimeZoneParam);
+ ASSERT_EQ("THISANDFUTURE", testEvent.recurranceIDDataRangeParam);
+ ASSERT_EQ("DATE", testEvent.recurranceIDDataValue);
+ ASSERT_EQ("EXAMPLE=DATA", testEvent.recurranceIDDataTokens);
+
+ // Tests for RRULE.
+
+ ASSERT_EQ("FREQ=DAILY;COUNT=10", testEvent.recurranceRuleData);
+ ASSERT_EQ("TEST=DATA", testEvent.recurranceRuleDataTokens);
+
+ // Tests for DTEND.
+
+ ASSERT_EQ("20160124T183000Z", testEvent.dateTimeEndData);
+ ASSERT_EQ("DATE-TIME", testEvent.dateTimeEndDataValue);
+ ASSERT_EQ("Europe/Truro", testEvent.dateTimeEndDataTimeZoneID);
+ ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", testEvent.dateTimeEndDataTokens);
+
+ // Tests for DURATION. (Done in another file called
+ // iCalendarEvent-Load3.vcf).
+
+ CalendarEventObject testEvent2;
+ ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent2.LoadFile("iCalendarEvent-Load3.vcf"));
+ ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent2.ValidBaseObject());
+
+ ASSERT_EQ("PT1H", testEvent2.durationData);
+ ASSERT_EQ("TEST=EXAMPLE", testEvent2.durationDataTokens);
+
+ // Tests for ATTACH. First ATTACH property.
+
+ std::string attachData;
+ std::string attachDataFormatType;
+ std::string attachDataValue;
+ std::string attachDataEncoding;
+ std::string attachDataTokens;
+
+ if (testEvent.attachList.begin() != testEvent.attachList.end()){
+
+ attachData = testEvent.attachList[0];
+
+ }
+
+ if (testEvent.attachListFormatType.begin() != testEvent.attachListFormatType.end()){
+
+ attachDataFormatType = testEvent.attachListFormatType[0];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Second ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+
+ if (testEvent.attachList.size() > 1){
+
+ attachData = testEvent.attachList[1];
+
+ }
+
+ if (testEvent.attachListFormatType.size() > 1){
+
+ attachDataFormatType = testEvent.attachListFormatType[1];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/page2.html", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Third ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+ attachDataTokens.clear();
+
+ if (testEvent.attachList.size() > 2){
+
+ attachData = testEvent.attachList[2];
+
+ }
+
+ if (testEvent.attachListFormatType.size() > 2){
+
+ attachDataFormatType = testEvent.attachListFormatType[2];
+
+ }
+
+ if (testEvent.attachListValue.size() > 2){
+
+ attachDataValue = testEvent.attachListValue[2];
+
+ }
+
+ if (testEvent.attachListFormatType.size() > 2){
+
+ attachDataEncoding = testEvent.attachListEncoding[2];
+
+ }
+
+ if (testEvent.attachListTokens.size() > 2){
+
+ attachDataTokens = testEvent.attachListTokens[2];
+
+ }
+
+ ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
+ ASSERT_EQ("text/plain", attachDataFormatType);
+ ASSERT_EQ("BASE64", attachDataEncoding);
+ ASSERT_EQ("BINARY", attachDataValue);
+ ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
+
+ // Tests for ATTENDEE. First ATTENDEE property.
+
+ std::string attendeeDataMember;
+ std::string attendeeDataDelegatedFrom;
+ std::string attendeeDataDelegatedTo;
+ std::string attendeeDataRole;
+ std::string attendeeDataRSVP;
+ std::string attendeeDataDirectoryEntry;
+ std::string attendeeDataSentBy;
+ std::string attendeeDataCommonName;
+ std::string attendeeDataCalendarUserType;
+ std::string attendeeDataParticipationStatus;
+ std::string attendeeDataLanguage;
+ std::string attendeeDataTokens;
+ std::string attendeeData;
+
+ if (testEvent.attendeeList.begin() != testEvent.attendeeList.end()){
+
+ attendeeData = testEvent.attendeeList[0];
+
+ }
+
+ ASSERT_EQ("Attendee One", attendeeData);
+
+ // Second ATTENDEE property.
+
+ attendeeData.clear();
+
+ if (testEvent.attendeeList.size() > 1){
+
+ attendeeData = testEvent.attendeeList[1];
+
+ }
+
+ if (testEvent.attendeeList.size() > 1){
+
+ attendeeDataDelegatedFrom = testEvent.attendeeListDelegatedFrom[1];
+
+ }
+
+ if (testEvent.attendeeList.size() > 1){
+
+ attendeeDataDelegatedTo = testEvent.attendeeListDelegatedTo[1];
+
+ }
+
+ if (testEvent.attendeeList.size() > 1){
+
+ attendeeDataRole = testEvent.attendeeListRole[1];
+
+ }
+
+ if (testEvent.attendeeList.size() > 1){
+
+ attendeeDataRSVP = testEvent.attendeeListRSVP[1];
+
+ }
+
+ ASSERT_EQ("Attendee Two", attendeeData);
+ ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
+ ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
+ ASSERT_EQ("CHAIR", attendeeDataRole);
+ ASSERT_EQ("TRUE", attendeeDataRSVP);
+
+ // Third ATTENDEE property.
+
+ attendeeData.clear();
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeData = testEvent.attendeeList[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataDirectoryEntry = testEvent.attendeeListDirectoryEntry[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataSentBy = testEvent.attendeeListSentBy[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataCommonName = testEvent.attendeeListCommonName[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataCalendarUserType = testEvent.attendeeListCalendarUserType[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataParticipationStatus = testEvent.attendeeListParticipationStatus[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataLanguage = testEvent.attendeeListLanguage[2];
+
+ }
+
+ if (testEvent.attendeeList.size() > 2){
+
+ attendeeDataTokens = testEvent.attendeeListTokens[2];
+
+ }
+
+ ASSERT_EQ("Attendee Three", attendeeData);
+ ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
+ ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
+ ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
+ ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
+ ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
+ ASSERT_EQ("kw", attendeeDataLanguage);
+ ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
+
+ // Get the first CATEGORIES.
+
+ std::string categoryData;
+
+ if (testEvent.categoriesList.begin() != testEvent.categoriesList.end()){
+
+ categoryData = testEvent.categoriesList[0];
+
+ }
+
+ ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
+
+ categoryData.clear();
+
+ std::string categoryLanguage;
+
+ // Get the second CATEGORIES.
+
+ if (testEvent.categoriesList.size() > 1){
+
+ categoryData = testEvent.categoriesList[1];
+
+ }
+
+ if (testEvent.categoriesList.size() > 1){
+
+ categoryLanguage = testEvent.categoriesListLanguage[1];
+
+ }
+
+ ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
+ ASSERT_EQ("en", categoryLanguage);
+
+ categoryData.clear();
+ categoryLanguage.clear();
+
+ // Get the third CATEGORIES.
+
+ std::string categoryTokens;
+
+ if (testEvent.categoriesList.size() > 2){
+
+ categoryData = testEvent.categoriesList[2];
+
+ }
+
+ if (testEvent.categoriesList.size() > 2){
+
+ categoryLanguage = testEvent.categoriesListLanguage[2];
+
+ }
+
+ if (testEvent.categoriesList.size() > 2){
+
+ categoryTokens = testEvent.categoriesListTokens[2];
+
+ }
+
+ ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
+ ASSERT_EQ("en-GB", categoryLanguage);
+ ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
+
+ // Get the first COMMENT.
+
+ std::string commentData;
+
+ if (testEvent.commentList.begin() != testEvent.commentList.end()){
+
+ commentData = testEvent.commentList[0];
+
+ }
+
+ ASSERT_EQ("This is the first comment.", commentData);
+
+ // Get the second COMMENT.
+
+ commentData.clear();
+
+ std::string commentDataAltRep;
+ std::string commentDataLanguage;
+
+ if (testEvent.commentList.size() > 1){
+
+ commentData = testEvent.commentList[1];
+
+ }
+
+ if (testEvent.commentList.size() > 1){
+
+ commentDataAltRep = testEvent.commentListAltRep[1];
+
+ }
+
+ if (testEvent.commentList.size() > 1){
+
+ commentDataLanguage = testEvent.commentListLanguage[1];
+
+ }
+
+ ASSERT_EQ("This is the second comment.", commentData);
+ ASSERT_EQ("null:nodata", commentDataAltRep);
+ ASSERT_EQ("en", commentDataLanguage);
+
+ // Get the third COMMENT.
+
+ commentData.clear();
+
+ std::string commentDataTokens;
+
+ if (testEvent.commentList.size() > 2){
+
+ commentData = testEvent.commentList[2];
+
+ }
+
+ if (testEvent.commentList.size() > 2){
+
+ commentDataTokens = testEvent.commentListTokens[2];
+
+ }
+
+ ASSERT_EQ("This is the third comment.", commentData);
+ ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
+
+ // Get the first CONTACT.
+
+ std::string contactData;
+
+ if (testEvent.contactList.begin() != testEvent.contactList.end()){
+
+ contactData = testEvent.contactList[0];
+
+ }
+
+ ASSERT_EQ("First Contact", contactData);
+
+ // Get the second CONTACT.
+
+ contactData.clear();
+
+ std::string contactDataAltRep;
+ std::string contactDataLanguage;
+
+ if (testEvent.contactList.size() > 1){
+
+ contactData = testEvent.contactList[1];
+
+ }
+
+ if (testEvent.contactList.size() > 1){
+
+ contactDataAltRep = testEvent.contactListAltRep[1];
+
+ }
+
+ if (testEvent.contactList.size() > 1){
+
+ contactDataLanguage = testEvent.contactListLanguage[1];
+
+ }
+
+ ASSERT_EQ("Second Contact", contactData);
+ ASSERT_EQ("null:nodata", contactDataAltRep);
+ ASSERT_EQ("en-GB", contactDataLanguage);
+
+ // Get the third CONTACT.
+
+ contactData.clear();
+
+ std::string contactDataTokens;
+
+ if (testEvent.contactList.size() > 2){
+
+ contactData = testEvent.contactList[2];
+
+ }
+
+ if (testEvent.contactList.size() > 2){
+
+ contactDataTokens = testEvent.contactListTokens[2];
+
+ }
+
+ ASSERT_EQ("Third Contact", contactData);
+ ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
+
+ // Get the first EXDATE.
+
+ std::string excludeDate;
+
+ if (testEvent.excludeDateData.begin() != testEvent.excludeDateData.end()){
+
+ excludeDate = testEvent.excludeDateData[0];
+
+ }
+
+ ASSERT_EQ("20160125T120000Z", excludeDate);
+
+ // Get the second EXDATE.
+
+ excludeDate.clear();
+
+ std::string excludeDataTimeZoneParam;
+ std::string excludeDataValue;
+
+ if (testEvent.contactList.size() > 1){
+
+ excludeDate = testEvent.excludeDateData[1];
+
+ }
+
+ if (testEvent.contactList.size() > 1){
+
+ excludeDataTimeZoneParam = testEvent.excludeDateDataTimeZoneParam[1];
+
+ }
+
+ if (testEvent.contactList.size() > 1){
+
+ excludeDataValue = testEvent.excludeDateDataValue[1];
+
+ }
+
+ ASSERT_EQ("20160125T130000Z", excludeDate);
+ ASSERT_EQ("DATE-TIME", excludeDataValue);
+ ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
+
+ // Get the third EXDATE.
+
+ excludeDate.clear();
+
+ std::string excludeDataTokens;
+
+ if (testEvent.contactList.size() > 2){
+
+ excludeDate = testEvent.excludeDateData[2];
+
+ }
+
+ if (testEvent.contactList.size() > 2){
+
+ excludeDataTokens = testEvent.excludeDateDataTokens[2];
+
+ }
+
+ ASSERT_EQ("20160125T133000Z", excludeDate);
+ ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
+
+ // Get the first REQUEST-STATUS.
+
+ std::string requestStatus;
+
+ if (testEvent.requestStatusData.begin() != testEvent.requestStatusData.end()){
+
+ requestStatus = testEvent.requestStatusData[0];
+
+ }
+
+ ASSERT_EQ("2.0;Success", requestStatus);
+
+ // Get the second REQUEST-STATUS.
+
+ requestStatus.clear();
+
+ std::string requestLanguage;
+
+ if (testEvent.requestStatusData.size() > 1){
+
+ requestStatus = testEvent.requestStatusData[1];
+
+ }
+
+ if (testEvent.requestStatusData.size() > 1){
+
+ requestLanguage = testEvent.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 (testEvent.requestStatusData.size() > 2){
+
+ requestStatus = testEvent.requestStatusData[2];
+
+ }
+
+ if (testEvent.requestStatusData.size() > 2){
+
+ requestTokens = testEvent.requestStatusTokens[2];
+
+ }
+
+ ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
+ ASSERT_EQ("USER=MISSING", requestTokens);
+
+ // Get the first RELATED-TO.
+
+ std::string relatedTo;
+
+ if (testEvent.relatedToData.begin() != testEvent.relatedToData.end()){
+
+ relatedTo = testEvent.relatedToData[0];
+
+ }
+
+ ASSERT_EQ("person.1@example.com", relatedTo);
+
+ // Get the second RELATED-TO.
+
+ relatedTo.clear();
+
+ std::string relatedToType;
+
+ if (testEvent.relatedToData.size() > 1){
+
+ relatedTo = testEvent.relatedToData[1];
+
+ }
+
+ if (testEvent.relatedToData.size() > 1){
+
+ relatedToType = testEvent.relatedToDataRelationType[1];
+
+ }
+
+ ASSERT_EQ("person.2@example.com", relatedTo);
+ ASSERT_EQ("PARENT", relatedToType);
+
+ // Get the third RELATED-TO.
+
+ relatedTo.clear();
+
+ std::string relatedToTokens;
+
+ if (testEvent.relatedToData.size() > 2){
+
+ relatedTo = testEvent.relatedToData[2];
+
+ }
+
+ if (testEvent.relatedToData.size() > 2){
+
+ relatedToTokens = testEvent.relatedToDataTokens[2];
+
+ }
+
+ ASSERT_EQ("person.3@example.com", relatedTo);
+ ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
+
+ // Get the first RESOURCES.
+
+ std::string resources;
+
+ if (testEvent.resourcesData.begin() != testEvent.resourcesData.end()){
+
+ resources = testEvent.resourcesData[0];
+
+ }
+
+ ASSERT_EQ("DMAC RECEIVER", resources);
+
+ // Get the second RESOURCES.
+
+ resources.clear();
+
+ std::string resourcesLanguage;
+
+ if (testEvent.resourcesData.size() > 1){
+
+ resources = testEvent.resourcesData[1];
+
+ }
+
+ if (testEvent.resourcesData.size() > 1){
+
+ resourcesLanguage = testEvent.resourcesDataLanguage[1];
+
+ }
+
+ ASSERT_EQ("PAL-I TELEVISION SET", resources);
+ ASSERT_EQ("en", resourcesLanguage);
+
+ // Get the third RESOURCES.
+
+ resources.clear();
+
+ std::string resourcesAltRep;
+ std::string resourcesTokens;
+
+ if (testEvent.resourcesData.size() > 2){
+
+ resources = testEvent.resourcesData[2];
+
+ }
+
+ if (testEvent.resourcesData.size() > 2){
+
+ resourcesAltRep = testEvent.resourcesDataAltRep[2];
+
+ }
+
+ if (testEvent.resourcesData.size() > 2){
+
+ resourcesTokens = testEvent.resourcesDataTokens[2];
+
+ }
+
+ ASSERT_EQ("PAL/SECAM VCR", resources);
+ ASSERT_EQ("null:nodata", resourcesAltRep);
+ ASSERT_EQ("STATUS=BROKEN", resourcesTokens);
+
+ // Get the first RDATE.
+
+ std::string recurrenceDate;
+
+ if (testEvent.recurranceDateData.begin() != testEvent.recurranceDateData.end()){
+
+ recurrenceDate = testEvent.recurranceDateData[0];
+
+ }
+
+ ASSERT_EQ("20160120", recurrenceDate);
+
+ // Get the second RDATE.
+
+ recurrenceDate.clear();
+
+ std::string recurrenceDateTimeZoneParam;
+ std::string recurrenceDateValue;
+
+ if (testEvent.recurranceDateData.size() > 1){
+
+ recurrenceDate = testEvent.recurranceDateData[1];
+
+ }
+
+ if (testEvent.recurranceDateData.size() > 1){
+
+ recurrenceDateTimeZoneParam = testEvent.recurranceDateDataTimeZoneParam[1];
+
+ }
+
+ if (testEvent.recurranceDateData.size() > 1){
+
+ recurrenceDateValue = testEvent.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 (testEvent.recurranceDateData.size() > 2){
+
+ recurrenceDate = testEvent.recurranceDateData[2];
+
+ }
+
+ if (testEvent.recurranceDateData.size() > 2){
+
+ recurrenceTokens = testEvent.recurranceDateDataTokens[2];
+
+ }
+
+ ASSERT_EQ("20160520", recurrenceDate);
+ ASSERT_EQ("ZILCH=DATA", recurrenceTokens);
+
+ // Get the first X-EXAMPLE1 token.
+
+ std::string xTokenName;
+ std::string xTokenData;
+
+ if (testEvent.xTokensData.size() != 0 ){
+
+ xTokenData = testEvent.xTokensData[0];
+
+ }
+
+ if (testEvent.xTokensData.size() != 0){
+
+ xTokenName = testEvent.xTokensDataTokens[0];
+
+ }
+
+ ASSERT_EQ("Moo", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1", xTokenName);
+
+ // Get the second X-EXAMPLE1 token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 1){
+
+ xTokenData = testEvent.xTokensData[1];
+
+ }
+
+ if (testEvent.xTokensData.size() > 1){
+
+ xTokenName = testEvent.xTokensDataTokens[1];
+
+ }
+
+ ASSERT_EQ("Meep", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
+
+ // Get the third X-EXAMPLE1 token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 2){
+
+ xTokenData = testEvent.xTokensData[2];
+
+ }
+
+ if (testEvent.xTokensData.size() > 2){
+
+ xTokenName = testEvent.xTokensDataTokens[2];
+
+ }
+
+ ASSERT_EQ("Meow", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
+
+ // Get the first X-EXAMPLE2 token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 3){
+
+ xTokenData = testEvent.xTokensData[3];
+
+ }
+
+ if (testEvent.xTokensData.size() > 3){
+
+ xTokenName = testEvent.xTokensDataTokens[3];
+
+ }
+
+ ASSERT_EQ("Dish", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2", xTokenName);
+
+ // Get the second X-EXAMPLE2 token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 4){
+
+ xTokenData = testEvent.xTokensData[4];
+
+ }
+
+ if (testEvent.xTokensData.size() > 4){
+
+ xTokenName = testEvent.xTokensDataTokens[4];
+
+ }
+
+ ASSERT_EQ("Fork", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
+
+ // Get the third X-EXAMPLE2 token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 5){
+
+ xTokenData = testEvent.xTokensData[5];
+
+ }
+
+ if (testEvent.xTokensData.size() > 5){
+
+ xTokenName = testEvent.xTokensDataTokens[5];
+
+ }
+
+ ASSERT_EQ("Table", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
+
+ // Get the X-STATUS token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 6){
+
+ xTokenData = testEvent.xTokensData[6];
+
+ }
+
+ if (testEvent.xTokensData.size() > 6){
+
+ xTokenName = testEvent.xTokensDataTokens[6];
+
+ }
+
+ ASSERT_EQ("Idle", xTokenData);
+ ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
+
+ // Get the X-TRANSPORT token.
+
+ xTokenName.clear();
+ xTokenData.clear();
+
+ if (testEvent.xTokensData.size() > 7){
+
+ xTokenData = testEvent.xTokensData[7];
+
+ }
+
+ if (testEvent.xTokensData.size() > 7){
+
+ xTokenName = testEvent.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 (testEvent.xTokensData.size() > 8){
+
+ xTokenData = testEvent.xTokensData[8];
+
+ }
+
+ if (testEvent.xTokensData.size() > 8){
+
+ xTokenName = testEvent.xTokensDataTokens[8];
+
+ }
+
+ ASSERT_EQ("None", xTokenData);
+ ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
+
+}
+
+TEST(iCalendarEvent, AlarmTests){
+
+ CalendarEventObject testEvent;
+ ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
+ ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
+
+ // Tests for the first VALARM property.
+
+ std::string actionData;
+ std::string actionDataTokens;
+
+ std::string triggerData;
+ std::string triggerRelated;
+ std::string triggerValue;
+ std::string triggerTokens;
+
+ std::string durationData;
+ std::string durationTokens;
+
+ std::string repeatData;
+ std::string repeatTokens;
+
+ std::string xTokenData;
+ std::string xTokenName;
+
+ if (testEvent.calendarAlarmData.size() > 0){
+
+ actionData = testEvent.calendarAlarmData[0].alarmAction;
+ actionDataTokens = testEvent.calendarAlarmData[0].alarmActionTokens;
+
+ triggerData = testEvent.calendarAlarmData[0].triggerData;
+ triggerRelated = testEvent.calendarAlarmData[0].triggerRelated;
+ triggerValue = testEvent.calendarAlarmData[0].triggerValue;
+ triggerTokens = testEvent.calendarAlarmData[0].triggerTokens;
+
+ durationData = testEvent.calendarAlarmData[0].durationData;
+ durationTokens = testEvent.calendarAlarmData[0].durationTokens;
+
+ repeatData = testEvent.calendarAlarmData[0].repeatData;
+ repeatTokens = testEvent.calendarAlarmData[0].repeatTokens;
+
+ }
+
+ ASSERT_EQ("AUDIO", actionData);
+ ASSERT_EQ("FUNKY=SOUNDS", actionDataTokens);
+
+ ASSERT_EQ("20160220T160000Z", triggerData);
+ ASSERT_EQ("END", triggerRelated);
+ ASSERT_EQ("DATE-TIME", triggerValue);
+ ASSERT_EQ("PUSH=BUTTON", triggerTokens);
+
+ ASSERT_EQ("PT5H", durationData);
+ ASSERT_EQ("FLYING=NO", durationTokens);
+
+ ASSERT_EQ("PT5M", repeatData);
+ ASSERT_EQ("NEVER=SLEEP", repeatTokens);
+
+ // Tests for ATTACH. First ATTACH property.
+
+ std::string attachData;
+ std::string attachDataFormatType;
+ std::string attachDataValue;
+ std::string attachDataEncoding;
+ std::string attachDataTokens;
+
+ if (testEvent.calendarAlarmData[0].attachList.begin() != testEvent.calendarAlarmData[0].attachList.end()){
+
+ attachData = testEvent.attachList[0];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListFormatType.begin() != testEvent.calendarAlarmData[0].attachListFormatType.end()){
+
+ attachDataFormatType = testEvent.attachListFormatType[0];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Second ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+
+ if (testEvent.calendarAlarmData[0].attachList.size() > 1){
+
+ attachData = testEvent.calendarAlarmData[0].attachList[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 1){
+
+ attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[1];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/page2.html", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Third ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+ attachDataTokens.clear();
+
+ if (testEvent.calendarAlarmData[0].attachList.size() > 2){
+
+ attachData = testEvent.calendarAlarmData[0].attachList[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
+
+ attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListValue.size() > 2){
+
+ attachDataValue = testEvent.calendarAlarmData[0].attachListValue[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
+
+ attachDataEncoding = testEvent.calendarAlarmData[0].attachListEncoding[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[0].attachListTokens.size() > 2){
+
+ attachDataTokens = testEvent.calendarAlarmData[0].attachListTokens[2];
+
+ }
+
+ ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
+ ASSERT_EQ("text/plain", attachDataFormatType);
+ ASSERT_EQ("BASE64", attachDataEncoding);
+ ASSERT_EQ("BINARY", attachDataValue);
+ ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
+
+ // Test the first X-Token.
+
+ if (testEvent.calendarAlarmData[0].xTokensData.size() > 0){
+
+ xTokenData = testEvent.calendarAlarmData[0].xTokensData[0];
+ xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[0];
+
+ }
+
+ ASSERT_EQ("Example Data 1", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
+
+ // Test the second X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[0].xTokensData.size() > 1){
+
+ xTokenData = testEvent.calendarAlarmData[0].xTokensData[1];
+ xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[1];
+
+ }
+
+ ASSERT_EQ("Example Data 2", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
+
+ // Test the third X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[0].xTokensData.size() > 2){
+
+ xTokenData = testEvent.calendarAlarmData[0].xTokensData[2];
+ xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[2];
+
+ }
+
+ ASSERT_EQ("Example Data 3", xTokenData);
+ ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
+
+ // Tests for the second VALARM property.
+
+ actionData.clear();
+ actionDataTokens.clear();
+
+ triggerData.clear();
+ triggerRelated.clear();
+ triggerValue.clear();
+ triggerTokens.clear();
+
+ durationData.clear();
+ durationTokens.clear();
+
+ repeatData.clear();
+ repeatTokens.clear();
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ string descriptionData;
+ string descriptionAltRep;
+ string descriptionLanguage;
+ string descriptionTokens;
+
+ if (testEvent.calendarAlarmData.size() > 1){
+
+ actionData = testEvent.calendarAlarmData[1].alarmAction;
+ actionDataTokens = testEvent.calendarAlarmData[1].alarmActionTokens;
+
+ triggerData = testEvent.calendarAlarmData[1].triggerData;
+ triggerRelated = testEvent.calendarAlarmData[1].triggerRelated;
+ triggerValue = testEvent.calendarAlarmData[1].triggerValue;
+ triggerTokens = testEvent.calendarAlarmData[1].triggerTokens;
+
+ durationData = testEvent.calendarAlarmData[1].durationData;
+ durationTokens = testEvent.calendarAlarmData[1].durationTokens;
+
+ repeatData = testEvent.calendarAlarmData[1].repeatData;
+ repeatTokens = testEvent.calendarAlarmData[1].repeatTokens;
+
+ descriptionData = testEvent.calendarAlarmData[1].descriptionData;
+ descriptionAltRep = testEvent.calendarAlarmData[1].descriptionAltRep;
+ descriptionLanguage = testEvent.calendarAlarmData[1].descriptionLanguage;
+ descriptionTokens = testEvent.calendarAlarmData[1].descriptionTokens;
+
+ }
+
+ ASSERT_EQ("DISPLAY", actionData);
+ ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
+
+ ASSERT_EQ("20160230T110000Z", triggerData);
+ ASSERT_EQ("END", triggerRelated);
+ ASSERT_EQ("DATE-TIME", triggerValue);
+ ASSERT_EQ("PUSH=BUTTON", triggerTokens);
+
+ ASSERT_EQ("PT7H", durationData);
+ ASSERT_EQ("FLYING=YES", durationTokens);
+
+ ASSERT_EQ("PT3M", repeatData);
+ ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
+
+ ASSERT_EQ("This is the second alarm.", descriptionData);
+ ASSERT_EQ("null:nodata", descriptionAltRep);
+ ASSERT_EQ("kw", descriptionLanguage);
+ ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
+
+ // Test the first X-Token.
+
+ if (testEvent.calendarAlarmData[1].xTokensData.size() > 0){
+
+ xTokenData = testEvent.calendarAlarmData[1].xTokensData[0];
+ xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[0];
+
+ }
+
+ ASSERT_EQ("Example Data 1", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
+
+ // Test the second X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[1].xTokensData.size() > 1){
+
+ xTokenData = testEvent.calendarAlarmData[1].xTokensData[1];
+ xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[1];
+
+ }
+
+ ASSERT_EQ("Example Data 2", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
+
+ // Test the third X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[1].xTokensData.size() > 2){
+
+ xTokenData = testEvent.calendarAlarmData[1].xTokensData[2];
+ xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[2];
+
+ }
+
+ ASSERT_EQ("Example Data 3", xTokenData);
+ ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
+
+ // Tests for the third VALARM property.
+
+ actionData.clear();
+ actionDataTokens.clear();
+
+ triggerData.clear();
+ triggerRelated.clear();
+ triggerValue.clear();
+ triggerTokens.clear();
+
+ durationData.clear();
+ durationTokens.clear();
+
+ repeatData.clear();
+ repeatTokens.clear();
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ descriptionData.clear();
+ descriptionAltRep.clear();
+ descriptionLanguage.clear();
+ descriptionTokens.clear();
+
+ string summaryData;
+ string summaryAltRep;
+ string summaryLanguage;
+ string summaryTokens;
+
+ string attendeeDataMember;
+ string attendeeDataDelegatedFrom;
+ string attendeeDataDelegatedTo;
+ string attendeeDataRole;
+ string attendeeDataRSVP;
+ string attendeeDataDirectoryEntry;
+ string attendeeDataSentBy;
+ string attendeeDataCommonName;
+ string attendeeDataCalendarUserType;
+ string attendeeDataParticipationStatus;
+ string attendeeDataLanguage;
+ string attendeeDataTokens;
+ string attendeeData;
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+ attachDataTokens.clear();
+
+ if (testEvent.calendarAlarmData.size() > 2){
+
+ actionData = testEvent.calendarAlarmData[2].alarmAction;
+ actionDataTokens = testEvent.calendarAlarmData[2].alarmActionTokens;
+
+ triggerData = testEvent.calendarAlarmData[2].triggerData;
+ triggerRelated = testEvent.calendarAlarmData[2].triggerRelated;
+ triggerValue = testEvent.calendarAlarmData[2].triggerValue;
+ triggerTokens = testEvent.calendarAlarmData[2].triggerTokens;
+
+ durationData = testEvent.calendarAlarmData[2].durationData;
+ durationTokens = testEvent.calendarAlarmData[2].durationTokens;
+
+ repeatData = testEvent.calendarAlarmData[2].repeatData;
+ repeatTokens = testEvent.calendarAlarmData[2].repeatTokens;
+
+ descriptionData = testEvent.calendarAlarmData[2].descriptionData;
+ descriptionAltRep = testEvent.calendarAlarmData[2].descriptionAltRep;
+ descriptionLanguage = testEvent.calendarAlarmData[2].descriptionLanguage;
+ descriptionTokens = testEvent.calendarAlarmData[2].descriptionTokens;
+
+ summaryData = testEvent.calendarAlarmData[2].summaryData;
+ summaryAltRep = testEvent.calendarAlarmData[2].summaryAltRep;
+ summaryLanguage = testEvent.calendarAlarmData[2].summaryLanguage;
+ summaryTokens = testEvent.calendarAlarmData[2].summaryTokens;
+
+ }
+
+ ASSERT_EQ("EMAIL", actionData);
+ ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
+
+ ASSERT_EQ("20160230T120000Z", triggerData);
+ ASSERT_EQ("END", triggerRelated);
+ ASSERT_EQ("DATE-TIME", triggerValue);
+ ASSERT_EQ("PUSH=BUTTON", triggerTokens);
+
+ ASSERT_EQ("PT7H", durationData);
+ ASSERT_EQ("FLYING=YES", durationTokens);
+
+ ASSERT_EQ("PT3M", repeatData);
+ ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
+
+ ASSERT_EQ("This is the third alarm.", descriptionData);
+ ASSERT_EQ("null:nodata", descriptionAltRep);
+ ASSERT_EQ("kw", descriptionLanguage);
+ ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
+
+ ASSERT_EQ("This is the summary of the third alarm.", summaryData);
+ ASSERT_EQ("null:nodata", summaryAltRep);
+ ASSERT_EQ("en", summaryLanguage);
+ ASSERT_EQ("MEEP=MOOP", summaryTokens);
+
+ // Tests for ATTENDEE. First ATTENDEE property.
+
+ if (testEvent.calendarAlarmData[2].attendeeList.begin() != testEvent.calendarAlarmData[2].attendeeList.end()){
+
+ attendeeData = testEvent.calendarAlarmData[2].attendeeList[0];
+
+ }
+
+ ASSERT_EQ("Attendee One", attendeeData);
+
+ // Second ATTENDEE property.
+
+ attendeeData.clear();
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
+
+ attendeeData = testEvent.calendarAlarmData[2].attendeeList[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
+
+ attendeeDataDelegatedFrom = testEvent.calendarAlarmData[2].attendeeListDelegatedFrom[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
+
+ attendeeDataDelegatedTo = testEvent.calendarAlarmData[2].attendeeListDelegatedTo[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
+
+ attendeeDataRole = testEvent.calendarAlarmData[2].attendeeListRole[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
+
+ attendeeDataRSVP = testEvent.calendarAlarmData[2].attendeeListRSVP[1];
+
+ }
+
+ ASSERT_EQ("Attendee Two", attendeeData);
+ ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
+ ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
+ ASSERT_EQ("CHAIR", attendeeDataRole);
+ ASSERT_EQ("TRUE", attendeeDataRSVP);
+
+ // Third ATTENDEE property.
+
+ attendeeData.clear();
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeData = testEvent.calendarAlarmData[2].attendeeList[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataDirectoryEntry = testEvent.calendarAlarmData[2].attendeeListDirectoryEntry[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataSentBy = testEvent.calendarAlarmData[2].attendeeListSentBy[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataCommonName = testEvent.calendarAlarmData[2].attendeeListCommonName[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataCalendarUserType = testEvent.calendarAlarmData[2].attendeeListCalendarUserType[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataParticipationStatus = testEvent.calendarAlarmData[2].attendeeListParticipationStatus[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataLanguage = testEvent.calendarAlarmData[2].attendeeListLanguage[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
+
+ attendeeDataTokens = testEvent.calendarAlarmData[2].attendeeListTokens[2];
+
+ }
+
+ ASSERT_EQ("Attendee Three", attendeeData);
+ ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
+ ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
+ ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
+ ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
+ ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
+ ASSERT_EQ("kw", attendeeDataLanguage);
+ ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
+
+ // Tests for ATTACH. First ATTACH property.
+
+ if (testEvent.calendarAlarmData[2].attachList.begin() != testEvent.calendarAlarmData[2].attachList.end()){
+
+ attachData = testEvent.calendarAlarmData[2].attachList[0];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListFormatType.begin() != testEvent.calendarAlarmData[2].attachListFormatType.end()){
+
+ attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[0];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Second ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+
+ if (testEvent.calendarAlarmData[2].attachList.size() > 1){
+
+ attachData = testEvent.calendarAlarmData[2].attachList[1];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 1){
+
+ attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[1];
+
+ }
+
+ ASSERT_EQ("http://www.example.com/page2.html", attachData);
+ ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
+
+ // Third ATTACH property.
+
+ attachData.clear();
+ attachDataFormatType.clear();
+ attachDataValue.clear();
+ attachDataEncoding.clear();
+ attachDataTokens.clear();
+
+ if (testEvent.calendarAlarmData[2].attachList.size() > 2){
+
+ attachData = testEvent.calendarAlarmData[2].attachList[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
+
+ attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListValue.size() > 2){
+
+ attachDataValue = testEvent.calendarAlarmData[2].attachListValue[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
+
+ attachDataEncoding = testEvent.calendarAlarmData[2].attachListEncoding[2];
+
+ }
+
+ if (testEvent.calendarAlarmData[2].attachListTokens.size() > 2){
+
+ attachDataTokens = testEvent.calendarAlarmData[2].attachListTokens[2];
+
+ }
+
+ ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
+ ASSERT_EQ("text/plain", attachDataFormatType);
+ ASSERT_EQ("BASE64", attachDataEncoding);
+ ASSERT_EQ("BINARY", attachDataValue);
+ ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
+
+ // Test the first X-Token.
+
+ if (testEvent.calendarAlarmData[2].xTokensData.size() > 0){
+
+ xTokenData = testEvent.calendarAlarmData[2].xTokensData[0];
+ xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[0];
+
+ }
+
+ ASSERT_EQ("Example Data 1", xTokenData);
+ ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
+
+ // Test the second X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[2].xTokensData.size() > 1){
+
+ xTokenData = testEvent.calendarAlarmData[2].xTokensData[1];
+ xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[1];
+
+ }
+
+ ASSERT_EQ("Example Data 2", xTokenData);
+ ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
+
+ // Test the third X-Token.
+
+ xTokenData.clear();
+ xTokenName.clear();
+
+ if (testEvent.calendarAlarmData[2].xTokensData.size() > 2){
+
+ xTokenData = testEvent.calendarAlarmData[2].xTokensData[2];
+ xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[2];
+
+ }
+
+ ASSERT_EQ("Example Data 3", xTokenData);
+ ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
+
+}