All Pairs

This is the third and final fixture of a suite that make up the AllPairsExample. Like with AllFiles, we expand wildcard characters in path specifications to get lists of tests. And, like in AllCombinations, we enumerate cases drawing from these lists one test at a time in sequence. But here our goal is only to test all possible pairs of test, which will require fewer cases.

Here is the same specification we used to test the CalculatorExample in AllCombinations. Try it using AllPairs.



To meet the "all pairs" requirement we need at least n X m cases, where n and m are the sizes of the two largest categories. That means with only two categories all combinations and all pairs are the same. The marvel of the all pairs algorithm is that it squeezes draws from additional categories into these same cases and possibly a few more.



The algorithm is largely JamesBach's from the source cited on the AllPairsExample page. My implementation can be summarized as follows.

The case currently being filled is called the slug. A pair will fit the slug only if the following hold.

The fixture uses these helper objects to represent the state of the algorithm.

See the source.

See AllPairsAlgorithm for some tests we've written for this algorithm itself.

Last edited November 9, 2002