Пример #1
0
        /// <summary>
        /// Runs a test for a pair of input text files
        /// </summary>
        /// <param name="expected">The expected results for the test</param>
        /// <param name="oldText">The reference text to compare to</param>
        /// <param name="newText">The updated text to compare</param>
        private static void Test(LineModificationType[] expected, string oldText, string newText)
        {
            MemoryOwner <LineModificationType> result = LineDiffer.ComputeDiff(oldText, newText, '\r');

            try
            {
                Assert.AreEqual(expected.Length, result.Length);

                if (expected.Length == 0)
                {
                    return;
                }

                Assert.IsTrue(expected.SequenceEqual(result.Span.ToArray()));
            }
            finally
            {
                result.Dispose();
            }
        }
Пример #2
0
        private void UpdateDiffInfo(string text)
        {
            MemoryOwner <LineModificationType> diff = LineDiffer.ComputeDiff(_LoadedText, text, Characters.CarriageReturn);

            ref LineModificationType oldRef = ref _DiffIndicators.DangerousGetReference();