public void Should_partition_string() { var p = new StringPartition("left=right", "="); Assert.AreEqual("left", p.LeftString); Assert.AreEqual("=", p.Separator); Assert.AreEqual("right", p.RightString); }
public void Should_partition_string_no_sep_match() { var p = new StringPartition("left", "="); Assert.AreEqual("left", p.LeftString); Assert.AreEqual("", p.Separator); Assert.AreEqual("", p.RightString); }
private static IEnumerable <string> GetAllSuffixes(int minSuffixLength, string word) { for (var i = word.Length - minSuffixLength; i >= 0; i--) { var partition = new StringPartition(word, i); yield return(partition.ToString()); } }
public void SplitTest(string origin, int start, int length, int splitAt, string expectedHead, string expectedRest) { var target = new StringPartition(origin, start, length); var actual = target.Split(splitAt); Assert.AreEqual(expectedHead, actual.Head); Assert.AreEqual(expectedRest, actual.Rest); }
public void StartsWithTest(string inputThis, string inputOther, bool expectedResult) { var target = new StringPartition(inputThis); var other = new StringPartition(inputOther); var actual = target.StartsWith(other); Assert.AreEqual(expectedResult, actual); }
public void ZipTest(string inputThis, string inputOther, string expectedCommonHead, string expectedThisRest, string expectedOtherRest) { var target = new StringPartition(inputThis); var other = new StringPartition(inputOther); var actual = target.ZipWith(other); Assert.AreEqual(expectedCommonHead, actual.CommonHead.ToString()); Assert.AreEqual(expectedThisRest, actual.ThisRest.ToString()); Assert.AreEqual(expectedOtherRest, actual.OtherRest.ToString()); }
public SplitResult(StringPartition head, StringPartition rest) { m_Head = head; m_Rest = rest; }
public ZipResult(StringPartition commonHead, StringPartition thisRest, StringPartition otherRest) { m_CommonHead = commonHead; m_ThisRest = thisRest; m_OtherRest = otherRest; }
public SplitResult(StringPartition head, StringPartition rest) { this.m_Head = head; this.m_Rest = rest; }
public SplitResult(StringPartition head, StringPartition rest) { this.head = head; this.rest = rest; }