public void ComputeWithUpperAndLowerCase() { var calculator = new OverlapCalculator("cocaCoLa", false); var result = calculator.Compute(); var expected = new int[] { 0, 0, 1, 0, 1, 2, 0, 0 }; CollectionAssert.AreEqual(expected, result); }
public void ComputeNoMatchingOverlaps() { var calculator = new OverlapCalculator("abdeft", true); var result = calculator.Compute(); var expected = new int[] { 0, 0, 0, 0, 0, 0 }; CollectionAssert.AreEqual(expected, result); }
public void ComputeMatchedOverlaps() { var calculator = new OverlapCalculator("ATTATACA", true); var result = calculator.Compute(); var expected = new int[] { 0, 0, 0, 1, 2, 1, 0, 1 }; CollectionAssert.AreEqual(expected, result); }
/// <summary> /// get an input strings object, produces matches array of all matches and returns true/false on successful completion without any errors /// </summary> /// <param name="input"></param> /// <param name="matches"></param> /// <param name="isCaseSensitive"></param> /// <returns></returns> public static bool Run(IInput input, out int[] matches, bool isCaseSensitive = false) { matches = new int[] { }; if (input == null) { return false; } else if (!input.IsValid) { var errors = input.ErrorList; if (errors != null && errors.Count > 0) { Logger.Push(Environment.NewLine + "Errors in given input: " + string.Join(", ", errors)); } return false; } else { var overlapCalculator = new OverlapCalculator(input.SubText, isCaseSensitive); var algo = new Algorithm(input, overlapCalculator, isCaseSensitive); matches = algo.FindMatches(); return true; } }
/// <summary> /// get an input strings object, produces matches array of all matches and returns true/false on successful completion without any errors /// </summary> /// <param name="input"></param> /// <param name="matches"></param> /// <param name="isCaseSensitive"></param> /// <returns></returns> public static bool Run(IInput input, out int[] matches, bool isCaseSensitive = false) { matches = new int[] { }; if (input == null) { return(false); } else if (!input.IsValid) { var errors = input.ErrorList; if (errors != null && errors.Count > 0) { Logger.Push(Environment.NewLine + "Errors in given input: " + string.Join(", ", errors)); } return(false); } else { var overlapCalculator = new OverlapCalculator(input.SubText, isCaseSensitive); var algo = new Algorithm(input, overlapCalculator, isCaseSensitive); matches = algo.FindMatches(); return(true); } }
public void NullablePattern() { var calculator = new OverlapCalculator(null); }
public void EmptyPattern() { var calculator = new OverlapCalculator(""); }