Skip to content

[Enhancement]: rtol interface for tests #281

@ThijsJenneskens

Description

@ThijsJenneskens

Feature/Enhancement Description

Linking #280: I would like relative tolerance as an option for @test_rules the same way absolute tolerance is, such that I can write:

@test_rules [check_type_promotion = true, rtol = 1e-4] ...

Motivation / Use Case

I'm writing some tests for extreme cases of the Gamma node, and the tests fails with cases like this:

┌ Warning: Testset for rule Gamma(:α, Marginalisation) has failed!
│ Inputs: (q_out = PointMass(x), q_θ = ReactiveMP.BayesBase.convert_paramfloattype(__promoted_T, Gamma(z, w)))
│ Expected output: ReactiveMP.GammaShapeLikelihood{Float64}(p=1.0, γ=-23.025850929890456)
│ Actual output: ReactiveMP.GammaShapeLikelihood{Float64}(p=1.0, γ=-23.02584966210056)

Proposed Solution

I would like relative tolerance as an option for @test_rules the same way absolute tolerance is, such that I can write:

@test_rules [check_type_promotion = true, rtol = 1e-4] ...

Alternatives Considered

No response

Example Use Cases

No response

Priority (from your perspective)

Important

Related Issues / Discussions

No response

Additional Context

No response

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions