Skip to content
Extraits de code Groupes Projets
Valider fc1b6068 rédigé par Laurent Paucot's avatar Laurent Paucot
Parcourir les fichiers

Test,run,makefile ok

parent fc0d4005
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
all : run all : run
run : run.o test.o run : run.o test.o
gcc -o run run.o test.o gcc -o run run.o test.o -I${HOME}/local/include -lcunit -L${HOME}/local/lib
run.o : run.c run.o : run.c
...@@ -9,11 +9,11 @@ run.o : run.c ...@@ -9,11 +9,11 @@ run.o : run.c
test.o : test.c run.h test.o : test.c run.h
gcc -o test.o -c test.c -I${HOME}/local/include -W -Wall gcc -o test.o -c test.c -I${HOME}/local/include -W -Wall -lcunit
clean : clean :
rm -rf *.o rm -rf *.o
mrproper: clean mrproper: clean
rm -rf hello rm -rf run
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
#include <CUnit/CUnit.h> #include <CUnit/CUnit.h>
#include <CUnit/TestRun.h> #include <CUnit/TestRun.h>
#include <CUnit/CUError.h> #include <CUnit/CUError.h>
#include <CUnit/Basic.h>
void test_is_div(void){ void test_is_div(void){
CU_ASSERT_TRUE(is_div(14,7)); CU_ASSERT_TRUE(is_div(14,7));
} }
void test_is_prime(void){
CU_ASSERT_TRUE(is_prime(13));
}
void test_is_not_prime(void){
CU_ASSERT_FALSE(is_prime(14));
}
int main(){ int setup(void){
if (CUE_SUCCESS != CU_initialize_registry())
{
return CU_get_error();
}
int setup(void){
return 0; return 0;
} }
...@@ -26,6 +26,13 @@ int main(){ ...@@ -26,6 +26,13 @@ int main(){
return 0; return 0;
} }
int main(){
if (CUE_SUCCESS != CU_initialize_registry())
{
return CU_get_error();
}
CU_pSuite pSuite = NULL; CU_pSuite pSuite = NULL;
...@@ -37,7 +44,9 @@ int main(){ ...@@ -37,7 +44,9 @@ int main(){
return CU_get_error(); return CU_get_error();
} }
if (NULL == CU_add_test(pSuite,"test_is_div",test_is_div)) if (NULL == CU_add_test(pSuite,"test_is_div",test_is_div) ||
NULL == CU_add_test(pSuite, "test_is_prime",test_is_prime) ||
NULL == CU_add_test(pSuite, "test_is_not_prime",test_is_not_prime))
{ {
CU_cleanup_registry(); CU_cleanup_registry();
return CU_get_error(); return CU_get_error();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter