int main(int argc, char const *argv[]) { pthread_mutex_init(&mutex, NULL); if (argc != 3) { fprintf(stderr, "usage:./testfifo <integer value>:#threads <integer value>:#actions\n"); return -1; } if(atoi(argv[1]) < 1){ fprintf(stderr, "#threads is %d and must be >= 1\n", atoi(argv[1])); return -1; } if(atoi(argv[2]) < 1){ fprintf(stderr, "#actions is %d and must be >= 1\n", atoi(argv[2])); return -1; } int threads = atoi(argv[1]); int actions = atoi(argv[2]); List* l = list_new(); if(!listTest(threads, actions, l, threads * actions, listAdder)){ printf("Addtest failed\n"); return -1; }else{ printf("Addtest Succeeded\n"); } if(!listTest(threads, actions, l, 0, listRemover)){ printf("Removetest failed\n"); return -1; }else{ printf("Removetest Succeeded\n"); } actions -= (actions % 2 == 1) ? 1 : 0; if(!listTest(threads, actions, l, 0, listBoth)){ printf("Bothtest failed\n"); return -1; }else{ printf("Bothtest Succeeded\n"); } return 0; }
int main(void) { listTest(); return 0; }