LCOV - code coverage report
Current view: top level - src - state.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 14 14 100.0 %
Date: 2025-02-26 15:13:49 Functions: 0 0 -

          Line data    Source code
       1             : """
       2             : State of ODE solver
       3             : 
       4             : - May be returned by `dy(t, y)`
       5             :   - `AcceptStep` (synonym: `Ok`)
       6             :   - `OutOfDomain`
       7             :   - `Stopped` (by callback)
       8             : 
       9             : - Set by [`Solver`](@ref)
      10             :   - `Stopped` (e.g., at boundary after bisection)
      11             :   - `Failed` (e.g., initialization impossible)
      12             :   - `OutOfTolerance` (e.g., no more progress)
      13             :   - `Uninitialized`
      14             : 
      15             : See also [`Maybe`](@ef)
      16             : """
      17             : primitive type State   <: Unsigned 8 end
      18             : 
      19           3 : _makestate(x::Int) = reinterpret(State, UInt8(x))
      20             : 
      21             : const Ok::State = _makestate(0)
      22             : const AcceptStep::State = Ok
      23             : const Failed::State = _makestate(1)
      24             : const OutOfDomain::State = _makestate(2)
      25             : const Stopped::State = _makestate(3)
      26             : const OutOfTolerance::State = _makestate(4)
      27             : const Uninitialized::State = _makestate(5)
      28             : 
      29          11 : function Base.show(io::IO, s::State)
      30          11 :     (s == Ok) && return print(io, "Ok")
      31           8 :     (s == Failed) && return print(io, "Failed")
      32           7 :     (s == OutOfDomain) && return print(io, "OutOfDomain")
      33           6 :     (s == Stopped) && return print(io, "Stopped")
      34           5 :     (s == OutOfTolerance) && return print(io, "OutOfTolerance")
      35           4 :     (s == Uninitialized) && return print(io, "Uninitialized")
      36             : 
      37           1 :     error("unknown state $(reinterpret(UInt8, s))")
      38             : end
      39             : 
      40           1 : function Base.string(s::State)
      41           1 :     buf = IOBuffer()
      42           1 :     show(buf, s)
      43           1 :     String(take!(buf))
      44             : end
      45             : 
      46             : """
      47             : Check if [`RK43.State`](@ref) `s` equals `Ok`.
      48             : """
      49     6495603 : issuccess(s::State) = (s == Ok)
      50             : 
      51             : # NOTE: Enum is slow!

Generated by: LCOV version 1.16