public void NfdAndFixOffsets_WithStackedDiacriticsInMultipleRuns_FixesOffsetsCorrectly()
        {
            TsString input = CreateStackedDiacriticsInput(singleRun: false);

            int[] origOffsets     = { 21, 22, 23, 24, 25 };             // Offsets 26 through end of string are unchanged by this test
            int[] expectedOffsets = { 21, 24, 22, 23, 25 };

            ITsString nfd;

            int[] actualOffsets;
            using (ArrayPtr nativeOffsets = ConvertToNativeArray(origOffsets))
            {
                input.NfdAndFixOffsets(out nfd, nativeOffsets, origOffsets.Length);
                actualOffsets = ConvertToManagedArray(nativeOffsets, origOffsets.Length);
            }
            CollectionAssert.AreEqual(expectedOffsets, actualOffsets);

            // All the new offsets should still point to the same characters that they did before
            for (int i = 0; i < origOffsets.Length; i++)
            {
                int  oldOffset = origOffsets[i];
                int  newOffset = actualOffsets[i];
                char oldCh     = input.Text[oldOffset];
                char newCh     = nfd.Text[newOffset];
                Assert.That(newCh, Is.EqualTo(oldCh),
                            String.Format("Old char '{0}' (U+{1:X4}) at {2} should match new char '{3}' (U+{4:X4}) at {5}, but didn't match.",
                                          oldCh, (int)oldCh, oldOffset, newCh, newOffset, (int)newCh));
            }
        }
        public void NfdAndFixOffsets_OffsetsPointingToSecondHalfOfSurrogatePair_AreFixedUpToPointToFirstHalf(
            string input, string expectedNfd, int[] origOffsets, int[] expectedOffsets)
        {
            var       tsInput = new TsString(input, EnglishWS);
            ITsString nfd;

            int[] actualOffsets;
            using (ArrayPtr nativeOffsets = ConvertToNativeArray(origOffsets))
            {
                tsInput.NfdAndFixOffsets(out nfd, nativeOffsets, origOffsets.Length);
                actualOffsets = ConvertToManagedArray(nativeOffsets, origOffsets.Length);
            }
            CollectionAssert.AreEqual(expectedOffsets, actualOffsets);
            Assert.That(nfd.Text, Is.EqualTo(expectedNfd));
        }