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