mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
test cartesian product
This commit is contained in:
parent
fbf68e490f
commit
ecdc7bd172
@ -16,4 +16,12 @@ describe('cartesianProduct', () => {
|
||||
expect(product1).toEqual([[1, 1]]);
|
||||
expect(product2).toEqual([[1, 3], [1, 5], [2, 3], [2, 5]]);
|
||||
});
|
||||
|
||||
it('should return an empty set if one or both of the source is empty', () => {
|
||||
const product1 = cartesianProduct([], [1, 2, 3]);
|
||||
const product2 = cartesianProduct([], []);
|
||||
|
||||
expect(product1).toEqual([]);
|
||||
expect(product2).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user