Skip to content

Commit 6a1abd3

Browse files
committed
More Test
1 parent a115adf commit 6a1abd3

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

src/BranchChecker_avl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Node* Delete(Node* node, int data)
220220

221221
void Inorder(Node* node, int* result) {
222222
if (node == NULL) return;
223-
if (curIndex >= 7) return;
223+
if (curIndex >= 11) return;
224224

225225
Inorder(node->Left, result);
226226

@@ -240,8 +240,8 @@ void Inorder(Node* node, int* result) {
240240
}
241241

242242
int* getInorder(Node* node) {
243-
int* result = (int*)malloc(sizeof(int) * 7);
244-
for(int i = 0; i < 7; i++) {
243+
int* result = (int*)malloc(sizeof(int) * 11);
244+
for(int i = 0; i < 11; i++) {
245245
result[i] = 0;
246246
}
247247
Inorder(node, result);

test.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ double input5_1[TEST_SIZE][4] = {
132132
{5, 8, 10, 3}
133133
};
134134

135-
int input6_1[TEST_SIZE][7] = {
136-
{4, 10, 13, 20, 25, 32, 55},
137-
{3, 8, 11, 6, 8, 10, 30},
138-
{7, 6, 5, 4, 3, 2, 1},
139-
{20, 200, 5, 2, 3, 25, 5},
140-
{7, 6, 5, 4, 3, 2, 1},
141-
{20, 200, 5, 2, 3, 25, 5},
142-
{3, 8, 11, 6, 8, 10, 30}
135+
int input6_1[TEST_SIZE][11] = {
136+
{4, 10, 13, 20, 25, 32, 55, 20, 25, 32, 55},
137+
{3, 8, 11, 6, 8, 10, 30, 6, 8, 10, 30},
138+
{7, 6, 5, 4, 3, 2, 1, 4, 3, 2, 1},
139+
{20, 200, 5, 2, 3, 25, 5, 2, 3, 25, 5},
140+
{7, 6, 5, 4, 3, 2, 1, 4, 3, 2, 1},
141+
{20, 200, 5, 2, 3, 25, 5, 2, 3, 25, 5},
142+
{38, 6, 1, 90, 12, 50, 54, 17, 20, 4, 45 }
143143
};
144144

145145
int input6_2[TEST_SIZE][3] = {
@@ -149,7 +149,7 @@ int input6_2[TEST_SIZE][3] = {
149149
{5, 3, 5},
150150
{0, 0, 0},
151151
{0, 0, 25},
152-
{0, 0, 0}
152+
{4, 11, 45}
153153
};
154154

155155

@@ -189,14 +189,14 @@ double expected_output5[TEST_SIZE][4] = {
189189
{5, 8, 8, 5}
190190
};
191191

192-
int expected_output6[TEST_SIZE][7] = {
192+
int expected_output6[TEST_SIZE][11] = {
193193
{20, 25, 32, 55},
194194
{6, 8, 30},
195195
{1, 2, 3, 4, 7},
196196
{2, 20, 25, 200},
197197
{1, 2, 3, 4, 5, 6, 7},
198198
{2, 3, 5, 20, 200},
199-
{3, 6, 8, 10, 11, 30}
199+
{1, 6, 12, 17, 20, 38, 50, 54, 90}
200200
};
201201

202202

@@ -345,7 +345,7 @@ int main(int argc, char *argv[]) {
345345
case 6: ;
346346
struct Node* root = NULL;
347347

348-
for (int i = 0; i < 7; i++) {
348+
for (int i = 0; i < 11; i++) {
349349
root = Insert(root, input6_1[test_index][i]);
350350
}
351351

@@ -355,13 +355,15 @@ int main(int argc, char *argv[]) {
355355

356356
int* actual_output6 = getInorder(root);
357357

358-
for (int i = 0; i < 7; i++) {
358+
for (int i = 0; i < 11; i++) {
359359
printf("%d, ", actual_output6[i]);
360360
}
361361
int i = 0;
362362
bool compare = true;
363-
for (int i = 0; i < 7; i++) {
363+
for (int i = 0; i < 11; i++) {
364+
printf("Actual: %d Expected: %d\n", actual_output6[i], expected_output6[test_index][i]);
364365
if (actual_output6[i] != expected_output6[test_index][i]) {
366+
365367
compare = false;
366368
break;
367369
}

0 commit comments

Comments
 (0)