Skip to content

Commit ec51253

Browse files
committed
Combine two way to excute the tests
1 parent ea55fb9 commit ec51253

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

test.c

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -426,18 +426,7 @@ int main(int argc, char *argv[]) {
426426
for (int i = 0; i < 11; i++) {
427427
root = Insert(root, input6_1[test_index][i]);
428428
}
429-
// root = arrInsertDelete(root, input6_1[test_index][0]
430-
// , input6_1[test_index][1]
431-
// , input6_1[test_index][2]
432-
// , input6_1[test_index][3]
433-
// , input6_1[test_index][4]
434-
// , input6_1[test_index][5]
435-
// , input6_1[test_index][6]
436-
// , input6_1[test_index][7]
437-
// , input6_1[test_index][8]
438-
// , input6_1[test_index][9]
439-
// , input6_1[test_index][10]
440-
// );
429+
441430

442431
for (int i = 0; i < 3; i++) {
443432
root = Delete(root, input6_2[test_index][i]);
@@ -448,6 +437,22 @@ int main(int argc, char *argv[]) {
448437

449438
int* actual_output6 = getInorder(root);
450439

440+
root = NULL;
441+
root = arrInsertDelete(root, input6_1[test_index][0]
442+
, input6_1[test_index][1]
443+
, input6_1[test_index][2]
444+
, input6_1[test_index][3]
445+
, input6_1[test_index][4]
446+
, input6_1[test_index][5]
447+
, input6_1[test_index][6]
448+
, input6_1[test_index][7]
449+
, input6_1[test_index][8]
450+
, input6_1[test_index][9]
451+
, input6_1[test_index][10]
452+
);
453+
454+
int* actual_output6_2 = getInorder(root);
455+
451456
for (int i = 0; i < 11; i++) {
452457
printf("%d, ", actual_output6[i]);
453458
}
@@ -461,12 +466,24 @@ int main(int argc, char *argv[]) {
461466
break;
462467
}
463468
}
469+
470+
for (int i = 0; i < 11; i++) {
471+
printf("Actual: %d Expected: %d\n", actual_output6_2[i], expected_output6[test_index][i]);
472+
if (actual_output6_2[i] != expected_output6[test_index][i]) {
473+
474+
// compare = false;
475+
break;
476+
}
477+
}
478+
464479
if (compare) {
465480
printf("PASSED\n");
466481
}
467482
else {
468483
printf("FAILED\n");
469484
}
485+
486+
470487
return compare == true ? 0 : 1;
471488

472489

0 commit comments

Comments
 (0)