-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for DiscontinuousTestODE #368
Test for DiscontinuousTestODE #368
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #368 +/- ##
==========================================
+ Coverage 72.55% 72.56% +0.01%
==========================================
Files 269 269
Lines 22330 22328 -2
==========================================
+ Hits 16202 16203 +1
+ Misses 6128 6125 -3
☔ View full report in Codecov by Sentry. |
u_event = DODE.u_exact(DODE.t_switch_exact) | ||
h = u_event[0] - 5 | ||
|
||
assert h < 1e-15, 'Value of state function at exact event time is not zero!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you should test for the absolute value of h
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
sol = DODE.solve_system(**args) | ||
assert np.isclose( | ||
sol[0], DODE.u_exact(t0 + dt)[0], atol=2e-3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use np.allclose
and test all of the values instead of just the first one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your are right, but in this case, the solution consists of only one value.
Ready to be merged? |
From my side, yes. Depends on @brownbaerchen |
Since hardcoded solutions do not say anything about the correctness of the problem class itself, I also added a small test for the
DiscontinuousTestODE
. It's only a small one whether the correct event time together with value of state function at event is tested. In the TIME-X test hackathon I also learnt that errors can be tested by capture them. Thus,ProblemError
andlogger.warning
are also captured through this test whennan
values arises.The function
get_switching_info
is not tested here, because this is rather stuff ofSwitchEstimator
which I also started to test during the test hackathon. (Coming soon some time..)Let me know if this is not enough.