// main.c // Tammy Zhong // Program to test email management system functions // (Provided) #include #include #include "email_management_system.h" int main(void) { printf("*****1. Creating Folder 1... and inserting emails...*****\n"); struct folder *folder_1 = create_folder("Folder 1"); insert_email_at_head(folder_1, "Bob", "A", 10.25, RECEIVED, HIGH_PRIORITY); insert_email_at_head(folder_1, "Frank", "B", 20.44, RECEIVED, NORMAL_PRIORITY); insert_email_at_head(folder_1, "Tammy", "C", 150.0, SENT, HIGH_PRIORITY); insert_email_at_head(folder_1, "Tammy", "D", 150.2, DRAFT, NORMAL_PRIORITY); printf("\n*****2. Printing Folder 1...*****\n"); print_emails(folder_1); printf("\n*****3. Number of emails in Folder 1: %d*****\n", count_emails(folder_1)); printf("\n*****4. Look for email with subject 'Assignment 1'...*****\n"); struct email *email_found = search_email(folder_1, "Assignment 1"); printf("\n*****5. Printing email found in Folder 1 with the subject...*****\n"); print_single_email(email_found); printf("\n*****6. Creating Folder 2... and inserting emails...*****\n"); struct folder *folder_2 = create_folder("Folder 2"); insert_email_at_head(folder_2, "Tammy", "E", 50.5, SENT, HIGH_PRIORITY); insert_email_at_head(folder_2, "Jennie", "F", 5.97, RECEIVED, LOW_PRIORITY); insert_email_at_head(folder_2, "Jisoo", "G", 30.28, RECEIVED, NORMAL_PRIORITY); insert_email_at_head(folder_2, "Rose", "H", 5.5, RECEIVED, HIGH_PRIORITY); insert_email_at_head(folder_2, "Lisa", "I", 25.25, RECEIVED, LOW_PRIORITY); printf("\n*****7. Printing Folder 2...*****\n"); print_emails(folder_2); printf("\n*****8. Deleting LOW_PRIORITY (i.e. priority 3) emails from Folder 2...*****\n"); delete_email_of_priority(folder_2, LOW_PRIORITY); printf("\n*****9. Printing Folder 2...*****\n"); print_emails(folder_2); printf("\n*****10. Merging Folder 1 and Folder 2...*****\n"); struct folder *merged_folder = merge_folders("Merged Folder", folder_1, folder_2); printf("\n*****11. Printing merged folder...*****\n"); print_emails(merged_folder); printf("\n*****12. Sort emails in merged folder based on size...*****\n"); sort_emails(merged_folder); printf("\n*****13. Printing sorted merged folder...*****\n"); print_emails(merged_folder); printf("\n*****14. Split merged folder into inbox, sent and draft folders...*****\n"); struct folder *inbox = create_folder("inbox"); struct folder *sent = create_folder("sent"); struct folder *draft = create_folder("draft"); split_folder(merged_folder, inbox, sent, draft); printf("\n*****15. Printing inbox...*****\n"); print_emails(inbox); printf("\n*****16. Printing sent...*****\n"); print_emails(sent); printf("\n*****17. Printing draft...*****\n"); print_emails(draft); printf("\n*****18. Clearing inbox, sent and draft and freeing all memory...*****\n"); clear_folder(inbox); clear_folder(sent); clear_folder(draft); return 0; }