Commit 0592e891 authored by Louis Malevez's avatar Louis Malevez

Tests finals

parent 5a4792db
Pipeline #10344 passed with stage
in 0 seconds
//
// Created by Louis Malevez on 13-05-20.
//
#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"
#include"fonctions.c"
void test_entier(void) // test si les diviseurs premiers retournés par la fonction list_prime() sont correctes
{
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);
CU_ASSERT(get_node_t(prime4)==2);
CU_ASSERT(get_node_t(prime4)==3);
CU_ASSERT(get_node_t(prime4)==7);
CU_ASSERT(get_node_t(prime4)==11);
CU_ASSERT(get_node_t(prime4)==31);
CU_ASSERT(get_node_t(prime4)==151);
CU_ASSERT(get_node_t(prime4)==331);
clear_list_t(prime4);
}
int main() {
CU_initialize_registry();
CU_pSuite suite = CU_add_suite("maxi_test", 0, 0);
CU_add_test(suite, "fact_entier", test_entier);
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