-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBin.h
More file actions
247 lines (235 loc) · 7.97 KB
/
TestBin.h
File metadata and controls
247 lines (235 loc) · 7.97 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*
TestBin: Defined functions for testing the bin class
@file vector3D.h
@author Adanna Obibuaku
@date 14/11/20
*/
#define NO_BINS 6
#define NO_BIN_TEST 7
#ifndef BIN_HEADER
#define BIN_HEADER
#include "Bin.h"
#endif
//Helper function below:
/*
* assertEqualsBin: A helper funtion. This is used to check whether two bins
have the same value. Two bins are equal if they have the
* same class
* Input:
* b (Bin): The bin provided by the class
* expectedIndex (Bin): The expected index of bin
* expectedSize (Bin): The expected index of size
* Output:
* (bool) denotes if the two bins are equal
*/
bool assertEqualBin(Bin b, float expectedIndex, float expextedSize);
/*
* add: A helper fundtion. This is used at add elements for a given
* bin
* Input:
* b (Bin): The bin provided
* maxSize (int): The size of the bin
* Output:
* (b): The bin added with the apprioate elements
*/
Bin add(Bin b,int maxSize);
/*
* testCpyConstructor: Testing the copy constructor within Bin class.
* Expected pstTest = |(1,1,1)|
* |(2,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* Expected cpyTest = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* Expected -> When I remove an element from an object bin
* it does not directly affect/change prior bin
* object is was copied from.
*/
bool testCpyConstructor();
/*
* TestAssignmentOp: testing the assignment operator in Bin class
* Expected normalTest = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
*
* Expected errorTest = |(1,1,1)|
* |(2,1,1)|
* Expected -> (Normal)
* When I assign a Bin object to a Bin object it returns
* The correct bin.
* (Error)
* When I assign a Bin object to the same
* Bin object it returns the same Bin Object
*/
bool testAssignmentOp();
/*
* testXComponet: testing the getX() function in Bin class
* Expected normal: 3 Input: getX(2) Enviroment: (Size = 3)
* Expected range: 0.0 Input: getX(-1)
*/
bool testXComponetBin();
/*
* testYComponet: testing the getY() function in Bin class
* Expected normal: 1 Input: getX(1) Enviroment: (Size = 2)
* Expected range: 0.0 Input: getX(2)
*/
bool testYComponetBin();
/*
* testZComponet: testing the getZ() function in Bin class
* Expected normal: 1 Input: getZ(1) Enviorment: (Size = 2 )
* Expected range: 0.0 Input: getZ(5)
*/
bool testZComponetBin();
/*
* testAddBin: testing add function in the Bin class
* normal values: We have bin sizes of 6 Test Bin objects which have the sizes
* n = 0, 1, 2, 3 ,4, 5 respectivly. We are testing that that the
* add function works correctly to add n number of elements when
* our bin size is within range.
*
* Expected testBins[0] = Nothing Input vectors: Nothing
* Bin size: 0
*
* Expected testBins[1] = |(1,1,1)| Input vectors: (1,1,1)
* Bin size: 1
*
* Expected testBins[2] = |(1,1,1)| Input vectors: (1,1,1), (2,1,1)
* |(2,1,1)| Bin size: 2
*
* Expected testBins[3] = |(1,1,1)| Input vectors: (1,1,1), (2,1,1), (3,1,1)
* |(2,1,1)| Bin size: 3
* |(3,1,1)|
*
* Expected testBins[4] = |(1,1,1)| Input vectors: (1,1,1), (2,1,1), (3,1,1), (4,1,1)
* |(2,1,1)| Bin size: 4
* |(3,1,1)|
* |(4,1,1)|
*
* Expected testBins[5] = |(1,1,1)| Input vectors: (1,1,1), (2,1,1), (3,1,1), (4,1,1), (5,1,1)
* |(2,1,1)| Bin size: 5
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
*
* range values: We have bin sizes of 6 test Bin objects which have the the sizes
* n = 0, 1, 2, 3, 4, 5 respectivly. We are testing that the add function
* works correctly to add n+1 number off elements when our bin size
* is out of range.
*
* Expected testBins2[0] = |(1,1,1)| Input Vector: (1,1,1)
* |(0,0,0)| Bin size: 0
*
* Expected testBins2[1] = |(1,1,1)| Input Vector: (1,1,1), (2,1,1)
* |(2,1,1)| Bin size: 1
*
* Expected testBins2[2] = |(1,1,1)| Input Vector: (1,1,1), (2,1,1), (3,1,1)
* |(2,1,1)| Bin size: 2
* |(3,1,1)|
* |(0,0,0)|
*
* Expected testBins2[3] = |(1,1,1)| Input Vector: (1,1,1), (2,2,2), (3,1,1), (4,1,1)
* |(2,1,1)| Bin size: 4
* |(3,1,1)|
* |(4,1,1)|
* |(0,0,0)|
* |(0,0,0)|
*
* Expected testBins2[4] = |(1,1,1)| Input Vector: (1,1,1), (2,2,2), (3,1,1), (4,1,1), (5,1,1)
* |(2,1,1)| Bin size: 5
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
*
* Expected testBins2[5] = |(1,1,1)| Input Vector: (1,1,1), (2,2,2), (3,1,1), (4,1,1), (5,1,1)
* |(2,1,1)| Bin size: 6
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* |(6,1,1)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
*/
bool testAddBin();
/*
* testRemoveBin: Testing the remove function in Bin class
*
* --> where using the same bins as before.
*
* normal values: Testing we can remove element, when elements exits within the
* Bin object.
* Expected testBins[0] =
*
* Expected testBins[1] =
*
* Expected testBins[2] = |(1,1,1)|
*
* Expected testBins[3] = |(1,1,1)|
* |(3,1,1)|
*
* Expected testBins[4] = |(1,1,1)|
* |(2,1,1)|
* |(4,1,1)|
*
* Expected testBins[5] = |(1,1,1)|
* |(2,1,1)|
* |(4,1,1)|
* |(5,1,1)|
*
* range values: Testing remove function works correctly, when the element specified
* to be removed is not within the range of bin size. The Bin should
* not change
*
* Expected testBins[0] = |(1,1,1)|
* |(0,0,0)|
*
* Expected testBins[1] = |(1,1,1)|
* |(2,1,1)|
*
* Expected testBins[2] = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
* |(0,0,0)|
*
* Expected testBins[3] = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
* |(4,1,1)|
* |(0,0,0)|
* |(0,0,0)|
*
* Expected testBins[4] = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
*
* Expected testBins[5] = |(1,1,1)|
* |(2,1,1)|
* |(3,1,1)|
* |(4,1,1)|
* |(5,1,1)|
* |(6,1,1)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
* |(0,0,0)|
*
* Error test: Testing the remove function works correctly, when we try to remove
* from a bin, which has no elements.
* Expected test = |0,0,0|
* |0,0,0|
* |0,0,0|
* |0,0,0|
*/
bool testRemoveBin();