1 // xestiaab_contactload.h - Xestia Address Book Contact Load Unit Tests.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book 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.
11 // Xestia Address Book 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.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include <gtest/gtest.h>
20 #include "../contacteditor/ContactDataObject.h"
22 TEST(ContactLoad, ContactLoadTests){
24 ContactDataObject TestFile;
26 // Check that the file given is not missing.
28 ASSERT_EQ(CONTACTLOAD_FILEMISSING, TestFile.LoadFile("MissingFile.vcf"));
30 // Check that the file given does not have an error when attempting to
33 ASSERT_EQ(CONTACTLOAD_FILEERROR, TestFile.LoadFile("InvalidPermissions.vcf"));
35 // Check that the file is a valid vCard 4.0 file.
37 ASSERT_EQ(CONTACTLOAD_FILEINVALIDFORMAT, TestFile.LoadFile("LoadCheck-Load1-v3.vcf"));
39 // Check that the vCard 4.0 file meets the base specification.
41 ASSERT_EQ(CONTACTLOAD_FILEBASESPECFAIL, TestFile.LoadFile("LoadCheck-Load3.vcf"));
43 // Check that the vCard 4.0 file loads OK.
45 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
47 // Check that the kind status has been set. (KIND).
49 ASSERT_NE(CONTACTKIND_NONE, TestFile.ContactKind);
50 ASSERT_EQ(CONTACTKIND_INDIVIDUAL, TestFile.ContactKind);
52 // Check that the groups have been read (MEMBER).
54 std::map<int,wxString>::iterator TestFileIter;
55 std::map<int,int>::iterator TestFileIntIter;
57 TestFileIter = TestFile.GroupsList.find(0);
59 ASSERT_NE(TestFile.GroupsList.end(), TestFileIter);
60 ASSERT_EQ("7a2af44d-6431-4797-a55f-d86d56304fda", TestFileIter->second);
62 // Check the ALTID parameter.
64 TestFileIter = TestFile.GroupsListAltID.find(0);
65 ASSERT_NE(TestFile.GroupsListAltID.end(), TestFileIter);
66 ASSERT_EQ("35", TestFileIter->second);
68 // Check the PID parameter.
70 TestFileIter = TestFile.GroupsListPID.find(0);
71 ASSERT_NE(TestFile.GroupsListPID.end(), TestFileIter);
72 ASSERT_EQ("40", TestFileIter->second);
74 // Check the PREF parameter.
76 TestFileIntIter = TestFile.GroupsListPref.find(0);
77 ASSERT_NE(TestFile.GroupsListPref.end(), TestFileIntIter);
78 ASSERT_EQ(45, TestFileIntIter->second);
80 // Check the MEDIATYPE parameter.
82 TestFileIter = TestFile.GroupsListMediaType.find(0);
83 ASSERT_NE(TestFile.GroupsListMediaType.end(), TestFileIter);
84 ASSERT_EQ("text/plain", TestFileIter->second);
86 // Check the extra tokens parameter.
88 TestFileIter = TestFile.GroupsListTokens.find(0);
89 ASSERT_NE(TestFile.GroupsListTokens.end(), TestFileIter);
90 ASSERT_EQ("EXAMPLE=Meep", TestFileIter->second);
92 // Check that the formatted name has been read (FN).
94 TestFileIter = TestFile.FullNamesList.find(0);
95 ASSERT_NE(TestFile.FullNamesList.end(), TestFileIter);
96 ASSERT_EQ("Test Contact", TestFileIter->second);
98 // Check the TYPE parameter.
100 TestFileIter = TestFile.FullNamesListType.find(0);
101 ASSERT_NE(TestFile.FullNamesListType.end(), TestFileIter);
102 ASSERT_EQ("work", TestFileIter->second);
104 // Check the LANGUAGE parameter.
106 TestFileIter = TestFile.FullNamesListLanguage.find(0);
107 ASSERT_NE(TestFile.FullNamesListLanguage.end(), TestFileIter);
108 ASSERT_EQ("kw", TestFileIter->second);
110 // Check the ALTID parameter.
112 TestFileIter = TestFile.FullNamesListAltID.find(0);
113 ASSERT_NE(TestFile.FullNamesListAltID.end(), TestFileIter);
114 ASSERT_EQ("500", TestFileIter->second);
116 // Check the PID parameter.
118 TestFileIter = TestFile.FullNamesListPID.find(0);
119 ASSERT_NE(TestFile.FullNamesListPID.end(), TestFileIter);
120 ASSERT_EQ("40", TestFileIter->second);
122 // Check the PREF parameter.
124 TestFileIntIter = TestFile.FullNamesListPref.find(0);
125 ASSERT_NE(TestFile.FullNamesListPref.end(), TestFileIntIter);
126 ASSERT_EQ(45, TestFileIntIter->second);
128 // Check for the extra tokens parameter.
130 TestFileIter = TestFile.FullNamesListTokens.find(0);
131 ASSERT_NE(TestFile.FullNamesListTokens.end(), TestFileIter);
132 ASSERT_EQ("EXAMPLE=Baaa", TestFileIter->second);
134 // Check that the name has been read (N).
136 ASSERT_EQ("Contact", TestFile.NameSurname);
137 ASSERT_EQ("Test", TestFile.NameForename);
138 ASSERT_EQ("Example", TestFile.NameOtherNames);
139 ASSERT_EQ("Robot", TestFile.NameTitle);
140 ASSERT_EQ("LOONY", TestFile.NameSuffix);
142 // Check the ALTID parameter.
144 ASSERT_EQ("3", TestFile.NameAltID);
146 // Check the LANGUAGE parameter.
148 ASSERT_EQ("kw", TestFile.NameLanguage);
150 // Check the SORT-AS parameter.
152 ASSERT_EQ("Contact,Test", TestFile.NameDisplayAs);
154 // Check the extra tokens parameter.
156 ASSERT_EQ("TEST=Yes", TestFile.NameTokens);
160 TEST(ContactLoad, NicknameTests){
162 ContactDataObject TestFile;
164 // Check that the vCard 4.0 file loads OK.
166 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
168 std::map<int,wxString>::iterator TestFileIter;
169 std::map<int,int>::iterator TestFileIntIter;
171 // Check that the nickname has been read (NICKNAME). General.
173 TestFileIter = TestFile.GeneralNicknamesList.find(0);
174 ASSERT_NE(TestFile.GeneralNicknamesList.end(), TestFileIter);
175 ASSERT_EQ("Tester", TestFileIter->second);
177 // Check the ALTID parameter.
179 TestFileIter = TestFile.GeneralNicknamesListAltID.find(0);
180 ASSERT_NE(TestFile.GeneralNicknamesListAltID.end(), TestFileIter);
181 ASSERT_EQ("35", TestFileIter->second);
183 // Check the PID parameter.
185 TestFileIter = TestFile.GeneralNicknamesListPID.find(0);
186 ASSERT_NE(TestFile.GeneralNicknamesListPID.end(), TestFileIter);
187 ASSERT_EQ("50", TestFileIter->second);
189 // Check the PREF parameter.
191 TestFileIntIter = TestFile.GeneralNicknamesListPref.find(0);
192 ASSERT_NE(TestFile.GeneralNicknamesListPref.end(), TestFileIntIter);
193 ASSERT_EQ(40, TestFileIntIter->second);
195 // Check the LANGUAGE parameter.
197 TestFileIter = TestFile.GeneralNicknamesListLanguage.find(0);
198 ASSERT_NE(TestFile.GeneralNicknamesListLanguage.end(), TestFileIter);
199 ASSERT_EQ("kw", TestFileIter->second);
201 // Check the extra tokens parameter.
203 TestFileIter = TestFile.GeneralNicknamesListTokens.find(0);
204 ASSERT_NE(TestFile.GeneralNicknamesListTokens.end(), TestFileIter);
205 ASSERT_EQ("YAY=Nope;Beep=Boop", TestFileIter->second);
207 // Repeat for the home type.
209 TestFileIter = TestFile.HomeNicknamesList.find(1);
210 ASSERT_NE(TestFile.HomeNicknamesList.end(), TestFileIter);
211 ASSERT_EQ("Testy", TestFileIter->second);
213 // Check the ALTID parameter.
215 TestFileIter = TestFile.HomeNicknamesListAltID.find(1);
216 ASSERT_NE(TestFile.HomeNicknamesListAltID.end(), TestFileIter);
217 ASSERT_EQ("17", TestFileIter->second);
219 // Check the PID parameter.
221 TestFileIter = TestFile.HomeNicknamesListPID.find(1);
222 ASSERT_NE(TestFile.HomeNicknamesListPID.end(), TestFileIter);
223 ASSERT_EQ("39", TestFileIter->second);
225 // Check the PREF parameter.
227 TestFileIntIter = TestFile.HomeNicknamesListPref.find(1);
228 ASSERT_NE(TestFile.HomeNicknamesListPref.end(), TestFileIntIter);
229 ASSERT_EQ(78, TestFileIntIter->second);
231 // Check the LANGUAGE parameter.
233 TestFileIter = TestFile.HomeNicknamesListLanguage.find(1);
234 ASSERT_NE(TestFile.HomeNicknamesListLanguage.end(), TestFileIter);
235 ASSERT_EQ("en", TestFileIter->second);
237 // Check the extra tokens parameter.
239 TestFileIter = TestFile.HomeNicknamesListTokens.find(1);
240 ASSERT_NE(TestFile.HomeNicknamesListTokens.end(), TestFileIter);
241 ASSERT_EQ("YAY=Yep;Beep=Boop", TestFileIter->second);
243 // Repeat for the work type.
245 TestFileIter = TestFile.BusinessNicknamesList.find(2);
246 ASSERT_NE(TestFile.BusinessNicknamesList.end(), TestFileIter);
247 ASSERT_EQ("The Testing One", TestFileIter->second);
249 // Check the ALTID parameter.
251 TestFileIter = TestFile.BusinessNicknamesListAltID.find(2);
252 ASSERT_NE(TestFile.BusinessNicknamesListAltID.end(), TestFileIter);
253 ASSERT_EQ("99", TestFileIter->second);
255 // Check the PID parameter.
257 TestFileIter = TestFile.BusinessNicknamesListPID.find(2);
258 ASSERT_NE(TestFile.BusinessNicknamesListPID.end(), TestFileIter);
259 ASSERT_EQ("10", TestFileIter->second);
261 // Check the PREF parameter.
263 TestFileIntIter = TestFile.BusinessNicknamesListPref.find(2);
264 ASSERT_NE(TestFile.BusinessNicknamesListPref.end(), TestFileIntIter);
265 ASSERT_EQ(1, TestFileIntIter->second);
267 // Check the LANGUAGE parameter.
269 TestFileIter = TestFile.BusinessNicknamesListLanguage.find(2);
270 ASSERT_NE(TestFile.BusinessNicknamesListLanguage.end(), TestFileIter);
271 ASSERT_EQ("en-GB", TestFileIter->second);
273 // Check the extra tokens parameter.
275 TestFileIter = TestFile.BusinessNicknamesListTokens.find(2);
276 ASSERT_NE(TestFile.BusinessNicknamesListTokens.end(), TestFileIter);
277 ASSERT_EQ("YAY=Maybe;Boop=Boing", TestFileIter->second);
281 TEST(ContactLoad, GenderTests){
283 // Check that the gender has been read.
285 ContactDataObject TestFile;
287 // Check that the vCard 4.0 file loads OK.
289 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
291 std::map<int,wxString>::iterator TestFileIter;
292 std::map<int,int>::iterator TestFileIntIter;
294 ASSERT_NE("", TestFile.Gender);
295 ASSERT_EQ("F", TestFile.Gender);
296 ASSERT_EQ("Example Text", TestFile.GenderDetails);
297 ASSERT_EQ("BEEP=Boop", TestFile.GenderTokens);
301 TEST(ContactLoad, BirthdayTests){
303 // Check that the birthday has been read.
305 ContactDataObject TestFile;
307 // Check that the vCard 4.0 file loads OK.
309 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
311 std::map<int,wxString>::iterator TestFileIter;
312 std::map<int,int>::iterator TestFileIntIter;
314 ASSERT_NE("", TestFile.Birthday);
315 ASSERT_EQ("20040101", TestFile.Birthday);
317 // Check the ALTID parameter.
319 ASSERT_EQ("35", TestFile.BirthdayAltID);
321 // Check the CALSCALE parameter.
323 ASSERT_EQ("georgian", TestFile.BirthdayCalScale);
325 // Check the extra tokens parameter.
327 ASSERT_EQ("HAPPY=Days", TestFile.BirthdayTokens);
329 // Check the VALUE parameter. (Note have to use a different file
330 // due to the *1 rule in RFC6350.
332 ContactDataObject TestFileValue;
333 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf"));
335 ASSERT_EQ("Circa 2000s", TestFile.Birthday);
339 TEST(ContactLoad, AnniversaryTests){
341 // Check that the anniversary has been read.
343 ContactDataObject TestFile;
345 // Check that the vCard 4.0 file loads OK.
347 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
349 std::map<int,wxString>::iterator TestFileIter;
350 std::map<int,int>::iterator TestFileIntIter;
352 ASSERT_NE("", TestFile.Anniversary);
353 ASSERT_EQ("20200516", TestFile.Anniversary);
355 // Check the ALTID parameter.
357 ASSERT_EQ("70", TestFile.AnniversaryAltID);
359 // Check the CALSCALE parameter.
361 ASSERT_EQ("georgian", TestFile.AnniversaryCalScale);
363 // Check the extra tokens parameter.
365 ASSERT_EQ("WONDERFUL=Day", TestFile.AnniversaryTokens);
367 // Check the VALUE parameter. (Note have to use a different file
368 // due to the *1 rule in RFC6350.
370 ContactDataObject TestFileValue;
371 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4-BDayValue.vcf"));
373 ASSERT_EQ("Circa 2020s", TestFile.Anniversary);
377 TEST(ContactLoad, TimeZoneTests){
379 ContactDataObject TestFile;
381 // Check that the vCard 4.0 file loads OK.
383 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
385 std::map<int,wxString>::iterator TestFileIter;
386 std::map<int,int>::iterator TestFileIntIter;
388 // Check that the timezone has been read (TZ). General.
390 TestFileIter = TestFile.GeneralTZList.find(0);
391 ASSERT_NE(TestFile.GeneralTZList.end(), TestFileIter);
392 ASSERT_EQ("Europe/Truro", TestFileIter->second);
394 // Check the ALTID parameter.
396 TestFileIter = TestFile.GeneralTZListAltID.find(0);
397 ASSERT_NE(TestFile.GeneralTZListAltID.end(), TestFileIter);
398 ASSERT_EQ("35", TestFileIter->second);
400 // Check the PID parameter.
402 TestFileIter = TestFile.GeneralTZListPID.find(0);
403 ASSERT_NE(TestFile.GeneralTZListPID.end(), TestFileIter);
404 ASSERT_EQ("60", TestFileIter->second);
406 // Check the PREF parameter.
408 TestFileIntIter = TestFile.GeneralTZListPref.find(0);
409 ASSERT_NE(TestFile.GeneralTZListPref.end(), TestFileIntIter);
410 ASSERT_EQ(20, TestFileIntIter->second);
412 // Check the LANGUAGE parameter.
414 TestFileIter = TestFile.GeneralTZListMediatype.find(0);
415 ASSERT_NE(TestFile.GeneralTZListMediatype.end(), TestFileIter);
416 ASSERT_EQ("text/plain", TestFileIter->second);
418 // Check the extra tokens parameter.
420 TestFileIter = TestFile.GeneralTZListTokens.find(0);
421 ASSERT_NE(TestFile.GeneralTZListTokens.end(), TestFileIter);
422 ASSERT_EQ("WHATS=This;A=Potato", TestFileIter->second);
424 // Check that the timezone has been read (TZ). Home.
426 TestFileIter = TestFile.HomeTZList.find(1);
427 ASSERT_NE(TestFile.HomeTZList.end(), TestFileIter);
428 ASSERT_EQ("Europe/Penzance", TestFileIter->second);
430 // Check the ALTID parameter.
432 TestFileIter = TestFile.HomeTZListAltID.find(1);
433 ASSERT_NE(TestFile.HomeTZListAltID.end(), TestFileIter);
434 ASSERT_EQ("15", TestFileIter->second);
436 // Check the PID parameter.
438 TestFileIter = TestFile.HomeTZListPID.find(1);
439 ASSERT_NE(TestFile.HomeTZListPID.end(), TestFileIter);
440 ASSERT_EQ("20", TestFileIter->second);
442 // Check the PREF parameter.
444 TestFileIntIter = TestFile.HomeTZListPref.find(1);
445 ASSERT_NE(TestFile.HomeTZListPref.end(), TestFileIntIter);
446 ASSERT_EQ(40, TestFileIntIter->second);
448 // Check the LANGUAGE parameter.
450 TestFileIter = TestFile.HomeTZListMediatype.find(1);
451 ASSERT_NE(TestFile.HomeTZListMediatype.end(), TestFileIter);
452 ASSERT_EQ("text/plain", TestFileIter->second);
454 // Check the extra tokens parameter.
456 TestFileIter = TestFile.HomeTZListTokens.find(1);
457 ASSERT_NE(TestFile.HomeTZListTokens.end(), TestFileIter);
458 ASSERT_EQ("MAYBE=not", TestFileIter->second);
460 // Check that the timezone has been read (TZ). Business.
462 TestFileIter = TestFile.BusinessTZList.find(2);
463 ASSERT_NE(TestFile.BusinessTZList.end(), TestFileIter);
464 ASSERT_EQ("Europe/St Austell", TestFileIter->second);
466 // Check the ALTID parameter.
468 TestFileIter = TestFile.BusinessTZListAltID.find(2);
469 ASSERT_NE(TestFile.BusinessTZListAltID.end(), TestFileIter);
470 ASSERT_EQ("45", TestFileIter->second);
472 // Check the PID parameter.
474 TestFileIter = TestFile.BusinessTZListPID.find(2);
475 ASSERT_NE(TestFile.BusinessTZListPID.end(), TestFileIter);
476 ASSERT_EQ("70", TestFileIter->second);
478 // Check the PREF parameter.
480 TestFileIntIter = TestFile.BusinessTZListPref.find(2);
481 ASSERT_NE(TestFile.BusinessTZListPref.end(), TestFileIntIter);
482 ASSERT_EQ(80, TestFileIntIter->second);
484 // Check the LANGUAGE parameter.
486 TestFileIter = TestFile.BusinessTZListMediatype.find(2);
487 ASSERT_NE(TestFile.BusinessTZListMediatype.end(), TestFileIter);
488 ASSERT_EQ("text/plain", TestFileIter->second);
490 // Check the extra tokens parameter.
492 TestFileIter = TestFile.BusinessTZListTokens.find(2);
493 ASSERT_NE(TestFile.BusinessTZListTokens.end(), TestFileIter);
494 ASSERT_EQ("MAYBE=yes", TestFileIter->second);
498 TEST(ContactLoad, AddressTests){
500 ContactDataObject TestFile;
502 // Check that the vCard 4.0 file loads OK.
504 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
506 std::map<int,wxString>::iterator TestFileIter;
507 std::map<int,int>::iterator TestFileIntIter;
509 // Start with the general address.
511 // Check the address street section.
513 TestFileIter = TestFile.GeneralAddressList.find(0);
514 ASSERT_NE(TestFile.GeneralAddressList.end(), TestFileIter);
515 ASSERT_EQ("1 Lovely Lane", TestFileIter->second);
517 // Check the address town section.
519 TestFileIter = TestFile.GeneralAddressListTown.find(0);
520 ASSERT_NE(TestFile.GeneralAddressListTown.end(), TestFileIter);
521 ASSERT_EQ("Rodney", TestFileIter->second);
523 // Check the address county section.
525 TestFileIter = TestFile.GeneralAddressListCounty.find(0);
526 ASSERT_NE(TestFile.GeneralAddressListCounty.end(), TestFileIter);
527 ASSERT_EQ("Cornwall", TestFileIter->second);
529 // Check the address post code section.
531 TestFileIter = TestFile.GeneralAddressListPostCode.find(0);
532 ASSERT_NE(TestFile.GeneralAddressListPostCode.end(), TestFileIter);
533 ASSERT_EQ("PL99 1AA", TestFileIter->second);
535 // Check the address country section.
537 TestFileIter = TestFile.GeneralAddressListCountry.find(0);
538 ASSERT_NE(TestFile.GeneralAddressListCountry.end(), TestFileIter);
539 ASSERT_EQ("United Kingdom", TestFileIter->second);
541 // Check the LABEL section.
543 TestFileIter = TestFile.GeneralAddressListLabel.find(0);
544 ASSERT_NE(TestFile.GeneralAddressListLabel.end(), TestFileIter);
545 ASSERT_EQ("\"1 Lovely Lane\nRodney\nCornwall\nPL99 1AA\nCornwall\nUnited Kingdom\"", TestFileIter->second);
547 // Check the LANGUAGE section.
549 TestFileIter = TestFile.GeneralAddressListLang.find(0);
550 ASSERT_NE(TestFile.GeneralAddressListLang.end(), TestFileIter);
551 ASSERT_EQ("kw", TestFileIter->second);
553 // Check the ALTID section.
555 TestFileIter = TestFile.GeneralAddressListAltID.find(0);
556 ASSERT_NE(TestFile.GeneralAddressListAltID.end(), TestFileIter);
557 ASSERT_EQ("15", TestFileIter->second);
559 // Check the PID section.
561 TestFileIter = TestFile.GeneralAddressListPID.find(0);
562 ASSERT_NE(TestFile.GeneralAddressListPID.end(), TestFileIter);
563 ASSERT_EQ("81", TestFileIter->second);
565 // Check the GEO section.
567 TestFileIter = TestFile.GeneralAddressListGeo.find(0);
568 ASSERT_NE(TestFile.GeneralAddressListGeo.end(), TestFileIter);
569 ASSERT_EQ("\"geo:1.0, 1.0\"", TestFileIter->second);
571 // Check the TZ section.
573 TestFileIter = TestFile.GeneralAddressListTimezone.find(0);
574 ASSERT_NE(TestFile.GeneralAddressListTimezone.end(), TestFileIter);
575 ASSERT_EQ("Europe/Truro", TestFileIter->second);
577 // Check the MEDIATYPE section.
579 TestFileIter = TestFile.GeneralAddressListMediatype.find(0);
580 ASSERT_NE(TestFile.GeneralAddressListMediatype.end(), TestFileIter);
581 ASSERT_EQ("text/plain", TestFileIter->second);
583 // Check the PREF section.
585 TestFileIntIter = TestFile.GeneralAddressListPref.find(0);
586 ASSERT_NE(TestFile.GeneralAddressListPref.end(), TestFileIntIter);
587 ASSERT_EQ(98, TestFileIntIter->second);
589 // Check the extra tokens.
591 TestFileIter = TestFile.GeneralAddressListTokens.find(0);
592 ASSERT_NE(TestFile.GeneralAddressListTokens.end(), TestFileIter);
593 ASSERT_EQ("MAKES=Moo;ANIMAL=Cow", TestFileIter->second);
595 // Process the home address
597 // Check the address street section.
599 TestFileIter = TestFile.HomeAddressList.find(1);
600 ASSERT_NE(TestFile.HomeAddressList.end(), TestFileIter);
601 ASSERT_EQ("3 Working Plaice", TestFileIter->second);
603 // Check the address town section.
605 TestFileIter = TestFile.HomeAddressListTown.find(1);
606 ASSERT_NE(TestFile.HomeAddressListTown.end(), TestFileIter);
607 ASSERT_EQ("Roger", TestFileIter->second);
609 // Check the address county section.
611 TestFileIter = TestFile.HomeAddressListCounty.find(1);
612 ASSERT_NE(TestFile.HomeAddressListCounty.end(), TestFileIter);
613 ASSERT_EQ("Cornwall", TestFileIter->second);
615 // Check the address post code section.
617 TestFileIter = TestFile.HomeAddressListPostCode.find(1);
618 ASSERT_NE(TestFile.HomeAddressListPostCode.end(), TestFileIter);
619 ASSERT_EQ("PL75 4ZZ", TestFileIter->second);
621 // Check the address country section.
623 TestFileIter = TestFile.HomeAddressListCountry.find(1);
624 ASSERT_NE(TestFile.HomeAddressListCountry.end(), TestFileIter);
625 ASSERT_EQ("United Kingdom", TestFileIter->second);
627 // Check the LABEL section.
629 TestFileIter = TestFile.HomeAddressListLabel.find(1);
630 ASSERT_NE(TestFile.HomeAddressListLabel.end(), TestFileIter);
631 ASSERT_EQ("\"3 Working Plaice\nRoger\nCornwall\nPL75 4ZZ\nCornwall\nUnited Kingdom\"", TestFileIter->second);
633 // Check the LANGUAGE section.
635 TestFileIter = TestFile.HomeAddressListLang.find(1);
636 ASSERT_NE(TestFile.HomeAddressListLang.end(), TestFileIter);
637 ASSERT_EQ("en", TestFileIter->second);
639 // Check the ALTID section.
641 TestFileIter = TestFile.HomeAddressListAltID.find(1);
642 ASSERT_NE(TestFile.HomeAddressListAltID.end(), TestFileIter);
643 ASSERT_EQ("40", TestFileIter->second);
645 // Check the PID section.
647 TestFileIter = TestFile.HomeAddressListPID.find(1);
648 ASSERT_NE(TestFile.HomeAddressListPID.end(), TestFileIter);
649 ASSERT_EQ("13", TestFileIter->second);
651 // Check the GEO section.
653 TestFileIter = TestFile.HomeAddressListGeo.find(1);
654 ASSERT_NE(TestFile.HomeAddressListGeo.end(), TestFileIter);
655 ASSERT_EQ("\"geo:4.0, 4.0\"", TestFileIter->second);
657 // Check the TZ section.
659 TestFileIter = TestFile.HomeAddressListTimezone.find(1);
660 ASSERT_NE(TestFile.HomeAddressListTimezone.end(), TestFileIter);
661 ASSERT_EQ("Europe/St Ives", TestFileIter->second);
663 // Check the MEDIATYPE section.
665 TestFileIter = TestFile.HomeAddressListMediatype.find(1);
666 ASSERT_NE(TestFile.HomeAddressListMediatype.end(), TestFileIter);
667 ASSERT_EQ("text/plain", TestFileIter->second);
669 // Check the PREF section.
671 TestFileIntIter = TestFile.HomeAddressListPref.find(1);
672 ASSERT_NE(TestFile.HomeAddressListPref.end(), TestFileIntIter);
673 ASSERT_EQ(10, TestFileIntIter->second);
675 // Check the extra tokens.
677 TestFileIter = TestFile.HomeAddressListTokens.find(1);
678 ASSERT_NE(TestFile.HomeAddressListTokens.end(), TestFileIter);
679 ASSERT_EQ("TOAST=Butter", TestFileIter->second);
681 // Process the business address.
683 // Check the address street section.
685 TestFileIter = TestFile.BusinessAddressList.find(2);
686 ASSERT_NE(TestFile.BusinessAddressList.end(), TestFileIter);
687 ASSERT_EQ("7 Flyby Drive", TestFileIter->second);
689 // Check the address town section.
691 TestFileIter = TestFile.BusinessAddressListTown.find(2);
692 ASSERT_NE(TestFile.BusinessAddressListTown.end(), TestFileIter);
693 ASSERT_EQ("Elaine", TestFileIter->second);
695 // Check the address county section.
697 TestFileIter = TestFile.BusinessAddressListCounty.find(2);
698 ASSERT_NE(TestFile.BusinessAddressListCounty.end(), TestFileIter);
699 ASSERT_EQ("Cornwall", TestFileIter->second);
701 // Check the address post code section.
703 TestFileIter = TestFile.BusinessAddressListPostCode.find(2);
704 ASSERT_NE(TestFile.BusinessAddressListPostCode.end(), TestFileIter);
705 ASSERT_EQ("PL84 9YE", TestFileIter->second);
707 // Check the address country section.
709 TestFileIter = TestFile.BusinessAddressListCountry.find(2);
710 ASSERT_NE(TestFile.BusinessAddressListCountry.end(), TestFileIter);
711 ASSERT_EQ("United Kingdom", TestFileIter->second);
713 // Check the LABEL section.
715 TestFileIter = TestFile.BusinessAddressListLabel.find(2);
716 ASSERT_NE(TestFile.BusinessAddressListLabel.end(), TestFileIter);
717 ASSERT_EQ("\"7 Flyby Drive\nElaine\nCornwall\nPL84 9YE\nCornwall\nUnited Kingdom\"", TestFileIter->second);
719 // Check the LANGUAGE section.
721 TestFileIter = TestFile.BusinessAddressListLang.find(2);
722 ASSERT_NE(TestFile.BusinessAddressListLang.end(), TestFileIter);
723 ASSERT_EQ("en-GB", TestFileIter->second);
725 // Check the ALTID section.
727 TestFileIter = TestFile.BusinessAddressListAltID.find(2);
728 ASSERT_NE(TestFile.BusinessAddressListAltID.end(), TestFileIter);
729 ASSERT_EQ("45", TestFileIter->second);
731 // Check the PID section.
733 TestFileIter = TestFile.BusinessAddressListPID.find(2);
734 ASSERT_NE(TestFile.BusinessAddressListPID.end(), TestFileIter);
735 ASSERT_EQ("28", TestFileIter->second);
737 // Check the GEO section.
739 TestFileIter = TestFile.BusinessAddressListGeo.find(2);
740 ASSERT_NE(TestFile.BusinessAddressListGeo.end(), TestFileIter);
741 ASSERT_EQ("\"geo:7.0, 7.0\"", TestFileIter->second);
743 // Check the TZ section.
745 TestFileIter = TestFile.BusinessAddressListTimezone.find(2);
746 ASSERT_NE(TestFile.BusinessAddressListTimezone.end(), TestFileIter);
747 ASSERT_EQ("Europe/Newquay", TestFileIter->second);
749 // Check the MEDIATYPE section.
751 TestFileIter = TestFile.BusinessAddressListMediatype.find(2);
752 ASSERT_NE(TestFile.BusinessAddressListMediatype.end(), TestFileIter);
753 ASSERT_EQ("text/plain", TestFileIter->second);
755 // Check the PREF section.
757 TestFileIntIter = TestFile.BusinessAddressListPref.find(2);
758 ASSERT_NE(TestFile.BusinessAddressListPref.end(), TestFileIntIter);
759 ASSERT_EQ(10, TestFileIntIter->second);
761 // Check the extra tokens.
763 TestFileIter = TestFile.BusinessAddressListTokens.find(2);
764 ASSERT_NE(TestFile.BusinessAddressListTokens.end(), TestFileIter);
765 ASSERT_EQ("JAM=Red", TestFileIter->second);
770 TEST(ContactLoad, EmailTests){
772 ContactDataObject TestFile;
774 // Check that the vCard 4.0 file loads OK.
776 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
778 std::map<int,wxString>::iterator TestFileIter;
779 std::map<int,int>::iterator TestFileIntIter;
781 // Start with the general email.
783 TestFileIter = TestFile.GeneralEmailList.find(0);
784 ASSERT_NE(TestFile.GeneralEmailList.end(), TestFileIter);
785 ASSERT_EQ("moo@example.com", TestFileIter->second);
787 // Check the ALTID section.
789 TestFileIter = TestFile.GeneralEmailListAltID.find(0);
790 ASSERT_NE(TestFile.GeneralEmailListAltID.end(), TestFileIter);
791 ASSERT_EQ("10", TestFileIter->second);
793 // Check the PID section.
795 TestFileIter = TestFile.GeneralEmailListPID.find(0);
796 ASSERT_NE(TestFile.GeneralEmailListPID.end(), TestFileIter);
797 ASSERT_EQ("20", TestFileIter->second);
799 // Check the PREF section.
801 TestFileIntIter = TestFile.GeneralEmailListPref.find(0);
802 ASSERT_NE(TestFile.GeneralEmailListPref.end(), TestFileIntIter);
803 ASSERT_EQ(40, TestFileIntIter->second);
805 // Check the extra tokens.
807 TestFileIter = TestFile.GeneralEmailListTokens.find(0);
808 ASSERT_NE(TestFile.GeneralEmailListTokens.end(), TestFileIter);
809 ASSERT_EQ("WONDERFUL=Colour", TestFileIter->second);
811 // Start with the home email.
813 TestFileIter = TestFile.HomeEmailList.find(1);
814 ASSERT_NE(TestFile.HomeEmailList.end(), TestFileIter);
815 ASSERT_EQ("moo.home@example.com", TestFileIter->second);
817 // Check the ALTID section.
819 TestFileIter = TestFile.HomeEmailListAltID.find(1);
820 ASSERT_NE(TestFile.HomeEmailListAltID.end(), TestFileIter);
821 ASSERT_EQ("5", TestFileIter->second);
823 // Check the PID section.
825 TestFileIter = TestFile.HomeEmailListPID.find(1);
826 ASSERT_NE(TestFile.HomeEmailListPID.end(), TestFileIter);
827 ASSERT_EQ("10", TestFileIter->second);
829 // Check the PREF section.
831 TestFileIntIter = TestFile.HomeEmailListPref.find(1);
832 ASSERT_NE(TestFile.HomeEmailListPref.end(), TestFileIntIter);
833 ASSERT_EQ(20, TestFileIntIter->second);
835 // Check the extra tokens.
837 TestFileIter = TestFile.HomeEmailListTokens.find(1);
838 ASSERT_NE(TestFile.HomeEmailListTokens.end(), TestFileIter);
839 ASSERT_EQ("PEACE=quiet", TestFileIter->second);
841 // Start with the business email.
843 TestFileIter = TestFile.BusinessEmailList.find(2);
844 ASSERT_NE(TestFile.BusinessEmailList.end(), TestFileIter);
845 ASSERT_EQ("moo.business@example.com", TestFileIter->second);
847 // Check the ALTID section.
849 TestFileIter = TestFile.BusinessEmailListAltID.find(2);
850 ASSERT_NE(TestFile.BusinessEmailListAltID.end(), TestFileIter);
851 ASSERT_EQ("1", TestFileIter->second);
853 // Check the PID section.
855 TestFileIter = TestFile.BusinessEmailListPID.find(2);
856 ASSERT_NE(TestFile.BusinessEmailListPID.end(), TestFileIter);
857 ASSERT_EQ("2", TestFileIter->second);
859 // Check the PREF section.
861 TestFileIntIter = TestFile.BusinessEmailListPref.find(2);
862 ASSERT_NE(TestFile.BusinessEmailListPref.end(), TestFileIntIter);
863 ASSERT_EQ(3, TestFileIntIter->second);
865 // Check the extra tokens.
867 TestFileIter = TestFile.BusinessEmailListTokens.find(2);
868 ASSERT_NE(TestFile.BusinessEmailListTokens.end(), TestFileIter);
869 ASSERT_EQ("BUSINESS=Money", TestFileIter->second);
873 TEST(ContactLoad, IMTests){
875 ContactDataObject TestFile;
877 // Check that the vCard 4.0 file loads OK.
879 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
881 std::map<int,wxString>::iterator TestFileIter;
882 std::map<int,int>::iterator TestFileIntIter;
884 // Start with the general IM.
886 TestFileIter = TestFile.GeneralIMList.find(0);
887 ASSERT_NE(TestFile.GeneralIMList.end(), TestFileIter);
888 ASSERT_EQ("moo@example.com", TestFileIter->second);
890 // Check the ALTID section.
892 TestFileIter = TestFile.GeneralIMListAltID.find(0);
893 ASSERT_NE(TestFile.GeneralIMListAltID.end(), TestFileIter);
894 ASSERT_EQ("10", TestFileIter->second);
896 // Check the PID section.
898 TestFileIter = TestFile.GeneralIMListPID.find(0);
899 ASSERT_NE(TestFile.GeneralIMListPID.end(), TestFileIter);
900 ASSERT_EQ("20", TestFileIter->second);
902 // Check the MEDIATYPE section.
904 TestFileIter = TestFile.GeneralIMListMediatype.find(0);
905 ASSERT_NE(TestFile.GeneralIMListMediatype.end(), TestFileIter);
906 ASSERT_EQ("text/plain", TestFileIter->second);
908 // Check the PREF section.
910 TestFileIntIter = TestFile.GeneralIMListPref.find(0);
911 ASSERT_NE(TestFile.GeneralIMListPref.end(), TestFileIntIter);
912 ASSERT_EQ(40, TestFileIntIter->second);
914 // Check the extra tokens.
916 TestFileIter = TestFile.GeneralIMListTokens.find(0);
917 ASSERT_NE(TestFile.GeneralIMListTokens.end(), TestFileIter);
918 ASSERT_EQ("WONDERFUL=Colour", TestFileIter->second);
920 // Start with the home IM.
922 TestFileIter = TestFile.HomeIMList.find(1);
923 ASSERT_NE(TestFile.HomeIMList.end(), TestFileIter);
924 ASSERT_EQ("moo.home@example.com", TestFileIter->second);
926 // Check the ALTID section.
928 TestFileIter = TestFile.HomeIMListAltID.find(1);
929 ASSERT_NE(TestFile.HomeIMListAltID.end(), TestFileIter);
930 ASSERT_EQ("20", TestFileIter->second);
932 // Check the PID section.
934 TestFileIter = TestFile.HomeIMListPID.find(1);
935 ASSERT_NE(TestFile.HomeIMListPID.end(), TestFileIter);
936 ASSERT_EQ("40", TestFileIter->second);
938 // Check the MEDIATYPE section.
940 TestFileIter = TestFile.HomeIMListMediatype.find(1);
941 ASSERT_NE(TestFile.HomeIMListMediatype.end(), TestFileIter);
942 ASSERT_EQ("text/reallyplain", TestFileIter->second);
944 // Check the PREF section.
946 TestFileIntIter = TestFile.HomeIMListPref.find(1);
947 ASSERT_NE(TestFile.HomeIMListPref.end(), TestFileIntIter);
948 ASSERT_EQ(80, TestFileIntIter->second);
950 // Check the extra tokens.
952 TestFileIter = TestFile.HomeIMListTokens.find(1);
953 ASSERT_NE(TestFile.HomeIMListTokens.end(), TestFileIter);
954 ASSERT_EQ("PEACE=quiet", TestFileIter->second);
956 // Start with the business IM.
958 TestFileIter = TestFile.BusinessIMList.find(2);
959 ASSERT_NE(TestFile.BusinessIMList.end(), TestFileIter);
960 ASSERT_EQ("moo.business@example.com", TestFileIter->second);
962 // Check the ALTID section.
964 TestFileIter = TestFile.BusinessIMListAltID.find(2);
965 ASSERT_NE(TestFile.BusinessIMListAltID.end(), TestFileIter);
966 ASSERT_EQ("98", TestFileIter->second);
968 // Check the PID section.
970 TestFileIter = TestFile.BusinessIMListPID.find(2);
971 ASSERT_NE(TestFile.BusinessIMListPID.end(), TestFileIter);
972 ASSERT_EQ("99", TestFileIter->second);
974 // Check the MEDIATYPE section.
976 TestFileIter = TestFile.BusinessIMListMediatype.find(2);
977 ASSERT_NE(TestFile.BusinessIMListMediatype.end(), TestFileIter);
978 ASSERT_EQ("text/superplain", TestFileIter->second);
980 // Check the PREF section.
982 TestFileIntIter = TestFile.BusinessIMListPref.find(2);
983 ASSERT_NE(TestFile.BusinessIMListPref.end(), TestFileIntIter);
984 ASSERT_EQ(50, TestFileIntIter->second);
986 // Check the extra tokens.
988 TestFileIter = TestFile.BusinessIMListTokens.find(2);
989 ASSERT_NE(TestFile.BusinessIMListTokens.end(), TestFileIter);
990 ASSERT_EQ("BUSINESS=Money", TestFileIter->second);
994 TEST(ContactLoad, TelephoneTests){
996 ContactDataObject TestFile;
998 // Check that the vCard 4.0 file loads OK.
1000 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1002 std::map<int,wxString>::iterator TestFileIter;
1003 std::map<int,int>::iterator TestFileIntIter;
1005 // Start with the general Telephone.
1007 TestFileIter = TestFile.GeneralTelephoneList.find(0);
1008 ASSERT_NE(TestFile.GeneralTelephoneList.end(), TestFileIter);
1009 ASSERT_EQ("tel:00000000", TestFileIter->second);
1011 // Check the type section.
1013 TestFileIter = TestFile.GeneralTelephoneListTypeInfo.find(0);
1014 ASSERT_NE(TestFile.GeneralTelephoneListTypeInfo.end(), TestFileIter);
1015 ASSERT_EQ("fax,mobile", TestFileIter->second);
1017 // Check the ALTID section.
1019 TestFileIter = TestFile.GeneralTelephoneListAltID.find(0);
1020 ASSERT_NE(TestFile.GeneralTelephoneListAltID.end(), TestFileIter);
1021 ASSERT_EQ("10", TestFileIter->second);
1023 // Check the PID section.
1025 TestFileIter = TestFile.GeneralTelephoneListPID.find(0);
1026 ASSERT_NE(TestFile.GeneralTelephoneListPID.end(), TestFileIter);
1027 ASSERT_EQ("20", TestFileIter->second);
1029 // Check the PREF section.
1031 TestFileIntIter = TestFile.GeneralTelephoneListPref.find(0);
1032 ASSERT_NE(TestFile.GeneralTelephoneListPref.end(), TestFileIntIter);
1033 ASSERT_EQ(40, TestFileIntIter->second);
1035 // Check the extra tokens.
1037 TestFileIter = TestFile.GeneralTelephoneListTokens.find(0);
1038 ASSERT_NE(TestFile.GeneralTelephoneListTokens.end(), TestFileIter);
1039 ASSERT_EQ("WONDERFUL=Colour", TestFileIter->second);
1041 // Start with the home Telephone.
1043 TestFileIter = TestFile.HomeTelephoneList.find(1);
1044 ASSERT_NE(TestFile.HomeTelephoneList.end(), TestFileIter);
1045 ASSERT_EQ("tel:00001111", TestFileIter->second);
1047 // Check the type section.
1049 TestFileIter = TestFile.HomeTelephoneListTypeInfo.find(1);
1050 ASSERT_NE(TestFile.HomeTelephoneListTypeInfo.end(), TestFileIter);
1051 ASSERT_EQ("fax", TestFileIter->second);
1053 // Check the ALTID section.
1055 TestFileIter = TestFile.HomeTelephoneListAltID.find(1);
1056 ASSERT_NE(TestFile.HomeTelephoneListAltID.end(), TestFileIter);
1057 ASSERT_EQ("10", TestFileIter->second);
1059 // Check the PID section.
1061 TestFileIter = TestFile.HomeTelephoneListPID.find(1);
1062 ASSERT_NE(TestFile.HomeTelephoneListPID.end(), TestFileIter);
1063 ASSERT_EQ("20", TestFileIter->second);
1065 // Check the PREF section.
1067 TestFileIntIter = TestFile.HomeTelephoneListPref.find(1);
1068 ASSERT_NE(TestFile.HomeTelephoneListPref.end(), TestFileIntIter);
1069 ASSERT_EQ(40, TestFileIntIter->second);
1071 // Check the extra tokens.
1073 TestFileIter = TestFile.HomeTelephoneListTokens.find(1);
1074 ASSERT_NE(TestFile.HomeTelephoneListTokens.end(), TestFileIter);
1075 ASSERT_EQ("BUSINESS=Money", TestFileIter->second);
1077 // Start with the business Telephone.
1079 TestFileIter = TestFile.BusinessTelephoneList.find(2);
1080 ASSERT_NE(TestFile.BusinessTelephoneList.end(), TestFileIter);
1081 ASSERT_EQ("tel:22221111", TestFileIter->second);
1083 // Check the type section.
1085 TestFileIter = TestFile.BusinessTelephoneListTypeInfo.find(2);
1086 ASSERT_NE(TestFile.BusinessTelephoneListTypeInfo.end(), TestFileIter);
1087 ASSERT_EQ("voice", TestFileIter->second);
1089 // Check the ALTID section.
1091 TestFileIter = TestFile.BusinessTelephoneListAltID.find(2);
1092 ASSERT_NE(TestFile.BusinessTelephoneListAltID.end(), TestFileIter);
1093 ASSERT_EQ("25", TestFileIter->second);
1095 // Check the PID section.
1097 TestFileIter = TestFile.BusinessTelephoneListPID.find(2);
1098 ASSERT_NE(TestFile.BusinessTelephoneListPID.end(), TestFileIter);
1099 ASSERT_EQ("50", TestFileIter->second);
1101 // Check the PREF section.
1103 TestFileIntIter = TestFile.BusinessTelephoneListPref.find(2);
1104 ASSERT_NE(TestFile.BusinessTelephoneListPref.end(), TestFileIntIter);
1105 ASSERT_EQ(75, TestFileIntIter->second);
1107 // Check the extra tokens.
1109 TestFileIter = TestFile.BusinessTelephoneListTokens.find(2);
1110 ASSERT_NE(TestFile.BusinessTelephoneListTokens.end(), TestFileIter);
1111 ASSERT_EQ("BEEP=Boop", TestFileIter->second);
1115 TEST(ContactLoad, LanguageTests){
1117 ContactDataObject TestFile;
1119 // Check that the vCard 4.0 file loads OK.
1121 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1123 std::map<int,wxString>::iterator TestFileIter;
1124 std::map<int,int>::iterator TestFileIntIter;
1126 // Start with the general language.
1128 TestFileIter = TestFile.GeneralLanguageList.find(0);
1129 ASSERT_NE(TestFile.GeneralLanguageList.end(), TestFileIter);
1130 ASSERT_EQ("kw", TestFileIter->second);
1132 // Check the ALTID section.
1134 TestFileIter = TestFile.GeneralLanguageListAltID.find(0);
1135 ASSERT_NE(TestFile.GeneralLanguageListAltID.end(), TestFileIter);
1136 ASSERT_EQ("20", TestFileIter->second);
1138 // Check the PID section.
1140 TestFileIter = TestFile.GeneralLanguageListPID.find(0);
1141 ASSERT_NE(TestFile.GeneralLanguageListPID.end(), TestFileIter);
1142 ASSERT_EQ("40", TestFileIter->second);
1144 // Check the PREF section.
1146 TestFileIntIter = TestFile.GeneralLanguageListPref.find(0);
1147 ASSERT_NE(TestFile.GeneralLanguageListPref.end(), TestFileIntIter);
1148 ASSERT_EQ(80, TestFileIntIter->second);
1150 // Check the extra tokens.
1152 TestFileIter = TestFile.GeneralLanguageListTokens.find(0);
1153 ASSERT_NE(TestFile.GeneralLanguageListTokens.end(), TestFileIter);
1154 ASSERT_EQ("GELFORN=Great", TestFileIter->second);
1156 // Start with the home language.
1158 TestFileIter = TestFile.HomeLanguageList.find(1);
1159 ASSERT_NE(TestFile.HomeLanguageList.end(), TestFileIter);
1160 ASSERT_EQ("en", TestFileIter->second);
1162 // Check the ALTID section.
1164 TestFileIter = TestFile.HomeLanguageListAltID.find(1);
1165 ASSERT_NE(TestFile.HomeLanguageListAltID.end(), TestFileIter);
1166 ASSERT_EQ("22", TestFileIter->second);
1168 // Check the PID section.
1170 TestFileIter = TestFile.HomeLanguageListPID.find(1);
1171 ASSERT_NE(TestFile.HomeLanguageListPID.end(), TestFileIter);
1172 ASSERT_EQ("45", TestFileIter->second);
1174 // Check the PREF section.
1176 TestFileIntIter = TestFile.HomeLanguageListPref.find(1);
1177 ASSERT_NE(TestFile.HomeLanguageListPref.end(), TestFileIntIter);
1178 ASSERT_EQ(90, TestFileIntIter->second);
1180 // Check the extra tokens.
1182 TestFileIter = TestFile.HomeLanguageListTokens.find(1);
1183 ASSERT_NE(TestFile.HomeLanguageListTokens.end(), TestFileIter);
1184 ASSERT_EQ("LANGUAGE=yes", TestFileIter->second);
1186 // Start with the business language.
1188 TestFileIter = TestFile.BusinessLanguageList.find(2);
1189 ASSERT_NE(TestFile.BusinessLanguageList.end(), TestFileIter);
1190 ASSERT_EQ("cy", TestFileIter->second);
1192 // Check the ALTID section.
1194 TestFileIter = TestFile.BusinessLanguageListAltID.find(2);
1195 ASSERT_NE(TestFile.BusinessLanguageListAltID.end(), TestFileIter);
1196 ASSERT_EQ("10", TestFileIter->second);
1198 // Check the PID section.
1200 TestFileIter = TestFile.BusinessLanguageListPID.find(2);
1201 ASSERT_NE(TestFile.BusinessLanguageListPID.end(), TestFileIter);
1202 ASSERT_EQ("15", TestFileIter->second);
1204 // Check the PREF section.
1206 TestFileIntIter = TestFile.BusinessLanguageListPref.find(2);
1207 ASSERT_NE(TestFile.BusinessLanguageListPref.end(), TestFileIntIter);
1208 ASSERT_EQ(20, TestFileIntIter->second);
1210 // Check the extra tokens.
1212 TestFileIter = TestFile.BusinessLanguageListTokens.find(2);
1213 ASSERT_NE(TestFile.BusinessLanguageListTokens.end(), TestFileIter);
1214 ASSERT_EQ("FFENSTRI=ie", TestFileIter->second);
1218 TEST(ContactLoad, GeographicTests){
1220 ContactDataObject TestFile;
1222 // Check that the vCard 4.0 file loads OK.
1224 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1226 std::map<int,wxString>::iterator TestFileIter;
1227 std::map<int,int>::iterator TestFileIntIter;
1229 // Start with the general Geoposition.
1231 TestFileIter = TestFile.GeneralGeographyList.find(0);
1232 ASSERT_NE(TestFile.GeneralGeographyList.end(), TestFileIter);
1233 ASSERT_EQ("geo:3.5,3.5", TestFileIter->second);
1235 // Check the ALTID section.
1237 TestFileIter = TestFile.GeneralGeographyListAltID.find(0);
1238 ASSERT_NE(TestFile.GeneralGeographyListAltID.end(), TestFileIter);
1239 ASSERT_EQ("13", TestFileIter->second);
1241 // Check the PID section.
1243 TestFileIter = TestFile.GeneralGeographyListPID.find(0);
1244 ASSERT_NE(TestFile.GeneralGeographyListPID.end(), TestFileIter);
1245 ASSERT_EQ("26", TestFileIter->second);
1247 // Check the MEDIATYPE section.
1249 TestFileIter = TestFile.GeneralGeographyListMediatype.find(0);
1250 ASSERT_NE(TestFile.GeneralGeographyListMediatype.end(), TestFileIter);
1251 ASSERT_EQ("text/plain", TestFileIter->second);
1253 // Check the PREF section.
1255 TestFileIntIter = TestFile.GeneralGeographyListPref.find(0);
1256 ASSERT_NE(TestFile.GeneralGeographyListPref.end(), TestFileIntIter);
1257 ASSERT_EQ(39, TestFileIntIter->second);
1259 // Check the extra tokens.
1261 TestFileIter = TestFile.GeneralGeographyListTokens.find(0);
1262 ASSERT_NE(TestFile.GeneralGeographyListTokens.end(), TestFileIter);
1263 ASSERT_EQ("POS=Yep", TestFileIter->second);
1265 // Start with the home Geoposition.
1267 TestFileIter = TestFile.HomeGeographyList.find(1);
1268 ASSERT_NE(TestFile.HomeGeographyList.end(), TestFileIter);
1269 ASSERT_EQ("geo:7.0,7.0", TestFileIter->second);
1271 // Check the ALTID section.
1273 TestFileIter = TestFile.HomeGeographyListAltID.find(1);
1274 ASSERT_NE(TestFile.HomeGeographyListAltID.end(), TestFileIter);
1275 ASSERT_EQ("140", TestFileIter->second);
1277 // Check the PID section.
1279 TestFileIter = TestFile.HomeGeographyListPID.find(1);
1280 ASSERT_NE(TestFile.HomeGeographyListPID.end(), TestFileIter);
1281 ASSERT_EQ("70", TestFileIter->second);
1283 // Check the MEDIATYPE section.
1285 TestFileIter = TestFile.HomeGeographyListMediatype.find(1);
1286 ASSERT_NE(TestFile.HomeGeographyListMediatype.end(), TestFileIter);
1287 ASSERT_EQ("text/ratherplain", TestFileIter->second);
1289 // Check the PREF section.
1291 TestFileIntIter = TestFile.HomeGeographyListPref.find(1);
1292 ASSERT_NE(TestFile.HomeGeographyListPref.end(), TestFileIntIter);
1293 ASSERT_EQ(1, TestFileIntIter->second);
1295 // Check the extra tokens.
1297 TestFileIter = TestFile.HomeGeographyListTokens.find(1);
1298 ASSERT_NE(TestFile.HomeGeographyListTokens.end(), TestFileIter);
1299 ASSERT_EQ("POS=Nope", TestFileIter->second);
1301 // Start with the business Geoposition.
1303 TestFileIter = TestFile.BusinessGeographyList.find(2);
1304 ASSERT_NE(TestFile.BusinessGeographyList.end(), TestFileIter);
1305 ASSERT_EQ("geo:14.0,14.0", TestFileIter->second);
1307 // Check the ALTID section.
1309 TestFileIter = TestFile.BusinessGeographyListAltID.find(2);
1310 ASSERT_NE(TestFile.BusinessGeographyListAltID.end(), TestFileIter);
1311 ASSERT_EQ("75", TestFileIter->second);
1313 // Check the PID section.
1315 TestFileIter = TestFile.BusinessGeographyListPID.find(2);
1316 ASSERT_NE(TestFile.BusinessGeographyListPID.end(), TestFileIter);
1317 ASSERT_EQ("32", TestFileIter->second);
1319 // Check the MEDIATYPE section.
1321 TestFileIter = TestFile.BusinessGeographyListMediatype.find(2);
1322 ASSERT_NE(TestFile.BusinessGeographyListMediatype.end(), TestFileIter);
1323 ASSERT_EQ("text/greenplain", TestFileIter->second);
1325 // Check the PREF section.
1327 TestFileIntIter = TestFile.BusinessGeographyListPref.find(2);
1328 ASSERT_NE(TestFile.BusinessGeographyListPref.end(), TestFileIntIter);
1329 ASSERT_EQ(4, TestFileIntIter->second);
1331 // Check the extra tokens.
1333 TestFileIter = TestFile.BusinessGeographyListTokens.find(2);
1334 ASSERT_NE(TestFile.BusinessGeographyListTokens.end(), TestFileIter);
1335 ASSERT_EQ("POS=Money", TestFileIter->second);
1339 TEST(ContactLoad, RelatedTests){
1341 ContactDataObject TestFile;
1343 // Check that the vCard 4.0 file loads OK.
1345 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1347 std::map<int,wxString>::iterator TestFileIter;
1348 std::map<int,int>::iterator TestFileIntIter;
1350 // Start with the first relation.
1352 TestFileIter = TestFile.GeneralRelatedList.find(0);
1353 ASSERT_NE(TestFile.GeneralRelatedList.end(), TestFileIter);
1354 ASSERT_EQ("Friend Test", TestFileIter->second);
1356 // Check the TYPE section.
1358 TestFileIter = TestFile.GeneralRelatedListType.find(0);
1359 ASSERT_NE(TestFile.GeneralRelatedListType.end(), TestFileIter);
1360 ASSERT_EQ("Kin", TestFileIter->second);
1362 // Check the ALTID section.
1364 TestFileIter = TestFile.GeneralRelatedListAltID.find(0);
1365 ASSERT_NE(TestFile.GeneralRelatedListAltID.end(), TestFileIter);
1366 ASSERT_EQ("5", TestFileIter->second);
1368 // Check the PID section.
1370 TestFileIter = TestFile.GeneralRelatedListPID.find(0);
1371 ASSERT_NE(TestFile.GeneralRelatedListPID.end(), TestFileIter);
1372 ASSERT_EQ("10", TestFileIter->second);
1374 // Check the PREF section.
1376 TestFileIntIter = TestFile.GeneralRelatedListPref.find(0);
1377 ASSERT_NE(TestFile.GeneralRelatedListPref.end(), TestFileIntIter);
1378 ASSERT_EQ(20, TestFileIntIter->second);
1380 // Check the extra tokens.
1382 TestFileIter = TestFile.GeneralRelatedListTokens.find(0);
1383 ASSERT_NE(TestFile.GeneralRelatedListTokens.end(), TestFileIter);
1384 ASSERT_EQ("OPTION=Yes", TestFileIter->second);
1386 // Start with the second relation.
1388 TestFileIter = TestFile.GeneralRelatedList.find(1);
1389 ASSERT_NE(TestFile.GeneralRelatedList.end(), TestFileIter);
1390 ASSERT_EQ("Friend Test Two", TestFileIter->second);
1392 // Check the TYPE section.
1394 TestFileIter = TestFile.GeneralRelatedListType.find(1);
1395 ASSERT_NE(TestFile.GeneralRelatedListType.end(), TestFileIter);
1396 ASSERT_EQ("Spouse", TestFileIter->second);
1398 // Check the ALTID section.
1400 TestFileIter = TestFile.GeneralRelatedListAltID.find(1);
1401 ASSERT_NE(TestFile.GeneralRelatedListAltID.end(), TestFileIter);
1402 ASSERT_EQ("1", TestFileIter->second);
1404 // Check the PID section.
1406 TestFileIter = TestFile.GeneralRelatedListPID.find(1);
1407 ASSERT_NE(TestFile.GeneralRelatedListPID.end(), TestFileIter);
1408 ASSERT_EQ("2", TestFileIter->second);
1410 // Check the PREF section.
1412 TestFileIntIter = TestFile.GeneralRelatedListPref.find(1);
1413 ASSERT_NE(TestFile.GeneralRelatedListPref.end(), TestFileIntIter);
1414 ASSERT_EQ(3, TestFileIntIter->second);
1416 // Check the extra tokens.
1418 TestFileIter = TestFile.GeneralRelatedListTokens.find(1);
1419 ASSERT_NE(TestFile.GeneralRelatedListTokens.end(), TestFileIter);
1420 ASSERT_EQ("OPTION=No", TestFileIter->second);
1422 // Start with the second relation.
1424 TestFileIter = TestFile.GeneralRelatedList.find(2);
1425 ASSERT_NE(TestFile.GeneralRelatedList.end(), TestFileIter);
1426 ASSERT_EQ("Friend Test Three", TestFileIter->second);
1428 // Check the TYPE section.
1430 TestFileIter = TestFile.GeneralRelatedListType.find(2);
1431 ASSERT_NE(TestFile.GeneralRelatedListType.end(), TestFileIter);
1432 ASSERT_EQ("Muse", TestFileIter->second);
1434 // Check the ALTID section.
1436 TestFileIter = TestFile.GeneralRelatedListAltID.find(2);
1437 ASSERT_NE(TestFile.GeneralRelatedListAltID.end(), TestFileIter);
1438 ASSERT_EQ("4", TestFileIter->second);
1440 // Check the PID section.
1442 TestFileIter = TestFile.GeneralRelatedListPID.find(2);
1443 ASSERT_NE(TestFile.GeneralRelatedListPID.end(), TestFileIter);
1444 ASSERT_EQ("5", TestFileIter->second);
1446 // Check the PREF section.
1448 TestFileIntIter = TestFile.GeneralRelatedListPref.find(2);
1449 ASSERT_NE(TestFile.GeneralRelatedListPref.end(), TestFileIntIter);
1450 ASSERT_EQ(6, TestFileIntIter->second);
1452 // Check the extra tokens.
1454 TestFileIter = TestFile.GeneralRelatedListTokens.find(2);
1455 ASSERT_NE(TestFile.GeneralRelatedListTokens.end(), TestFileIter);
1456 ASSERT_EQ("OPTION=Maybe", TestFileIter->second);
1460 TEST(ContactLoad, URLTests){
1462 ContactDataObject TestFile;
1464 // Check that the vCard 4.0 file loads OK.
1466 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1468 std::map<int,wxString>::iterator TestFileIter;
1469 std::map<int,int>::iterator TestFileIntIter;
1471 // Start with the general URL.
1473 TestFileIter = TestFile.GeneralWebsiteList.find(0);
1474 ASSERT_NE(TestFile.GeneralWebsiteList.end(), TestFileIter);
1475 ASSERT_EQ("http://example.com/", TestFileIter->second);
1477 // Check the ALTID section.
1479 TestFileIter = TestFile.GeneralWebsiteListAltID.find(0);
1480 ASSERT_NE(TestFile.GeneralWebsiteListAltID.end(), TestFileIter);
1481 ASSERT_EQ("0", TestFileIter->second);
1483 // Check the PID section.
1485 TestFileIter = TestFile.GeneralWebsiteListPID.find(0);
1486 ASSERT_NE(TestFile.GeneralWebsiteListPID.end(), TestFileIter);
1487 ASSERT_EQ("1", TestFileIter->second);
1489 // Check the MEDIATYPE section.
1491 TestFileIter = TestFile.GeneralWebsiteListMediatype.find(0);
1492 ASSERT_NE(TestFile.GeneralWebsiteListMediatype.end(), TestFileIter);
1493 ASSERT_EQ("text/plain", TestFileIter->second);
1495 // Check the PREF section.
1497 TestFileIntIter = TestFile.GeneralWebsiteListPref.find(0);
1498 ASSERT_NE(TestFile.GeneralWebsiteListPref.end(), TestFileIntIter);
1499 ASSERT_EQ(2, TestFileIntIter->second);
1501 // Check the extra tokens.
1503 TestFileIter = TestFile.GeneralWebsiteListTokens.find(0);
1504 ASSERT_NE(TestFile.GeneralWebsiteListTokens.end(), TestFileIter);
1505 ASSERT_EQ("MEEP=Moo", TestFileIter->second);
1507 // Start with the home URL.
1509 TestFileIter = TestFile.HomeWebsiteList.find(1);
1510 ASSERT_NE(TestFile.HomeWebsiteList.end(), TestFileIter);
1511 ASSERT_EQ("http://example.com/home/", TestFileIter->second);
1513 // Check the ALTID section.
1515 TestFileIter = TestFile.HomeWebsiteListAltID.find(1);
1516 ASSERT_NE(TestFile.HomeWebsiteListAltID.end(), TestFileIter);
1517 ASSERT_EQ("10", TestFileIter->second);
1519 // Check the PID section.
1521 TestFileIter = TestFile.HomeWebsiteListPID.find(1);
1522 ASSERT_NE(TestFile.HomeWebsiteListPID.end(), TestFileIter);
1523 ASSERT_EQ("11", TestFileIter->second);
1525 // Check the MEDIATYPE section.
1527 TestFileIter = TestFile.HomeWebsiteListMediatype.find(1);
1528 ASSERT_NE(TestFile.HomeWebsiteListMediatype.end(), TestFileIter);
1529 ASSERT_EQ("grass/soggy", TestFileIter->second);
1531 // Check the PREF section.
1533 TestFileIntIter = TestFile.HomeWebsiteListPref.find(1);
1534 ASSERT_NE(TestFile.HomeWebsiteListPref.end(), TestFileIntIter);
1535 ASSERT_EQ(12, TestFileIntIter->second);
1537 // Check the extra tokens.
1539 TestFileIter = TestFile.HomeWebsiteListTokens.find(1);
1540 ASSERT_NE(TestFile.HomeWebsiteListTokens.end(), TestFileIter);
1541 ASSERT_EQ("BON=Bon", TestFileIter->second);
1543 // Start with the business URL.
1545 TestFileIter = TestFile.BusinessWebsiteList.find(2);
1546 ASSERT_NE(TestFile.BusinessWebsiteList.end(), TestFileIter);
1547 ASSERT_EQ("http://example.com/business/", TestFileIter->second);
1549 // Check the ALTID section.
1551 TestFileIter = TestFile.BusinessWebsiteListAltID.find(2);
1552 ASSERT_NE(TestFile.BusinessWebsiteListAltID.end(), TestFileIter);
1553 ASSERT_EQ("20", TestFileIter->second);
1555 // Check the PID section.
1557 TestFileIter = TestFile.BusinessWebsiteListPID.find(2);
1558 ASSERT_NE(TestFile.BusinessWebsiteListPID.end(), TestFileIter);
1559 ASSERT_EQ("21", TestFileIter->second);
1561 // Check the MEDIATYPE section.
1563 TestFileIter = TestFile.BusinessWebsiteListMediatype.find(2);
1564 ASSERT_NE(TestFile.BusinessWebsiteListMediatype.end(), TestFileIter);
1565 ASSERT_EQ("chocolate/yummy", TestFileIter->second);
1567 // Check the PREF section.
1569 TestFileIntIter = TestFile.BusinessWebsiteListPref.find(2);
1570 ASSERT_NE(TestFile.BusinessWebsiteListPref.end(), TestFileIntIter);
1571 ASSERT_EQ(22, TestFileIntIter->second);
1573 // Check the extra tokens.
1575 TestFileIter = TestFile.BusinessWebsiteListTokens.find(2);
1576 ASSERT_NE(TestFile.BusinessWebsiteListTokens.end(), TestFileIter);
1577 ASSERT_EQ("YES=No", TestFileIter->second);
1581 TEST(ContactLoad, TitleTests){
1583 ContactDataObject TestFile;
1585 // Check that the vCard 4.0 file loads OK.
1587 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1589 std::map<int,wxString>::iterator TestFileIter;
1590 std::map<int,int>::iterator TestFileIntIter;
1592 // Start with the general title.
1594 TestFileIter = TestFile.GeneralTitleList.find(0);
1595 ASSERT_NE(TestFile.GeneralTitleList.end(), TestFileIter);
1596 ASSERT_EQ("Lord of Light", TestFileIter->second);
1598 // Check the ALTID section.
1600 TestFileIter = TestFile.GeneralTitleListAltID.find(0);
1601 ASSERT_NE(TestFile.GeneralTitleListAltID.end(), TestFileIter);
1602 ASSERT_EQ("20", TestFileIter->second);
1604 // Check the PID section.
1606 TestFileIter = TestFile.GeneralTitleListPID.find(0);
1607 ASSERT_NE(TestFile.GeneralTitleListPID.end(), TestFileIter);
1608 ASSERT_EQ("21", TestFileIter->second);
1610 // Check the LANGUAGE section.
1612 TestFileIter = TestFile.GeneralTitleListLanguage.find(0);
1613 ASSERT_NE(TestFile.GeneralTitleListLanguage.end(), TestFileIter);
1614 ASSERT_EQ("text/plain", TestFileIter->second);
1616 // Check the PREF section.
1618 TestFileIntIter = TestFile.GeneralTitleListPref.find(0);
1619 ASSERT_NE(TestFile.GeneralTitleListPref.end(), TestFileIntIter);
1620 ASSERT_EQ(22, TestFileIntIter->second);
1622 // Check the extra tokens.
1624 TestFileIter = TestFile.GeneralTitleListTokens.find(0);
1625 ASSERT_NE(TestFile.GeneralTitleListTokens.end(), TestFileIter);
1626 ASSERT_EQ("EEP=LIGHT", TestFileIter->second);
1628 // Start with the home title.
1630 TestFileIter = TestFile.HomeTitleList.find(1);
1631 ASSERT_NE(TestFile.HomeTitleList.end(), TestFileIter);
1632 ASSERT_EQ("Lord of Darkness", TestFileIter->second);
1634 // Check the ALTID section.
1636 TestFileIter = TestFile.HomeTitleListAltID.find(1);
1637 ASSERT_NE(TestFile.HomeTitleListAltID.end(), TestFileIter);
1638 ASSERT_EQ("30", TestFileIter->second);
1640 // Check the PID section.
1642 TestFileIter = TestFile.HomeTitleListPID.find(1);
1643 ASSERT_NE(TestFile.HomeTitleListPID.end(), TestFileIter);
1644 ASSERT_EQ("31", TestFileIter->second);
1646 // Check the LANGUAGE section.
1648 TestFileIter = TestFile.HomeTitleListLanguage.find(1);
1649 ASSERT_NE(TestFile.HomeTitleListLanguage.end(), TestFileIter);
1650 ASSERT_EQ("grass/dry", TestFileIter->second);
1652 // Check the PREF section.
1654 TestFileIntIter = TestFile.HomeTitleListPref.find(1);
1655 ASSERT_NE(TestFile.HomeTitleListPref.end(), TestFileIntIter);
1656 ASSERT_EQ(32, TestFileIntIter->second);
1658 // Check the extra tokens.
1660 TestFileIter = TestFile.HomeTitleListTokens.find(1);
1661 ASSERT_NE(TestFile.HomeTitleListTokens.end(), TestFileIter);
1662 ASSERT_EQ("EEP=DARK", TestFileIter->second);
1664 // Start with the business title.
1666 TestFileIter = TestFile.BusinessTitleList.find(2);
1667 ASSERT_NE(TestFile.BusinessTitleList.end(), TestFileIter);
1668 ASSERT_EQ("Master of the Light & Darkness", TestFileIter->second);
1670 // Check the ALTID section.
1672 TestFileIter = TestFile.BusinessTitleListAltID.find(2);
1673 ASSERT_NE(TestFile.BusinessTitleListAltID.end(), TestFileIter);
1674 ASSERT_EQ("40", TestFileIter->second);
1676 // Check the PID section.
1678 TestFileIter = TestFile.BusinessTitleListPID.find(2);
1679 ASSERT_NE(TestFile.BusinessTitleListPID.end(), TestFileIter);
1680 ASSERT_EQ("41", TestFileIter->second);
1682 // Check the LANGUAGE section.
1684 TestFileIter = TestFile.BusinessTitleListLanguage.find(2);
1685 ASSERT_NE(TestFile.BusinessTitleListLanguage.end(), TestFileIter);
1686 ASSERT_EQ("moths/eew", TestFileIter->second);
1688 // Check the PREF section.
1690 TestFileIntIter = TestFile.BusinessTitleListPref.find(2);
1691 ASSERT_NE(TestFile.BusinessTitleListPref.end(), TestFileIntIter);
1692 ASSERT_EQ(42, TestFileIntIter->second);
1694 // Check the extra tokens.
1696 TestFileIter = TestFile.BusinessTitleListTokens.find(2);
1697 ASSERT_NE(TestFile.BusinessTitleListTokens.end(), TestFileIter);
1698 ASSERT_EQ("EEP=BOTH", TestFileIter->second);
1702 TEST(ContactLoad, RoleTests){
1704 ContactDataObject TestFile;
1706 // Check that the vCard 4.0 file loads OK.
1708 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1710 std::map<int,wxString>::iterator TestFileIter;
1711 std::map<int,int>::iterator TestFileIntIter;
1713 // Start with the general role.
1715 TestFileIter = TestFile.GeneralRoleList.find(0);
1716 ASSERT_NE(TestFile.GeneralRoleList.end(), TestFileIter);
1717 ASSERT_EQ("Ordinary Person", TestFileIter->second);
1719 // Check the ALTID section.
1721 TestFileIter = TestFile.GeneralRoleListAltID.find(0);
1722 ASSERT_NE(TestFile.GeneralRoleListAltID.end(), TestFileIter);
1723 ASSERT_EQ("50", TestFileIter->second);
1725 // Check the PID section.
1727 TestFileIter = TestFile.GeneralRoleListPID.find(0);
1728 ASSERT_NE(TestFile.GeneralRoleListPID.end(), TestFileIter);
1729 ASSERT_EQ("51", TestFileIter->second);
1731 // Check the LANGUAGE section.
1733 TestFileIter = TestFile.GeneralRoleListLanguage.find(0);
1734 ASSERT_NE(TestFile.GeneralRoleListLanguage.end(), TestFileIter);
1735 ASSERT_EQ("en", TestFileIter->second);
1737 // Check the PREF section.
1739 TestFileIntIter = TestFile.GeneralRoleListPref.find(0);
1740 ASSERT_NE(TestFile.GeneralRoleListPref.end(), TestFileIntIter);
1741 ASSERT_EQ(52, TestFileIntIter->second);
1743 // Check the extra tokens.
1745 TestFileIter = TestFile.GeneralRoleListTokens.find(0);
1746 ASSERT_NE(TestFile.GeneralRoleListTokens.end(), TestFileIter);
1747 ASSERT_EQ("ASTERISK=None", TestFileIter->second);
1749 // Start with the home role.
1751 TestFileIter = TestFile.HomeRoleList.find(1);
1752 ASSERT_NE(TestFile.HomeRoleList.end(), TestFileIter);
1753 ASSERT_EQ("Ordinary Lazy Person", TestFileIter->second);
1755 // Check the ALTID section.
1757 TestFileIter = TestFile.HomeRoleListAltID.find(1);
1758 ASSERT_NE(TestFile.HomeRoleListAltID.end(), TestFileIter);
1759 ASSERT_EQ("60", TestFileIter->second);
1761 // Check the PID section.
1763 TestFileIter = TestFile.HomeRoleListPID.find(1);
1764 ASSERT_NE(TestFile.HomeRoleListPID.end(), TestFileIter);
1765 ASSERT_EQ("61", TestFileIter->second);
1767 // Check the LANGUAGE section.
1769 TestFileIter = TestFile.HomeRoleListLanguage.find(1);
1770 ASSERT_NE(TestFile.HomeRoleListLanguage.end(), TestFileIter);
1771 ASSERT_EQ("en-GB", TestFileIter->second);
1773 // Check the PREF section.
1775 TestFileIntIter = TestFile.HomeRoleListPref.find(1);
1776 ASSERT_NE(TestFile.HomeRoleListPref.end(), TestFileIntIter);
1777 ASSERT_EQ(62, TestFileIntIter->second);
1779 // Check the extra tokens.
1781 TestFileIter = TestFile.HomeRoleListTokens.find(1);
1782 ASSERT_NE(TestFile.HomeRoleListTokens.end(), TestFileIter);
1783 ASSERT_EQ("SOMEWHERE=There", TestFileIter->second);
1785 // Start with the business role.
1787 TestFileIter = TestFile.BusinessRoleList.find(2);
1788 ASSERT_NE(TestFile.BusinessRoleList.end(), TestFileIter);
1789 ASSERT_EQ("Company Owner", TestFileIter->second);
1791 // Check the ALTID section.
1793 TestFileIter = TestFile.BusinessRoleListAltID.find(2);
1794 ASSERT_NE(TestFile.BusinessRoleListAltID.end(), TestFileIter);
1795 ASSERT_EQ("70", TestFileIter->second);
1797 // Check the PID section.
1799 TestFileIter = TestFile.BusinessRoleListPID.find(2);
1800 ASSERT_NE(TestFile.BusinessRoleListPID.end(), TestFileIter);
1801 ASSERT_EQ("71", TestFileIter->second);
1803 // Check the LANGUAGE section.
1805 TestFileIter = TestFile.BusinessRoleListLanguage.find(2);
1806 ASSERT_NE(TestFile.BusinessRoleListLanguage.end(), TestFileIter);
1807 ASSERT_EQ("en-AU", TestFileIter->second);
1809 // Check the PREF section.
1811 TestFileIntIter = TestFile.BusinessRoleListPref.find(2);
1812 ASSERT_NE(TestFile.BusinessRoleListPref.end(), TestFileIntIter);
1813 ASSERT_EQ(72, TestFileIntIter->second);
1815 // Check the extra tokens.
1817 TestFileIter = TestFile.BusinessRoleListTokens.find(2);
1818 ASSERT_NE(TestFile.BusinessRoleListTokens.end(), TestFileIter);
1819 ASSERT_EQ("HERE=Nope", TestFileIter->second);
1823 TEST(ContactLoad, OrganisationTests){
1825 ContactDataObject TestFile;
1827 // Check that the vCard 4.0 file loads OK.
1829 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1831 std::map<int,wxString>::iterator TestFileIter;
1832 std::map<int,int>::iterator TestFileIntIter;
1834 // Start with the general organisation.
1836 TestFileIter = TestFile.GeneralOrganisationsList.find(0);
1837 ASSERT_NE(TestFile.GeneralOrganisationsList.end(), TestFileIter);
1838 ASSERT_EQ("Ordinary Organisation", TestFileIter->second);
1840 // Check the SORT-AS section.
1842 TestFileIter = TestFile.GeneralOrganisationsListSortAs.find(0);
1843 ASSERT_NE(TestFile.GeneralOrganisationsListSortAs.end(), TestFileIter);
1844 ASSERT_EQ("Organisation, Ordinary", TestFileIter->second);
1846 // Check the ALTID section.
1848 TestFileIter = TestFile.GeneralOrganisationsListAltID.find(0);
1849 ASSERT_NE(TestFile.GeneralOrganisationsListAltID.end(), TestFileIter);
1850 ASSERT_EQ("50", TestFileIter->second);
1852 // Check the PID section.
1854 TestFileIter = TestFile.GeneralOrganisationsListPID.find(0);
1855 ASSERT_NE(TestFile.GeneralOrganisationsListPID.end(), TestFileIter);
1856 ASSERT_EQ("51", TestFileIter->second);
1858 // Check the LANGUAGE section.
1860 TestFileIter = TestFile.GeneralOrganisationsListLanguage.find(0);
1861 ASSERT_NE(TestFile.GeneralOrganisationsListLanguage.end(), TestFileIter);
1862 ASSERT_EQ("en", TestFileIter->second);
1864 // Check the PREF section.
1866 TestFileIntIter = TestFile.GeneralOrganisationsListPref.find(0);
1867 ASSERT_NE(TestFile.GeneralOrganisationsListPref.end(), TestFileIntIter);
1868 ASSERT_EQ(52, TestFileIntIter->second);
1870 // Check the extra tokens.
1872 TestFileIter = TestFile.GeneralOrganisationsListTokens.find(0);
1873 ASSERT_NE(TestFile.GeneralOrganisationsListTokens.end(), TestFileIter);
1874 ASSERT_EQ("ASTERISK=None", TestFileIter->second);
1876 // Start with the home Organisation.
1878 TestFileIter = TestFile.HomeOrganisationsList.find(1);
1879 ASSERT_NE(TestFile.HomeOrganisationsList.end(), TestFileIter);
1880 ASSERT_EQ("Ordinary Lazy Person", TestFileIter->second);
1882 // Check the SORT-AS section.
1884 TestFileIter = TestFile.HomeOrganisationsListSortAs.find(1);
1885 ASSERT_NE(TestFile.HomeOrganisationsListSortAs.end(), TestFileIter);
1886 ASSERT_EQ("Person, Ordinary Lazy", TestFileIter->second);
1888 // Check the ALTID section.
1890 TestFileIter = TestFile.HomeOrganisationsListAltID.find(1);
1891 ASSERT_NE(TestFile.HomeOrganisationsListAltID.end(), TestFileIter);
1892 ASSERT_EQ("60", TestFileIter->second);
1894 // Check the PID section.
1896 TestFileIter = TestFile.HomeOrganisationsListPID.find(1);
1897 ASSERT_NE(TestFile.HomeOrganisationsListPID.end(), TestFileIter);
1898 ASSERT_EQ("61", TestFileIter->second);
1900 // Check the LANGUAGE section.
1902 TestFileIter = TestFile.HomeOrganisationsListLanguage.find(1);
1903 ASSERT_NE(TestFile.HomeOrganisationsListLanguage.end(), TestFileIter);
1904 ASSERT_EQ("en-GB", TestFileIter->second);
1906 // Check the PREF section.
1908 TestFileIntIter = TestFile.HomeOrganisationsListPref.find(1);
1909 ASSERT_NE(TestFile.HomeOrganisationsListPref.end(), TestFileIntIter);
1910 ASSERT_EQ(62, TestFileIntIter->second);
1912 // Check the extra tokens.
1914 TestFileIter = TestFile.HomeOrganisationsListTokens.find(1);
1915 ASSERT_NE(TestFile.HomeOrganisationsListTokens.end(), TestFileIter);
1916 ASSERT_EQ("SOMEWHERE=There", TestFileIter->second);
1918 // Start with the business Organisation.
1920 TestFileIter = TestFile.BusinessOrganisationsList.find(2);
1921 ASSERT_NE(TestFile.BusinessOrganisationsList.end(), TestFileIter);
1922 ASSERT_EQ("Company Owner", TestFileIter->second);
1924 // Check the SORT-AS section.
1926 TestFileIter = TestFile.BusinessOrganisationsListSortAs.find(2);
1927 ASSERT_NE(TestFile.BusinessOrganisationsListSortAs.end(), TestFileIter);
1928 ASSERT_EQ("Owner, Company", TestFileIter->second);
1930 // Check the ALTID section.
1932 TestFileIter = TestFile.BusinessOrganisationsListAltID.find(2);
1933 ASSERT_NE(TestFile.BusinessOrganisationsListAltID.end(), TestFileIter);
1934 ASSERT_EQ("70", TestFileIter->second);
1936 // Check the PID section.
1938 TestFileIter = TestFile.BusinessOrganisationsListPID.find(2);
1939 ASSERT_NE(TestFile.BusinessOrganisationsListPID.end(), TestFileIter);
1940 ASSERT_EQ("71", TestFileIter->second);
1942 // Check the LANGUAGE section.
1944 TestFileIter = TestFile.BusinessOrganisationsListLanguage.find(2);
1945 ASSERT_NE(TestFile.BusinessOrganisationsListLanguage.end(), TestFileIter);
1946 ASSERT_EQ("en-AU", TestFileIter->second);
1948 // Check the PREF section.
1950 TestFileIntIter = TestFile.BusinessOrganisationsListPref.find(2);
1951 ASSERT_NE(TestFile.BusinessOrganisationsListPref.end(), TestFileIntIter);
1952 ASSERT_EQ(72, TestFileIntIter->second);
1954 // Check the extra tokens.
1956 TestFileIter = TestFile.BusinessOrganisationsListTokens.find(2);
1957 ASSERT_NE(TestFile.BusinessOrganisationsListTokens.end(), TestFileIter);
1958 ASSERT_EQ("HERE=Nope", TestFileIter->second);
1962 TEST(ContactLoad, NoteTests){
1964 ContactDataObject TestFile;
1966 // Check that the vCard 4.0 file loads OK.
1968 ASSERT_EQ(CONTACTLOAD_OK, TestFile.LoadFile("LoadCheck-Load4.vcf"));
1970 std::map<int,wxString>::iterator TestFileIter;
1971 std::map<int,int>::iterator TestFileIntIter;
1973 // Start with the general note.
1975 TestFileIter = TestFile.GeneralNoteList.find(0);
1976 ASSERT_NE(TestFile.GeneralNoteList.end(), TestFileIter);
1977 ASSERT_EQ("Note\n\nLine 3\nLine 4\nLine 5", TestFileIter->second);
1979 // Check the ALTID section.
1981 TestFileIter = TestFile.GeneralNoteListAltID.find(0);
1982 ASSERT_NE(TestFile.GeneralNoteListAltID.end(), TestFileIter);
1983 ASSERT_EQ("90", TestFileIter->second);
1985 // Check the PID section.
1987 TestFileIter = TestFile.GeneralNoteListPID.find(0);
1988 ASSERT_NE(TestFile.GeneralNoteListPID.end(), TestFileIter);
1989 ASSERT_EQ("91", TestFileIter->second);
1991 // Check the LANGUAGE section.
1993 TestFileIter = TestFile.GeneralNoteListLanguage.find(0);
1994 ASSERT_NE(TestFile.GeneralNoteListLanguage.end(), TestFileIter);
1995 ASSERT_EQ("en", TestFileIter->second);
1997 // Check the PREF section.
1999 TestFileIntIter = TestFile.GeneralNoteListPref.find(0);
2000 ASSERT_NE(TestFile.GeneralNoteListPref.end(), TestFileIntIter);
2001 ASSERT_EQ(92, TestFileIntIter->second);
2003 // Check the extra tokens.
2005 TestFileIter = TestFile.GeneralNoteListTokens.find(0);
2006 ASSERT_NE(TestFile.GeneralNoteListTokens.end(), TestFileIter);
2007 ASSERT_EQ("WOO=WOOP", TestFileIter->second);
2009 // Start with the home note.
2011 TestFileIter = TestFile.HomeNoteList.find(1);
2012 ASSERT_NE(TestFile.HomeNoteList.end(), TestFileIter);
2013 ASSERT_EQ("Note\n\n\n\nLine 5\nLine 6\nLine 7", TestFileIter->second);
2015 // Check the ALTID section.
2017 TestFileIter = TestFile.HomeNoteListAltID.find(1);
2018 ASSERT_NE(TestFile.HomeNoteListAltID.end(), TestFileIter);
2019 ASSERT_EQ("80", TestFileIter->second);
2021 // Check the PID section.
2023 TestFileIter = TestFile.HomeNoteListPID.find(1);
2024 ASSERT_NE(TestFile.HomeNoteListPID.end(), TestFileIter);
2025 ASSERT_EQ("81", TestFileIter->second);
2027 // Check the LANGUAGE section.
2029 TestFileIter = TestFile.HomeNoteListLanguage.find(1);
2030 ASSERT_NE(TestFile.HomeNoteListLanguage.end(), TestFileIter);
2031 ASSERT_EQ("kw", TestFileIter->second);
2033 // Check the PREF section.
2035 TestFileIntIter = TestFile.HomeNoteListPref.find(1);
2036 ASSERT_NE(TestFile.HomeNoteListPref.end(), TestFileIntIter);
2037 ASSERT_EQ(82, TestFileIntIter->second);
2039 // Check the extra tokens.
2041 TestFileIter = TestFile.HomeNoteListTokens.find(1);
2042 ASSERT_NE(TestFile.HomeNoteListTokens.end(), TestFileIter);
2043 ASSERT_EQ("MOO=MEEP", TestFileIter->second);
2045 // Start with the business note.
2047 TestFileIter = TestFile.BusinessNoteList.find(2);
2048 ASSERT_NE(TestFile.BusinessNoteList.end(), TestFileIter);
2049 ASSERT_EQ("Note\n\n\n\nLine 8\nLine 9\nLine 10", TestFileIter->second);
2051 // Check the ALTID section.
2053 TestFileIter = TestFile.BusinessNoteListAltID.find(2);
2054 ASSERT_NE(TestFile.BusinessNoteListAltID.end(), TestFileIter);
2055 ASSERT_EQ("70", TestFileIter->second);
2057 // Check the PID section.
2059 TestFileIter = TestFile.BusinessNoteListPID.find(2);
2060 ASSERT_NE(TestFile.BusinessNoteListPID.end(), TestFileIter);
2061 ASSERT_EQ("71", TestFileIter->second);
2063 // Check the LANGUAGE section.
2065 TestFileIter = TestFile.BusinessNoteListLanguage.find(2);
2066 ASSERT_NE(TestFile.BusinessNoteListLanguage.end(), TestFileIter);
2067 ASSERT_EQ("fr", TestFileIter->second);
2069 // Check the PREF section.
2071 TestFileIntIter = TestFile.BusinessNoteListPref.find(2);
2072 ASSERT_NE(TestFile.BusinessNoteListPref.end(), TestFileIntIter);
2073 ASSERT_EQ(72, TestFileIntIter->second);
2075 // Check the extra tokens.
2077 TestFileIter = TestFile.BusinessNoteListTokens.find(2);
2078 ASSERT_NE(TestFile.BusinessNoteListTokens.end(), TestFileIter);
2079 ASSERT_EQ("BOING=BOOP", TestFileIter->second);
2083 // TODO: Add tests for the Contact Loading process.