Commit 7eb6e4fc authored by Arnaud Lefebvre's avatar Arnaud Lefebvre

Upload New File

parent fbd1e37d
Pipeline #10445 passed with stage
in 0 seconds
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include <CUnit/Automated.h>
#include <pthread.h>
#include <semaphore.h>
#include <inttypes.h>
#include "fonctions.h"
/*
Test si les diviseurs premiers retournés par la fonction list_prime() sont corrects
*/
void test_entier(void) {
list_t *prime2=prime_list(2);
CU_ASSERT(prime2->first->value==2);
clear_list_t(prime2);
list_t *prime3=prime_list(666343);
CU_ASSERT(get_node_t(prime3)==666343);
CU_ASSERT(get_node_t(prime3)==89);
CU_ASSERT(get_node_t(prime3)==7487);
clear_list_t(prime3);
list_t *prime4=prime_list(2147483647);
CU_ASSERT(get_node_t(prime4)==2147483647);
clear_list_t(prime4);
}
/*
Exemple de test qui échouera
*/
void test_failed(void) {
list_t *faux=prime_list(666343);
CU_ASSERT(get_node_t(faux) != 3);
clear_list_t(faux);
}
int main() {
CU_initialize_registry();
CU_pSuite suite = CU_add_suite("maxi_test", 0, 0);
CU_add_test(suite, "fact_entier", test_entier);
CU_add_test(suite, "fail",test_failed);
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_automated_run_tests();
CU_cleanup_registry();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment