Add Cartesian-product function and tests.