diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kmail/tests/messagedicttests.cpp | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/tests/messagedicttests.cpp')
-rw-r--r-- | kmail/tests/messagedicttests.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/kmail/tests/messagedicttests.cpp b/kmail/tests/messagedicttests.cpp new file mode 100644 index 000000000..063fc1cb4 --- /dev/null +++ b/kmail/tests/messagedicttests.cpp @@ -0,0 +1,79 @@ +/** + * Copyright (C) 2005 Till Adam <adam@kde.org> + * This file is subject to the GPL version 2. + */ + +#include <kdebug.h> +#include <kunittest/runner.h> +#include <kunittest/module.h> + +#include "kmdict.h" + +#include "messagedicttests.h" + +static void p( const QString & str ) +{ + kdDebug() << str << endl; +} + +void MessageDictTester::setUp() +{ + kdDebug() << "setUp" << endl; + m_dict = new KMDict( 4 ); // will be thrown away in init +} + +void MessageDictTester::tearDown() +{ + kdDebug() << "tearDown" << endl; + delete m_dict; +} + +void MessageDictTester::testKMDictCreation() +{ + p("MessageDictTester::testKMDict()"); + p("Check creation with size of next prime: "); + CHECK( m_dict->size(), 31 ); + m_dict->init( 13 ); // will be created with a 13, no nextPrime() + CHECK( m_dict->size(), 13 ); +} + +void MessageDictTester::testKMDictInsert() +{ + p("Insert: "); + KMDictItem *item = new KMDictItem(); + m_dict->insert( 12345, item ); + KMDictItem *found = m_dict->find( 12345 ); + CHECK( item, found); +} + +void MessageDictTester::testKMDictRemove() +{ + p("Remove: "); + m_dict->remove( 12345 ); + KMDictItem *item = m_dict->find( 12345 ); + CHECK( item, (KMDictItem*)0 ); +} + +void MessageDictTester::testKMDictClear() +{ + p("Check clear: "); + for ( unsigned int i=0; i<11; ++i ) + m_dict->insert( i, new KMDictItem() ); + m_dict->clear(); + CHECK( m_dict->mVecs, (KMDictItem**)0 ); +} + +void MessageDictTester::testKMDictReplace() +{ + p("Check replace: "); + m_dict->init( 31 ); + KMDictItem *oldItem = new KMDictItem(); + KMDictItem *newItem = new KMDictItem(); + m_dict->insert( 12345, oldItem ); + m_dict->replace( 12345, newItem ); + KMDictItem *found = m_dict->find( 12345 ); + CHECK( found, newItem ); +} + +#include "messagedicttests.moc" + |