Added a test function that generates all permutations of an array.