< Summary

Information
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 49
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/WaitForRealSeconds.cs

#LineLine coverage
 1//=======================================================================
 2// WaitForRealSeconds.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
 8using FixedMathSharp;
 9
 10namespace Gravitas.Support;
 11
 12/// <summary>
 13/// A coroutine yield instruction that waits for a specified duration on the owning context's deterministic clock.
 14/// </summary>
 15public readonly struct WaitForRealSeconds : ILockedYieldInstruction
 16{
 17    private readonly GravitasWorldContext _context;
 18    private readonly Fixed64 _targetTime;
 19
 20    /// <summary>
 21    /// Creates an instruction that waits for a nonnegative duration on the context's deterministic clock.
 22    /// </summary>
 23    public WaitForRealSeconds(GravitasWorldContext context, Fixed64 seconds)
 24    {
 625        SwiftThrowHelper.ThrowIfNull(context, nameof(context));
 526        SwiftThrowHelper.ThrowIfArgument(seconds < Fixed64.Zero, nameof(seconds), "Wait duration cannot be negative.");
 27
 428        _context = context;
 429        _targetTime = context.TotalTime + seconds;
 430    }
 31
 32    /// <inheritdoc />
 233    public GravitasWorldContext Context => _context;
 34
 35    /// <inheritdoc />
 1036    public bool KeepWaiting => _context.TotalTime < _targetTime;
 37
 38    /// <inheritdoc />
 139    public object? Current => null;
 40
 41    /// <inheritdoc />
 342    public bool MoveNext() => KeepWaiting;
 43
 44    /// <inheritdoc />
 145    public void Reset() { }
 46
 47    /// <inheritdoc />
 248    public void Dispose() { }
 49}