示例#1
0
 public static void RunPossibleValuesChecker(BestSequenceFinderTest.ITestSequenceModel tsm, IBestSequenceFinder sf)
 {
     int[] bestLabels = sf.BestSequence(tsm);
     // System.out.println("The best sequence is ... " + Arrays.toString(bestLabels));
     for (int i = 0; i < bestLabels.Length; i++)
     {
         int[] possibleValues = tsm.GetPossibleValues(i);
         bool  found          = false;
         foreach (int possible in possibleValues)
         {
             if (bestLabels[i] == possible)
             {
                 found = true;
             }
         }
         if (!found)
         {
             Fail("Returned impossible label " + bestLabels[i] + " for position " + i);
         }
     }
 }
示例#2
0
 // end class TestSequenceModel2
 public static void RunSequenceFinder(BestSequenceFinderTest.ITestSequenceModel tsm, IBestSequenceFinder sf)
 {
     int[] bestLabels = sf.BestSequence(tsm);
     NUnit.Framework.Assert.IsTrue("Best sequence is wrong. Correct: " + Arrays.ToString(tsm.CorrectAnswers()) + ", found: " + Arrays.ToString(bestLabels), Arrays.Equals(tsm.CorrectAnswers(), bestLabels));
     NUnit.Framework.Assert.AreEqual("Best sequence score is wrong.", tsm.BestSequenceScore(), tsm.ScoreOf(bestLabels));
 }