1 #include "../common/file.h"
2 #include "../common/text.h"
4 TEST(CommonFunctions, FileTests){
6 ASSERT_EQ(false, FileExists("iCalendarEvent-Missing.vcf"));
7 ASSERT_EQ(true, FileExists("iCalendarEvent-InvalidPermissions.vcf"));
11 TEST(CommonFunctions, ProcessTextVectorsTests){
13 // Setup the objects to be used for processing.
15 vector<string> TextPropertiesExample1;
16 vector<string> TextValueExample1;
17 multimap<string, string> TextExample1TestResult;
19 TextPropertiesExample1.push_back("ATTENDEE");
20 TextValueExample1.push_back("Example Attendee 1");
22 TextPropertiesExample1.push_back("ATTENDEE");
23 TextValueExample1.push_back("Example Attendee 2");
25 TextPropertiesExample1.push_back("ATTENDEE");
26 TextValueExample1.push_back("Example Attendee 3");
28 TextPropertiesExample1.push_back("CATEGORIES");
29 TextValueExample1.push_back("CATEGORY 1");
31 TextPropertiesExample1.push_back("CATEGORIES");
32 TextValueExample1.push_back("CATEGORY 2");
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.");
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");
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 TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 1"));
65 TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 2"));
66 TextExample1TestResult.insert(make_pair("ATTENDEE", "Example Attendee 3"));
68 ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "ATTENDEE"));
70 TextExample1TestResult.clear();
71 TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 1"));
72 TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 2"));
73 TextExample1TestResult.insert(make_pair("CATEGORIES", "CATEGORY 3"));
75 ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "CATEGORIES"));
77 TextExample1TestResult.clear();
78 TextExample1TestResult.insert(make_pair("COMMENT", "This is the first comment."));
79 TextExample1TestResult.insert(make_pair("COMMENT", "This is the second comment."));
80 TextExample1TestResult.insert(make_pair("COMMENT", "This is the third comment."));
82 ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "COMMENT"));
84 TextExample1TestResult.clear();
85 TextExample1TestResult.insert(make_pair("CONTACT;TEST=VALUE", "First Contact"));
86 TextExample1TestResult.insert(make_pair("CONTACT;LAZY=NOPE", "Second Contact"));
87 TextExample1TestResult.insert(make_pair("CONTACT;SETUP=NO", "Third Contact"));
89 ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "CONTACT"));
91 TextExample1TestResult.clear();
92 TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=YES", "First Resource Widget"));
93 TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=NO", "Second Resource Widget"));
94 TextExample1TestResult.insert(make_pair("RESOURCES;ROOM=UNKNOWN", "Third Resource Widget"));
96 ASSERT_EQ(TextExample1TestResult, ProcessTextVectors(&TextPropertiesExample1, &TextValueExample1, true, "RESOURCES"));