forked from freudenreichan/info2Praktikum-NeuronalesNetz
Compare commits
No commits in common. "07f217f1f411b768c0749a0a53e747f11aff493d" and "d4375c31e8ea82684a90a7bdb441a64ef5c5cc37" have entirely different histories.
07f217f1f4
...
d4375c31e8
Binary file not shown.
@ -54,7 +54,7 @@ void test_readImagesReturnsCorrectImageWidth(void)
|
|||||||
GrayScaleImageSeries *series = NULL;
|
GrayScaleImageSeries *series = NULL;
|
||||||
const unsigned short expectedWidth = 10;
|
const unsigned short expectedWidth = 10;
|
||||||
const char *path = "testFile.info2";
|
const char *path = "testFile.info2";
|
||||||
prepareImageFile(path, expectedWidth, 8, 2, 1);
|
prepareImageFile(path, 8, expectedWidth, 2, 1);
|
||||||
series = readImages(path);
|
series = readImages(path);
|
||||||
TEST_ASSERT_NOT_NULL(series);
|
TEST_ASSERT_NOT_NULL(series);
|
||||||
TEST_ASSERT_NOT_NULL(series->images);
|
TEST_ASSERT_NOT_NULL(series->images);
|
||||||
@ -70,7 +70,7 @@ void test_readImagesReturnsCorrectImageHeight(void)
|
|||||||
GrayScaleImageSeries *series = NULL;
|
GrayScaleImageSeries *series = NULL;
|
||||||
const unsigned short expectedHeight = 10;
|
const unsigned short expectedHeight = 10;
|
||||||
const char *path = "testFile.info2";
|
const char *path = "testFile.info2";
|
||||||
prepareImageFile(path, 8, expectedHeight, 2, 1);
|
prepareImageFile(path, expectedHeight, 8, 2, 1);
|
||||||
series = readImages(path);
|
series = readImages(path);
|
||||||
TEST_ASSERT_NOT_NULL(series);
|
TEST_ASSERT_NOT_NULL(series);
|
||||||
TEST_ASSERT_NOT_NULL(series->images);
|
TEST_ASSERT_NOT_NULL(series->images);
|
||||||
|
|||||||
@ -71,32 +71,6 @@ void test_addFailsOnDifferentInputDimensions(void)
|
|||||||
TEST_ASSERT_EQUAL_UINT32(0, result.cols);
|
TEST_ASSERT_EQUAL_UINT32(0, result.cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_addSupportsBroadcasting(void)
|
|
||||||
{
|
|
||||||
MatrixType buffer1[] = {1, 2, 3, 4, 5, 6};
|
|
||||||
MatrixType buffer2[] = {7, 8};
|
|
||||||
Matrix matrix1 = {.rows=2, .cols=3, .buffer=buffer1};
|
|
||||||
Matrix matrix2 = {.rows=2, .cols=1, .buffer=buffer2};
|
|
||||||
|
|
||||||
Matrix result1 = add(matrix1, matrix2);
|
|
||||||
Matrix result2 = add(matrix2, matrix1);
|
|
||||||
|
|
||||||
float expectedResults[] = {8, 9, 10, 12, 13, 14};
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_UINT32(matrix1.rows, result1.rows);
|
|
||||||
TEST_ASSERT_EQUAL_UINT32(matrix1.cols, result1.cols);
|
|
||||||
TEST_ASSERT_EQUAL_UINT32(matrix1.rows, result2.rows);
|
|
||||||
TEST_ASSERT_EQUAL_UINT32(matrix1.cols, result2.cols);
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(sizeof(expectedResults)/sizeof(expectedResults[0]), result1.rows * result1.cols);
|
|
||||||
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, result1.buffer, result1.cols * result1.rows);
|
|
||||||
TEST_ASSERT_EQUAL_INT(sizeof(expectedResults)/sizeof(expectedResults[0]), result2.rows * result2.cols);
|
|
||||||
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, result2.buffer, result2.cols * result2.rows);
|
|
||||||
|
|
||||||
free(result1.buffer);
|
|
||||||
free(result2.buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_multiplyReturnsCorrectResults(void)
|
void test_multiplyReturnsCorrectResults(void)
|
||||||
{
|
{
|
||||||
MatrixType buffer1[] = {1, 2, 3, 4, 5, 6};
|
MatrixType buffer1[] = {1, 2, 3, 4, 5, 6};
|
||||||
@ -185,7 +159,6 @@ int main()
|
|||||||
RUN_TEST(test_clearMatrixSetsMembersToNull);
|
RUN_TEST(test_clearMatrixSetsMembersToNull);
|
||||||
RUN_TEST(test_addReturnsCorrectResult);
|
RUN_TEST(test_addReturnsCorrectResult);
|
||||||
RUN_TEST(test_addFailsOnDifferentInputDimensions);
|
RUN_TEST(test_addFailsOnDifferentInputDimensions);
|
||||||
RUN_TEST(test_addSupportsBroadcasting);
|
|
||||||
RUN_TEST(test_multiplyReturnsCorrectResults);
|
RUN_TEST(test_multiplyReturnsCorrectResults);
|
||||||
RUN_TEST(test_multiplyFailsOnWrongInputDimensions);
|
RUN_TEST(test_multiplyFailsOnWrongInputDimensions);
|
||||||
RUN_TEST(test_getMatrixAtReturnsCorrectResult);
|
RUN_TEST(test_getMatrixAtReturnsCorrectResult);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user