Fix more missing cases; expand exhaustive tests.

The exhaustive tests now cover the following dimensions:
  0x0, 0x1, 0x2 (and by extension 0xN)
  1x0, 1x1, 1x2 (and by extension 1xN)
  2x0, 2x1, 2x2 (and by extension 2xN)
  3x0, 3x1, 3x2 (and by extension 3xN)
  4x0, 4x1, 4x2 (and by extension 4xN)

With more than 100 lines of "construction" templates just to
deal with two dimensions, I'm not sure three dimensions is
going to be feasible at all. But we'll see.