From aec1dd1aff4e4af7951f59df5f4229518857e8ed Mon Sep 17 00:00:00 2001 From: lpaucot_uclouvain <laurent.paucot@student.uclouvain.be> Date: Wed, 18 Mar 2020 05:12:32 +0100 Subject: [PATCH] Prototype --- Makefile | 19 +++++++++++++++++++ projet_3.h | 12 ++++++++++++ test.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 Makefile create mode 100644 projet_3.h create mode 100644 test.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..39aadc7 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +all : projet_3 + +projet_3 : projet_3.o test.o + gcc -o projet_3 projet_3.o test.o + + +projet_3.o : projet_3.c + gcc -o projet_3.o -c projet_3.c -W -Wall + + +test.o : test.c + gcc -o test.o -c test.c -W -Wall + + +clean : + rm -rf *.o + +mrproper: clean + rm -rf hello \ No newline at end of file diff --git a/projet_3.h b/projet_3.h new file mode 100644 index 0000000..1ee6af6 --- /dev/null +++ b/projet_3.h @@ -0,0 +1,12 @@ +#ifndef PROJET +#define PROJET + +int is_div(int number, int i); +int is_prime(int number); +list_t *init_node(int value, struct list *list); +void add_node(list_t *list, int value); +list_t * prime_divs(int number); +void *afficherListe(list_t *liste); +void ecrire_dans_fichier(char *input, char *output); + +#endif \ No newline at end of file diff --git a/test.c b/test.c new file mode 100644 index 0000000..7e0e5f8 --- /dev/null +++ b/test.c @@ -0,0 +1,43 @@ +#include <stdlib.h> +#include <stdio.h> +#include "projet_3.h" + +void test_is_div(void){ + CU_ASSERT_TRUE(is_div(14,7)); +} + + + + +if (CUE_SUCCESS != CU_initialize_registry()) +{ + return CU_get_error(); +} + +int setup(void){ + return 0; +} + +int teardown(void) +{ + return 0; +} +CU_pSuite pSuite = NULL; + +pSuite = CU_add_suite("ma_suite",setup,teardown); + +if (NULL == pSuite) +{ + CU_cleanup_registry(); + return CU_get_error(); +} + +if (NULL == CU_add_test(pSuite,"test_is_div",test_is_div)) +{ + CU_cleanup_registry(); + return CU_get_error(); +} + + +CU_basic_run_tests(); +CU_basic_show_failures(CU_get_failure_list()); \ No newline at end of file -- GitLab