< Summary

Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 43
Line coverage: 87.5%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
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%44100%
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/Any3CharPackedSearchValues.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 Any3CharPackedSearchValues : SearchValues<char>
 11    {
 12        private readonly char _e0, _e1, _e2;
 13
 46114        public Any3CharPackedSearchValues(char value0, char value1, char value2) =>
 46115            (_e0, _e1, _e2) = (value0, value1, value2);
 16
 17        internal override char[] GetValues() =>
 018            [_e0, _e1, _e2];
 19
 20        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 21        internal override bool ContainsCore(char value) =>
 9903222            value == _e0 || value == _e1 || value == _e2;
 23
 24        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 25        [CompExactlyDependsOn(typeof(Sse2))]
 26        internal override int IndexOfAny(ReadOnlySpan<char> span) =>
 184427            PackedSpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length);
 28
 29        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 30        [CompExactlyDependsOn(typeof(Sse2))]
 31        internal override int IndexOfAnyExcept(ReadOnlySpan<char> span) =>
 184432            PackedSpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), _e0, _e1, _e2, span.Length);
 33
 34        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 35        internal override int LastIndexOfAny(ReadOnlySpan<char> span) =>
 92236            span.LastIndexOfAny(_e0, _e1, _e2);
 37
 38        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 39        internal override int LastIndexOfAnyExcept(ReadOnlySpan<char> span) =>
 92240            span.LastIndexOfAnyExcept(_e0, _e1, _e2);
 41    }
 42}
 43