Pflichtaufgaben fertig: Matrix-Fixes, Bilder einlesen, NN-Testdatei

- matrix.c: multiply summiert in MatrixType statt int (Nachkommastellen
  gingen verloren), clearMatrix gibt Speicher frei, Indexpruefung pro
  Zeile/Spalte, NULL-Pruefungen in add/multiply
- imageInput.c: fseek-Spruenge entfernt, Dateikopf pruefen, Lesefehler
  behandeln, clearSeries implementiert
- neuralNetworkTests.c: prepareNeuralNetworkFile implementiert
- neuralNetwork.c: clearModel gibt das Layer-Array frei (Speicherleck)
- Zusaetzliche Unittests fuer Matrix und Bildeinlesen
- Testartefakte und Testprogramme in .gitignore, testFile.info2 entfernt

Alle 33 Tests gruen, keine Warnungen, 87.37 % Genauigkeit (wie Referenz).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Manuel GlockandClaude Opus 5.5 committed 2026-11-13 12:19:07 +01:00
1 parent 570e3fa930
commit 4d6a86f293
8 files changed
+326 -87

No files matched your search

+24
View File
@@ -130,6 +130,28 @@ void test_multiplyFailsOnWrongInputDimensions(void)
TEST_ASSERT_EQUAL_UINT32(0, result.cols);
}
void test_multiplyKeepsFractionalValues(void)
{
MatrixType buffer1[] = {0.5f, 0.25f};
MatrixType buffer2[] = {0.5f, 0.5f};
Matrix matrix1 = {.rows=1, .cols=2, .buffer=buffer1};
Matrix matrix2 = {.rows=2, .cols=1, .buffer=buffer2};
Matrix result = multiply(matrix1, matrix2);
TEST_ASSERT_NOT_NULL(result.buffer);
TEST_ASSERT_EQUAL_FLOAT(0.375f, result.buffer[0]);
free(result.buffer);
}
void test_getMatrixAtFailsOnColumnIndexOutOfRange(void)
{
MatrixType buffer[] = {1, 2, 3, 4, 5, 6};
Matrix matrixToTest = {.rows=2, .cols=3, .buffer=buffer};
TEST_ASSERT_EQUAL_INT(UNDEFINED_MATRIX_VALUE, getMatrixAt(matrixToTest, 0, 3));
}
void test_getMatrixAtReturnsCorrectResult(void)
{
MatrixType buffer[] = {1, 2, 3, 4, 5, 6};
@@ -188,6 +210,8 @@ int main()
RUN_TEST(test_addSupportsBroadcasting);
RUN_TEST(test_multiplyReturnsCorrectResults);
RUN_TEST(test_multiplyFailsOnWrongInputDimensions);
RUN_TEST(test_multiplyKeepsFractionalValues);
RUN_TEST(test_getMatrixAtFailsOnColumnIndexOutOfRange);
RUN_TEST(test_getMatrixAtReturnsCorrectResult);
RUN_TEST(test_getMatrixAtFailsOnIndicesOutOfRange);
RUN_TEST(test_setMatrixAtSetsCorrectValue);