mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 09:28:26 +08:00

* Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.test.js Changes made it the type of testing. Instead of testing the class now the program will test the function * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.js * Update AllCombinationsOfSizeK.test.js * Update AllCombinationsOfSizeK.test.js
25 lines
539 B
JavaScript
25 lines
539 B
JavaScript
import { generateCombinations } from '../AllCombinationsOfSizeK'
|
|
|
|
describe('AllCombinationsOfSizeK', () => {
|
|
it('should return 3x2 matrix solution for n = 3 and k = 2', () => {
|
|
const res = generateCombinations(3, 2)
|
|
expect(res).toEqual([
|
|
[1, 2],
|
|
[1, 3],
|
|
[2, 3]
|
|
])
|
|
})
|
|
|
|
it('should return 6x2 matrix solution for n = 4 and k = 2', () => {
|
|
const res = generateCombinations(4, 2)
|
|
expect(res).toEqual([
|
|
[1, 2],
|
|
[1, 3],
|
|
[1, 4],
|
|
[2, 3],
|
|
[2, 4],
|
|
[3, 4]
|
|
])
|
|
})
|
|
})
|