private static void AssertEqual(byte[] left, byte[] right) { using (MemoryStream leftstream = new(left)) { using (MemoryStream rightstream = new(right)) { AssertEqual(leftstream, rightstream); leftstream.Seek(0, SeekOrigin.Begin); rightstream.Seek(0, SeekOrigin.Begin); AssertEqual(leftstream, rightstream, left.Length); leftstream.Seek(0, SeekOrigin.Begin); rightstream.Seek(0, SeekOrigin.Begin); Assert.IsFalse(FastCompare.NotEquals(leftstream, rightstream)); } } }
public void DifferentLengthFull() { Random r = new(Seed); byte[] left = new byte[8192 * 4]; byte[] right = new byte[8192 * 3]; r.NextBytes(left); Array.Copy(left, right, right.Length); using (MemoryStream leftstream = new(left)) { using (MemoryStream rightstream = new(right)) { Assert.IsFalse(FastCompare.Equals(leftstream, rightstream)); leftstream.Seek(0, SeekOrigin.Begin); rightstream.Seek(0, SeekOrigin.Begin); Assert.IsTrue(FastCompare.NotEquals(leftstream, rightstream)); } } }
private static void AssertDiff(Stream left, Stream right) => Assert.IsTrue(FastCompare.NotEquals(left, right));