< Summary

Information
Class: DeltaSharp.Util.StandardCompatibility
Assembly: DeltaSharp
File(s): /home/runner/work/DeltaSharp/DeltaSharp/src/DeltaSharp/Util/StandardCompatibility.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 31
Line coverage: 100%
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 Crap Score Cyclomatic complexity Line coverage
Write(...)100%11100%
Count(...)100%44100%

File(s)

/home/runner/work/DeltaSharp/DeltaSharp/src/DeltaSharp/Util/StandardCompatibility.cs

#LineLine coverage
 1#if NETSTANDARD2_0
 2namespace System.Runtime.CompilerServices
 3{
 4    internal static class IsExternalInit { }
 5}
 6
 7namespace DeltaSharp.Util
 8{
 9    internal static class StandardCompatibility
 10    {
 11        // The delta writers own expandable MemoryStreams and only append to them.
 12        public static void Write(this MemoryStream stream, ReadOnlySpan<byte> bytes)
 13        {
 21900414            int offset = checked((int)stream.Position);
 21900415            int end = checked(offset + bytes.Length);
 21900416            stream.SetLength(end);
 21900417            bytes.CopyTo(stream.GetBuffer().AsSpan(offset));
 21900418            stream.Position = end;
 21900419        }
 20
 21        public static int Count<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>
 22        {
 1623            int matches = 0;
 13474216024            foreach (T item in span)
 6737106425                if (item.Equals(value))
 3368554026                    matches++;
 1627            return matches;
 28        }
 29    }
 30}
 31#endif