Directory: | ./ |
---|---|
File: | s21_transpose.c |
Date: | 2025-08-15 23:01:21 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 8 | 8 | 100.0% |
Branches: | 8 | 8 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "s21_matrix.h" | ||
2 | |||
3 | 14 | int s21_transpose(matrix_t *A, matrix_t *result) { | |
4 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 10 times.
|
14 | if (s21_check_matrix_is_invalid(A) || result == NULL) { |
5 | 4 | return ERROR; | |
6 | } | ||
7 | |||
8 | 10 | s21_create_matrix(A->columns, A->rows, result); | |
9 | |||
10 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 10 times.
|
38 | for (int i = 0; i < result->rows; i++) { |
11 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 28 times.
|
116 | for (int j = 0; j < result->columns; j++) { |
12 | 88 | result->matrix[i][j] = A->matrix[j][i]; | |
13 | } | ||
14 | } | ||
15 | |||
16 | 10 | return OK; | |
17 | } | ||
18 |