2
* Copyright (C) 2005 Till Adam <adam@kde.org>
3
* This file is subject to the GPL version 2.
6
#include "messagedicttests.h"
11
#include "qtest_kde.h"
13
QTEST_KDEMAIN_CORE( MessageDictTester )
15
void MessageDictTester::initTestCase()
17
m_dict = new KMDict( 4 ); // will be thrown away in init
20
void MessageDictTester::cleanupTestCase()
25
void MessageDictTester::test_KMDictCreation()
27
QCOMPARE( m_dict->size(), 31 );
28
m_dict->init( 13 ); // will be created with a 13, no nextPrime()
29
QCOMPARE( m_dict->size(), 13 );
32
void MessageDictTester::test_KMDictInsert()
34
KMDictItem *item = new KMDictItem();
35
m_dict->insert( 12345, item );
36
KMDictItem *found = m_dict->find( 12345 );
37
QCOMPARE( item, found);
40
void MessageDictTester::test_KMDictRemove()
42
m_dict->remove( 12345 );
43
KMDictItem *item = m_dict->find( 12345 );
44
QCOMPARE( item, (KMDictItem*)0 );
47
void MessageDictTester::test_KMDictClear()
49
for ( unsigned int i=0; i<11; ++i )
50
m_dict->insert( i, new KMDictItem() );
52
QCOMPARE( m_dict->mVecs, (KMDictItem**)0 );
55
void MessageDictTester::test_KMDictReplace()
58
KMDictItem *oldItem = new KMDictItem();
59
KMDictItem *newItem = new KMDictItem();
60
m_dict->insert( 12345, oldItem );
61
m_dict->replace( 12345, newItem );
62
KMDictItem *found = m_dict->find( 12345 );
63
QCOMPARE( found, newItem );
66
#include "messagedicttests.moc"