Added test for display_task_lists

This commit is contained in:
xavi 2024-09-15 10:58:41 -07:00
parent 7bc91f34e6
commit f3be9dc13c

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
// printf Formating
#define X_RED "\x1B[31m"
@ -14,7 +15,7 @@
// SET THE NUMBER OF TESTS
#define NUM_TESTS 5
#define NUM_TESTS 6
// DEFINE REUSABLE TEST SETUPS
int set_up_db(sqlite3 **db){
@ -99,11 +100,40 @@ int test_add_then_update_task_status_then_delete(){
return 0;
}
int test_display_task(){
printf("%s... ", __func__);
FILE *fd1;
FILE *stdout_org;
sqlite3 *db;
int rc = 0;
if ( (rc = set_up_db(&db)) ){
return rc;
}
stdout_org = stdout;
errno = 0;
fd1 = fopen("/dev/null", "w");
if(fd1 == NULL){
return -1;
}
stdout = fd1;
if ( (rc = view_tasks(db)) ){
return rc;
}
stdout = stdout_org;
fclose(fd1);
return 0;
}
int test_update_task(){
printf("%s... ", __func__);
int rc = 0;
sqlite3 *db;
}
// DUMMY TEST
@ -142,6 +172,7 @@ int main(){
tests[2] = test_del_task;
tests[3] = test_add_new_task_with_date_and_delete;
tests[4] = test_add_then_update_task_status_then_delete;
tests[5] = test_display_task;
// END OF PASSING TESTS