moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 660 B
JavaScript
import __ from '../../src/Function/__'
/**
* [[a]] -> [[a]]
*/
import transpose from '../../src/List/transpose'
test('transpose(not using __), the same length of innerList', () => {
expect(
transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
).toEqual([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
})
test('transpose(not using __), not the same length of innerList', () => {
expect(
transpose([[1, 2, 3], [4, 5], [6, 7, 8, 9]])
).toEqual([[1, 4, 6], [2, 5, 7], [3, 8], [9]])
})
test('transpose(using __), the same length of innerList', () => {
expect(
transpose(__)([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
).toEqual([[1, 4, 7], [2, 5, 8], [3, 6, 9]])
})