Added exhaustive test for small cases.