As discussed with @str4d, we need to more thoroughly test IsValidSolution(), in particular with duplicate indices. The current two expected-failure tests for duplicate indices are for trivial special cases, and they might not detect some plausible bugs in the dupe check.
We need to add some test vectors with just one pair of non-adjacent duplicate indices per test vector, and such that they would be expected to pass validation if it were not for the dupe check.
We also need to have the tests distinguish between the different "return false;" and require that the expected one be triggered. This requires a change to the function prototype or some out-of-band means to communicate this detail specifically to the unit tests.