-
Notifications
You must be signed in to change notification settings - Fork 27
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
Unit test 150 #198
Unit test 150 #198
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
==========================================
+ Coverage 57.50% 62.90% +5.40%
==========================================
Files 103 105 +2
Lines 26964 27214 +250
==========================================
+ Hits 15505 17119 +1614
+ Misses 11459 10095 -1364 ☔ View full report in Codecov by Sentry. |
@ktbolt, I'll look over this PR and after @yuecheng-yu and I have iterated over it, I'll assign you as a reviewer |
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.
Thank you for making the unit tests work, @yuecheng-yu! I added a couple of comments on how to clean up the code and make it more modular. Please have a look and let me know if you have any questions.
Very nice idea to use a fixture! Do you think we could use a Mock object for things like |
Yes, I think it's possible. When I compared mock object with test fixture, I felt that while mock object is more ideal for unit testing, it may be harder to use for our current structures of material model. Because each type of model has completely different parameters/classes and also the parameters used in get_pk2cc such as C10/C01 are different from the input file (Elastic Modules, etc.), I think it could be a better timing to use Mock method for comprehensive unit testing after we have a new material model interface. Meanwhile, I personally really like the fixture thing which can rerun the setup code, which I think is the main reason I picked fixture to try first, please forget my previous blah blah. I'll try to write a GMock frame for nHK first to see how it works. |
@mrp089 @yuecheng-yu I feel that there is too much discussion here that is not included in the Issue. I think we should have code reviews before people do a PR. |
True, but unfortunately, creating a (draft) PR is necessary to get the code review function in GitHub (which nicely lets multiple people interact on the code). And it's better to have a discussion in the PR than not having a discussion. The discussion is still easily accessible since the merged commit is linked to the PR (and indirectly to the issue). |
@mrp089 I created an Isotropic material class for unit test, wrapped the mock class inside the test class. So the users only need to define material parameters, input deformation gradient, and reference solutions at the testing interface (test.cpp). |
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.
Nicely done, @yuecheng-yu! This is looking good, just some minor cleanups.
Current situation
Refer to #150
Release Notes
A unit testing program using GoogleTest to test
get_pk2cc
is implemented and built. It allows user defined deformation gradient as input to check the correctness ofget_pk2cc
(material model) by comparing the output stress and tangent tensors.Documentation
None
Testing
To be tested
Code of Conduct & Contributing Guidelines