Approach for adding more coverage in qofinstance.c
Stefan Koch
stefan.koch.micro at gmail.com
Wed Jan 21 14:53:42 EST 2026
(Thank you for merging my first commit test-qofid.cpp).
I am moving on to adding more coverage, in particular I thought in the
qofinstance would be a good low level next step.
This is currently in part of the glib based test for test-oqf. I am
proposing removing it from there and making it a stand alone google test.
I like the stand alone test because it allows me just to run this one and
see the coverage of just this test. (That removes other tests from
providing accidental coverage.)
I also like full coverage since it is easy to check for 100% coverage, but
hard to check if the coverage moved from 88% to 85% when running tests. I
cannot get 100% coverage since there are some lines that are unreachable
when the other subsystems are correct. I thought I saw some setup in lcov
that allows marking of lines to not be covered, but I have not investigated
that further.
There were some issues that I had to work out:
1. I had to use the google TEST_F so that I could have a class to replace
the setup and teardown from glib testing.
2. I had to create a main() that overrides the default google one, that
allows the setting g_test_init which is still needed since the qofinstance
still makes use of the glib error handling.
3. I replaced the g_assert functions with the equivalent google test calls.
4. I replaced the g_test_message with a local call that does printf.
The I have not added extra coverage. I wanted to verify that this approach
is what is desired here, or if this is too to change, and not worth your
time reviewing.
The commit can be seen here:
https://github.com/stefan-koch-micro/gnucash/commit/fc5742e12d8007f86929450080750a14bec3ec43#diff-dcd2eece63e17b3ec55c96a3eab8a60c4582884a2d01b47b1c4940c1c0594bf0
I have not made a pull request as this is a partial implementation. If the
approach is OK, I will add more/full coverage and then make a merge
request. (Or even do more of the test-qof set before making the request.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20260121/1124393b/attachment.htm>
More information about the gnucash-devel
mailing list