argmin
argmin copied to clipboard
Add tests to BrentRoot
Hi, this is my PR for #403.
I added an error message for when a negative tolerance is passed as an argument. I created a couple of tests:
- Negative tolerance
- Invalid range when $f(a)$ and $f(b)$ have the same sign
- Valid range
- Check that the algorithm converges for a quadratic problem
- Symmetry (check that if passing $a$ as $b$ gives the same result)
I implemented a quadratic problem ($x^2 - 1$) to do the tests, but I am unsure if this is the correct way to do it in the library. Let me know if it needs to be changed.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.92%. Comparing base (
be2444e) to head (6006918).
Additional details and impacted files
@@ Coverage Diff @@
## main #525 +/- ##
==========================================
+ Coverage 91.49% 91.92% +0.43%
==========================================
Files 178 177 -1
Lines 23623 23724 +101
==========================================
+ Hits 21613 21808 +195
+ Misses 2010 1916 -94
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Oh dear, I wanted to rebase this PR onto the new main to fix the clippy issue and somehow completely messed up and directly pushed your changes to main! Not really sure how this can happen since the main branch is protected... Apparently I'm not doing this enough recently!
Luckily I don't have any complaints with this PR! :) Thanks a lot for your work on this and apologies for messing up the merge!