int main(int argc, char *argv[]) { int list[MAX]; init_queue(list); printf("Queue from start:\n"); print_queue(list); printf("Queue after adding 7,8,9 in turn\n"); input(list, 7); input(list, 8); input(list, 9); print_queue(list); printf("Queue after adding 21\n"); input(list, 21); print_queue(list); printf("Queue after removing 7\n"); remove(list); print_queue(list); printf("Querying the queue\n"); queue_status(list); printf("Filling the queue\n"); input(list, 9); input(list, 9); print_queue(list); queue_status(list); printf("Attempting to add to queue, this is the returned int: %d \n", input(list, 200)); print_queue(list); remove(list); printf("Removing and attempting again, this is the returned int: %d \n", input(list, 200)); }
int main(void) { srand(time(NULL)); cmocka_tests(); getchar(); system("cls"); queue_t * queue = queue_new(); user_t * user1 = user_new("User1"); user_t * user2 = user_new("User2"); user_t * user3 = user_new("User3"); user_t * userArr[] = { user1, user2, user3 }; int userArrSize = sizeof(userArr)/sizeof(userArr[0]); event_t* firstEvent = event_new("First event"); event_t* secondEvent = event_new("Second event"); event_t* thirdEvent = event_new("Third event"); event_addReceiver(firstEvent, user1, alert_callback); event_addReceiver(firstEvent, user2, alert_callback); event_addReceiver(secondEvent, user1, alert_callback); event_addReceiver(thirdEvent, user1, alert_callback); event_addReceiver(secondEvent, user2, alert_callback); event_addReceiver(thirdEvent, user3, alert_callback); event_addReceiver(secondEvent, user3, alert_callback); event_addReceiver(thirdEvent, user2, alert_callback); while(!kbhit() && queue_status(queue) != QUEUE_FULL) { queue_start(firstEvent, secondEvent, thirdEvent, queue); } event_free(firstEvent); event_free(secondEvent); event_free(thirdEvent); for(int i = 0; i<userArrSize; i++) user_free(userArr[i]); queue_free(queue); return 0; }