blob: b69d63a9ddb016779561e8592f7ecd12517e5cc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/***************************************************************************
mymoneyobjecttest.cpp
-------------------
copyright : (C) 2005 by Thomas Baumgart
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "mymoneyobjecttest.h"
#include "mymoneyaccount.h"
MyMoneyObjectTest::MyMoneyObjectTest()
{
}
void MyMoneyObjectTest::setUp () {
}
void MyMoneyObjectTest::tearDown () {
}
void MyMoneyObjectTest::testEmptyConstructor() {
MyMoneyAccount a;
CPPUNIT_ASSERT(a.id().isEmpty());
}
void MyMoneyObjectTest::testConstructor() {
MyMoneyAccount a(TQString("thb"), MyMoneyAccount());
CPPUNIT_ASSERT(!a.id().isEmpty());
CPPUNIT_ASSERT(a.id() == TQString("thb"));
}
void MyMoneyObjectTest::testClearId() {
MyMoneyAccount a(TQString("thb"), MyMoneyAccount());
CPPUNIT_ASSERT(!a.id().isEmpty());
a.clearId();
CPPUNIT_ASSERT(a.id().isEmpty());
}
void MyMoneyObjectTest::testCopyConstructor() {
MyMoneyAccount a(TQString("thb"), MyMoneyAccount());
MyMoneyAccount b(a);
CPPUNIT_ASSERT(a.MyMoneyObject::operator==(b));
}
void MyMoneyObjectTest::testAssignmentConstructor() {
MyMoneyAccount a(TQString("thb"), MyMoneyAccount());
MyMoneyAccount b = a;
CPPUNIT_ASSERT(a.MyMoneyObject::operator==(b));
}
void MyMoneyObjectTest::testEquality() {
MyMoneyAccount a(TQString("thb"), MyMoneyAccount());
MyMoneyAccount b(TQString("thb"), MyMoneyAccount());
MyMoneyAccount c(TQString("ace"), MyMoneyAccount());
CPPUNIT_ASSERT(a.MyMoneyObject::operator==(b));
CPPUNIT_ASSERT(!(a.MyMoneyObject::operator==(c)));
}
|