From: phillip.wood123@gmail.com Date: Wed, 26 Jun 2024 08:59:49 GMT Subject: Re: [GSoC][PATCH] t: migrate helper/test-oidmap.c to unit-tests/t-oidmap.c Message-ID: <360290b2-f9eb-4a12-9832-1bb53ff455ef@gmail.com> In-Reply-To: Hi Ghanshyam On 25/06/2024 20:16, Ghanshyam Thakkar wrote: > Phillip Wood wrote: >> When writing unit tests it is important to make sure that they fail, >> rather than just return early if there is an error. There are a number >> of places like this that return early without calling one of the check() >> macros to make the test fail. > > They do fail. `get_oid_arbitrary_hex()` from 'unit-tests/lib-oid.h' is > a function specifically built for the use in unit tests. And it > contains in built `check_*` to ensure that the tests fails if something > goes wrong and also prints diagnostic info. Maybe we can add a check here > as well to know the line number at which the call failed, but since we > already print queried hex value and other diagnostic info from > `get_oid_arbitrary_hex()`, I thought it would be enough. Oh, sorry I didn't realize that. I agree that the check in get_oid_arbitary_hex() should be sufficient. Best Wishes Phillip