Comparison sorts only care about the relative order of elements, not their exact values. So if the relative order of two arrays are the same, a comparison sort algorithm will act the same way on those two arrays.
For example, [0, 3, 1, 9, 1] is the same as [-3, 12, 7, 13, 7], since their relative orders are the same.
I want to generate all possible test cases of length $n$ for comparison sorts that all possible relative orders are considered, and no two different test cases have the same relative order.
The number of possible test cases of length $n$ is given by A000670.
Here are all possible test cases of length 0:
[]
Here are all possible test cases of length 1:
[0]
Here are all possible test cases of length 2:
[0, 0]
[0, 1]
[1, 0]
Here are all possible test cases of length 3:
[0, 0, 0]
[0, 0, 1]
[0, 1, 0]
[0, 1, 1]
[0, 1, 2]
[0, 2, 1]
[1, 0, 0]
[1, 0, 1]
[1, 0, 2]
[1, 1, 0]
[1, 2, 0]
[2, 0, 1]
[2, 1, 0]
Is there a generic way rather than brutal force to generate these test cases?