umock_c_negative_tests_fail_call should have a return value
- Dominant language
- C
- Stars
- 36
- Forks
- 27
- Avg merge
- 32m
- Merged PRs (30d)
- 3
Description
Usually code goes like the following:
```c
for (size_t i = 0; i < umock_c_negative_tests_call_count(); i++)
{
if(i==4) continue;
umock_c_negative_tests_reset();
umock_c_negative_tests_fail_call(i);
///act something
```
The suggestion is to have
`umock_c_negative_tests_fail_call(i)` return a value. The value is `true` if the function is `fail`-able (that is: it is NOT void **and** has a .`SetFailReturn` value explicitly set). Otherwise it returns `false`.
If that would exist, then the above loop turns into:
```c
for (size_t i = 0; i < umock_c_negative_tests_call_count(); i++)
{
umock_c_negative_tests_reset();
if(!umock_c_negative_tests_fail_call(i)) continue;
///act something
```
Note the missing of `if` that excludes the non-failable function (which can get quite heavy).
Best Regards,
Andrei Porumb
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the declaration and implementation of umock_c_negative_tests_fail_call, then find the existing tests for negative-test failures. Verify that the call reports true only for non-void functions with an explicitly set SetFailReturn value, and false otherwise; add coverage for both outcomes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 40/100