< Summary

Information
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 50
Line coverage: 100%
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 Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Context()100%11100%
get_KeepWaiting()100%11100%
get_Current()100%11100%
MoveNext()100%11100%
Reset()100%11100%
Dispose()100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Support/Coroutines/LockedYieldInstructions/WaitForFrames.cs

#LineLine coverage
 1//=======================================================================
 2// WaitForFrames.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8namespace Gravitas.Support;
 9
 10/// <summary>
 11/// A coroutine yield instruction that waits for a specified number of Gravitas simulation frames.
 12/// </summary>
 13public readonly struct WaitForFrames : ILockedYieldInstruction
 14{
 15    private readonly GravitasWorldContext _context;
 16    private readonly int _startFrameCount;
 17    private readonly uint _numberOfFrames;
 18
 19    /// <summary>
 20    /// Creates an instruction that waits for a nonnegative number of simulation frames.
 21    /// </summary>
 22    public WaitForFrames(GravitasWorldContext context, int numberOfFrames)
 23    {
 1024        SwiftThrowHelper.ThrowIfNull(context, nameof(context));
 1025        SwiftThrowHelper.ThrowIfNegative(numberOfFrames, nameof(numberOfFrames));
 26
 927        _context = context;
 928        _startFrameCount = context.FrameCount;
 929        _numberOfFrames = (uint)numberOfFrames;
 930    }
 31
 32    /// <inheritdoc />
 633    public GravitasWorldContext Context => _context;
 34
 35    /// <inheritdoc />
 36    public bool KeepWaiting =>
 1137        unchecked((uint)(_context.FrameCount - _startFrameCount)) < _numberOfFrames;
 38
 39    /// <inheritdoc />
 140    public object? Current => null;
 41
 42    /// <inheritdoc />
 243    public bool MoveNext() => KeepWaiting;
 44
 45    /// <inheritdoc />
 146    public void Reset() { }
 47
 48    /// <inheritdoc />
 749    public void Dispose() { }
 50}