public void TestSequence() { cbx_1 buffer = new cbx_1(); buffer.Create(20, 100); int lenTest = test.Length(); buffer.InsertString(0, test.Data(), lenTest); Assert.AreEqual(buffer.Length(), lenTest); byte[] ret = new byte[3]; buffer.RetrieveString(1, ret, 3); for (int h = 0; h < 3; h++) { Assert.AreEqual(ret[h], test.CharAt(h + 1)); } for (int i = 0; i < lenTest; i++) { Assert.AreEqual(test.CharAt(i), buffer.CharAt(i)); } buffer.DeleteRange(1, 2); Assert.AreEqual(buffer.Length(), lenTest - 2); buffer.InsertString(1, shortInsert.Data(), 2); Assert.AreEqual(buffer.Length(), lenTest); for (int k = 0; k < lenTest; k++) { Assert.AreEqual(test.CharAt(k), buffer.CharAt(k)); } }
public void testFillRange() { cbx_1 buffer = new cbx_1(); buffer.Create(20, 100); int total = 0; buffer.InsertString(0, longtest.Data(), 10); buffer.FillRange(0, (byte)'x', 10); total++; for (int l = 0; l < 10; l++) { Assert.AreEqual('x', (char)buffer.CharAt(l)); } }
public void TestManyInsertions() { cbx_1 buffer = new cbx_1(); buffer.Create(20, 100); int total = 0; buffer.InsertString(0, longtest.Data(), 1); total++; for (int l = 0; l < 10000; l++) { for (int m = 0; m < 20; m++) { buffer.InsertString(1, longtest.Data(), m + 1); total += m + 1; } } Assert.AreEqual(buffer.Length(), total); }