Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cubool/sources/cuda/cuda_matrix_ewisemult_inverted.cu
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace cubool {
assert(b->getNrows() == M);
assert(b->getNcols() == N);

if (a->isMatrixEmpty() || b->isMatrixEmpty()) {
if (a->isMatrixEmpty()) {
this->clearAndResizeStorageToDim();
return;
}
Expand Down
59 changes: 59 additions & 0 deletions cubool/tests/test_matrix_ewisemult_inverted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,64 @@ TEST(cuBool_Matrix, ApplyMatrixRandom) {
ASSERT_EQ(cuBool_Finalize(), CUBOOL_STATUS_SUCCESS);
}

TEST(cuBool_Matrix, ApplyMatrixEmptyMask) {
ASSERT_EQ(cuBool_Initialize(CUBOOL_HINT_NO), CUBOOL_STATUS_SUCCESS);

DataMatrix matrix{
{1, 0, 1},
{0, 1, 0},
{1, 1, 0},
};

DataMatrix mask{
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
};

testApplyNotMask(matrix, mask);

ASSERT_EQ(cuBool_Finalize(), CUBOOL_STATUS_SUCCESS);
}

TEST(cuBool_Matrix, ApplyMatrixEmptySource) {
ASSERT_EQ(cuBool_Initialize(CUBOOL_HINT_NO), CUBOOL_STATUS_SUCCESS);

DataMatrix matrix{
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
};

DataMatrix mask{
{1, 0, 1},
{0, 1, 0},
{1, 1, 0},
};

testApplyNotMask(matrix, mask);

ASSERT_EQ(cuBool_Finalize(), CUBOOL_STATUS_SUCCESS);
}

TEST(cuBool_Matrix, ApplyMatrixBothEmpty) {
ASSERT_EQ(cuBool_Initialize(CUBOOL_HINT_NO), CUBOOL_STATUS_SUCCESS);

DataMatrix matrix{
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
};

DataMatrix mask{
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
};

testApplyNotMask(matrix, mask);

ASSERT_EQ(cuBool_Finalize(), CUBOOL_STATUS_SUCCESS);
}

CUBOOL_GTEST_MAIN
3 changes: 2 additions & 1 deletion scripts/run_tests_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
./cubool/tests/test_vector_ewisemult
./cubool/tests/test_vector_mxv
./cubool/tests/test_vector_vxm
./cubool/tests/test_vector_sub_vector
./cubool/tests/test_vector_sub_vector
./cubool/tests/test_matrix_ewisemult_inverted
Loading