[this may apply to other tracks, I noticed it in the cpp track]
In Vehicle Purchase the second requirement wants the solver to return the vehicle that comes first in lexicographical order. All the tests for this requirement work with an implementation that always returns the first parameter and never the second parameter - that is, the tests always pass in the options already sorted in lexicographical order.
I propose switching at least one of the tests so that the user has to evaluate the parameters. Such as:
TEST_CASE(“chooses Ford Focus over Ford Pinto”) {
std::string choice1{“Ford Pinto”};
std::string choice2{“Ford Focus”};
REQUIRE(vehicle_purchase::choose_vehicle(choice1, choice2) ==
“Ford Focus is clearly the better choice.”);
}
I’ll create a PR if anyone else thinks this is worth improving.
I do support the change. It is not some corner case, but a valuable addition.
The problem is, that this would retest all the instances that have been committed for this exercise. So it is a question of resources versus future application.
I don’t think too many people have solved the exercise for C++ yet, so it should be okay.
Yes, we merged something else in the meantime, so it is not up to date. Also, your PR is on your own fork. I can make a new one for the exercism repository, but then I would not be able to review it.
The easiest path would be if you resubmitted your changes as a PR with the latest version on the exercism PR and gave me a ping.