From 281272a79110a4372f9cdd26c3433afe5bb1b5f3 Mon Sep 17 00:00:00 2001 From: Thomas Feuvrier <thomas.feuvrier@c-s.fr> Date: Wed, 26 Jul 2006 08:42:17 +0000 Subject: [PATCH] MAJ dos2unix. --- Code/Common/otbTestMain.h | 196 +++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/Code/Common/otbTestMain.h b/Code/Common/otbTestMain.h index 9171b09c1d..9f460e870f 100644 --- a/Code/Common/otbTestMain.h +++ b/Code/Common/otbTestMain.h @@ -268,47 +268,47 @@ otbMsgDebugMacro(<<"---------------- FIN Controle NON-REGRESION ----------- // Regression Testing Code -bool isNumber(int i) -{ - return ((i>47)&&(i<58)); -} - -bool isPoint(int i) -{ - return (i==46); -} - -bool isMinusSign(int i) -{ - return (i==45); -} - -bool isNumeric(std::string str) -{ - int nbOfPoints = 0 ; - int nbOfNumbers = 0 ; +bool isNumber(int i) +{ + return ((i>47)&&(i<58)); +} + +bool isPoint(int i) +{ + return (i==46); +} + +bool isMinusSign(int i) +{ + return (i==45); +} + +bool isNumeric(std::string str) +{ + int nbOfPoints = 0 ; + int nbOfNumbers = 0 ; int number ; - int i = 0 ; - bool result = true ; - - while ((i<str.size())&&(result==true)) - { - number = str[i]; - - if (isPoint(number)) - nbOfPoints++ ; - if (isNumber(number)) - nbOfNumbers++; + int i = 0 ; + bool result = true ; + + while ((i<str.size())&&(result==true)) + { + number = str[i]; + + if (isPoint(number)) + nbOfPoints++ ; + if (isNumber(number)) + nbOfNumbers++; if ((!isNumber(number)&&!isPoint(number)&&!isMinusSign(number)) - ||(isMinusSign(number)&&(i!=0))) + ||(isMinusSign(number)&&(i!=0))) result = false ; - - i++; - } - if ((str.size()==0)||(nbOfPoints > 1)/*||(nbOfNumbers==0)*/) - result = false ; - - return result; + + i++; + } + if ((str.size()==0)||(nbOfPoints > 1)/*||(nbOfNumbers==0)*/) + result = false ; + + return result; } int RegressionTestAsciiFile(const char * testAsciiFileName, const char * baselineAsciiFileName, int reportErrors, const double epsilon) @@ -345,62 +345,62 @@ int RegressionTestAsciiFile(const char * testAsciiFileName, const char * baselin std::getline(fluxfiletest,strfiletest); - buffstreamRef << strfileref ; + buffstreamRef << strfileref ; buffstreamTest << strfiletest ; - - while (buffstreamRef.peek() != EOF) - { + + while (buffstreamRef.peek() != EOF) + { std::string strRef; std::string strTest; - - std::string strNumRef; + + std::string strNumRef; std::string strCharRef; - std::string strNumTest; - std::string strCharTest; - + std::string strNumTest; + std::string strCharTest; + buffstreamRef >> strRef ; - buffstreamTest >> strTest ; - - bool chgt= false; - std::string charTmpRef; + buffstreamTest >> strTest ; + + bool chgt= false; + std::string charTmpRef; std::string charTmpTest; - - unsigned int i=0; - - while (i < strRef.size()) - { + + unsigned int i=0; + + while (i < strRef.size()) + { charTmpRef=strRef[i]; - charTmpTest=strTest[i]; - - if (isNumeric(charTmpRef)) - etatCour = ETAT_NUM; - else - etatCour = ETAT_CHAR; - - // initialisation de l'état de "référence" - if (i==0) - etatPrec=etatCour; - - // Cas où l'on a un chiffre après des caractères - if ((etatCour==ETAT_NUM)&&(etatPrec==ETAT_CHAR)) - { + charTmpTest=strTest[i]; + + if (isNumeric(charTmpRef)) + etatCour = ETAT_NUM; + else + etatCour = ETAT_CHAR; + + // initialisation de l'état de "référence" + if (i==0) + etatPrec=etatCour; + + // Cas où l'on a un chiffre après des caractères + if ((etatCour==ETAT_NUM)&&(etatPrec==ETAT_CHAR)) + { if ( strCharRef != strCharTest ) { fluxfilediff << "Diff at line " << numLine << " : " << strCharRef << " != " << strCharTest << std::endl ; nbdiff++; - } + } strCharRef=""; - strCharTest=""; + strCharTest=""; strNumRef=charTmpRef; - strNumTest=charTmpTest; - chgt=true; - } - // Cas où l'on a un caractère après des chiffres - else if ((etatCour==ETAT_CHAR)&&(etatPrec==ETAT_NUM)) - { + strNumTest=charTmpTest; + chgt=true; + } + // Cas où l'on a un caractère après des chiffres + else if ((etatCour==ETAT_CHAR)&&(etatPrec==ETAT_NUM)) + { if (fabs(atof(strNumRef.c_str())-atof(strNumTest.c_str())) > epsilon) { @@ -409,34 +409,34 @@ int RegressionTestAsciiFile(const char * testAsciiFileName, const char * baselin << ") ) > " << epsilon << std::endl ; nbdiff++; } - + strNumRef=""; - strNumTest=""; + strNumTest=""; strCharRef=charTmpRef; - strCharTest=charTmpTest; - chgt=true; - } - else if (etatCour==etatPrec) - { + strCharTest=charTmpTest; + chgt=true; + } + else if (etatCour==etatPrec) + { if (etatCour==ETAT_CHAR) - { + { strCharRef+=charTmpRef; strCharTest+=charTmpTest; - } + } else { - strNumRef+=charTmpRef; + strNumRef+=charTmpRef; strNumTest+=charTmpTest; - } - } - - etatPrec = etatCour; - i++; + } + } + + etatPrec = etatCour; + i++; } - // Cas le plus simple : chaine de caractere ou valeur numérique entre 2 separateurs - if (!chgt) - { + // Cas le plus simple : chaine de caractere ou valeur numérique entre 2 separateurs + if (!chgt) + { if (isNumeric(strRef)) { @@ -457,10 +457,10 @@ int RegressionTestAsciiFile(const char * testAsciiFileName, const char * baselin << " != " << strTest << std::endl ; nbdiff++; } - } + } } } - numLine++; + numLine++; } fluxfiletest.close(); -- GitLab