Skip to content

Commit 02dc2bf

Browse files
committed
Separate test case for CT and original
1 parent ec51253 commit 02dc2bf

3 files changed

Lines changed: 68 additions & 47 deletions

File tree

.github/workflows/test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
steps:
2525
- name: run test
2626
run: |
27-
./test 6 0
28-
./test 6 1
29-
./test 6 2
30-
./test 6 3
31-
./test 6 4
32-
./test 6 5
33-
./test 6 6
27+
./test 6 0 0
28+
./test 6 1 0
29+
./test 6 2 0
30+
./test 6 3 0
31+
./test 6 4 0
32+
./test 6 5 0
33+
./test 6 6 0
3434
# ./test 5 0
3535
# ./test 5 1
3636
# ./test 5 2

test.c

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ int main(int argc, char *argv[]) {
247247
#endif
248248
int test_case = atoi(argv[1]);
249249
int test_index = atoi(argv[2]); //e.q. ./test 2 3
250+
int test_orig = atoi(argv[3]);
250251
bool compare = true;
251252

252253
double input5[TEST_SIZE][4] = {
@@ -422,60 +423,80 @@ int main(int argc, char *argv[]) {
422423

423424
case 6: ;
424425
struct Node* root = NULL;
426+
int* actual_output6 = NULL;
425427

426-
for (int i = 0; i < 11; i++) {
427-
root = Insert(root, input6_1[test_index][i]);
428-
}
428+
if (test_orig == 0) {
429+
for (int i = 0; i < 11; i++) {
430+
root = Insert(root, input6_1[test_index][i]);
431+
}
429432

430433

431-
for (int i = 0; i < 3; i++) {
432-
root = Delete(root, input6_2[test_index][i]);
433-
}
434+
for (int i = 0; i < 3; i++) {
435+
root = Delete(root, input6_2[test_index][i]);
436+
}
434437
// root = arrDelete(root, input6_2[test_index][0]
435438
// , input6_2[test_index][1]
436439
// , input6_2[test_index][2]);
437440

438-
int* actual_output6 = getInorder(root);
441+
actual_output6 = getInorder(root);
442+
}
443+
else {
444+
root = NULL;
445+
root = arrInsertDelete(root, input6_1[test_index][0]
446+
, input6_1[test_index][1]
447+
, input6_1[test_index][2]
448+
, input6_1[test_index][3]
449+
, input6_1[test_index][4]
450+
, input6_1[test_index][5]
451+
, input6_1[test_index][6]
452+
, input6_1[test_index][7]
453+
, input6_1[test_index][8]
454+
, input6_1[test_index][9]
455+
, input6_1[test_index][10]
456+
);
457+
458+
actual_output6 = getInorder(root);
459+
}
460+
439461

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-
);
453462

454-
int* actual_output6_2 = getInorder(root);
455463

456464
for (int i = 0; i < 11; i++) {
457465
printf("%d, ", actual_output6[i]);
458466
}
459467
int i = 0;
460468
compare = true;
461-
for (int i = 0; i < 11; i++) {
462-
printf("Actual: %d Expected: %d\n", actual_output6[i], expected_output6_orig[test_index][i]);
463-
if (actual_output6[i] != expected_output6_orig[test_index][i]) {
464-
465-
compare = false;
466-
break;
469+
if (test_orig == 0) {
470+
for (int i = 0; i < 11; i++) {
471+
printf("Actual: %d Expected: %d\n", actual_output6[i], expected_output6_orig[test_index][i]);
472+
if (actual_output6[i] != expected_output6_orig[test_index][i]) {
473+
474+
compare = false;
475+
break;
476+
}
467477
}
468478
}
479+
else {
480+
for (int i = 0; i < 11; i++) {
481+
printf("Actual: %d Expected: %d\n", actual_output6[i], expected_output6[test_index][i]);
482+
if (actual_output6[i] != expected_output6[test_index][i]) {
469483

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;
484+
compare = false;
485+
break;
486+
}
476487
}
477488
}
478489

490+
491+
// for (int i = 0; i < 11; i++) {
492+
// printf("Actual: %d Expected: %d\n", actual_output6_2[i], expected_output6[test_index][i]);
493+
// if (actual_output6_2[i] != expected_output6[test_index][i]) {
494+
//
495+
//// compare = false;
496+
// break;
497+
// }
498+
// }
499+
479500
if (compare) {
480501
printf("PASSED\n");
481502
}

vulcan.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ coverage-build-command: | # 커버리지 빌드 커맨드 / defect4cpp 기준 me
3030
# 테스트 실행 역시 range안에 있는 테스트들만 실행하도록 묶어서 command를 부르거나 여러번 불러야함
3131
test-type: automake
3232
test-list: | # 테스트 리스트 커맨드 / 테스트를 하나씩 실행하기 위해 테스트 리스트를 출력해주는 내용 필요
33-
./test 6 0
34-
./test 6 1
35-
./test 6 2
36-
./test 6 3
37-
./test 6 4
38-
./test 6 5
39-
./test 6 6
33+
./test 6 0 0
34+
./test 6 1 0
35+
./test 6 2 0
36+
./test 6 3 0
37+
./test 6 4 0
38+
./test 6 5 0
39+
./test 6 6 0
4040
# ./test 5 0
4141
# ./test 5 1
4242
# ./test 5 2

0 commit comments

Comments
 (0)