Ejemplo n.º 1
0
 void patternReco(char[,] digits, string outputFileName)
 {
     using (StreamWriter outputFile = new StreamWriter(outputFileName)) {
         for( int i = 0; i < nbLineFile ; i = i + 4) {
             string foundNumber = "";
             bool wrongChar = false;
             for (int j = 0; j < nbColFile; j = j + 3)
             {
                 string singleNumber =  detectANumber(digits, i, j);
                 if (singleNumber.Equals("?") )
                 {
                     wrongChar = true;
                 }
                 foundNumber += singleNumber;
             }
             if (wrongChar)
             {
                 foundNumber += " ILL";
             }
             else
             {
                 CheckSum checkSumForAccount = new CheckSum();
                 if (checkSumForAccount.computeCheckSum(foundNumber) != 0)
                 {
                     foundNumber += " ERR";
                 }
             }
             outputFile.WriteLine(foundNumber);
         }
     }
 }
Ejemplo n.º 2
0
 public void TestCheckSumDigitOKWithoutZero()
 {
     CheckSum checker = new CheckSum();
     Assert.AreEqual(0, checker.computeCheckSum("345882865"));
 }
Ejemplo n.º 3
0
 public void TestCheckSumDigitOKWithZero()
 {
     CheckSum checker = new CheckSum();
     Assert.AreEqual(0, checker.computeCheckSum("000000000"));
 }
Ejemplo n.º 4
0
 public void TestCheckSumDigitKO1()
 {
     CheckSum checker = new CheckSum();
     Assert.AreNotEqual(0, checker.computeCheckSum("345882867"));
 }