public void printResults_empty() { int[] arr = { 0 }; TextMatching s = new TextMatching(); string textMatching = s.PrintResults(arr); Assert.AreEqual(null, textMatching); }
public void findMatch_empty() { int FromIndex = 0; string text = "", subtext = ""; TextMatching tm = new TextMatching(); tm.FindMatch(FromIndex, text, subtext); }
public void printResults_invalidValues() { int[] arr = new int[] { 1, 2, 3, -1, 5, 6, 7, 8, 9 }; TextMatching s = new TextMatching(); string textMatching = s.PrintResults(arr); Assert.AreEqual("1,2,3", textMatching); }
public void findMatch_ValidValues_lastIndex() { int FromIndex = 0; string text = "Polly put the kettle on, polly put the kettle on, polly put the kettle on we'll all have tea z", subtext = "z"; int expectedValue = 94; TextMatching tm = new TextMatching(); int actualValue = tm.FindMatch(FromIndex, text, subtext); Assert.AreEqual(expectedValue, actualValue); }
public void calc_validValues() { string text = "polly put the kettle on, polly put the kettle on, polly put the kettle on we'll all have tea", subtext = "polly"; int[] expectedValues = { 1, 26, 51, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; TextMatching tm = new TextMatching(); int[] actualValues = tm.Calc(text, subtext); for (int i = 0; i < actualValues.Length; i++) { Assert.AreEqual(expectedValues[i], actualValues[i]); } }