tdeabc
testread2.cpp
00001 #include "testutils.h"
00002 #include <tdeabc/addressee.h>
00003 #include <vcardconverter.h>
00004 #include <kdebug.h>
00005
00006 using namespace TDEABC;
00007
00008 int
00009 main()
00010 {
00011 int rc=0;
00012 Addressee::List l = vCardsAsAddresseeList();
00013 TQString vcards = vCardsAsText();
00014
00015 VCardConverter vct;
00016
00017 Addressee::List parsed = vct.parseVCards( vcards );
00018
00019 if ( l.size() != parsed.size() ) {
00020 kdDebug()<<"\tSize - FAILED : "<<l.size()<<" vs. parsed "<<parsed.size()<<endl;
00021 rc=1;
00022 } else {
00023 kdDebug()<<"\tSize - PASSED"<<endl;
00024 }
00025
00026 Addressee::List::iterator itr1;
00027 Addressee::List::iterator itr2;
00028 for ( itr1 = l.begin(), itr2 = parsed.begin();
00029 itr1 != l.end(); ++itr1, ++itr2 ) {
00030 if ( (*itr1).fullEmail() == (*itr2).fullEmail() &&
00031 (*itr1).organization() == (*itr2).organization() &&
00032 (*itr1).phoneNumbers() == (*itr2).phoneNumbers() &&
00033 (*itr1).emails() == (*itr2).emails() &&
00034 (*itr1).role() == (*itr2).role() ) {
00035 kdDebug()<<"\tAddressee - PASSED"<<endl;
00036 kdDebug()<<"\t\t"<< (*itr1).fullEmail() << " VS. " << (*itr2).fullEmail()<<endl;
00037 } else {
00038 kdDebug()<<"\tAddressee - FAILED"<<endl;
00039 kdDebug()<<">>>>>>>Addressee from code<<<<<<<<"<<endl;
00040 (*itr1).dump();
00041 kdDebug()<<">>>>>>>Addressee from file<<<<<<<<"<<endl;
00042 (*itr2).dump();
00043
00044 rc=1;
00045 }
00046 }
00047
00048 return rc;
00049 }