Skip to content

Zero code coverage for NaN-safe mode #775

@devmotion

Description

@devmotion

Tests of NaN-safe mode are only run if NaN-safe mode is enabled:

if ForwardDiff.NANSAFE_MODE_ENABLED
ZEROS = Partials((fill(zero(T), N)...,))
@test (NaN * ZEROS).values == ZEROS.values
@test (Inf * ZEROS).values == ZEROS.values
@test (ZEROS / 0).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, X, NaN).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, NaN, X).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, X, Inf).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, Inf, X).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, Inf, NaN).values == ZEROS.values
@test ForwardDiff._mul_partials(ZEROS, ZEROS, NaN, Inf).values == ZEROS.values
end

However, CI tests are only run without NaN-safe mode. Therefore the NaN-safe mode implementation is currently not covered by CI: https://app.codecov.io/gh/JuliaDiff/ForwardDiff.jl/blob/master/src%2Fpartials.jl#L93

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions