mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 07:01:18 +08:00
Add test cases mentioned in #308
This commit is contained in:
parent
3b9a3580d8
commit
f6408ffb57
@ -2,6 +2,16 @@ import combinationSum from '../combinationSum';
|
|||||||
|
|
||||||
describe('combinationSum', () => {
|
describe('combinationSum', () => {
|
||||||
it('should find all combinations with specific sum', () => {
|
it('should find all combinations with specific sum', () => {
|
||||||
|
expect(combinationSum([1], 100000)).toHaveLength(1);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
combinationSum([1], 100000)[0]
|
||||||
|
.every(el => el === 1),
|
||||||
|
)
|
||||||
|
.toBe(true);
|
||||||
|
|
||||||
|
expect(combinationSum([0, 2], 6)).toEqual([[2, 2, 2]]);
|
||||||
|
|
||||||
expect(combinationSum([1], 4)).toEqual([
|
expect(combinationSum([1], 4)).toEqual([
|
||||||
[1, 1, 1, 1],
|
[1, 1, 1, 1],
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user