public void TestUtfStringBuffer2() { string source = "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty"; Utf8StringBuffer buffer = new Utf8StringBuffer(); buffer.Append(source); for (int i = 0; i < 100; i++) { source += "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty"; buffer.Append("abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty"); } Assert.AreEqual(source, buffer.ToString()); Assert.IsTrue(buffer.ToString().EndsWith("njetty")); }
public void TestUtfStringBuffer1() { string source = "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty"; for (int i = 0; i < 100; i++) { source += "abcd012345\n\r\u0000\u00a4\u10fb\ufffdnjetty"; } byte[] bytes = System.Text.Encoding.UTF8.GetBytes(source); Utf8StringBuffer buffer = new Utf8StringBuffer(); for (int i = 0; i < bytes.Length; i++) { buffer.Append(bytes[i]); } Assert.AreEqual(source, buffer.ToString()); Assert.IsTrue(buffer.ToString().EndsWith("njetty")); }