public static void AreEqual(FilterableBuffer b1, FilterableBuffer b2) { if (!b1.CurrentWordSymbols.SequenceEqual(b2.CurrentWordSymbols)) { Assert.IsTrue(false); } AreEqual(b1.Buffer, b2.Buffer); }
public void TestBufferFilter_Punctuation1() { var primer = new FilterableBuffer(); primer.Buffer = new char[] { 'a' }; char[] original = new char[] { '(', 'a', ')', }; AssertBufferFilter(0, true, original, primer); }
public void TestFilterBufferTwoSpaces() { var primer = new FilterableBuffer(); primer.Buffer = new char[] { 'a', ' ', ' ', 'b', }; char[] original = new char[] { 'a', ' ', ' ', 'b', }; AssertBufferFilter(1, false, original, primer); }
public void TestBufferFilter2() { var primer = new FilterableBuffer(); primer.CurrentWordSymbols = new Queue <char>(new[] { 'h', 'j' }); primer.Buffer = new char[] { 'a', 'b', 'c', ' ', '\n', }; char[] original = new char[] { 'a', 'b', 'c', ' ', 'e', 'd', '\n', 'f', 'g', ' ', 'h', 'j', }; AssertBufferFilter(3, false, original, primer); }
public void TestBufferFilter1() { var primer = new FilterableBuffer(); primer.Buffer = new char[] { 'a', 'b', 'c', ' ', '\n', 'h', 'j', 'k', }; char[] original = new char[] { 'a', 'b', 'c', ' ', 'd', 'e', '\n', 'f', 'g', ' ', 'h', 'j', 'k', }; AssertBufferFilter(3, false, original, primer); }
public void TestBufferFilter_Punctuation3() { var primer = new FilterableBuffer(); primer.Buffer = new char[] { 'a', ' ', 'b', }; primer.CurrentWordSymbols = new Queue <char> { }; char[] original = new char[] { 'a', ',', ' ', 'b', }; AssertBufferFilter(0, true, original, primer); }
public static void AssertBufferFilter(int wordLength, bool removing, char[] original, FilterableBuffer primer) { var filter = new TextFilter(wordLength, removing, original.Length); filter.FilterBuffer(original); CustomAssert.AreEqual(filter, primer); }