Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
unit-test: Refactor unit testing building/running/info collecting for build server
[xestiacalendar/.git] / source / tests / iCalendarJournalTests / iCalendarJournalLoad.cpp
1 // xestiacalendar_icaljournalload.h - Xestia Calendar iCalendar Journal 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 "calendarjournal/CalendarJournal.h"
20 #include <gtest/gtest.h>
22 class iCalendarJournalLoadTests : public ::testing::Test
23 {
24 private:
25     virtual void SetUp()
26     {
27     }
28     
29     virtual void TearDown()
30     {
31     }
32 };
34 TEST_F(iCalendarJournalLoadTests, BasicTests){
36         CalendarJournalObject testJournal;
37         
38         ASSERT_EQ(CALENDAROBJECTLOAD_MISSING, testJournal.LoadFile("iCalendarJournal-Missing.vcf"));
39         ASSERT_EQ(CALENDAROBJECTLOAD_CANNOTOPEN, testJournal.LoadFile("iCalendarJournal-InvalidPermissions.vcf"));
40         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testJournal.LoadFile("iCalendarJournal-Load1.vcf"));
41         
42 }
44 TEST_F(iCalendarJournalLoadTests, ObjectDataTests){
45         
46         CalendarJournalObject testJournal;
47         ASSERT_EQ(CALENDAROBJECTLOAD_OK, testJournal.LoadFile("iCalendarJournal-Load2.vcf"));
48         ASSERT_EQ(CALENDAROBJECTVALID_OK, testJournal.ValidBaseObject());
49         
50         // Tests for DTSTAMP.
51         
52         ASSERT_EQ("20160131T141500Z", testJournal.dateTimeStampData);
53         ASSERT_EQ("OTHER=PARAM", testJournal.dateTimeStampTokens);
54         
55         // Tests for UID.
56         
57         ASSERT_EQ("b3a16392-ad86-4061-be53-c215af2306c1", testJournal.uniqueID);
58         ASSERT_EQ("UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT", testJournal.uniqueIDTokens);
59         
60         // Tests for CLASS.
61         
62         ASSERT_EQ("PUBLIC", testJournal.classData);
63         ASSERT_EQ("CHOCOLATE=BAR", testJournal.classDataTokens);
64         
65         // Tests for DTSTART.
66         
67         ASSERT_EQ("20160131T143500Z", testJournal.dateTimeStartData);
68         ASSERT_EQ("DATE-TIME", testJournal.dateTimeStartDataValue);
69         ASSERT_EQ("Europe/Truro", testJournal.dateTimeStartDataTimeZoneID);
70         ASSERT_EQ("PARAMONE=YES;PARAMTWO=NO", testJournal.dateTimeStartDataTokens);
71         
72         // Tests for LAST-MODIFIED.
73         
74         ASSERT_EQ("20160131T143700Z", testJournal.lastModifiedData);
75         ASSERT_EQ("FUTURE=YES", testJournal.lastModifiedTokens);
76         
77         // Tests for ORGANIZER.
78         
79         ASSERT_EQ("mailto:organiser@example.com", testJournal.organiserData);
80         ASSERT_EQ("ExampleOrganiser", testJournal.organiserDataCommonName);
81         ASSERT_EQ("null:nodata", testJournal.organiserDataDirectoryEntry);
82         ASSERT_EQ("mailto:organiser.noreply@example.com", testJournal.organiserDataSentByParam);
83         ASSERT_EQ("kw", testJournal.organiserDataLanguage);
84         ASSERT_EQ("HAPPY=DAYS", testJournal.organiserDataTokens);
85         
86         // Tests for RECURRENCE-ID.
87         
88         ASSERT_EQ("20160131", testJournal.recurranceIDData);
89         ASSERT_EQ("Europe/Truro", testJournal.recurranceIDDataTimeZoneParam);
90         ASSERT_EQ("THISANDFUTURE", testJournal.recurranceIDDataRangeParam);
91         ASSERT_EQ("DATE", testJournal.recurranceIDDataValue);
92         ASSERT_EQ("EXAMPLE=DATA", testJournal.recurranceIDDataTokens);
93         
94         // Tests for SEQUENCE.
95         
96         ASSERT_EQ(7, testJournal.sequenceData);
97         ASSERT_EQ("TEST=YAY", testJournal.sequenceTokens);
98         
99         // Tests for STATUS.
100         
101         ASSERT_EQ("2.0;Success", testJournal.statusData);
102         ASSERT_EQ("kw", testJournal.statusLanguage);
103         ASSERT_EQ("FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN", testJournal.statusTokens);
104         
105         // Tests for SUMMARY.
106         
107         ASSERT_EQ("A summary of the journal entry.", testJournal.summaryData);
108         ASSERT_EQ("null:nodata", testJournal.summaryDataAltRep);
109         ASSERT_EQ("kw", testJournal.summaryDataLanguage);
110         ASSERT_EQ("FAVOURITE=TOFU;NOTLIKE=NONE", testJournal.summaryDataTokens);
111         
112         // Tests for URL.
114         ASSERT_EQ("http://www.example.com/", testJournal.urlData);
115         ASSERT_EQ("EXTERNAL=YES", testJournal.urlDataTokens);
116         
117         // Tests for RRULE.
118         
119         ASSERT_EQ("FREQ=DAILY;COUNT=10", testJournal.recurranceRuleData);
120         ASSERT_EQ("TEST=DATA", testJournal.recurranceRuleDataTokens);
121         
122         // Tests for ATTACH. First ATTACH property.
124         std::string attachData;
125         std::string attachDataFormatType;
126         std::string attachDataValue;
127         std::string attachDataEncoding;
128         std::string attachDataTokens;
130         if (testJournal.attachList.begin() != testJournal.attachList.end()){
131                 
132                 attachData = testJournal.attachList[0];
133                 
134         }
135         
136         if (testJournal.attachListFormatType.begin() != testJournal.attachListFormatType.end()){
137                 
138                 attachDataFormatType = testJournal.attachListFormatType[0];
139                 
140         }
142         ASSERT_EQ("http://www.example.com/", attachData);
143         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
144         
145         // Second ATTACH property.
146         
147         attachData.clear();
148         attachDataFormatType.clear();
149         attachDataValue.clear();
150         attachDataEncoding.clear();
151         
152         if (testJournal.attachList.size() > 1){
153                 
154                 attachData = testJournal.attachList[1];
155                 
156         }
157         
158         if (testJournal.attachListFormatType.size() > 1){
159                 
160                 attachDataFormatType = testJournal.attachListFormatType[1];
161                 
162         }
164         ASSERT_EQ("http://www.example.com/page2.html", attachData);
165         ASSERT_EQ("application/internet-shortcut", attachDataFormatType);
166         
167         // Third ATTACH property.
169         attachData.clear();
170         attachDataFormatType.clear();
171         attachDataValue.clear();
172         attachDataEncoding.clear();
173         attachDataTokens.clear();
174         
175         if (testJournal.attachList.size() > 2){
176                 
177                 attachData = testJournal.attachList[2];
178                 
179         }
180         
181         if (testJournal.attachListFormatType.size() > 2){
182                 
183                 attachDataFormatType = testJournal.attachListFormatType[2];
184                 
185         }
186         
187         if (testJournal.attachListValue.size() > 2){
188                 
189                 attachDataValue = testJournal.attachListValue[2];
190                 
191         }
192         
193         if (testJournal.attachListFormatType.size() > 2){
194                 
195                 attachDataEncoding = testJournal.attachListEncoding[2];
196                 
197         }
199         if (testJournal.attachListTokens.size() > 2){
200                 
201                 attachDataTokens = testJournal.attachListTokens[2];
202                 
203         }
204         
205         ASSERT_EQ("VGhpcyBpcyBhbiBleGFtcGxlIGZpbGU=", attachData);
206         ASSERT_EQ("text/plain", attachDataFormatType);
207         ASSERT_EQ("BASE64", attachDataEncoding);
208         ASSERT_EQ("BINARY", attachDataValue);
209         ASSERT_EQ("STUPID=EXAMPLE", attachDataTokens);
210         
211         // Tests for ATTENDEE. First ATTENDEE property.
213         std::string attendeeDataMember;
214         std::string attendeeDataDelegatedFrom;
215         std::string attendeeDataDelegatedTo;
216         std::string attendeeDataRole;
217         std::string attendeeDataRSVP;
218         std::string attendeeDataDirectoryEntry;
219         std::string attendeeDataSentBy;
220         std::string attendeeDataCommonName;
221         std::string attendeeDataCalendarUserType;
222         std::string attendeeDataParticipationStatus;
223         std::string attendeeDataLanguage;
224         std::string attendeeDataTokens;
225         std::string attendeeData;
227         if (testJournal.attendeeList.begin() != testJournal.attendeeList.end()){
228                 
229                 attendeeData = testJournal.attendeeList[0];
230                 
231         }
232         
233         ASSERT_EQ("Attendee One", attendeeData);
234         
235         // Second ATTENDEE property.
236         
237         attendeeData.clear();
238         
239         if (testJournal.attendeeList.size() > 1){
240                 
241                 attendeeData = testJournal.attendeeList[1];
242                 
243         }
245         if (testJournal.attendeeList.size() > 1){
246                 
247                 attendeeDataDelegatedFrom = testJournal.attendeeListDelegatedFrom[1];
248                 
249         }
250         
251         if (testJournal.attendeeList.size() > 1){
252                 
253                 attendeeDataDelegatedTo = testJournal.attendeeListDelegatedTo[1];
254                 
255         }
257         if (testJournal.attendeeList.size() > 1){
258                 
259                 attendeeDataRole = testJournal.attendeeListRole[1];
260                 
261         }
262         
263         if (testJournal.attendeeList.size() > 1){
264                 
265                 attendeeDataRSVP = testJournal.attendeeListRSVP[1];
266                 
267         }
268         
269         ASSERT_EQ("Attendee Two", attendeeData);
270         ASSERT_EQ("mailto:delegated.from@example.com", attendeeDataDelegatedFrom);
271         ASSERT_EQ("mailto:delegated.to@example.com", attendeeDataDelegatedTo);
272         ASSERT_EQ("CHAIR", attendeeDataRole);
273         ASSERT_EQ("TRUE", attendeeDataRSVP);
275         // Third ATTENDEE property.
276         
277         attendeeData.clear();
278         
279         if (testJournal.attendeeList.size() > 2){
280                 
281                 attendeeData = testJournal.attendeeList[2];
282                 
283         }
285         if (testJournal.attendeeList.size() > 2){
286                 
287                 attendeeDataDirectoryEntry = testJournal.attendeeListDirectoryEntry[2];
288                 
289         }
290         
291         if (testJournal.attendeeList.size() > 2){
292                 
293                 attendeeDataSentBy = testJournal.attendeeListSentBy[2];
294                 
295         }
297         if (testJournal.attendeeList.size() > 2){
298                 
299                 attendeeDataCommonName = testJournal.attendeeListCommonName[2];
300                 
301         }
302         
303         if (testJournal.attendeeList.size() > 2){
304                 
305                 attendeeDataCalendarUserType = testJournal.attendeeListCalendarUserType[2];
306                 
307         }
309         if (testJournal.attendeeList.size() > 2){
310                 
311                 attendeeDataParticipationStatus = testJournal.attendeeListParticipationStatus[2];
312                 
313         }
315         if (testJournal.attendeeList.size() > 2){
316                 
317                 attendeeDataLanguage = testJournal.attendeeListLanguage[2];
318                 
319         }
320         
321         if (testJournal.attendeeList.size() > 2){
322                 
323                 attendeeDataTokens = testJournal.attendeeListTokens[2];
324                 
325         }
326         
327         ASSERT_EQ("Attendee Three", attendeeData);
328         ASSERT_EQ("null:nodata", attendeeDataDirectoryEntry);
329         ASSERT_EQ("mailto:sent.by@example.com", attendeeDataSentBy);
330         ASSERT_EQ("Attendee The Third", attendeeDataCommonName);
331         ASSERT_EQ("INDIVIDUAL", attendeeDataCalendarUserType);
332         ASSERT_EQ("ACCEPTED", attendeeDataParticipationStatus);
333         ASSERT_EQ("kw", attendeeDataLanguage);
334         ASSERT_EQ("EXAMPLE=DATA", attendeeDataTokens);
335         
336         // Get the first CATEGORIES.
337         
338         std::string categoryData;
339         
340         if (testJournal.categoriesList.begin() != testJournal.categoriesList.end()){
341                 
342                 categoryData = testJournal.categoriesList[0];
343                 
344         }
345         
346         ASSERT_EQ("CATEGORY ONE, CATEGORY TWO", categoryData);
347         
348         categoryData.clear();
350         std::string categoryLanguage;
351         
352         // Get the second CATEGORIES.
353         
354         if (testJournal.categoriesList.size() > 1){
355                 
356                 categoryData = testJournal.categoriesList[1];
357                 
358         }
359         
360         if (testJournal.categoriesList.size() > 1){
361                 
362                 categoryLanguage = testJournal.categoriesListLanguage[1];
363                 
364         }
365                 
366         ASSERT_EQ("CATEGORY THREE, CATEGORY FOUR", categoryData);
367         ASSERT_EQ("en", categoryLanguage);
368         
369         categoryData.clear();
370         categoryLanguage.clear();
371         
372         // Get the third CATEGORIES.
373         
374         std::string categoryTokens;
375         
376         if (testJournal.categoriesList.size() > 2){
377                 
378                 categoryData = testJournal.categoriesList[2];
379                 
380         }
381         
382         if (testJournal.categoriesList.size() > 2){
383                 
384                 categoryLanguage = testJournal.categoriesListLanguage[2];
385                 
386         }
387         
388         if (testJournal.categoriesList.size() > 2){
389                 
390                 categoryTokens = testJournal.categoriesListTokens[2];
391                 
392         }
393                 
394         ASSERT_EQ("CATEGORY FIVE, CATEGORY SIX, CATEGORY SEVEN", categoryData);
395         ASSERT_EQ("en-GB", categoryLanguage);
396         ASSERT_EQ("SAMPLE=TOKEN", categoryTokens);
397         
398         // Get the first COMMENT.
399         
400         std::string commentData;
401         
402         if (testJournal.commentList.begin() != testJournal.commentList.end()){
403                 
404                 commentData = testJournal.commentList[0];
405                 
406         }
407         
408         ASSERT_EQ("This is the first comment.", commentData);
409         
410         // Get the second COMMENT.
411         
412         commentData.clear();
413         
414         std::string commentDataAltRep;
415         std::string commentDataLanguage;
416         
417         if (testJournal.commentList.size() > 1){
418                 
419                 commentData = testJournal.commentList[1];
420                 
421         }
422         
423         if (testJournal.commentList.size() > 1){
424                 
425                 commentDataAltRep = testJournal.commentListAltRep[1];
426                 
427         }
428         
429         if (testJournal.commentList.size() > 1){
430                 
431                 commentDataLanguage = testJournal.commentListLanguage[1];
432                 
433         }
434         
435         ASSERT_EQ("This is the second comment.", commentData);
436         ASSERT_EQ("null:nodata", commentDataAltRep);
437         ASSERT_EQ("en", commentDataLanguage);
438         
439         // Get the third COMMENT.
440         
441         commentData.clear();
442         
443         std::string commentDataTokens;
444         
445         if (testJournal.commentList.size() > 2){
446                 
447                 commentData = testJournal.commentList[2];
448                 
449         }
450         
451         if (testJournal.commentList.size() > 2){
452                 
453                 commentDataTokens = testJournal.commentListTokens[2];
454                 
455         }
456         
457         ASSERT_EQ("This is the third comment.", commentData);
458         ASSERT_EQ("ZEBRAS=YES", commentDataTokens);
459         
460         // Get the first CONTACT.
461         
462         std::string contactData;
463         
464         if (testJournal.contactList.begin() != testJournal.contactList.end()){
465                 
466                 contactData = testJournal.contactList[0];
467                 
468         }
469         
470         ASSERT_EQ("First Contact", contactData);
471         
472         // Get the second CONTACT.
473         
474         contactData.clear();
475         
476         std::string contactDataAltRep;
477         std::string contactDataLanguage;
478         
479         if (testJournal.contactList.size() > 1){
480                 
481                 contactData = testJournal.contactList[1];
482                 
483         }
484         
485         if (testJournal.contactList.size() > 1){
486                 
487                 contactDataAltRep = testJournal.contactListAltRep[1];
488                 
489         }
490         
491         if (testJournal.contactList.size() > 1){
492                 
493                 contactDataLanguage = testJournal.contactListLanguage[1];
494                 
495         }
496         
497         ASSERT_EQ("Second Contact", contactData);
498         ASSERT_EQ("null:nodata", contactDataAltRep);
499         ASSERT_EQ("en-GB", contactDataLanguage);
500         
501         // Get the third CONTACT.
502         
503         contactData.clear();
504         
505         std::string contactDataTokens;
506         
507         if (testJournal.contactList.size() > 2){
508                 
509                 contactData = testJournal.contactList[2];
510                 
511         }
512         
513         if (testJournal.contactList.size() > 2){
514                 
515                 contactDataTokens = testJournal.contactListTokens[2];
516                 
517         }
518         
519         ASSERT_EQ("Third Contact", contactData);
520         ASSERT_EQ("ZEBRAS=NO", contactDataTokens);
521         
522         // Get the first DESCRIPTION.
523         
524         std::string descriptionData;
525         
526         if (testJournal.descriptionList.begin() != testJournal.descriptionList.end()){
527                 
528                 descriptionData = testJournal.descriptionList[0];
529                 
530         }
531         
532         ASSERT_EQ("First Journal Entry Description", descriptionData);
533         
534         // Get the second DESCRIPTION.
535         
536         descriptionData.clear();
537         
538         std::string descriptionAltRep;
539         std::string descriptionLanguage;
540         
541         if (testJournal.descriptionList.size() > 1){
542                 
543                 descriptionData = testJournal.descriptionList[1];
544                 
545         }
546         
547         if (testJournal.descriptionList.size() > 1){
548                 
549                 descriptionAltRep = testJournal.descriptionListAltRep[1];
550                 
551         }
552         
553         if (testJournal.descriptionList.size() > 1){
554                 
555                 descriptionLanguage = testJournal.descriptionListLanguage[1];
556                 
557         }
558         
559         ASSERT_EQ("This is the second journal description.", descriptionData);
560         ASSERT_EQ("null:nodata", descriptionAltRep);
561         ASSERT_EQ("en-GB", descriptionLanguage);
562         
563         // Get the third DESCRIPTION.
564         
565         descriptionData.clear();
566         
567         std::string descriptionDataTokens;
568         
569         if (testJournal.descriptionList.size() > 2){
570                 
571                 descriptionData = testJournal.descriptionList[2];
572                 
573         }
574         
575         if (testJournal.descriptionList.size() > 2){
576                 
577                 descriptionDataTokens = testJournal.descriptionListTokens[2];
578                 
579         }
580         
581         ASSERT_EQ("This is the third journal description.", descriptionData);
582         ASSERT_EQ("ZEBRAS=NO", descriptionDataTokens);
583         
584         // Get the first EXDATE.
585         
586         std::string excludeDate;
587         
588         if (testJournal.excludeDateData.begin() != testJournal.excludeDateData.end()){
589                 
590                 excludeDate = testJournal.excludeDateData[0];
591                 
592         }
593         
594         ASSERT_EQ("20160125T120000Z", excludeDate);
595         
596         // Get the second EXDATE.
598         excludeDate.clear();
599         
600         std::string excludeDataTimeZoneParam;
601         std::string excludeDataValue;
602         
603         if (testJournal.contactList.size() > 1){
604                 
605                 excludeDate = testJournal.excludeDateData[1];
606                 
607         }
608         
609         if (testJournal.contactList.size() > 1){
610                 
611                 excludeDataTimeZoneParam = testJournal.excludeDateDataTimeZoneParam[1];
612                 
613         }
614         
615         if (testJournal.contactList.size() > 1){
616                 
617                 excludeDataValue = testJournal.excludeDateDataValue[1];
618                 
619         }
620         
621         ASSERT_EQ("20160125T130000Z", excludeDate);
622         ASSERT_EQ("DATE-TIME", excludeDataValue);
623         ASSERT_EQ("Europe/Truro", excludeDataTimeZoneParam);
624         
625         // Get the third EXDATE.
626         
627         excludeDate.clear();
628         
629         std::string excludeDataTokens;
630         
631         if (testJournal.contactList.size() > 2){
632                 
633                 excludeDate = testJournal.excludeDateData[2];
634                 
635         }
636         
637         if (testJournal.contactList.size() > 2){
638                 
639                 excludeDataTokens = testJournal.excludeDateDataTokens[2];
640                 
641         }
642         
643         ASSERT_EQ("20160125T133000Z", excludeDate);
644         ASSERT_EQ("ZOOP=ZIPPO", excludeDataTokens);
645         
646         // Get the first RELATED-TO.
647         
648         std::string relatedTo;
649         
650         if (testJournal.relatedToData.begin() != testJournal.relatedToData.end()){
651                 
652                 relatedTo = testJournal.relatedToData[0];
653                 
654         }
655         
656         ASSERT_EQ("person.1@example.com", relatedTo);
657         
658         // Get the second RELATED-TO.
659         
660         relatedTo.clear();
661         
662         std::string relatedToType;
663         
664         if (testJournal.relatedToData.size() > 1){
665                 
666                 relatedTo = testJournal.relatedToData[1];
667                 
668         }
669         
670         if (testJournal.relatedToData.size() > 1){
671                 
672                 relatedToType = testJournal.relatedToDataRelationType[1];
673                 
674         }
675         
676         ASSERT_EQ("person.2@example.com", relatedTo);
677         ASSERT_EQ("PARENT", relatedToType);
678         
679         // Get the third RELATED-TO.
680         
681         relatedTo.clear();
682         
683         std::string relatedToTokens;
684         
685         if (testJournal.relatedToData.size() > 2){
686                 
687                 relatedTo = testJournal.relatedToData[2];
688                 
689         }
690         
691         if (testJournal.relatedToData.size() > 2){
692                 
693                 relatedToTokens = testJournal.relatedToDataTokens[2];
694                 
695         }
696         
697         ASSERT_EQ("person.3@example.com", relatedTo);
698         ASSERT_EQ("SCHOOL=MEETING", relatedToTokens);
699         
700         // Get the first RDATE.
702         std::string recurrenceDate;
703         
704         if (testJournal.recurranceDateData.begin() != testJournal.recurranceDateData.end()){
705                 
706                 recurrenceDate = testJournal.recurranceDateData[0];
707                 
708         }
709         
710         ASSERT_EQ("20160120", recurrenceDate);
711         
712         // Get the second RDATE.
713         
714         recurrenceDate.clear();
715         
716         std::string recurrenceDateTimeZoneParam;
717         std::string recurrenceDateValue;
718         
719         if (testJournal.recurranceDateData.size() > 1){
720                 
721                 recurrenceDate = testJournal.recurranceDateData[1];
722                 
723         }
724         
725         if (testJournal.recurranceDateData.size() > 1){
726                 
727                 recurrenceDateTimeZoneParam = testJournal.recurranceDateDataTimeZoneParam[1];
728                 
729         }
730         
731         if (testJournal.recurranceDateData.size() > 1){
732                 
733                 recurrenceDateValue = testJournal.recurranceDateDataValue[1];
734                 
735         }
736         
737         ASSERT_EQ("20160121", recurrenceDate);
738         ASSERT_EQ("DATE", recurrenceDateValue);
739         ASSERT_EQ("Europe/Truro", recurrenceDateTimeZoneParam);
740         
741         // Get the third RDATE.
742         
743         recurrenceDate.clear();
744         
745         std::string RecurrenceTokens;
746         
747         if (testJournal.recurranceDateData.size() > 2){
748                 
749                 recurrenceDate = testJournal.recurranceDateData[2];
750                 
751         }
752         
753         if (testJournal.recurranceDateData.size() > 2){
754                 
755                 RecurrenceTokens = testJournal.recurranceDateDataTokens[2];
756                 
757         }
758         
759         ASSERT_EQ("20160520", recurrenceDate);
760         ASSERT_EQ("ZILCH=DATA", RecurrenceTokens);
762         // Get the first REQUEST-STATUS.
764         std::string requestStatus;
765         
766         if (testJournal.requestStatusData.begin() != testJournal.requestStatusData.end()){
767                 
768                 requestStatus = testJournal.requestStatusData[0];
769                 
770         }
771         
772         ASSERT_EQ("2.0;Success", requestStatus);
773         
774         // Get the second REQUEST-STATUS.
775         
776         requestStatus.clear();
777         
778         std::string requestLanguage;
779         
780         if (testJournal.contactList.size() > 1){
781                 
782                 requestStatus = testJournal.requestStatusData[1];
783                 
784         }
785         
786         if (testJournal.contactList.size() > 1){
787                 
788                 requestLanguage = testJournal.requestStatusLanguage[1];
789                 
790         }
791         
792         ASSERT_EQ("3.42;Really big irrecoverable error caused by the user", requestStatus);
793         ASSERT_EQ("en", requestLanguage);
794         
795         // Get the third REQUEST-STATUS.
796         
797         requestStatus.clear();
798         
799         std::string requestTokens;
800         
801         if (testJournal.contactList.size() > 2){
802                 
803                 requestStatus = testJournal.requestStatusData[2];
804                 
805         }
806         
807         if (testJournal.contactList.size() > 2){
808                 
809                 requestTokens = testJournal.requestStatusTokens[2];
810                 
811         }
812         
813         ASSERT_EQ("3.7;Invalid calendar user", requestStatus);
814         ASSERT_EQ("USER=MISSING", requestTokens);
815         
816         // Get the first X-EXAMPLE1 token.
817         
818         std::string xTokenName;
819         std::string xTokenData;
820         
821         if (testJournal.xTokensData.size() != 0 ){
822         
823                 xTokenData = testJournal.xTokensData[0];
824                 
825         }
827         if (testJournal.xTokensData.size() != 0){
828         
829                 xTokenName = testJournal.xTokensDataTokens[0];
830                 
831         }
832         
833         ASSERT_EQ("Moo", xTokenData);
834         ASSERT_EQ("X-EXAMPLE1", xTokenName);
835         
836         // Get the second X-EXAMPLE1 token.
838         xTokenName.clear();
839         xTokenData.clear();
840         
841         if (testJournal.xTokensData.size() > 1){
842         
843                 xTokenData = testJournal.xTokensData[1];
844                 
845         }
847         if (testJournal.xTokensData.size() > 1){
848         
849                 xTokenName = testJournal.xTokensDataTokens[1];
850                 
851         }
852         
853         ASSERT_EQ("Meep", xTokenData);
854         ASSERT_EQ("X-EXAMPLE1;ANIMAL=NOPE", xTokenName);
855         
856         // Get the third X-EXAMPLE1 token.
858         xTokenName.clear();
859         xTokenData.clear();
860         
861         if (testJournal.xTokensData.size() > 2){
862         
863                 xTokenData = testJournal.xTokensData[2];
864                 
865         }
867         if (testJournal.xTokensData.size() > 2){
868         
869                 xTokenName = testJournal.xTokensDataTokens[2];
870                 
871         }
872         
873         ASSERT_EQ("Meow", xTokenData);
874         ASSERT_EQ("X-EXAMPLE1;ANIMAL=CAT", xTokenName);
875         
876         // Get the first X-EXAMPLE2 token.
877         
878         xTokenName.clear();
879         xTokenData.clear();
880         
881         if (testJournal.xTokensData.size() > 3){
882         
883                 xTokenData = testJournal.xTokensData[3];
884                 
885         }
887         if (testJournal.xTokensData.size() > 3){
888         
889                 xTokenName = testJournal.xTokensDataTokens[3];
890                 
891         }
892         
893         ASSERT_EQ("Dish", xTokenData);
894         ASSERT_EQ("X-EXAMPLE2", xTokenName);
895         
896         // Get the second X-EXAMPLE2 token.
897         
898         xTokenName.clear();
899         xTokenData.clear();
900         
901         if (testJournal.xTokensData.size() > 4){
902         
903                 xTokenData = testJournal.xTokensData[4];
904                 
905         }
907         if (testJournal.xTokensData.size() > 4){
908         
909                 xTokenName = testJournal.xTokensDataTokens[4];
910                 
911         }
912         
913         ASSERT_EQ("Fork", xTokenData);
914         ASSERT_EQ("X-EXAMPLE2;OBJECT=KITCHEN", xTokenName);
915         
916         // Get the third X-EXAMPLE2 token.
917         
918         xTokenName.clear();
919         xTokenData.clear();
920         
921         if (testJournal.xTokensData.size() > 5){
922         
923                 xTokenData = testJournal.xTokensData[5];
924                 
925         }
927         if (testJournal.xTokensData.size() > 5){
928         
929                 xTokenName = testJournal.xTokensDataTokens[5];
930                 
931         }
932         
933         ASSERT_EQ("Table", xTokenData);
934         ASSERT_EQ("X-EXAMPLE2;OBJECT=LIVINGROOM", xTokenName);
935         
936         // Get the X-STATUS token.
937         
938         xTokenName.clear();
939         xTokenData.clear();
940         
941         if (testJournal.xTokensData.size() > 6){
942         
943                 xTokenData = testJournal.xTokensData[6];
944                 
945         }
947         if (testJournal.xTokensData.size() > 6){
948         
949                 xTokenName = testJournal.xTokensDataTokens[6];
950                 
951         }
952         
953         ASSERT_EQ("Idle", xTokenData);
954         ASSERT_EQ("X-STATUS;HOLIDAY=YES", xTokenName);
955         
956         // Get the X-TRANSPORT token.
957         
958         xTokenName.clear();
959         xTokenData.clear();
960         
961         if (testJournal.xTokensData.size() > 7){
962         
963                 xTokenData = testJournal.xTokensData[7];
964                 
965         }
967         if (testJournal.xTokensData.size() > 7){
968         
969                 xTokenName = testJournal.xTokensDataTokens[7];
970                 
971         }
972         
973         ASSERT_EQ("Private Hire", xTokenData);
974         ASSERT_EQ("X-TRANSPORT;PUBLIC=NO", xTokenName);
975         
976         // Get the X-PHANTOM-STATUS token.
977         
978         xTokenName.clear();
979         xTokenData.clear();
980         
981         if (testJournal.xTokensData.size() > 8){
982         
983                 xTokenData = testJournal.xTokensData[8];
984                 
985         }
987         if (testJournal.xTokensData.size() > 8){
988         
989                 xTokenName = testJournal.xTokensDataTokens[8];
990                 
991         }
992         
993         ASSERT_EQ("None", xTokenData);
994         ASSERT_EQ("X-PHANTOM-STATUS;HELP=NONE", xTokenName);
995         
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