예제 #1
0
        [InlineData('\u0080', '\u0080' + 32)] // Outside of ASCII range
        public void AsciiIgnoreCaseEquals_ReturnsFalse(char x, char y)
        {
            // Arrange

            // Act
            var result = Ascii.AsciiIgnoreCaseEquals(x, y);

            // Assert
            Assert.False(result);
        }
예제 #2
0
        public void IsAscii_ReturnsFalseForNonAscii()
        {
            // Arrange
            var text = "abcd\u0080";

            // Act
            var result = Ascii.IsAscii(text);

            // Assert
            Assert.False(result);
        }
예제 #3
0
        public void IsAscii_ReturnsTrueForAscii()
        {
            // Arrange
            var text = "abcd\u007F";

            // Act
            var result = Ascii.IsAscii(text);

            // Assert
            Assert.True(result);
        }
예제 #4
0
        public void UnsafeAsciiIgnoreCaseEquals_ReturnsTrue(string x, string y, int length)
        {
            // Arrange
            var spanX = x.AsSpan();
            var spanY = y.AsSpan();

            // Act
            var result = Ascii.AsciiIgnoreCaseEquals(spanX, spanY, length);

            // Assert
            Assert.True(result);
        }
        public unsafe override int GetDestination(string path, PathSegment segment)
        {
            var length = segment.Length;

            if (length == 0)
            {
                return(_exitDestination);
            }

            var text = _text;

            if (length != text.Length)
            {
                return(_defaultDestination);
            }

            var a = path.AsSpan(segment.Start, length);
            var b = text.AsSpan();

            return(Ascii.AsciiIgnoreCaseEquals(a, b, length) ? _destination : _defaultDestination);
        }