< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 28
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IsValid(...)100%110%
IndexOfInvalidSubsequence(...)100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Private.CoreLib/src/System/Text/Unicode/Utf16.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Text.Unicode
 5{
 6    /// <summary>
 7    /// Provides static methods that validate UTF-16 strings.
 8    /// </summary>
 9    public static class Utf16
 10    {
 11        /// <summary>
 12        /// Validates that the value is well-formed UTF-16.
 13        /// </summary>
 14        /// <param name="value">The <see cref="ReadOnlySpan{T}"/> containing the UTF-16 input text to validate.</param>
 15        /// <returns><c>true</c> if <paramref name="value"/> is well-formed UTF-16, <c>false</c> otherwise.</returns>
 16        public static bool IsValid(ReadOnlySpan<char> value) =>
 017            Utf16Utility.GetIndexOfFirstInvalidUtf16Sequence(value) < 0;
 18
 19        /// <summary>
 20        /// Finds the index of the first invalid UTF-16 subsequence.
 21        /// </summary>
 22        /// <param name="value">The <see cref="ReadOnlySpan{T}"/> containing the UTF-16 input text to examine.</param>
 23        /// <returns>The index of the first invalid UTF-16 subsequence, or <c>-1</c> if the entire input is valid.</retu
 24        public static int IndexOfInvalidSubsequence(ReadOnlySpan<char> value) =>
 025            Utf16Utility.GetIndexOfFirstInvalidUtf16Sequence(value);
 26    }
 27}
 28