public void ConcatenateSmallRopesToRope() { StringBuilder b = new StringBuilder(); Rope <char> rope = new Rope <char>(); for (int i = 1; i <= 1000; i++) { b.Append(i.ToString()); b.Append(' '); rope.AddRange(CharRope.Create(i.ToString() + " ")); } Assert.AreEqual(b.ToString(), rope.ToString()); }
public void ConcatenateSmallRopesToRopeBackwards() { StringBuilder b = new StringBuilder(); Rope <char> rope = new Rope <char>(); for (int i = 1; i <= 1000; i++) { b.Append(i.ToString()); b.Append(' '); } for (int i = 1000; i >= 1; i--) { rope.InsertRange(0, CharRope.Create(i.ToString() + " ")); } Assert.AreEqual(b.ToString(), rope.ToString()); }
public void ConcatenateSmallRopesByInsertionInMiddle() { StringBuilder b = new StringBuilder(); Rope <char> rope = new Rope <char>(); for (int i = 1; i <= 1000; i++) { b.Append(i.ToString("d3")); b.Append(' '); } int middle = 0; for (int i = 1; i <= 500; i++) { rope.InsertRange(middle, CharRope.Create(i.ToString("d3") + " ")); middle += 4; rope.InsertRange(middle, CharRope.Create((1001 - i).ToString("d3") + " ")); } Assert.AreEqual(b.ToString(), rope.ToString()); }