Complete Unit Test Suite for the Matlab Toolbox - Pt.2#1881
Complete Unit Test Suite for the Matlab Toolbox - Pt.2#1881ischoegl merged 42 commits intoCantera:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1881 +/- ##
==========================================
+ Coverage 74.28% 74.87% +0.58%
==========================================
Files 448 448
Lines 55744 55734 -10
Branches 9190 9192 +2
==========================================
+ Hits 41411 41730 +319
+ Misses 11232 10901 -331
- Partials 3101 3103 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ischoegl The second part of the unit test suite is ready for review. This will include tests for 0D classes. That leaves 1D classes to be the only part remaining, and these will come in a later PR as this one is also approaching 3000 lines. All CIs will pass but there is one issue that throws warnings about already deleted objects: This happens when an First, it calls the It then inherits methods and properties from the These steps should address this comment from #1665:
But for some reason, when the destructor is called, Cantera somehow thinks the object is already deleted, even though it isn't. Prior to invoking the destructor, all the methods of the |
bryanwweber
left a comment
There was a problem hiding this comment.
Thanks @ssun30! I have a few suggestions for improvements here.
ca6e1ff to
58a3504
Compare
256a46a to
0c97c78
Compare
ischoegl
left a comment
There was a problem hiding this comment.
@ssun30 ... some minor comments.
As in my previous feedback, I'd prefer if the MATLAB toolbox could adhere to the same approach as the other APIs and introduce minimal extra code: ideally, it should act as a minimal wrapper for CLib that just re-establishes the underlying C++ class structure.
One thing I noticed recently is that the bulk of the exception handling in MATLAB is re-implemented rather than relying on exceptions thrown by the C++ core - this results in a lot of redundant code.
speth
left a comment
There was a problem hiding this comment.
Thanks for your work on this, @ssun30. I'm really glad to see the expanded testing of the Matlab toolbox, and I think the approach taken here of translating some of the Python tests is generally a good one.
One thing to consider, to some extent here, but especially looking forward to tests of the 1D solver, is that the Python test suite includes many tests which are focused on making sure that the underlying algorithms are working correctly, which isn't really necessary to repeat in the Matlab test suite. Here, it's sufficient to just ensure that all of the classes / methods behave in expected ways, but not necessarily to test whether the solvers produce expected results across different ranges of inputs (though it is important to test that inputs that result in errors propagate those errors back in the expected way).
5fba737 to
c9ec1c4
Compare
There was a problem hiding this comment.
Thank you for removing the unnecessary checks for the destructors. One thing I wanted to point out is that you may want to check whether constructors actually work (currently, they could fail silently, potentially wreaking havoc later on). Those checks should be added for all CLib constructor calls.
Edit: ok to be deferred.
Exception are beyond the scope of this PR.
to avoid calling the corresponding functions in clib and throw a warning
destructor to prevent double deleting
and utility methods
Those tests will be re-enabled after the necessary methods are implemeneted.
ischoegl
left a comment
There was a problem hiding this comment.
All good from my side (my request for changes is removed as it goes beyond the scope of this PR).
Changes proposed in this pull request
Added unit tests for the remaining classes and methods in the Matlab toolbox.
Fixed bugs that prevent these tests from passing.
If applicable, fill in the issue number this pull request is fixing
Updates to Cantera/enhancements#177
If applicable, provide an example illustrating new features this pull request is introducing
Added tests for rates of progress, rate constants, species rates, and thermodynamic values.
Checklist
scons build&scons test) and unit tests address code coverage