Fail deliberately to avoid infinite loop

Although just merged pull request #6578 is totally correct, it only partially fixes some unit tests.  In particular, two unit tests will now go into infinite loops.
This temporary workaround inserts asserts to cause these two tests to fail immediately, to avoid infinite loops, which are not good for system resources.
Please merge this request as soon as you can.