Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added test to check result on a single match for RELATED.
[xestiacalendar/.git] / source / tests / xestiacalendar_commonfunctions.h
1 #include "../common/file.h"
2 #include "../common/text.h"
4 TEST(CommonFunctions, FileTests){
5         
6         ASSERT_EQ(false, FileExists("iCalendarEvent-Missing.vcf"));
7         ASSERT_EQ(true, FileExists("iCalendarEvent-InvalidPermissions.vcf"));
8         
9 }
11 TEST(CommonFunctions, ProcessTextVectorsTests){
12         
13         // Setup the objects to be used for processing.
14         
15         vector<string> TextPropertiesExample1;
16         vector<string> TextValueExample1;
17         multimap<string, string> TextExample1TestResult;
18         
19         TextPropertiesExample1.push_back("ATTENDEE");
20         TextValueExample1.push_back("Example Attendee 1");
22         TextPropertiesExample1.push_back("ATTENDEE");
23         TextValueExample1.push_back("Example Attendee 2");
24         
25         TextPropertiesExample1.push_back("ATTENDEE");
26         TextValueExample1.push_back("Example Attendee 3");
27         
28         TextPropertiesExample1.push_back("CATEGORIES");
29         TextValueExample1.push_back("CATEGORY 1");
31         TextPropertiesExample1.push_back("CATEGORIES");
32         TextValueExample1.push_back("CATEGORY 2");
33         
34         TextPropertiesExample1.push_back("CATEGORIES");
35         TextValueExample1.push_back("CATEGORY 3");
37         TextPropertiesExample1.push_back("COMMENT");
38         TextValueExample1.push_back("This is the first comment.");
40         TextPropertiesExample1.push_back("COMMENT");
41         TextValueExample1.push_back("This is the second comment.");
42         
43         TextPropertiesExample1.push_back("COMMENT");
44         TextValueExample1.push_back("This is the third comment.");
46         TextPropertiesExample1.push_back("CONTACT;TEST=VALUE");
47         TextValueExample1.push_back("First Contact");
49         TextPropertiesExample1.push_back("CONTACT;LAZY=NOPE");
50         TextValueExample1.push_back("Second Contact");
52         TextPropertiesExample1.push_back("CONTACT;SETUP=NO");
53         TextValueExample1.push_back("Third Contact");
54         
55         TextPropertiesExample1.push_back("RESOURCES;ROOM=YES");
56         TextValueExample1.push_back("First Resource Widget");
58         TextPropertiesExample1.push_back("RESOURCES;ROOM=NO");
59         TextValueExample1.push_back("Second Resource Widget");
61         TextPropertiesExample1.push_back("RESOURCES;ROOM=UNKNOWN");
62         TextValueExample1.push_back("Third Resource Widget");
64         TextPropertiesExample1.push_back("RELATED;RELATION=NO");
65         TextValueExample1.push_back("First Relation");
67         TextPropertiesExample1.push_back("RELATED;RELATION=YES");
68         TextValueExample1.push_back("Second Relation");
70         TextPropertiesExample1.push_back("RELATED;RELATION=MAYBE");
71         TextValueExample1.push_back("Third Relation");
73         TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 1"));
74         TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 2"));
75         TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 3"));
76         
77         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "ATTENDEE"));
79         TextExample1TestResult.clear();
80         TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 1"));
82         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "ATTENDEE"));
84         TextExample1TestResult.clear();
85         TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 1"));
86         TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 2"));
87         TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 3"));
89         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "CATEGORIES"));
91         TextExample1TestResult.clear();
92         TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 1"));
94         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "CATEGORIES"));
96         TextExample1TestResult.clear();
97         TextExample1TestResult.insert(make_pair("COMMENT", "This is the first comment."));
98         TextExample1TestResult.insert(make_pair("COMMENT", "This is the second comment."));
99         TextExample1TestResult.insert(make_pair("COMMENT", "This is the third comment."));
100         
101         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "COMMENT"));
103         TextExample1TestResult.clear();
104         TextExample1TestResult.insert(make_pair("COMMENT", "This is the first comment."));
106         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "COMMENT"));
108         TextExample1TestResult.clear();
109         TextExample1TestResult.insert(make_pair("CONTACT;TEST=VALUE", "First Contact"));
110         TextExample1TestResult.insert(make_pair("CONTACT;LAZY=NOPE", "Second Contact"));
111         TextExample1TestResult.insert(make_pair("CONTACT;SETUP=NO", "Third Contact"));
112         
113         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "CONTACT"));
115         TextExample1TestResult.clear();
116         TextExample1TestResult.insert(make_pair("CONTACT;TEST=VALUE", "First Contact"));
118         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "CONTACT"));
120         TextExample1TestResult.clear();
121         TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=YES", "First Resource Widget"));
122         TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=NO", "Second Resource Widget"));
123         TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=UNKNOWN", "Third Resource Widget"));
125         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "RESOURCES"));
127         TextExample1TestResult.clear();
128         TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=YES", "First Resource Widget"));
130         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "RESOURCES"));
132         TextExample1TestResult.clear();
133         TextExample1TestResult.insert(make_pair("RELATED;RELATION=NO", "First Relation"));
134         TextExample1TestResult.insert(make_pair("RELATED;RELATION=YES", "Second Relation"));
135         TextExample1TestResult.insert(make_pair("RELATED;RELATION=MAYBE", "Third Relation"));
137         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "RELATED"));
139         TextExample1TestResult.clear();
140         TextExample1TestResult.insert(make_pair("RELATED;RELATION=NO", "First Relation"));
142         ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, false, "RELATED"));
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