From 8669ec14246ad6f4c740bdaece7481f2ebdb4ffd Mon Sep 17 00:00:00 2001 From: lpaucot_uclouvain <laurent.paucot@student.uclouvain.be> Date: Thu, 19 Mar 2020 02:08:58 +0100 Subject: [PATCH] =?UTF-8?q?code=20ok,=20valid=C3=A9=20par=20test.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.c | 4 ++-- test.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/run.c b/run.c index 729b0e2..0f3f34b 100644 --- a/run.c +++ b/run.c @@ -116,10 +116,10 @@ int run (char *input,char *output){ struct node *current; current = malloc(sizeof(node_t)); *current = *pr_divs->tail; - fprintf(file2,"%s ",chaine); + fprintf(file2,"%s",chaine); for (int i = 0; i < pr_divs->size; i++) { - fprintf(file2,"%d ",current->value); + fprintf(file2," %d",current->value); current = current->next; } fputc('\n',file2); diff --git a/test.c b/test.c index 7518c6e..c3840f3 100644 --- a/test.c +++ b/test.c @@ -39,17 +39,15 @@ void file_test(void){ return; } - CU_ASSERT_PTR_EQUAL(file1,file2); - - /* char chaine1[50]; + char chaine1[50]; char chaine2[50]; while (fgets(chaine1,50,file1) != NULL && fgets(chaine2,50,file2) != NULL) { - printf(chaine1); - printf(chaine2); - CU_ASSERT_PTR_EQUAL(chaine1,chaine2); - } */ + printf("%d\n",chaine1[2]); + printf("%d\n",chaine2[2]); + CU_ASSERT_STRING_EQUAL(chaine1,chaine2); + } fclose(file1); fclose(file2); -- GitLab