< Summary

Information
Class: ZeroC.Slice.Codec.ReadOnlySequenceExtensions
Assembly: ZeroC.Slice.Codec
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/ZeroC.Slice.Codec/ReadOnlySequenceExtensions.cs
Tag: 1321_24790053727
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 25
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DecodeSliceBuffer(...)100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/ZeroC.Slice.Codec/ReadOnlySequenceExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Buffers;
 4
 5namespace ZeroC.Slice.Codec;
 6
 7/// <summary>Extension methods for <see cref="ReadOnlySequence{T}" />.</summary>
 8public static class ReadOnlySequenceExtensions
 9{
 10    /// <summary>Decodes a Slice buffer.</summary>
 11    /// <typeparam name="T">The decoded type.</typeparam>
 12    /// <param name="buffer">The byte buffer.</param>
 13    /// <param name="decodeFunc">The decode function for buffer.</param>
 14    /// <returns>The decoded value.</returns>
 15    /// <exception cref="InvalidDataException">Thrown when <paramref name="decodeFunc" /> finds invalid data
 16    /// or when the buffer contains trailing bytes that are not consumed by <paramref name="decodeFunc" />.
 17    /// </exception>
 18    public static T DecodeSliceBuffer<T>(this ReadOnlySequence<byte> buffer, DecodeFunc<T> decodeFunc)
 539119    {
 539120        var decoder = new SliceDecoder(buffer);
 539121        T result = decodeFunc(ref decoder);
 538522        decoder.CheckEndOfBuffer();
 538123        return result;
 538124    }
 25}