< Summary

Information
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 59
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/Runtime/Coroutines/LockedYieldInstructions/WaitForNextSimulate.cs

#LineLine coverage
 1//=======================================================================
 2// WaitForNextSimulate.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 until the next Gravitas simulation frame.
 12/// </summary>
 13/// <remarks>
 14/// Uses a checked deadline in the context's current clock lifetime. Reading an
 15/// instruction after context reset or disposal throws; reads never consume frames.
 16/// </remarks>
 17public readonly struct WaitForNextSimulate : ILockedYieldInstruction
 18{
 19    private readonly GravitasWorldContext _context;
 20    private readonly object _lifetime;
 21    private readonly long _deadlineFrame;
 22
 23    /// <summary>
 24    /// Creates an instruction that waits until the context advances to another simulation frame.
 25    /// </summary>
 26    public WaitForNextSimulate(GravitasWorldContext context)
 27    {
 23328        ChronicleGuard.ThrowIfNull(context, nameof(context));
 29
 23330        _context = context;
 23331        _lifetime = context.CaptureClockLifetime();
 23332        _deadlineFrame = context.GetDeadlineFrame(1);
 23233    }
 34
 35    /// <inheritdoc />
 1936    public GravitasWorldContext Context => _context;
 37
 38    /// <inheritdoc />
 39    public bool KeepWaiting
 40    {
 41        get
 42        {
 22543            _context.ValidateClockLifetime(_lifetime);
 22344            return _context.FrameCount < _deadlineFrame;
 45        }
 46    }
 47
 48    /// <inheritdoc />
 149    public object? Current => null;
 50
 51    /// <inheritdoc />
 252    public bool MoveNext() => KeepWaiting;
 53
 54    /// <inheritdoc />
 155    public void Reset() { }
 56
 57    /// <inheritdoc />
 2058    public void Dispose() { }
 59}