Skip to content

Commit ad0e57f

Browse files
committed
test file added
1 parent cdd4c93 commit ad0e57f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Backtracking/tests/GenerateSubsets.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { generateSubsets } from '../GenerateSubsets'
2+
3+
describe('generateSubsets', () => {
4+
it('should generate all subsets for an array', () => {
5+
const inputSet = [1, 2, 3];
6+
const expectedSubsets = [
7+
[],
8+
[1],
9+
[1, 2],
10+
[1, 2, 3],
11+
[1, 3],
12+
[2],
13+
[2, 3],
14+
[3]
15+
];
16+
17+
const subsets = generateSubsets(inputSet);
18+
19+
// Check if the generated subsets are deep equal to the expected subsets
20+
expect(subsets).to.deep.have.members(expectedSubsets);
21+
});
22+
});

0 commit comments

Comments
 (0)