Compare commits

..

2 Commits
main ... main

5 changed files with 3 additions and 15 deletions

View File

@ -1,3 +0,0 @@
{
"makefile.configureOnOpen": false
}

View File

@ -1,2 +0,0 @@
# Projekt 2 für Informatik 2 Praktikum

View File

@ -6,13 +6,12 @@
Matrix createMatrix(unsigned int rows, unsigned int cols) Matrix createMatrix(unsigned int rows, unsigned int cols)
{ {
MatrixType* data = malloc(rows * cols * sizeof(MatrixType));
Matrix newMatrix = {rows, cols, data};
return newMatrix;
} }
void clearMatrix(Matrix *matrix) void clearMatrix(Matrix *matrix)
{ {
} }
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)

View File

@ -6,12 +6,6 @@
typedef float MatrixType; typedef float MatrixType;
// TODO Matrixtyp definieren // TODO Matrixtyp definieren
typedef struct
{
unsigned int rows;
unsigned int cols;
MatrixType *data;
} Matrix;
Matrix createMatrix(unsigned int rows, unsigned int cols); Matrix createMatrix(unsigned int rows, unsigned int cols);

View File

@ -164,7 +164,7 @@ void test_setMatrixAtFailsOnIndicesOutOfRange(void)
Matrix matrixToTest = {.rows=2, .cols=3, .buffer=buffer}; Matrix matrixToTest = {.rows=2, .cols=3, .buffer=buffer};
setMatrixAt(-1, matrixToTest, 2, 3); setMatrixAt(-1, matrixToTest, 2, 3);
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, matrixToTest.buffer, matrixToTest.cols * matrixToTest.rows); TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, matrixToTest.buffer, sizeof(buffer)/sizeof(MatrixType));
} }
void setUp(void) { void setUp(void) {