4 ms·
You're right to want to avoid duplicating your code inside your test. In this case, I'd work out some simple permutations and test against those values, sorting
by mcobrien 14y ago
You're right to want to avoid duplicating your code inside your test. In this case, I'd work out some simple permutations and test against those values, sorting the results so order doesn't matter.
assert(sorted(permute((1, 2))) == [(1, 2), (2, 1)])