< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 31
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
Equals(...)0%440%
EqualDomains(...)100%110%
StripLeadingDot(...)0%220%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/Common/src/System/Net/CookieComparer.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.Net
 5{
 6    internal static class CookieComparer
 7    {
 8        internal static bool Equals(Cookie left, Cookie right)
 09        {
 010            if (!string.Equals(left.Name, right.Name, StringComparison.OrdinalIgnoreCase))
 011            {
 012                return false;
 13            }
 14
 015            if (!EqualDomains(left.Domain, right.Domain))
 016            {
 017                return false;
 18            }
 19
 20            // NB: Only the path is case sensitive as per spec. However, many Windows applications assume
 21            //     case-insensitivity.
 022            return string.Equals(left.Path, right.Path, StringComparison.Ordinal);
 023        }
 24
 25        internal static bool EqualDomains(ReadOnlySpan<char> left, ReadOnlySpan<char> right)
 026            => StripLeadingDot(left).Equals(StripLeadingDot(right), StringComparison.OrdinalIgnoreCase);
 27
 028        internal static ReadOnlySpan<char> StripLeadingDot(ReadOnlySpan<char> s) => s.StartsWith('.') ? s[1..] : s;
 29    }
 30}
 31