예제 #1
0
        public void TestIsWordBoundary()
        {
            var str = new Utf32Buffer("Hello () World").AsSlice();

            // Get the boundaries (assuming FindWordBoundaries is correct)
            var boundaries = WordBoundaryAlgorithm.FindWordBoundaries(str).ToList();

            var boundaries2 = new List <int>();

            for (int i = 0; i < str.Length; i++)
            {
                if (WordBoundaryAlgorithm.IsWordBoundary(str.SubSlice(0, i), str.SubSlice(i, str.Length - i)))
                {
                    boundaries2.Add(i);
                }
            }

            Assert.Equal(boundaries, boundaries2);
        }
예제 #2
0
 public bool ShouldAppend(StyledText text)
 {
     // If this is a word boundary then don't extend this unit
     return(!WordBoundaryAlgorithm.IsWordBoundary(_textBlock.CodePoints.SubSlice(0, _offset + _length), text.CodePoints.AsSlice()));
 }