Skip to content

Commit cad7652

Browse files
authored
feat: Create MatrixTransposition.test.js
Added test for the new algorithm Matrix Transposition.
1 parent 944a0d8 commit cad7652

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { matrixTranspose } from '../MatrixTransposition'
2+
3+
describe('Matrix Transpose', () => {
4+
it('should transpose a 2x2 matrix', () => {
5+
const matrix = [
6+
[1, 2],
7+
[3, 4]
8+
];
9+
10+
const transposedMatrix = matrixTranspose(matrix);
11+
12+
expect(transposedMatrix).toEqual([
13+
[1, 3],
14+
[2, 4]
15+
]);
16+
});
17+
18+
it('should transpose a 3x3 matrix', () => {
19+
const matrix = [
20+
[1, 2, 3],
21+
[4, 5, 6],
22+
[7, 8, 9]
23+
];
24+
25+
const transposedMatrix = matrixTranspose(matrix);
26+
27+
expect(transposedMatrix).toEqual([
28+
[1, 4, 7],
29+
[2, 5, 8],
30+
[3, 6, 9]
31+
]);
32+
});
33+
34+
});

0 commit comments

Comments
 (0)