test all cases for recursion