< Summary

Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 43
Line coverage: 87.5%
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
.ctor(...)100%11100%
GetValues()100%110%
ContainsCore(...)100%11100%
IndexOfAny(...)100%11100%
IndexOfAnyExcept(...)100%11100%
LastIndexOfAny(...)100%11100%
LastIndexOfAnyExcept(...)100%11100%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Private.CoreLib/src/System/SearchValues/Any1CharPackedSearchValues.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
 4using System.Runtime.CompilerServices;
 5using System.Runtime.InteropServices;
 6using System.Runtime.Intrinsics.X86;
 7
 8namespace System.Buffers
 9{
 10    internal sealed class Any1CharPackedSearchValues : SearchValues<char>
 11    {
 12        private readonly char _e0;
 13
 37514        public Any1CharPackedSearchValues(char value) =>
 37515            _e0 = value;
 16
 17        internal override char[] GetValues() =>
 018            [_e0];
 19
 20        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 21        internal override bool ContainsCore(char value) =>
 8114122            value == _e0;
 23
 24        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 25        [CompExactlyDependsOn(typeof(Sse2))]
 26        internal override int IndexOfAny(ReadOnlySpan<char> span) =>
 150027            PackedSpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), _e0, span.Length);
 28
 29        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 30        [CompExactlyDependsOn(typeof(Sse2))]
 31        internal override int IndexOfAnyExcept(ReadOnlySpan<char> span) =>
 150032            PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, span.Length);
 33
 34        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 35        internal override int LastIndexOfAny(ReadOnlySpan<char> span) =>
 75036            span.LastIndexOf(_e0);
 37
 38        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 39        internal override int LastIndexOfAnyExcept(ReadOnlySpan<char> span) =>
 75040            span.LastIndexOfAnyExcept(_e0);
 41    }
 42}
 43