Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Version 0.06 release
[xestiacalendar/.git] / source / tests / xestiacalendar_icaleventload.h
1 // xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Calendar 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.
10 //
11 // Xestia Calendar 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.
15 //
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/calendarevent/CalendarEvent.h"
21 TEST(iCalendarEvent, BasicTests){
23         CalendarEventObject testEvent;
24         
25         ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testEvent.LoadFile("iCalendarEvent-Missing.vcf"));
26         ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testEvent.LoadFile("iCalendarEvent-InvalidPermissions.vcf"));
27         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load1.vcf"));
28         
29 }
31 TEST(iCalendarEvent, BaseObjectVerifyTests){
33         CalendarEventObject testEvent;
34         testEvent.LoadFile("iCalendarEvent-Load1.vcf");
35         ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
36         
37         // Tests for METHOD.
38         
39         ASSERT_EQ("REQUEST", testEvent.methodData);
40         ASSERT_EQ("EXAMPLE=DATA", testEvent.methodTokens);
41         
42         // Tests for CALSCALE.
43         
44         ASSERT_EQ("GREGORIAN", testEvent.calendarScaleData);
45         ASSERT_EQ("MORE=YES", testEvent.calendarScaleTokens);
46         
47 }
49 TEST(iCalendarEvent, ObjectDataTests){
50         
51         CalendarEventObject testEvent;
52         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
53         ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
54         
55         // Tests for DTSTAMP.
56         
57         ASSERT_EQ("20160122T124100Z", testEvent.dateTimeStampData);
58         ASSERT_EQ("OTHER=PARAM", testEvent.dateTimeStampTokens);
59         
60         // Tests for UID.
61         
62         ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306e0", testEvent.uniqueID);
63         ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testEvent.uniqueIDTokens);
64         
65         // Tests for DTSTART.
66         
67         ASSERT_EQ("20160122T183000Z", testEvent.dateTimeStartData);
68         ASSERT_EQ("DATE-TIME", testEvent.dateTimeStartDataValue);
69         ASSERT_EQ("Europe/Truro", testEvent.dateTimeStartDataTimeZoneID);
70         ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testEvent.dateTimeStartDataTokens);
71         
72         // Tests for CLASS.
73         
74         ASSERT_EQ("PUBLIC", testEvent.classData);
75         ASSERT_EQ("CHOCOLATE=BAR", testEvent.classDataTokens);
77         // Tests for CREATED.
79         ASSERT_EQ("20160123T081100Z", testEvent.dateTimeCreatedData);
80         ASSERT_EQ("CARAMEL=PLEASE", testEvent.dateTimeCreatedTokens);
81         
82         // Tests for DESCRIPTION.
83         
84         std::string descriptionData;
85         std::string descriptionAltRep;
86         std::string descriptionLanguage;
87         std::string descriptionTokens;
88         
89         if (testEvent.descriptionList.begin() != testEvent.descriptionList.end()){
90                 descriptionData = testEvent.descriptionList[0];
91         }
93         if (testEvent.descriptionListAltRep.begin() != testEvent.descriptionListAltRep.end()){
94                 descriptionAltRep = testEvent.descriptionListAltRep[0];
95         }
97         if (testEvent.descriptionListLanguage.begin() != testEvent.descriptionListLanguage.end()){
98                 descriptionLanguage = testEvent.descriptionListLanguage[0];
99         }
101         if (testEvent.descriptionListTokens.begin() != testEvent.descriptionListTokens.end()){
102                 descriptionTokens = testEvent.descriptionListTokens[0];
103         }
104         
105         ASSERT_EQ("This is a description of the event.", descriptionData);
106         ASSERT_EQ("null:nodata", descriptionAltRep);
107         ASSERT_EQ("kw", descriptionLanguage);
108         ASSERT_EQ("EXAMPLE=TOKEN;MOREDATA=YES", descriptionTokens);
110         // Tests for GEO.
111         
112         ASSERT_EQ("5.0;5.0", testEvent.geographicData);
113         ASSERT_EQ("EXAMPLE=MEEP", testEvent.geographicTokens);
114         
115         // Tests for LAST-MODIFIED.
116         
117         ASSERT_EQ("20160124T093000Z", testEvent.lastModifiedData);
118         ASSERT_EQ("FUTURE=ODD", testEvent.lastModifiedTokens);
120         // Tests for LOCATION.
122         ASSERT_EQ("The Basement, Truro", testEvent.locationData);
123         ASSERT_EQ("null:nodata", testEvent.locationDataAltRep);
124         ASSERT_EQ("kw", testEvent.locationDataLanguage);
125         ASSERT_EQ("EXACT=NO", testEvent.locationDataTokens);
126         
127         // Tests for ORGANIZER.
128         
129         ASSERT_EQ("mailto:organiser@example.com", testEvent.organiserData);
130         ASSERT_EQ("ExampleOrganiser", testEvent.organiserDataCommonName);
131         ASSERT_EQ("null:nodata", testEvent.organiserDataDirectoryEntry);
132         ASSERT_EQ("mailto:organiser.noreply@example.com", testEvent.organiserDataSentByParam);
133         ASSERT_EQ("kw", testEvent.organiserDataLanguage);
134         ASSERT_EQ("HAPPY=DAYS", testEvent.organiserDataTokens);
135         
136         // Tests for PRIORITY.
137         
138         ASSERT_EQ(5, testEvent.priorityData);
139         ASSERT_EQ("STATUS=DEFAULT", testEvent.priorityTokens);
141         // Tests for SEQUENCE.
142         
143         ASSERT_EQ(3, testEvent.sequenceData);
144         ASSERT_EQ("TEST=YAY", testEvent.sequenceTokens);
146         // Tests for STATUS.
147         
148         ASSERT_EQ("2.0;Success", testEvent.statusData);
149         ASSERT_EQ("kw", testEvent.statusLanguage);
150         ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", testEvent.statusTokens);
152         // Tests for SUMMARY.
153         
154         ASSERT_EQ("A summary of the event.", testEvent.summaryData);
155         ASSERT_EQ("null:nodata", testEvent.summaryDataAltRep);
156         ASSERT_EQ("kw", testEvent.summaryDataLanguage);
157         ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testEvent.summaryDataTokens);
159         // Tests for TRANSP.
160         
161         ASSERT_EQ("TRANSPARENT", testEvent.timeTransparencyData);
162         ASSERT_EQ("OPAQUE=NOTYET", testEvent.timeTransparencyDataTokens);
164         // Tests for URL.
166         ASSERT_EQ("http://www.example.com/", testEvent.urlData);
167         ASSERT_EQ("EXTERNAL=YES", testEvent.urlDataTokens);
168         
169         // Tests for RECURRENCE-ID.
170         
171         ASSERT_EQ("20160124", testEvent.recurranceIDData);
172         ASSERT_EQ("Europe/Truro", testEvent.recurranceIDDataTimeZoneParam);
173         ASSERT_EQ("THISANDFUTURE", testEvent.recurranceIDDataRangeParam);
174         ASSERT_EQ("DATE", testEvent.recurranceIDDataValue);
175         ASSERT_EQ("EXAMPLE=DATA", testEvent.recurranceIDDataTokens);
177         // Tests for RRULE.
178         
179         ASSERT_EQ("FREQ=DAILY;COUNT=10", testEvent.recurranceRuleData);
180         ASSERT_EQ("TEST=DATA", testEvent.recurranceRuleDataTokens);
182         // Tests for DTEND.
183         
184         ASSERT_EQ("20160124T183000Z", testEvent.dateTimeEndData);
185         ASSERT_EQ("DATE-TIME", testEvent.dateTimeEndDataValue);
186         ASSERT_EQ("Europe/Truro", testEvent.dateTimeEndDataTimeZoneID);
187         ASSERT_EQ("PARAMFOUR=YES;PARAMTHREE=NO", testEvent.dateTimeEndDataTokens);
188         
189         // Tests for DURATION. (Done in another file called 
190         // iCalendarEvent-Load3.vcf).
192         CalendarEventObject testEvent2;
193         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent2.LoadFile("iCalendarEvent-Load3.vcf"));
194         ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent2.ValidBaseObject());
196         ASSERT_EQ("PT1H", testEvent2.durationData);
197         ASSERT_EQ("TEST=EXAMPLE", testEvent2.durationDataTokens);
198         
199         // Tests for ATTACH. First ATTACH property.
201         std::string attachData;
202         std::string attachDataFormatType;
203         std::string attachDataValue;
204         std::string attachDataEncoding;
205         std::string attachDataTokens;
207         if (testEvent.attachList.begin() != testEvent.attachList.end()){
208                 
209                 attachData = testEvent.attachList[0];
210                 
211         }
212         
213         if (testEvent.attachListFormatType.begin() != testEvent.attachListFormatType.end()){
214                 
215                 attachDataFormatType = testEvent.attachListFormatType[0];
216                 
217         }
219         ASSERT_EQ("http://www.example.com/", attachData);
220         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
221         
222         // Second ATTACH property.
223         
224         attachData.clear();
225         attachDataFormatType.clear();
226         attachDataValue.clear();
227         attachDataEncoding.clear();
228         
229         if (testEvent.attachList.size() > 1){
230                 
231                 attachData = testEvent.attachList[1];
232                 
233         }
234         
235         if (testEvent.attachListFormatType.size() > 1){
236                 
237                 attachDataFormatType = testEvent.attachListFormatType[1];
238                 
239         }
241         ASSERT_EQ("http://www.example.com/page2.html", attachData);
242         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
243         
244         // Third ATTACH property.
246         attachData.clear();
247         attachDataFormatType.clear();
248         attachDataValue.clear();
249         attachDataEncoding.clear();
250         attachDataTokens.clear();
251         
252         if (testEvent.attachList.size() > 2){
253                 
254                 attachData = testEvent.attachList[2];
255                 
256         }
257         
258         if (testEvent.attachListFormatType.size() > 2){
259                 
260                 attachDataFormatType = testEvent.attachListFormatType[2];
261                 
262         }
263         
264         if (testEvent.attachListValue.size() > 2){
265                 
266                 attachDataValue = testEvent.attachListValue[2];
267                 
268         }
269         
270         if (testEvent.attachListFormatType.size() > 2){
271                 
272                 attachDataEncoding = testEvent.attachListEncoding[2];
273                 
274         }
276         if (testEvent.attachListTokens.size() > 2){
277                 
278                 attachDataTokens = testEvent.attachListTokens[2];
279                 
280         }
281         
282         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
283         ASSERT_EQ("text/plain", attachDataFormatType);
284         ASSERT_EQ("BASE64", attachDataEncoding);
285         ASSERT_EQ("BINARY", attachDataValue);
286         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
288         // Tests for ATTENDEE. First ATTENDEE property.
290         std::string attendeeDataMember;
291         std::string attendeeDataDelegatedFrom;
292         std::string attendeeDataDelegatedTo;
293         std::string attendeeDataRole;
294         std::string attendeeDataRSVP;
295         std::string attendeeDataDirectoryEntry;
296         std::string attendeeDataSentBy;
297         std::string attendeeDataCommonName;
298         std::string attendeeDataCalendarUserType;
299         std::string attendeeDataParticipationStatus;
300         std::string attendeeDataLanguage;
301         std::string attendeeDataTokens;
302         std::string attendeeData;
304         if (testEvent.attendeeList.begin() != testEvent.attendeeList.end()){
305                 
306                 attendeeData = testEvent.attendeeList[0];
307                 
308         }
309         
310         ASSERT_EQ("Attendee One", attendeeData);
311         
312         // Second ATTENDEE property.
313         
314         attendeeData.clear();
315         
316         if (testEvent.attendeeList.size() > 1){
317                 
318                 attendeeData = testEvent.attendeeList[1];
319                 
320         }
322         if (testEvent.attendeeList.size() > 1){
323                 
324                 attendeeDataDelegatedFrom = testEvent.attendeeListDelegatedFrom[1];
325                 
326         }
327         
328         if (testEvent.attendeeList.size() > 1){
329                 
330                 attendeeDataDelegatedTo = testEvent.attendeeListDelegatedTo[1];
331                 
332         }
334         if (testEvent.attendeeList.size() > 1){
335                 
336                 attendeeDataRole = testEvent.attendeeListRole[1];
337                 
338         }
339         
340         if (testEvent.attendeeList.size() > 1){
341                 
342                 attendeeDataRSVP = testEvent.attendeeListRSVP[1];
343                 
344         }
345         
346         ASSERT_EQ("Attendee Two", attendeeData);
347         ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
348         ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
349         ASSERT_EQ("CHAIR", attendeeDataRole);
350         ASSERT_EQ("TRUE", attendeeDataRSVP);
352         // Third ATTENDEE property.
353         
354         attendeeData.clear();
355         
356         if (testEvent.attendeeList.size() > 2){
357                 
358                 attendeeData = testEvent.attendeeList[2];
359                 
360         }
362         if (testEvent.attendeeList.size() > 2){
363                 
364                 attendeeDataDirectoryEntry = testEvent.attendeeListDirectoryEntry[2];
365                 
366         }
367         
368         if (testEvent.attendeeList.size() > 2){
369                 
370                 attendeeDataSentBy = testEvent.attendeeListSentBy[2];
371                 
372         }
374         if (testEvent.attendeeList.size() > 2){
375                 
376                 attendeeDataCommonName = testEvent.attendeeListCommonName[2];
377                 
378         }
379         
380         if (testEvent.attendeeList.size() > 2){
381                 
382                 attendeeDataCalendarUserType = testEvent.attendeeListCalendarUserType[2];
383                 
384         }
386         if (testEvent.attendeeList.size() > 2){
387                 
388                 attendeeDataParticipationStatus = testEvent.attendeeListParticipationStatus[2];
389                 
390         }
392         if (testEvent.attendeeList.size() > 2){
393                 
394                 attendeeDataLanguage = testEvent.attendeeListLanguage[2];
395                 
396         }
397         
398         if (testEvent.attendeeList.size() > 2){
399                 
400                 attendeeDataTokens = testEvent.attendeeListTokens[2];
401                 
402         }
403         
404         ASSERT_EQ("Attendee Three", attendeeData);
405         ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
406         ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
407         ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
408         ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
409         ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
410         ASSERT_EQ("kw", attendeeDataLanguage);
411         ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
412         
413         // Get the first CATEGORIES.
414         
415         std::string categoryData;
416         
417         if (testEvent.categoriesList.begin() != testEvent.categoriesList.end()){
418                 
419                 categoryData = testEvent.categoriesList[0];
420                 
421         }
422         
423         ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
424         
425         categoryData.clear();
427         std::string categoryLanguage;
428         
429         // Get the second CATEGORIES.
430         
431         if (testEvent.categoriesList.size() > 1){
432                 
433                 categoryData = testEvent.categoriesList[1];
434                 
435         }
436         
437         if (testEvent.categoriesList.size() > 1){
438                 
439                 categoryLanguage = testEvent.categoriesListLanguage[1];
440                 
441         }
442                 
443         ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
444         ASSERT_EQ("en", categoryLanguage);
445         
446         categoryData.clear();
447         categoryLanguage.clear();
448         
449         // Get the third CATEGORIES.
450         
451         std::string categoryTokens;
452         
453         if (testEvent.categoriesList.size() > 2){
454                 
455                 categoryData = testEvent.categoriesList[2];
456                 
457         }
458         
459         if (testEvent.categoriesList.size() > 2){
460                 
461                 categoryLanguage = testEvent.categoriesListLanguage[2];
462                 
463         }
464         
465         if (testEvent.categoriesList.size() > 2){
466                 
467                 categoryTokens = testEvent.categoriesListTokens[2];
468                 
469         }
470                 
471         ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
472         ASSERT_EQ("en-GB", categoryLanguage);
473         ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
474         
475         // Get the first COMMENT.
476         
477         std::string commentData;
478         
479         if (testEvent.commentList.begin() != testEvent.commentList.end()){
480                 
481                 commentData = testEvent.commentList[0];
482                 
483         }
484         
485         ASSERT_EQ("This is the first comment.", commentData);
486         
487         // Get the second COMMENT.
488         
489         commentData.clear();
490         
491         std::string commentDataAltRep;
492         std::string commentDataLanguage;
493         
494         if (testEvent.commentList.size() > 1){
495                 
496                 commentData = testEvent.commentList[1];
497                 
498         }
499         
500         if (testEvent.commentList.size() > 1){
501                 
502                 commentDataAltRep = testEvent.commentListAltRep[1];
503                 
504         }
505         
506         if (testEvent.commentList.size() > 1){
507                 
508                 commentDataLanguage = testEvent.commentListLanguage[1];
509                 
510         }
511         
512         ASSERT_EQ("This is the second comment.", commentData);
513         ASSERT_EQ("null:nodata", commentDataAltRep);
514         ASSERT_EQ("en", commentDataLanguage);
515         
516         // Get the third COMMENT.
517         
518         commentData.clear();
519         
520         std::string commentDataTokens;
521         
522         if (testEvent.commentList.size() > 2){
523                 
524                 commentData = testEvent.commentList[2];
525                 
526         }
527         
528         if (testEvent.commentList.size() > 2){
529                 
530                 commentDataTokens = testEvent.commentListTokens[2];
531                 
532         }
533         
534         ASSERT_EQ("This is the third comment.", commentData);
535         ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
536         
537         // Get the first CONTACT.
538         
539         std::string contactData;
540         
541         if (testEvent.contactList.begin() != testEvent.contactList.end()){
542                 
543                 contactData = testEvent.contactList[0];
544                 
545         }
546         
547         ASSERT_EQ("First Contact", contactData);
548         
549         // Get the second CONTACT.
550         
551         contactData.clear();
552         
553         std::string contactDataAltRep;
554         std::string contactDataLanguage;
555         
556         if (testEvent.contactList.size() > 1){
557                 
558                 contactData = testEvent.contactList[1];
559                 
560         }
561         
562         if (testEvent.contactList.size() > 1){
563                 
564                 contactDataAltRep = testEvent.contactListAltRep[1];
565                 
566         }
567         
568         if (testEvent.contactList.size() > 1){
569                 
570                 contactDataLanguage = testEvent.contactListLanguage[1];
571                 
572         }
573         
574         ASSERT_EQ("Second Contact", contactData);
575         ASSERT_EQ("null:nodata", contactDataAltRep);
576         ASSERT_EQ("en-GB", contactDataLanguage);
577         
578         // Get the third CONTACT.
579         
580         contactData.clear();
581         
582         std::string contactDataTokens;
583         
584         if (testEvent.contactList.size() > 2){
585                 
586                 contactData = testEvent.contactList[2];
587                 
588         }
589         
590         if (testEvent.contactList.size() > 2){
591                 
592                 contactDataTokens = testEvent.contactListTokens[2];
593                 
594         }
595         
596         ASSERT_EQ("Third Contact", contactData);
597         ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
598         
599         // Get the first EXDATE.
600         
601         std::string excludeDate;
602         
603         if (testEvent.excludeDateData.begin() != testEvent.excludeDateData.end()){
604                 
605                 excludeDate = testEvent.excludeDateData[0];
606                 
607         }
608         
609         ASSERT_EQ("20160125T120000Z", excludeDate);
610         
611         // Get the second EXDATE.
613         excludeDate.clear();
614         
615         std::string excludeDataTimeZoneParam;
616         std::string excludeDataValue;
617         
618         if (testEvent.contactList.size() > 1){
619                 
620                 excludeDate = testEvent.excludeDateData[1];
621                 
622         }
623         
624         if (testEvent.contactList.size() > 1){
625                 
626                 excludeDataTimeZoneParam = testEvent.excludeDateDataTimeZoneParam[1];
627                 
628         }
629         
630         if (testEvent.contactList.size() > 1){
631                 
632                 excludeDataValue = testEvent.excludeDateDataValue[1];
633                 
634         }
635         
636         ASSERT_EQ("20160125T130000Z", excludeDate);
637         ASSERT_EQ("DATE-TIME", excludeDataValue);
638         ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
639         
640         // Get the third EXDATE.
641         
642         excludeDate.clear();
643         
644         std::string excludeDataTokens;
645         
646         if (testEvent.contactList.size() > 2){
647                 
648                 excludeDate = testEvent.excludeDateData[2];
649                 
650         }
651         
652         if (testEvent.contactList.size() > 2){
653                 
654                 excludeDataTokens = testEvent.excludeDateDataTokens[2];
655                 
656         }
657         
658         ASSERT_EQ("20160125T133000Z", excludeDate);
659         ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
660         
661         // Get the first REQUEST-STATUS.
663         std::string requestStatus;
664         
665         if (testEvent.requestStatusData.begin() != testEvent.requestStatusData.end()){
666                 
667                 requestStatus = testEvent.requestStatusData[0];
668                 
669         }
670         
671         ASSERT_EQ("2.0;Success", requestStatus);
672         
673         // Get the second REQUEST-STATUS.
674         
675         requestStatus.clear();
676         
677         std::string requestLanguage;
678         
679         if (testEvent.requestStatusData.size() > 1){
680                 
681                 requestStatus = testEvent.requestStatusData[1];
682                 
683         }
684         
685         if (testEvent.requestStatusData.size() > 1){
686                 
687                 requestLanguage = testEvent.requestStatusLanguage[1];
688                 
689         }
690         
691         ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus);
692         ASSERT_EQ("en", requestLanguage);
693         
694         // Get the third REQUEST-STATUS.
695         
696         requestStatus.clear();
697         
698         std::string requestTokens;
699         
700         if (testEvent.requestStatusData.size() > 2){
701                 
702                 requestStatus = testEvent.requestStatusData[2];
703                 
704         }
705         
706         if (testEvent.requestStatusData.size() > 2){
707                 
708                 requestTokens = testEvent.requestStatusTokens[2];
709                 
710         }
711         
712         ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
713         ASSERT_EQ("USER=MISSING", requestTokens);
714         
715         // Get the first RELATED-TO.
716         
717         std::string relatedTo;
718         
719         if (testEvent.relatedToData.begin() != testEvent.relatedToData.end()){
720                 
721                 relatedTo = testEvent.relatedToData[0];
722                 
723         }
724         
725         ASSERT_EQ("person.1@example.com", relatedTo);
726         
727         // Get the second RELATED-TO.
728         
729         relatedTo.clear();
730         
731         std::string relatedToType;
732         
733         if (testEvent.relatedToData.size() > 1){
734                 
735                 relatedTo = testEvent.relatedToData[1];
736                 
737         }
738         
739         if (testEvent.relatedToData.size() > 1){
740                 
741                 relatedToType = testEvent.relatedToDataRelationType[1];
742                 
743         }
744         
745         ASSERT_EQ("person.2@example.com", relatedTo);
746         ASSERT_EQ("PARENT", relatedToType);
747         
748         // Get the third RELATED-TO.
749         
750         relatedTo.clear();
751         
752         std::string relatedToTokens;
753         
754         if (testEvent.relatedToData.size() > 2){
755                 
756                 relatedTo = testEvent.relatedToData[2];
757                 
758         }
759         
760         if (testEvent.relatedToData.size() > 2){
761                 
762                 relatedToTokens = testEvent.relatedToDataTokens[2];
763                 
764         }
765         
766         ASSERT_EQ("person.3@example.com", relatedTo);
767         ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
768         
769         // Get the first RESOURCES.
771         std::string resources;
772         
773         if (testEvent.resourcesData.begin() != testEvent.resourcesData.end()){
774                 
775                 resources = testEvent.resourcesData[0];
776                 
777         }
778         
779         ASSERT_EQ("DMAC RECEIVER", resources);
780         
781         // Get the second RESOURCES.
782         
783         resources.clear();
784         
785         std::string resourcesLanguage;
786         
787         if (testEvent.resourcesData.size() > 1){
788                 
789                 resources = testEvent.resourcesData[1];
790                 
791         }
792         
793         if (testEvent.resourcesData.size() > 1){
794                 
795                 resourcesLanguage = testEvent.resourcesDataLanguage[1];
796                 
797         }
798         
799         ASSERT_EQ("PAL-I TELEVISION SET", resources);
800         ASSERT_EQ("en", resourcesLanguage);
801         
802         // Get the third RESOURCES.
803         
804         resources.clear();
805         
806         std::string resourcesAltRep;
807         std::string resourcesTokens;
808         
809         if (testEvent.resourcesData.size() > 2){
810                 
811                 resources = testEvent.resourcesData[2];
812                 
813         }
814                 
815         if (testEvent.resourcesData.size() > 2){
816                 
817                 resourcesAltRep = testEvent.resourcesDataAltRep[2];
818                 
819         }
820         
821         if (testEvent.resourcesData.size() > 2){
822                 
823                 resourcesTokens = testEvent.resourcesDataTokens[2];
824                 
825         }
826         
827         ASSERT_EQ("PAL/SECAM VCR", resources);
828         ASSERT_EQ("null:nodata", resourcesAltRep);
829         ASSERT_EQ("STATUS=BROKEN", resourcesTokens);
830         
831         // Get the first RDATE.
833         std::string recurrenceDate;
834         
835         if (testEvent.recurranceDateData.begin() != testEvent.recurranceDateData.end()){
836                 
837                 recurrenceDate = testEvent.recurranceDateData[0];
838                 
839         }
840         
841         ASSERT_EQ("20160120", recurrenceDate);
842         
843         // Get the second RDATE.
844         
845         recurrenceDate.clear();
846         
847         std::string recurrenceDateTimeZoneParam;
848         std::string recurrenceDateValue;
849         
850         if (testEvent.recurranceDateData.size() > 1){
851                 
852                 recurrenceDate = testEvent.recurranceDateData[1];
853                 
854         }
855         
856         if (testEvent.recurranceDateData.size() > 1){
857                 
858                 recurrenceDateTimeZoneParam = testEvent.recurranceDateDataTimeZoneParam[1];
859                 
860         }
861         
862         if (testEvent.recurranceDateData.size() > 1){
863                 
864                 recurrenceDateValue = testEvent.recurranceDateDataValue[1];
865                 
866         }
867         
868         ASSERT_EQ("20160121", recurrenceDate);
869         ASSERT_EQ("DATE", recurrenceDateValue);
870         ASSERT_EQ("Europe/Truro", recurrenceDateTimeZoneParam);
871         
872         // Get the third RDATE.
873         
874         recurrenceDate.clear();
875         
876         std::string recurrenceTokens;
877         
878         if (testEvent.recurranceDateData.size() > 2){
879                 
880                 recurrenceDate = testEvent.recurranceDateData[2];
881                 
882         }
883         
884         if (testEvent.recurranceDateData.size() > 2){
885                 
886                 recurrenceTokens = testEvent.recurranceDateDataTokens[2];
887                 
888         }
889         
890         ASSERT_EQ("20160520", recurrenceDate);
891         ASSERT_EQ("ZILCH=DATA", recurrenceTokens);
892         
893         // Get the first X-EXAMPLE1 token.
894         
895         std::string xTokenName;
896         std::string xTokenData;
897         
898         if (testEvent.xTokensData.size() != 0 ){
899         
900                 xTokenData = testEvent.xTokensData[0];
901                 
902         }
904         if (testEvent.xTokensData.size() != 0){
905         
906                 xTokenName = testEvent.xTokensDataTokens[0];
907                 
908         }
909         
910         ASSERT_EQ("Moo", xTokenData);
911         ASSERT_EQ("X-EXAMPLE1", xTokenName);
912         
913         // Get the second X-EXAMPLE1 token.
915         xTokenName.clear();
916         xTokenData.clear();
917         
918         if (testEvent.xTokensData.size() > 1){
919         
920                 xTokenData = testEvent.xTokensData[1];
921                 
922         }
924         if (testEvent.xTokensData.size() > 1){
925         
926                 xTokenName = testEvent.xTokensDataTokens[1];
927                 
928         }
929         
930         ASSERT_EQ("Meep", xTokenData);
931         ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
932         
933         // Get the third X-EXAMPLE1 token.
935         xTokenName.clear();
936         xTokenData.clear();
937         
938         if (testEvent.xTokensData.size() > 2){
939         
940                 xTokenData = testEvent.xTokensData[2];
941                 
942         }
944         if (testEvent.xTokensData.size() > 2){
945         
946                 xTokenName = testEvent.xTokensDataTokens[2];
947                 
948         }
949         
950         ASSERT_EQ("Meow", xTokenData);
951         ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
952         
953         // Get the first X-EXAMPLE2 token.
954         
955         xTokenName.clear();
956         xTokenData.clear();
957         
958         if (testEvent.xTokensData.size() > 3){
959         
960                 xTokenData = testEvent.xTokensData[3];
961                 
962         }
964         if (testEvent.xTokensData.size() > 3){
965         
966                 xTokenName = testEvent.xTokensDataTokens[3];
967                 
968         }
969         
970         ASSERT_EQ("Dish", xTokenData);
971         ASSERT_EQ("X-EXAMPLE2", xTokenName);
972         
973         // Get the second X-EXAMPLE2 token.
974         
975         xTokenName.clear();
976         xTokenData.clear();
977         
978         if (testEvent.xTokensData.size() > 4){
979         
980                 xTokenData = testEvent.xTokensData[4];
981                 
982         }
984         if (testEvent.xTokensData.size() > 4){
985         
986                 xTokenName = testEvent.xTokensDataTokens[4];
987                 
988         }
989         
990         ASSERT_EQ("Fork", xTokenData);
991         ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
992         
993         // Get the third X-EXAMPLE2 token.
994         
995         xTokenName.clear();
996         xTokenData.clear();
997         
998         if (testEvent.xTokensData.size() > 5){
999         
1000                 xTokenData = testEvent.xTokensData[5];
1001                 
1002         }
1004         if (testEvent.xTokensData.size() > 5){
1005         
1006                 xTokenName = testEvent.xTokensDataTokens[5];
1007                 
1008         }
1009         
1010         ASSERT_EQ("Table", xTokenData);
1011         ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
1012         
1013         // Get the X-STATUS token.
1014         
1015         xTokenName.clear();
1016         xTokenData.clear();
1017         
1018         if (testEvent.xTokensData.size() > 6){
1019         
1020                 xTokenData = testEvent.xTokensData[6];
1021                 
1022         }
1024         if (testEvent.xTokensData.size() > 6){
1025         
1026                 xTokenName = testEvent.xTokensDataTokens[6];
1027                 
1028         }
1029         
1030         ASSERT_EQ("Idle", xTokenData);
1031         ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
1032         
1033         // Get the X-TRANSPORT token.
1034         
1035         xTokenName.clear();
1036         xTokenData.clear();
1037         
1038         if (testEvent.xTokensData.size() > 7){
1039         
1040                 xTokenData = testEvent.xTokensData[7];
1041                 
1042         }
1044         if (testEvent.xTokensData.size() > 7){
1045         
1046                 xTokenName = testEvent.xTokensDataTokens[7];
1047                 
1048         }
1049         
1050         ASSERT_EQ("Private Hire", xTokenData);
1051         ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", xTokenName);
1052         
1053         // Get the X-PHANTOM-STATUS token.
1054         
1055         xTokenName.clear();
1056         xTokenData.clear();
1057         
1058         if (testEvent.xTokensData.size() > 8){
1059         
1060                 xTokenData = testEvent.xTokensData[8];
1061                 
1062         }
1064         if (testEvent.xTokensData.size() > 8){
1065         
1066                 xTokenName = testEvent.xTokensDataTokens[8];
1067                 
1068         }
1069         
1070         ASSERT_EQ("None", xTokenData);
1071         ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
1072         
1075 TEST(iCalendarEvent, AlarmTests){
1077         CalendarEventObject testEvent;
1078         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf"));
1079         ASSERT_EQ(CALENDAROBJECTVALID_OK, testEvent.ValidBaseObject());
1080         
1081         // Tests for the first VALARM property.
1082         
1083         std::string actionData;
1084         std::string actionDataTokens;
1085         
1086         std::string triggerData;
1087         std::string triggerRelated;
1088         std::string triggerValue;
1089         std::string triggerTokens;
1090         
1091         std::string durationData;
1092         std::string durationTokens;
1093         
1094         std::string repeatData;
1095         std::string repeatTokens;
1096         
1097         std::string xTokenData;
1098         std::string xTokenName;
1099         
1100         if (testEvent.calendarAlarmData.size() > 0){
1101         
1102                 actionData = testEvent.calendarAlarmData[0].alarmAction;
1103                 actionDataTokens = testEvent.calendarAlarmData[0].alarmActionTokens;
1104                 
1105                 triggerData = testEvent.calendarAlarmData[0].triggerData;
1106                 triggerRelated = testEvent.calendarAlarmData[0].triggerRelated;
1107                 triggerValue = testEvent.calendarAlarmData[0].triggerValue;
1108                 triggerTokens = testEvent.calendarAlarmData[0].triggerTokens;
1109                 
1110                 durationData = testEvent.calendarAlarmData[0].durationData;
1111                 durationTokens = testEvent.calendarAlarmData[0].durationTokens;
1112                 
1113                 repeatData = testEvent.calendarAlarmData[0].repeatData;
1114                 repeatTokens = testEvent.calendarAlarmData[0].repeatTokens;
1115                 
1116         }
1117         
1118         ASSERT_EQ("AUDIO", actionData);
1119         ASSERT_EQ("FUNKY=SOUNDS", actionDataTokens);
1120         
1121         ASSERT_EQ("20160220T160000Z", triggerData);
1122         ASSERT_EQ("END", triggerRelated);
1123         ASSERT_EQ("DATE-TIME", triggerValue);
1124         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1126         ASSERT_EQ("PT5H", durationData);
1127         ASSERT_EQ("FLYING=NO", durationTokens);
1129         ASSERT_EQ("PT5M", repeatData);
1130         ASSERT_EQ("NEVER=SLEEP", repeatTokens);
1131         
1132         // Tests for ATTACH. First ATTACH property.
1134         std::string attachData;
1135         std::string attachDataFormatType;
1136         std::string attachDataValue;
1137         std::string attachDataEncoding;
1138         std::string attachDataTokens;
1140         if (testEvent.calendarAlarmData[0].attachList.begin() != testEvent.calendarAlarmData[0].attachList.end()){
1141                 
1142                 attachData = testEvent.attachList[0];
1143                 
1144         }
1145         
1146         if (testEvent.calendarAlarmData[0].attachListFormatType.begin() != testEvent.calendarAlarmData[0].attachListFormatType.end()){
1147                 
1148                 attachDataFormatType = testEvent.attachListFormatType[0];
1149                 
1150         }
1152         ASSERT_EQ("http://www.example.com/", attachData);
1153         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1154         
1155         // Second ATTACH property.
1156         
1157         attachData.clear();
1158         attachDataFormatType.clear();
1159         attachDataValue.clear();
1160         attachDataEncoding.clear();
1161         
1162         if (testEvent.calendarAlarmData[0].attachList.size() > 1){
1163                 
1164                 attachData = testEvent.calendarAlarmData[0].attachList[1];
1165                 
1166         }
1167         
1168         if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 1){
1169                 
1170                 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[1];
1171                 
1172         }
1174         ASSERT_EQ("http://www.example.com/page2.html", attachData);
1175         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1176         
1177         // Third ATTACH property.
1179         attachData.clear();
1180         attachDataFormatType.clear();
1181         attachDataValue.clear();
1182         attachDataEncoding.clear();
1183         attachDataTokens.clear();
1184         
1185         if (testEvent.calendarAlarmData[0].attachList.size() > 2){
1186                 
1187                 attachData = testEvent.calendarAlarmData[0].attachList[2];
1188                 
1189         }
1190         
1191         if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1192                 
1193                 attachDataFormatType = testEvent.calendarAlarmData[0].attachListFormatType[2];
1194                 
1195         }
1196         
1197         if (testEvent.calendarAlarmData[0].attachListValue.size() > 2){
1198                 
1199                 attachDataValue = testEvent.calendarAlarmData[0].attachListValue[2];
1200                 
1201         }
1202         
1203         if (testEvent.calendarAlarmData[0].attachListFormatType.size() > 2){
1204                 
1205                 attachDataEncoding = testEvent.calendarAlarmData[0].attachListEncoding[2];
1206                 
1207         }
1209         if (testEvent.calendarAlarmData[0].attachListTokens.size() > 2){
1210                 
1211                 attachDataTokens = testEvent.calendarAlarmData[0].attachListTokens[2];
1212                 
1213         }
1214         
1215         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1216         ASSERT_EQ("text/plain", attachDataFormatType);
1217         ASSERT_EQ("BASE64", attachDataEncoding);
1218         ASSERT_EQ("BINARY", attachDataValue);
1219         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1220         
1221         // Test the first X-Token.
1222         
1223         if (testEvent.calendarAlarmData[0].xTokensData.size() > 0){
1224                 
1225                 xTokenData = testEvent.calendarAlarmData[0].xTokensData[0];
1226                 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[0];
1227                 
1228         }
1229         
1230         ASSERT_EQ("Example Data 1", xTokenData);
1231         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1232         
1233         // Test the second X-Token.
1234         
1235         xTokenData.clear();
1236         xTokenName.clear();
1237         
1238         if (testEvent.calendarAlarmData[0].xTokensData.size() > 1){
1239                 
1240                 xTokenData = testEvent.calendarAlarmData[0].xTokensData[1];
1241                 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[1];
1242                 
1243         }
1244         
1245         ASSERT_EQ("Example Data 2", xTokenData);
1246         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1247         
1248         // Test the third X-Token.
1250         xTokenData.clear();
1251         xTokenName.clear();
1252         
1253         if (testEvent.calendarAlarmData[0].xTokensData.size() > 2){
1254                 
1255                 xTokenData = testEvent.calendarAlarmData[0].xTokensData[2];
1256                 xTokenName = testEvent.calendarAlarmData[0].xTokensDataTokens[2];
1257                 
1258         }
1259         
1260         ASSERT_EQ("Example Data 3", xTokenData);
1261         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1262         
1263         // Tests for the second VALARM property.
1264         
1265         actionData.clear();
1266         actionDataTokens.clear();
1267         
1268         triggerData.clear();
1269         triggerRelated.clear();
1270         triggerValue.clear();
1271         triggerTokens.clear();
1272         
1273         durationData.clear();
1274         durationTokens.clear();
1275         
1276         repeatData.clear();
1277         repeatTokens.clear();
1278         
1279         xTokenData.clear();
1280         xTokenName.clear();
1281         
1282         string descriptionData;
1283         string descriptionAltRep;
1284         string descriptionLanguage;
1285         string descriptionTokens;
1286         
1287         if (testEvent.calendarAlarmData.size() > 1){
1288                 
1289                 actionData = testEvent.calendarAlarmData[1].alarmAction;
1290                 actionDataTokens = testEvent.calendarAlarmData[1].alarmActionTokens;
1291                 
1292                 triggerData = testEvent.calendarAlarmData[1].triggerData;
1293                 triggerRelated = testEvent.calendarAlarmData[1].triggerRelated;
1294                 triggerValue = testEvent.calendarAlarmData[1].triggerValue;
1295                 triggerTokens = testEvent.calendarAlarmData[1].triggerTokens;
1296                 
1297                 durationData = testEvent.calendarAlarmData[1].durationData;
1298                 durationTokens = testEvent.calendarAlarmData[1].durationTokens;
1299                 
1300                 repeatData = testEvent.calendarAlarmData[1].repeatData;
1301                 repeatTokens = testEvent.calendarAlarmData[1].repeatTokens;
1302                 
1303                 descriptionData = testEvent.calendarAlarmData[1].descriptionData;
1304                 descriptionAltRep = testEvent.calendarAlarmData[1].descriptionAltRep;
1305                 descriptionLanguage = testEvent.calendarAlarmData[1].descriptionLanguage;
1306                 descriptionTokens = testEvent.calendarAlarmData[1].descriptionTokens;
1307                 
1308         }
1309         
1310         ASSERT_EQ("DISPLAY", actionData);
1311         ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1312         
1313         ASSERT_EQ("20160230T110000Z", triggerData);
1314         ASSERT_EQ("END", triggerRelated);
1315         ASSERT_EQ("DATE-TIME", triggerValue);
1316         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1318         ASSERT_EQ("PT7H", durationData);
1319         ASSERT_EQ("FLYING=YES", durationTokens);
1321         ASSERT_EQ("PT3M", repeatData);
1322         ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1323         
1324         ASSERT_EQ("This is the second alarm.", descriptionData);
1325         ASSERT_EQ("null:nodata", descriptionAltRep);
1326         ASSERT_EQ("kw", descriptionLanguage);
1327         ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1328         
1329         // Test the first X-Token.
1330         
1331         if (testEvent.calendarAlarmData[1].xTokensData.size() > 0){
1332                 
1333                 xTokenData = testEvent.calendarAlarmData[1].xTokensData[0];
1334                 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[0];
1335                 
1336         }
1337         
1338         ASSERT_EQ("Example Data 1", xTokenData);
1339         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1340         
1341         // Test the second X-Token.
1342         
1343         xTokenData.clear();
1344         xTokenName.clear();
1345         
1346         if (testEvent.calendarAlarmData[1].xTokensData.size() > 1){
1347                 
1348                 xTokenData = testEvent.calendarAlarmData[1].xTokensData[1];
1349                 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[1];
1350                 
1351         }
1352         
1353         ASSERT_EQ("Example Data 2", xTokenData);
1354         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1355         
1356         // Test the third X-Token.
1358         xTokenData.clear();
1359         xTokenName.clear();
1360         
1361         if (testEvent.calendarAlarmData[1].xTokensData.size() > 2){
1362                 
1363                 xTokenData = testEvent.calendarAlarmData[1].xTokensData[2];
1364                 xTokenName = testEvent.calendarAlarmData[1].xTokensDataTokens[2];
1365                 
1366         }
1367         
1368         ASSERT_EQ("Example Data 3", xTokenData);
1369         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1370         
1371         // Tests for the third VALARM property.
1372         
1373         actionData.clear();
1374         actionDataTokens.clear();
1375         
1376         triggerData.clear();
1377         triggerRelated.clear();
1378         triggerValue.clear();
1379         triggerTokens.clear();
1380         
1381         durationData.clear();
1382         durationTokens.clear();
1383         
1384         repeatData.clear();
1385         repeatTokens.clear();
1386         
1387         xTokenData.clear();
1388         xTokenName.clear();
1389         
1390         descriptionData.clear();
1391         descriptionAltRep.clear();
1392         descriptionLanguage.clear();
1393         descriptionTokens.clear();
1395         string summaryData;
1396         string summaryAltRep;
1397         string summaryLanguage;
1398         string summaryTokens;
1399         
1400         string attendeeDataMember;
1401         string attendeeDataDelegatedFrom;
1402         string attendeeDataDelegatedTo;
1403         string attendeeDataRole;
1404         string attendeeDataRSVP;
1405         string attendeeDataDirectoryEntry;
1406         string attendeeDataSentBy;
1407         string attendeeDataCommonName;
1408         string attendeeDataCalendarUserType;
1409         string attendeeDataParticipationStatus;
1410         string attendeeDataLanguage;
1411         string attendeeDataTokens;
1412         string attendeeData;
1413         
1414         attachData.clear();
1415         attachDataFormatType.clear();
1416         attachDataValue.clear();
1417         attachDataEncoding.clear();
1418         attachDataTokens.clear();
1419         
1420         if (testEvent.calendarAlarmData.size() > 2){
1421                 
1422                 actionData = testEvent.calendarAlarmData[2].alarmAction;
1423                 actionDataTokens = testEvent.calendarAlarmData[2].alarmActionTokens;
1424                 
1425                 triggerData = testEvent.calendarAlarmData[2].triggerData;
1426                 triggerRelated = testEvent.calendarAlarmData[2].triggerRelated;
1427                 triggerValue = testEvent.calendarAlarmData[2].triggerValue;
1428                 triggerTokens = testEvent.calendarAlarmData[2].triggerTokens;
1429                 
1430                 durationData = testEvent.calendarAlarmData[2].durationData;
1431                 durationTokens = testEvent.calendarAlarmData[2].durationTokens;
1432                 
1433                 repeatData = testEvent.calendarAlarmData[2].repeatData;
1434                 repeatTokens = testEvent.calendarAlarmData[2].repeatTokens;
1435                 
1436                 descriptionData = testEvent.calendarAlarmData[2].descriptionData;
1437                 descriptionAltRep = testEvent.calendarAlarmData[2].descriptionAltRep;
1438                 descriptionLanguage = testEvent.calendarAlarmData[2].descriptionLanguage;
1439                 descriptionTokens = testEvent.calendarAlarmData[2].descriptionTokens;
1440                 
1441                 summaryData = testEvent.calendarAlarmData[2].summaryData;
1442                 summaryAltRep = testEvent.calendarAlarmData[2].summaryAltRep;
1443                 summaryLanguage = testEvent.calendarAlarmData[2].summaryLanguage;
1444                 summaryTokens = testEvent.calendarAlarmData[2].summaryTokens;
1445                 
1446         }
1447         
1448         ASSERT_EQ("EMAIL", actionData);
1449         ASSERT_EQ("FLASHING=LIGHTS", actionDataTokens);
1450         
1451         ASSERT_EQ("20160230T120000Z", triggerData);
1452         ASSERT_EQ("END", triggerRelated);
1453         ASSERT_EQ("DATE-TIME", triggerValue);
1454         ASSERT_EQ("PUSH=BUTTON", triggerTokens);
1456         ASSERT_EQ("PT7H", durationData);
1457         ASSERT_EQ("FLYING=YES", durationTokens);
1459         ASSERT_EQ("PT3M", repeatData);
1460         ASSERT_EQ("SLEEP=ALWAYS", repeatTokens);
1461         
1462         ASSERT_EQ("This is the third alarm.", descriptionData);
1463         ASSERT_EQ("null:nodata", descriptionAltRep);
1464         ASSERT_EQ("kw", descriptionLanguage);
1465         ASSERT_EQ("TERRIBLE=TOKEN", descriptionTokens);
1467         ASSERT_EQ("This is the summary of the third alarm.", summaryData);
1468         ASSERT_EQ("null:nodata", summaryAltRep);
1469         ASSERT_EQ("en", summaryLanguage);
1470         ASSERT_EQ("MEEP=MOOP", summaryTokens);
1472         // Tests for ATTENDEE. First ATTENDEE property.
1474         if (testEvent.calendarAlarmData[2].attendeeList.begin() != testEvent.calendarAlarmData[2].attendeeList.end()){
1475                 
1476                 attendeeData = testEvent.calendarAlarmData[2].attendeeList[0];
1477                 
1478         }
1479         
1480         ASSERT_EQ("Attendee One", attendeeData);
1481         
1482         // Second ATTENDEE property.
1483         
1484         attendeeData.clear();
1485         
1486         if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1487                 
1488                 attendeeData = testEvent.calendarAlarmData[2].attendeeList[1];
1489                 
1490         }
1492         if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1493                 
1494                 attendeeDataDelegatedFrom = testEvent.calendarAlarmData[2].attendeeListDelegatedFrom[1];
1495                 
1496         }
1497         
1498         if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1499                 
1500                 attendeeDataDelegatedTo = testEvent.calendarAlarmData[2].attendeeListDelegatedTo[1];
1501                 
1502         }
1504         if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1505                 
1506                 attendeeDataRole = testEvent.calendarAlarmData[2].attendeeListRole[1];
1507                 
1508         }
1509         
1510         if (testEvent.calendarAlarmData[2].attendeeList.size() > 1){
1511                 
1512                 attendeeDataRSVP = testEvent.calendarAlarmData[2].attendeeListRSVP[1];
1513                 
1514         }
1515         
1516         ASSERT_EQ("Attendee Two", attendeeData);
1517         ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
1518         ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
1519         ASSERT_EQ("CHAIR", attendeeDataRole);
1520         ASSERT_EQ("TRUE", attendeeDataRSVP);
1522         // Third ATTENDEE property.
1523         
1524         attendeeData.clear();
1525         
1526         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1527                 
1528                 attendeeData = testEvent.calendarAlarmData[2].attendeeList[2];
1529                 
1530         }
1532         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1533                 
1534                 attendeeDataDirectoryEntry = testEvent.calendarAlarmData[2].attendeeListDirectoryEntry[2];
1535                 
1536         }
1537         
1538         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1539                 
1540                 attendeeDataSentBy = testEvent.calendarAlarmData[2].attendeeListSentBy[2];
1541                 
1542         }
1544         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1545                 
1546                 attendeeDataCommonName = testEvent.calendarAlarmData[2].attendeeListCommonName[2];
1547                 
1548         }
1549         
1550         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1551                 
1552                 attendeeDataCalendarUserType = testEvent.calendarAlarmData[2].attendeeListCalendarUserType[2];
1553                 
1554         }
1556         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1557                 
1558                 attendeeDataParticipationStatus = testEvent.calendarAlarmData[2].attendeeListParticipationStatus[2];
1559                 
1560         }
1562         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1563                 
1564                 attendeeDataLanguage = testEvent.calendarAlarmData[2].attendeeListLanguage[2];
1565                 
1566         }
1567         
1568         if (testEvent.calendarAlarmData[2].attendeeList.size() > 2){
1569                 
1570                 attendeeDataTokens = testEvent.calendarAlarmData[2].attendeeListTokens[2];
1571                 
1572         }
1573         
1574         ASSERT_EQ("Attendee Three", attendeeData);
1575         ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
1576         ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
1577         ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
1578         ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
1579         ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
1580         ASSERT_EQ("kw", attendeeDataLanguage);
1581         ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
1583         // Tests for ATTACH. First ATTACH property.
1585         if (testEvent.calendarAlarmData[2].attachList.begin() != testEvent.calendarAlarmData[2].attachList.end()){
1586                 
1587                 attachData = testEvent.calendarAlarmData[2].attachList[0];
1588                 
1589         }
1590         
1591         if (testEvent.calendarAlarmData[2].attachListFormatType.begin() != testEvent.calendarAlarmData[2].attachListFormatType.end()){
1592                 
1593                 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[0];
1594                 
1595         }
1597         ASSERT_EQ("http://www.example.com/", attachData);
1598         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1599         
1600         // Second ATTACH property.
1601         
1602         attachData.clear();
1603         attachDataFormatType.clear();
1604         attachDataValue.clear();
1605         attachDataEncoding.clear();
1606         
1607         if (testEvent.calendarAlarmData[2].attachList.size() > 1){
1608                 
1609                 attachData = testEvent.calendarAlarmData[2].attachList[1];
1610                 
1611         }
1612         
1613         if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 1){
1614                 
1615                 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[1];
1616                 
1617         }
1619         ASSERT_EQ("http://www.example.com/page2.html", attachData);
1620         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
1621         
1622         // Third ATTACH property.
1624         attachData.clear();
1625         attachDataFormatType.clear();
1626         attachDataValue.clear();
1627         attachDataEncoding.clear();
1628         attachDataTokens.clear();
1629         
1630         if (testEvent.calendarAlarmData[2].attachList.size() > 2){
1631                 
1632                 attachData = testEvent.calendarAlarmData[2].attachList[2];
1633                 
1634         }
1635         
1636         if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1637                 
1638                 attachDataFormatType = testEvent.calendarAlarmData[2].attachListFormatType[2];
1639                 
1640         }
1641         
1642         if (testEvent.calendarAlarmData[2].attachListValue.size() > 2){
1643                 
1644                 attachDataValue = testEvent.calendarAlarmData[2].attachListValue[2];
1645                 
1646         }
1647         
1648         if (testEvent.calendarAlarmData[2].attachListFormatType.size() > 2){
1649                 
1650                 attachDataEncoding = testEvent.calendarAlarmData[2].attachListEncoding[2];
1651                 
1652         }
1654         if (testEvent.calendarAlarmData[2].attachListTokens.size() > 2){
1655                 
1656                 attachDataTokens = testEvent.calendarAlarmData[2].attachListTokens[2];
1657                 
1658         }
1659         
1660         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
1661         ASSERT_EQ("text/plain", attachDataFormatType);
1662         ASSERT_EQ("BASE64", attachDataEncoding);
1663         ASSERT_EQ("BINARY", attachDataValue);
1664         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
1665         
1666         // Test the first X-Token.
1667         
1668         if (testEvent.calendarAlarmData[2].xTokensData.size() > 0){
1669                 
1670                 xTokenData = testEvent.calendarAlarmData[2].xTokensData[0];
1671                 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[0];
1672                 
1673         }
1674         
1675         ASSERT_EQ("Example Data 1", xTokenData);
1676         ASSERT_EQ("X-EXAMPLE1;YAY=YES", xTokenName);
1677         
1678         // Test the second X-Token.
1679         
1680         xTokenData.clear();
1681         xTokenName.clear();
1682         
1683         if (testEvent.calendarAlarmData[2].xTokensData.size() > 1){
1684                 
1685                 xTokenData = testEvent.calendarAlarmData[2].xTokensData[1];
1686                 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[1];
1687                 
1688         }
1689         
1690         ASSERT_EQ("Example Data 2", xTokenData);
1691         ASSERT_EQ("X-EXAMPLE2;NOPE=YEP", xTokenName);
1692         
1693         // Test the third X-Token.
1695         xTokenData.clear();
1696         xTokenName.clear();
1697         
1698         if (testEvent.calendarAlarmData[2].xTokensData.size() > 2){
1699                 
1700                 xTokenData = testEvent.calendarAlarmData[2].xTokensData[2];
1701                 xTokenName = testEvent.calendarAlarmData[2].xTokensDataTokens[2];
1702                 
1703         }
1704         
1705         ASSERT_EQ("Example Data 3", xTokenData);
1706         ASSERT_EQ("X-EXAMPLE3;WORLD=NO", xTokenName);
1707         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy