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