I have a higher-level test failing because grad_reg_inc_gamma now throws on NaN, what should it do instead?
[ RUN ] AgradFwdGammaQ.nan
unknown file: Failure
C++ exception with description "grad_reg_inc_gamma: a is nan, but must not be nan!" thrown in the test body.
[ FAILED ] AgradFwdGammaQ.nan (1 ms)
Throwing is fine. You just want to test that it throws where it should.
EXPECT_THROW(statement, exception-type);
The exception type is something like std::exception
or whatever the type is that’s being thrown here. We usually throw std::domain_error
or std::invalid_argument
for illegal arguments.
these are auto-generated tests in fwd
and mix
, I’m just reverting to the old behavior for this function of immediately returning nan
for nan
arguments. Fixing this is a bigger project.