| ▲ | shagie 7 hours ago | |||||||
How would you suggest tests around:
The first filter is redundant in this example. Duplicate code checkers are checking for exactly matching lines.I am unaware of any linter or static analyzer that would flag this. What's more, unit tests to test the code for printEvens (there exists one) pass because they're working properly... and the unit test that calls the calling function passes because it is working properly too. Alternatively, write the failing test for this code. | ||||||||
| ▲ | tayo42 6 hours ago | parent [-] | |||||||
Idk how exactly to do it in cpp becasue I'm not familiar with the tooling You could write a test that makes sure the output of someCall is passed directly to printeven without being modified. The example as you wrote is hard to test in general. It's probably not something you would write if your serious about testing. | ||||||||
| ||||||||