forked from RaptDept/ptparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholdrehearsalsigntestsuite.cpp
187 lines (165 loc) · 6.49 KB
/
oldrehearsalsigntestsuite.cpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/////////////////////////////////////////////////////////////////////////////
// Name: oldrehearsalsigntestsuite.cpp
// Purpose: Performs unit testing on the OldRehearsalSign class
// Author: Brad Larsen
// Modified by:
// Created: Dec 10, 2004
// RCS-ID:
// Copyright: (c) Brad Larsen
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "stdwx.h"
#include "oldrehearsalsigntestsuite.h"
#include "oldrehearsalsign.h"
#include "rehearsalsign.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNAMIC_CLASS(OldRehearsalSignTestSuite, TestSuite)
/// Default Constructor
OldRehearsalSignTestSuite::OldRehearsalSignTestSuite()
{
//------Last Checked------//
// - Jan 3, 2005
}
/// Destructor
OldRehearsalSignTestSuite::~OldRehearsalSignTestSuite()
{
//------Last Checked------//
// - Jan 3, 2005
}
/// Gets the total number of tests in the test suite
/// @return The total number of tests in the test suite
size_t OldRehearsalSignTestSuite::GetTestCount() const
{
//------Last Checked------//
// - Jan 3, 2005
return (15);
}
/// Executes all test cases in the test suite
/// @return True if all tests were executed, false if not
bool OldRehearsalSignTestSuite::RunTestCases()
{
//------Last Checked------//
// - Jan 3, 2005
if (!TestCaseConstructor())
return (false);
if (!TestCaseConstruction())
return (false);
if (!TestCaseOperator())
return (false);
return (true);
}
/// Tests the Constructors
/// @return True if all tests were executed, false if not
bool OldRehearsalSignTestSuite::TestCaseConstructor()
{
//------Last Checked------//
// - Jan 3, 2005
// TEST CASE: Default Constructor
{
OldRehearsalSign oldRehearsalSign;
TEST(wxT("Default Constructor"), (
(oldRehearsalSign.m_system == OldRehearsalSign::DEFAULT_SYSTEM) &&
(oldRehearsalSign.m_position == OldRehearsalSign::DEFAULT_POSITION) &&
(oldRehearsalSign.m_data == OldRehearsalSign::DEFAULT_DATA) &&
(oldRehearsalSign.m_letter == OldRehearsalSign::DEFAULT_LETTER) &&
(oldRehearsalSign.m_description == OldRehearsalSign::DEFAULT_DESCRIPTION)
));
}
return (true);
}
/// Tests the Construction Functions
/// @return True if all tests were executed, false if not
bool OldRehearsalSignTestSuite::TestCaseConstruction()
{
//------Last Checked------//
// - Jan 3, 2005
OldRehearsalSign oldRehearsalSign;
oldRehearsalSign.m_system = 10;
oldRehearsalSign.m_position = 11;
oldRehearsalSign.m_data = 12;
oldRehearsalSign.m_letter = 'Z';
oldRehearsalSign.m_description = wxT("Test");
RehearsalSign rehearsalSign;
bool ok = oldRehearsalSign.ConstructRehearsalSign(rehearsalSign);
TEST(wxT("ConstructRehearsalSign"),
ok &&
(rehearsalSign.GetLetter() == 'Z') &&
(rehearsalSign.GetDescription() == wxT("Test"))
);
return (true);
}
/// Tests the Operators
/// @return True if all tests were executed, false if not
bool OldRehearsalSignTestSuite::TestCaseOperator()
{
//------Last Checked------//
// - Jan 5, 2005
// TEST CASE: Assignment Operator
{
OldRehearsalSign oldRehearsalSign;
oldRehearsalSign.m_system = 1;
oldRehearsalSign.m_position = 2;
oldRehearsalSign.m_data = 3;
oldRehearsalSign.m_letter = 'Z';
oldRehearsalSign.m_description = wxT("Test");
OldRehearsalSign oldRehearsalSign2 = oldRehearsalSign;
TEST(wxT("Operator="), (oldRehearsalSign == oldRehearsalSign2));
}
// TEST CASE: Equality Operator
{
OldRehearsalSign oldRehearsalSign;
OldRehearsalSign oldRehearsalSign2;
OldRehearsalSign oldRehearsalSign3;
oldRehearsalSign3.m_system = 1;
OldRehearsalSign oldRehearsalSign4;
oldRehearsalSign4.m_position = 2;
OldRehearsalSign oldRehearsalSign5;
oldRehearsalSign5.m_data = 3;
OldRehearsalSign oldRehearsalSign6;
oldRehearsalSign6.m_letter = 'Z';
OldRehearsalSign oldRehearsalSign7;
oldRehearsalSign7.m_description = wxT("Test");
TEST(wxT("Operator== - oldRehearsalSign == oldRehearsalSign"),
(oldRehearsalSign == oldRehearsalSign2));
TEST(wxT("Operator== - oldRehearsalSign != oldRehearsalSign"),
!(oldRehearsalSign == oldRehearsalSign3));
TEST(wxT("Operator== - oldRehearsalSign != oldRehearsalSign 2"),
!(oldRehearsalSign == oldRehearsalSign4));
TEST(wxT("Operator== - oldRehearsalSign != oldRehearsalSign 3"),
!(oldRehearsalSign == oldRehearsalSign5));
TEST(wxT("Operator== - oldRehearsalSign != oldRehearsalSign 4"),
!(oldRehearsalSign == oldRehearsalSign6));
TEST(wxT("Operator== - oldRehearsalSign != oldRehearsalSign 5"),
!(oldRehearsalSign == oldRehearsalSign7));
}
// TEST CASE: Inequality Operator
{
OldRehearsalSign oldRehearsalSign;
OldRehearsalSign oldRehearsalSign2;
OldRehearsalSign oldRehearsalSign3;
oldRehearsalSign3.m_system = 1;
OldRehearsalSign oldRehearsalSign4;
oldRehearsalSign4.m_position = 2;
OldRehearsalSign oldRehearsalSign5;
oldRehearsalSign5.m_data = 3;
OldRehearsalSign oldRehearsalSign6;
oldRehearsalSign6.m_letter = 'Z';
OldRehearsalSign oldRehearsalSign7;
oldRehearsalSign7.m_description = wxT("Test");
TEST(wxT("Operator!= - oldRehearsalSign == oldRehearsalSign"),
!(oldRehearsalSign != oldRehearsalSign2));
TEST(wxT("Operator!= - oldRehearsalSign != oldRehearsalSign"),
(oldRehearsalSign != oldRehearsalSign3));
TEST(wxT("Operator!= - oldRehearsalSign != oldRehearsalSign 2"),
(oldRehearsalSign != oldRehearsalSign4));
TEST(wxT("Operator!= - oldRehearsalSign != oldRehearsalSign 3"),
(oldRehearsalSign != oldRehearsalSign5));
TEST(wxT("Operator!= - oldRehearsalSign != oldRehearsalSign 4"),
(oldRehearsalSign != oldRehearsalSign6));
TEST(wxT("Operator!= - oldRehearsalSign != oldRehearsalSign 5"),
(oldRehearsalSign != oldRehearsalSign7));
}
return (true);
}