-
Notifications
You must be signed in to change notification settings - Fork 526
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
update math function unit test with catch2 #2955
Conversation
Sorry, seems some error will be introduced. I'm checking |
30ffd7e
to
909cdf1
Compare
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.
Thanks for tackling this @lhchg! I haven't reviewed all the changes yet but noticed the test failure and see that it's related to the issue below:
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.
Awesome!
One benefit of this change is that calc_pn_c
function at a among a few others requires temporary space to be allocated while particles are in flight. That's not really a great code design, since we could be using the recursive formula instead for scoring purposes. It's nice that this PR removes dependence on that behavior for testing. It would be more straightforward to just test the values (regardless of how they're obtained) rather than having the intermediate API that assumes a certain output format.
One thing worth addressing: is it possible any users are relying on these math functions in the C API?
I updated the code to use hardcode for the reference part. What do you think of this hardcode approach? If you think it would be better to include a python script, I will continue to modify it. |
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.
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.
Awesome changes! Nice to have the code simplified some like this.
There seems to be some dependency on the python math api
I have fixed it |
Co-authored-by: Paul Romano <[email protected]>
Description
Some interfaces do not need to be exposed to the python API, except for unit testing, so move math unit tests to C++ unit tests, which implemented in python before
Fixes #2943
Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)