Commit d7e0c7e1 authored by pernelle's avatar pernelle
Browse files

coorections sur les tests de conformité

parent 37539aaf
......@@ -505,16 +505,16 @@ int estDemandeConforme(type_demande demande, const char * msg){
char** splitmessage;
char demandeatester[20];
int ret=0;
int i;
int i,nbelement;
//printf("%s %d %s","--> test (estDemandeConforme) demande =", (int) demande,"\n");
strcpy(demandeatester,"");
splitmessage=split(msg,MSG_DELIMINTER,1);
//for(i=0;splitmessage[i]!=NULL;i++)
for(i=0;splitmessage[i]!=NULL;i++)
//{
// printf("%s %s %s","--> test (estDemandeConforme) split =", splitmessage[i],"\n");
//}
nbelement=i;
//printf("%s %d %s","--> test (estDemandeConforme) demande =", (int) demande,"\n");
switch (demande)
{
......@@ -527,9 +527,9 @@ int estDemandeConforme(type_demande demande, const char * msg){
case mondev : strcpy(demandeatester,MSG_GTK_MONDE_OK); break;
default : strcpy(demandeatester,"[NOK]");
}
//printf("%s %s %s","--> test (estDemandeConforme) demande à tester =", demandeatester,"\n");
//printf("%s %s %s %d %s","--> test (estDemandeConforme) demande à tester =", demandeatester,"nb element =",nbelement,"\n");
for(i=0;splitmessage[i]!=NULL;i++) {
if (( (strcmp(splitmessage[i],demandeatester)==0) && (strcmp(splitmessage[i+1],MSG_QUEST)==0) )
if (( (strcmp(splitmessage[i],demandeatester)==0) && (i+1<=nbelement) && (strcmp(splitmessage[i+1],MSG_QUEST)==0) )
|| ( (strcmp(splitmessage[i],demandeatester)==0) && (demande==bataillev) )
|| ( (strcmp(splitmessage[i],demandeatester)==0) && (demande==mondev) ))
{
......@@ -556,10 +556,14 @@ int estReponseConforme(type_demande demande, const char * valeurReponse, const c
int ret=0;
int i;
char demandeatester[20];
int nbelement=0;
//printf("--> lance le split pour tester le nom de clan recu ...\n");
splitmessage=split(msg,MSG_DELIMINTER,1);
for(i=0;splitmessage[i]!=NULL;i++)
nbelement=i;
switch (demande)
{
case nom : strcpy(demandeatester,MSG_CLAN); break;
......@@ -573,7 +577,7 @@ int estReponseConforme(type_demande demande, const char * valeurReponse, const c
for(i=0;splitmessage[i]!=NULL;i++) {
//printf("%s %s","\n -----SPLIT=",splitmessage[i]);
if ( (strcmp(splitmessage[i],demandeatester)==0) && (strcmp(splitmessage[i+1],MSG_QUEST)!=0) )
if ( (strcmp(splitmessage[i],demandeatester)==0) && (i+1<=nbelement) && (strcmp(splitmessage[i+1],MSG_QUEST)!=0) )
{
ret = 1;
......
Supports Markdown
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