A loop does make the code cleaner, but if the assertion fails, you cannot tell which function produced the wrong result. This applies to all other loops below.